-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_produit.php
226 lines (205 loc) · 9.17 KB
/
view_produit.php
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
220
221
222
223
224
225
226
<?php
$page_title = 'Volontaires';
require_once('includes/load.php');
if (!$session->isUserLoggedIn(true)) {
redirect('index', false);
}
page_require_level(1);
$user = current_user();
$products = join_product_table();
$date = make_date();
foreach ($products as $product) {
if ($product['id'] == $_GET['id']) {
$name = $product['name'];
$categorie = $product['categorie'];
$date_per = $product['date_peremp'];
$quanty = $product['quantity'];
$utilisation = $product['utili'];
$contreindi = $product['ci'];
}
}
?>
<?php include_once('layouts/header.php'); ?>
<?php echo display_msg($msg); ?>
<section class="py-5 bg-light">
<div class="container px-5">
<div class="row gx-5">
<div class="col-xl-8">
<a style="color:#6c757d" href="./produit">
<i class="bi bi-arrow-left"></i>
Retour page produits
</a>
<h1 class="fw-bolder"><?php echo $name ?></h1>
<br>
<div class="card shadow border-0">
<div class="card-body">
<a class="text-decoration-none link-dark stretched-link text-center" href="#!">
<h5 class="card-title mb-3">Utilisation :</h5>
</a>
<?php if ($utilisation == NULL || $utilisation == "") : ?>
<p class="card-text mb-0 text-center">---</p>
<?php else : ?>
<p class="card-text mb-0 text-center"><?php echo $utilisation ?></p>
<?php endif; ?>
</div>
</div>
<br>
<div class="card shadow border-0">
<div class="card-body">
<a class="text-decoration-none link-dark stretched-link text-center" href="#!">
<h5 class="card-title mb-3">Contre-indication :</h5>
</a>
<?php if ($contreindi == NULL || $contreindi == "") : ?>
<p class="card-text mb-0 text-center">---</p>
<?php else : ?>
<p class="card-text mb-0 text-center"><?php echo $contreindi ?></p>
<?php endif; ?>
</div>
</div>
<br>
</div>
<div class="col-xl-4">
<div class="card border-0 h-100">
<div class="card-body p-4">
<div class="d-flex h-100 align-items-center justify-content-center">
<div class="text-center">
<div class="h6 fw-bolder">Où cela se trouve ?</div>
<p><?php echo $categorie ?></p>
<div class="h6 fw-bolder">Date de péremption</div>
<?php if (empty($date_per)) : ?>
<p style="color:#198754">---</p>
<?php else : ?>
<?php if ($date_per < $date) : ?>
<p style="background-color: red;"><?php echo $date_per ?></p>
<?php else : ?>
<p style="color:#198754"><?php echo $date_per ?></p>
<?php endif; ?>
<?php endif; ?>
<div class="h6 fw-bolder">Quantité</div>
<?php if ($quanty <= 0) : ?>
<p style="background-color: red;"><?php echo $quanty ?></p>
<?php else : ?>
<p style="color:#198754"><?php echo $quanty ?></p>
<?php endif; ?>
<a href="edit_produit?id=<?php echo (int)$_GET['id']; ?>" class="btn btn-m btn-warning" data-toggle="tooltip" title="Editer">
<i class="bi bi-pencil"></i>
</a>
<a href="sup_produit?id=<?php echo (int)$_GET['id']; ?>" class="btn btn-m btn-danger" data-toggle="tooltip" title="Supprimer">
<i class="bi bi-x-lg"></i>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="py-5">
<div class="container px-2">
<h1 class="fw-bolder fs-5 mb-4">Autres emplacements :</h1>
<div class="card border-0 shadow rounded-3 overflow-hidden">
<div class="card-body p-0">
<div class="row gx-0">
<div class="p-2 p-md-2">
<div class="autre">
<table class="table table-bordered">
<thead>
<tr>
<th class="col">#</th>
<th class="col">Catégorie</th>
<th class="col">Quantité</th>
<th class="col">Date de péremption</th>
<th class="col">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) :
if ($product['name'] == $name) :
if ($product['date_peremp'] == $date_per && $product['categorie'] == $categorie) :
else : ?>
<tr>
<td><?php echo count_id(); ?></td>
<td><?php echo remove_junk(ucwords($product['categorie'])); ?></td>
<?php if ($product['quantity'] <= 0) : ?>
<td style="background-color: red;"><?php echo remove_junk(ucwords($product['quantity'])); ?></td>
<?php else : ?>
<td><?php echo remove_junk(ucwords($product['quantity'])); ?></td>
<?php endif; ?>
<?php if (empty($product['date_peremp'])) : ?>
<td>---</td>
<?php else : ?>
<?php if ($product['date_peremp'] < $date) : ?>
<td style="background-color: red;"><?php echo remove_junk(ucwords($product['date_peremp'])); ?></td>
<?php else : ?>
<td><?php echo remove_junk(ucwords($product['date_peremp'])); ?></td>
<?php endif; ?>
<?php endif; ?>
<td class="text-center">
<div class="btn-group">
<a href="view_produit?id=<?php echo (int)$product['id']; ?>" class="btn btn-sm btn-primary" data-toggle="tooltip" title="Voir">
<i class="bi bi-eye"></i>
</a>
<a href="edit_produit?id=<?php echo (int)$product['id']; ?>" class="btn btn-sm btn-warning" data-toggle="tooltip" title="Editer">
<i class="bi bi-pencil"></i>
</a>
<!-- <a href="sup_produit?id=<?php echo (int)$product['id']; ?>" class="btn btn-sm btn-danger" data-toggle="tooltip" title="Supprimer">
<i class="bi bi-x-lg"></i>
</a> -->
</div>
</td>
</tr>
<?php endif;
endif;
endforeach; ?>
</tbody>
</table>
</div>
<div class="phone">
<table class="table table-bordered">
<thead>
<tr>
<th class="col">Catégorie</th>
<th class="col">Date de pér.</th>
<th class="col">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) :
if ($product['name'] == $name) :
if ($product['date_peremp'] == $date_per && $product['categorie'] == $categorie) :
else : ?>
<tr>
<td><?php echo remove_junk(ucwords($product['categorie'])); ?></td>
<?php if ($product['date_peremp'] == "---") : ?>
<td>---</td>
<?php else : ?>
<?php if ($product['date_peremp'] < $date) : ?>
<td style="background-color: red;"><?php echo remove_junk(ucwords($product['date_peremp'])); ?></td>
<?php else : ?>
<td><?php echo remove_junk(ucwords($product['date_peremp'])); ?></td>
<?php endif; ?>
<?php endif; ?>
<td class="text-center">
<div class="btn-group">
<a href="view_produit?id=<?php echo (int)$product['id']; ?>" class="btn btn-sm btn-primary" data-toggle="tooltip" title="Voir">
<i class="bi bi-eye"></i>
</a>
<a href="edit_produit?id=<?php echo (int)$product['id']; ?>" class="btn btn-sm btn-warning" data-toggle="tooltip" title="Editer">
<i class="bi bi-pencil"></i>
</a>
</div>
</td>
</tr>
<?php endif;
endif;
endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include_once('layouts/footer.php'); ?>