-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduit-cat-medoc.php
172 lines (154 loc) · 6.71 KB
/
produit-cat-medoc.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
<?php
$page_title = 'Produits';
require_once('includes/load.php');
if (!$session->isUserLoggedIn(true)) {
redirect('index', false);
}
page_require_level(1);
$user = current_user();
$all_users = find_all_user();
$products = join_product_table();
$all_categories = find_all('categories');
$date = make_date();
page_require_level(1);
?>
<?php include_once('layouts/header.php'); ?>
<?php echo display_msg($msg); ?>
<section class="py-5">
<div class="autre">
<div class="container px-2">
<a style="color:#6c757d" href="./pre-produit-cat">
<i class="bi bi-arrow-left"></i>
Retour schéma principal
</a>
<br>
<br>
<h1 class="fw-bolder fs-5 mb-4">Produits <?php echo $_GET["cat"] ?>:</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="col">
<a href="pre_produit" class="btn btn-primary">Ajouter un produit</a>
</br>
</br>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th class="col">#</th>
<th class="col">Nom du produit</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 ($_GET['cat'] == $product['categorie']) : ?>
<tr>
<td><?php echo count_id(); ?></td>
<td><?php echo remove_junk(ucwords($product['name'])); ?></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 ($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;
endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="phone">
<div class="container px-2">
<a style="color:#6c757d" href="./pre-produit-cat">
<i class="bi bi-arrow-left"></i>
Retour schéma
</a>
<h1 class="fw-bolder fs-5 mb-4">Produits <?php echo $_GET['cat'] ?></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="py-1">
<a href="pre_produit" class="btn btn-primary">Ajouter un produit</a>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th class="col">Nom du produit</th>
<th class="col">Quantié</th>
<th class="col">Date de pér.</th>
<th class="col">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) :
if ($_GET['cat'] == $product['categorie']) : ?>
<tr>
<td><?php echo remove_junk(ucwords($product['name'])); ?></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 ($product['date_peremp'] == NULL) : ?>
<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;
endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include_once('layouts/footer.php'); ?>