-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
370 lines (309 loc) · 14.3 KB
/
Copy pathdashboard.php
File metadata and controls
370 lines (309 loc) · 14.3 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<?php
include('security.php');
secAdmin();
include('includes/header.php');
include('includes/navbar.php');
?>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Content Row -->
<div class="row">
<div class="col-xl-3 col-md-6 mb-4">
<a href="all_visiteurs.php" style="text-decoration: none; color: inherit;">
<div class="card border-left-primary shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
Total Visiteurs
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">
<?php
require 'dbconfig.php';
$query = "SELECT VisiteurID FROM visiteurs ";
$query_run = mysqli_query($connection, $query);
$row = mysqli_num_rows($query_run);
echo '<h5>' . $row . '</h5>'
?>
</div>
</div>
<div class="col-auto">
<i class="fas fa-user-friends fa-2x" style="color:#c8241c;"></i>
</div>
</div>
</div>
</div>
</a>
</div>
<!-- TOTAL Etudiants -->
<div class="col-xl-3 col-md-6 mb-4">
<a href="etudiants_all_classes.php" class="card border-left-success shadow h-100 py-2" style="text-decoration: none;">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">
TOTAL Étudiants
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">
<?php
require 'dbconfig.php';
$query = "SELECT COUNT(*) as total FROM etudiants";
$query_run = mysqli_query($connection, $query);
if ($query_run) {
$row = mysqli_fetch_assoc($query_run)['total'];
echo '<h5>' . $row . '</h5>';
} else {
echo "Erreur lors de l'exécution de la requête";
}
?>
</div>
</div>
<div class="col-auto">
<i class="fas fa-graduation-cap fa-2x" style="color:#c8241c;"></i>
</div>
</div>
</div>
</a>
</div>
<!-- Total Professeurs -->
<div class="col-xl-3 col-md-6 mb-4">
<a href="all_professeurs.php" class="card border-left-info shadow h-100 py-2" style="text-decoration: none;">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Total Professeurs
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">
<?php
require 'dbconfig.php';
$query = "SELECT ProfesseurID FROM professeurs ";
$query_run = mysqli_query($connection, $query);
$row = mysqli_num_rows($query_run);
echo '<h5>' . $row . '</h5>'
?>
</div>
</div>
<div class="col-auto">
<i class="fas fa-chalkboard-teacher fa-2x" style="color:#c8241c;"></i>
</div>
</div>
</div>
</a>
</div>
<!-- Total Groupes -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-info shadow h-100 py-2">
<a href="etudiants_all_groupes.php" style="text-decoration: none; color: inherit;">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Total Groupes
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">
<?php
require 'dbconfig.php';
$query = "SELECT GroupeID FROM groupes ";
$query_run = mysqli_query($connection, $query);
$row = mysqli_num_rows($query_run);
echo '<h5><a href="etudiants_all_groups.php" style="text-decoration: none; color: inherit;">' . $row . '</a></h5>';
?>
</div>
</div>
<div class="col-auto">
<i class="fas fa-users fa-2x" style="color:#c8241c;"></i>
</div>
</div>
</div>
</a>
</div>
</div>
<!-- Total Étudiants Exclus -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-danger shadow h-100 py-2">
<a href="etudiants_exclus.php" style="text-decoration: none; color: inherit;">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-danger text-uppercase mb-1">
XEtudiants
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">
<?php
require 'dbconfig.php';
$query = "SELECT COUNT(*) as total FROM x_etudiants";
$query_run = mysqli_query($connection, $query);
if ($query_run) {
$row = mysqli_fetch_assoc($query_run)['total'];
echo '<h5>' . $row . '</h5>';
} else {
echo "Erreur lors de l'exécution de la requête";
}
?>
</div>
</div>
<div class="col-auto">
<i class="fas fa-user-times fa-2x" style="color:#c8241c;"></i>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
<!-- Content Row -->
<div class="row">
<div class="card shadow mb-4" style="width: 100% !important; margin: 0 10px 0 10px;">
<div class="card-body">
<div class="table-responsive">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>Partir de la date </label>
<input type="date" class="form-control" id="start_date">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>À ce jour</label>
<input type="date" class="form-control" id="end_date">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<button id="filter" class="btn btn-outline-info btn-sm">Filter</button>
<button id="reset" class="btn btn-outline-warning btn-sm">Réinitialiser</button>
</div>
</div>
</div>
<div>
<table class="table table-borderless " id="records">
<thead>
<tr>
<th>Date_inscription</th>
<th>Nom</th>
<th>Prenom</th>
<th>Cin</th>
<th>Telephone</th>
<th>Adresse</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<?php
include('includes/scripts.php');
?>
<!-- Font Awesome -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>
<!-- Datepicker -->
<!-- Datatables -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-flash-1.6.1/b-html5-1.6.1/b-print-1.6.1/r-2.2.3/datatables.min.js">
</script>
<!-- Momentjs -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<script>
// Fetch records
function fetch(start_date, end_date) {
$.ajax({
url: "records.php",
type: "POST",
data: {
start_date: start_date,
end_date: end_date
},
dataType: "json",
success: function(data) {
// Datatables
$('#records').DataTable({
"data": data,
"dom": "<'row'<'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'B><'col-sm-12 col-md-4'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
"buttons": ['excel', 'print'],
"responsive": true,
"columns": [{
"data": "Date_inscription",
"render": function(data, type, row, meta) {
return moment(row.Date_inscription).format('DD-MM-YYYY');
}
},
{
"data": "Nom",
"render": function(data, type, row, meta) {
return `${row.Etudiant_name}`;
}
},
{
"data": "Prenom",
"render": function(data, type, row, meta) {
return `${row.Etudiant_prenom}`;
}
},
{
"data": "CIN",
"render": function(data, type, row, meta) {
return `${row.CIN}`;
}
},
{
"data": "Tele",
"render": function(data, type, row, meta) {
return `${row.Tele}`;
}
},
{
"data": "Adresse",
"render": function(data, type, row, meta) {
return `${row.Adresse}`;
}
}
// Add rendering for other columns as needed
]
});
}
});
}
fetch();
// Filter
$(document).on("click", "#filter", function(e) {
e.preventDefault();
var start_date = $("#start_date").val();
var end_date = $("#end_date").val();
if (start_date !== "" && end_date !== "") {
$('#records').DataTable().destroy();
fetch(start_date, end_date);
} else if (start_date !== "" && end_date == "") {
$('#records').DataTable().destroy();
fetch(start_date, '', '');
} else if (start_date == "" && end_date !== "") {
$('#records').DataTable().destroy();
fetch('', end_date);
} else {
$('#records').DataTable().destroy();
fetch();
}
});
// Reset
$(document).on("click", "#reset", function(e) {
e.preventDefault();
$("#start_date").val(''); // empty value
$("#end_date").val('');
$("#fetchval").val('');
$('#records').DataTable().destroy();
fetch();
});
//filter systeme
</script>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<?php
include('includes/footer.php');
?>