-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathemprunts.php
More file actions
219 lines (207 loc) · 19.2 KB
/
Copy pathemprunts.php
File metadata and controls
219 lines (207 loc) · 19.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
//This file belongs to the BookFind project.
//
//BookFind is distributed under the terms of the MIT software license.
//
//Copyright (C) 2025 Chromared
?>
<?php require 'actions/database.php';
require 'actions/users/securityAction.php';
require 'actions/functions/logFunction.php';
require 'actions/books/showEmprunts.php';
require 'actions/functions/conversionDateHour.php';
require 'actions/functions/conversionDate.php';
require 'actions/functions/colorDateEmpruntFunction.php'; ?>
<!DOCTYPE html>
<html lang="fr" data-bs-theme="<?php include 'actions/users/decodeThemeAction.php'; ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emprunts</title>
<?php include 'includes/header.php'; ?>
</head>
<body class="d-flex flex-column min-vh-100">
<?php include 'includes/navbar.php'; ?>
<?php if (isset($_GET['id']) and !empty($_GET['id'])) { ?>
<?php $nbRetards = $selectInfosFromEmprunts1->rowCount();
$nbAujourdhui = $selectInfosFromEmprunts2->rowCount();
$nbEnCours = $selectInfosFromEmprunts3->rowCount();
$nbRetournes = $selectInfosFromEmprunts4->rowCount(); ?>
<div class="container mt-3">
<div class="d-flex justify-content-center mt-4">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link <?php if ($nbRetards > 0) {
echo 'active';
} ?>" id="retard-tab" data-bs-toggle="tab" data-bs-target="#retard" type="button" role="tab" aria-controls="retard" aria-selected="<?php if ($nbRetards > 0) {
echo 'true';
} else {
echo 'false';
} ?>" <?php if ($nbRetards == 0) {
echo 'disabled';
} ?>>En retard <span class="badge text-bg-danger"><?= $nbRetards ?></span></button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link <?php if ($nbRetards == 0 and $nbAujourdhui > 0) {
echo 'active';
} ?>" id="aujourdhui-tab" data-bs-toggle="tab" data-bs-target="#aujourdhui" type="button" role="tab" aria-controls="aujourdhui" aria-selected="<?php if ($nbRetards == 0 and $nbAujourdhui > 0) {
echo 'true';
} else {
echo 'false';
} ?>" <?php if ($nbAujourdhui == 0) {
echo 'disabled';
} ?>>À rendre aujourd'hui <span class="badge text-bg-danger"><?= $nbAujourdhui ?></span></button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link <?php if ($nbRetards == 0 and $nbAujourdhui == 0 and $nbEnCours > 0) {
echo 'active';
} ?>" id="encours-tab" data-bs-toggle="tab" data-bs-target="#encours" type="button" role="tab" aria-controls="encours" aria-selected="<?php if ($nbRetards == 0 and $nbAujourdhui == 0 and $nbEnCours > 0) {
echo 'true';
} else {
echo 'false';
} ?>" <?php if ($nbEnCours == 0) {
echo 'disabled';
} ?>>En cours <span class="badge text-bg-danger"><?= $nbEnCours ?></span></button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link <?php if ($nbRetards == 0 and $nbAujourdhui == 0 and $nbEnCours == 0 and $nbRetournes > 0) {
echo 'active';
} ?>" id="retournes-tab" data-bs-toggle="tab" data-bs-target="#retournes" type="button" role="tab" aria-controls="retournes" aria-selected="<?php if ($nbRetards == 0 and $nbAujourdhui == 0 and $nbEnCours == 0 and $nbRetournes > 0) {
echo 'true';
} else {
echo 'false';
} ?>" <?php if ($nbRetournes == 0) {
echo 'disabled';
} ?>>Retournés <span class="badge text-bg-danger"><?= $nbRetournes ?></span></button>
</li>
</ul>
</div>
</div>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade <?php if ($nbRetards > 0) {
echo 'show active';
} ?>" id="retard" role="tabpanel" tabindex="0">
<?php if ($selectInfosFromEmprunts1->rowCount() > 0) {
while ($empruntsInfos1 = $selectInfosFromEmprunts1->fetch()) {
$selectInfosFromBooksEmprunts1 = $bdd->prepare('SELECT * FROM books WHERE id = ?');
$selectInfosFromBooksEmprunts1->execute(array($empruntsInfos1['id_book']));
$recupBooks = $selectInfosFromBooksEmprunts1->fetch(); ?>
<div class="container mt-3">
<div class="d-flex justify-content-center mt-4">
<div class="card text-center" style="width: 50rem;">
<div class="card-body">
<h5 class="card-title"><?= htmlspecialchars($recupBooks['titre']); ?></h5>
<h6 class="card-subtitle mb-2 text-body-secondary"><?= htmlspecialchars($recupBooks['auteur']); ?></h6>
<ul class="list-group list-group-flush">
<li class="list-group-item">Emprunté le <?php ConversionDateHour($empruntsInfos1['date_emprunt']); ?></li>
<li class="list-group-item">Retour prévu le <?php ColorDateEmprunt($empruntsInfos1['date_futur_retour']); ?></li>
</ul>
<div class="btn-group" role="group">
<a href="books-reader.php?id=<?= htmlspecialchars($recupBooks['id']); ?>" class="btn btn-secondary">Voir</a>
<?php if ($_SESSION['grade'] == 1) { ?><a href="gestion/emprunt.php?id=<?= htmlspecialchars($recupBooks['id']); ?><?php if ($recupBooks['statut'] == 1) {
echo '&user_id=' . htmlspecialchars($empruntsInfos1['id_emprunteur']);
} ?>" class="btn btn-success">Emprunt</a><?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
<div class="tab-pane fade <?php if ($nbRetards == 0 and $nbAujourdhui > 0) {
echo 'show active';
} ?>" id="aujourdhui" role="tabpanel" tabindex="0">
<?php if ($selectInfosFromEmprunts2->rowCount() > 0) {
while ($empruntsInfos2 = $selectInfosFromEmprunts2->fetch()) {
$selectInfosFromBooksEmprunts2 = $bdd->prepare('SELECT * FROM books WHERE id = ?');
$selectInfosFromBooksEmprunts2->execute(array($empruntsInfos2['id_book']));
$recupBooks = $selectInfosFromBooksEmprunts2->fetch(); ?>
<div class="container mt-3">
<div class="d-flex justify-content-center mt-4">
<div class="card text-center" style="width: 50rem;">
<div class="card-body">
<h5 class="card-title"><?= htmlspecialchars($recupBooks['titre']); ?></h5>
<h6 class="card-subtitle mb-2 text-body-secondary"><?= htmlspecialchars($recupBooks['auteur']); ?></h6>
<ul class="list-group list-group-flush">
<li class="list-group-item">Emprunté le <?php ConversionDateHour($empruntsInfos2['date_emprunt']); ?></li>
<li class="list-group-item">Retour prévu le <?php ColorDateEmprunt($empruntsInfos2['date_futur_retour']); ?></li>
</ul>
<div class="btn-group" role="group">
<a href="books-reader.php?id=<?= htmlspecialchars($recupBooks['id']); ?>" class="btn btn-secondary">Voir</a>
<?php if ($_SESSION['grade'] == 1) { ?><a href="gestion/emprunt.php?id=<?= htmlspecialchars($recupBooks['id']); ?><?php if ($recupBooks['statut'] == 1) {
echo '&user_id=' . htmlspecialchars($empruntsInfos2['id_emprunteur']);
} ?>" class="btn btn-success">Emprunt</a><?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
<div class="tab-pane fade <?php if ($nbRetards == 0 and $nbAujourdhui == 0 and $nbEnCours > 0) {
echo 'show active';
} ?>" id="encours" role="tabpanel" tabindex="0">
<?php if ($selectInfosFromEmprunts3->rowCount() > 0) {
while ($empruntsInfos3 = $selectInfosFromEmprunts3->fetch()) {
$selectInfosFromBooksEmprunts3 = $bdd->prepare('SELECT * FROM books WHERE id = ?');
$selectInfosFromBooksEmprunts3->execute(array($empruntsInfos3['id_book']));
$recupBooks = $selectInfosFromBooksEmprunts3->fetch(); ?>
<div class="container mt-3">
<div class="d-flex justify-content-center mt-4">
<div class="card text-center" style="width: 50rem;">
<div class="card-body">
<h5 class="card-title"><?= htmlspecialchars($recupBooks['titre']); ?></h5>
<h6 class="card-subtitle mb-2 text-body-secondary"><?= htmlspecialchars($recupBooks['auteur']); ?></h6>
<ul class="list-group list-group-flush">
<li class="list-group-item">Emprunté le <?php ConversionDateHour($empruntsInfos3['date_emprunt']); ?></li>
<li class="list-group-item">Retour prévu le <?php ColorDateEmprunt($empruntsInfos3['date_futur_retour']); ?></li>
</ul>
<div class="btn-group" role="group">
<a href="books-reader.php?id=<?= htmlspecialchars($recupBooks['id']); ?>" class="btn btn-secondary">Voir</a>
<?php if ($_SESSION['grade'] == 1) { ?><a href="gestion/emprunt.php?id=<?= htmlspecialchars($recupBooks['id']); ?><?php if ($recupBooks['statut'] == 1) {
echo '&user_id=' . htmlspecialchars($empruntsInfos3['id_emprunteur']);
} ?>" class="btn btn-success">Emprunt</a><?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
<div class="tab-pane fade <?php if ($nbRetards == 0 and $nbAujourdhui == 0 and $nbEnCours == 0 and $nbRetournes > 0) {
echo 'show active';
} ?>" id="retournes" role="tabpanel" tabindex="0">
<?php if ($selectInfosFromEmprunts4->rowCount() > 0) {
while ($empruntsInfos4 = $selectInfosFromEmprunts4->fetch()) {
$selectInfosFromBooksEmprunts4 = $bdd->prepare('SELECT * FROM books WHERE id = ?');
$selectInfosFromBooksEmprunts4->execute(array($empruntsInfos4['id_book']));
$recupBooks = $selectInfosFromBooksEmprunts4->fetch(); ?>
<div class="container mt-3">
<div class="d-flex justify-content-center mt-4">
<div class="card text-center" style="width: 50rem;">
<div class="card-body">
<h5 class="card-title"><?= htmlspecialchars($recupBooks['titre']); ?></h5>
<h6 class="card-subtitle mb-2 text-body-secondary"><?= htmlspecialchars($recupBooks['auteur']); ?></h6>
<ul class="list-group list-group-flush">
<li class="list-group-item">Emprunté le <?php ConversionDateHour($empruntsInfos4['date_emprunt']); ?></li>
<li class="list-group-item">Retourné le <?php ConversionDateHour($empruntsInfos4['date_retour']); ?></li>
</ul>
<a href="books-reader.php?id=<?= htmlspecialchars($recupBooks['id']); ?>" class="btn btn-secondary">Voir</a>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
</div>
<?php } else {
die('Absence du n° de l\'id');
} ?>
</div>
<?php include 'includes/footer.php'; ?>
</body>
</html>