-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtableau-de-bord.php
More file actions
166 lines (163 loc) · 7.88 KB
/
tableau-de-bord.php
File metadata and controls
166 lines (163 loc) · 7.88 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
<?php
include "components/header.php";
require_once "database/function.php";
// Vérification du rôle de l'utilisateur
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] !== 'secretaire') {
header("Location: index.php");
exit();
}
// Statistiques rapides
$nbPatients = 0;
$nbMedecins = 0;
$nbRdvJour = 0;
$nbRdvAttente = 0;
global $pdo;
$nbPatients = $pdo->query("SELECT COUNT(*) FROM utilisateurs WHERE role = 'patient'")->fetchColumn();
$nbMedecins = $pdo->query("SELECT COUNT(*) FROM utilisateurs WHERE role = 'medecin'")->fetchColumn();
$nbRdvJour = $pdo->query("SELECT COUNT(*) FROM rendez_vous WHERE date = CURDATE()")->fetchColumn();
$nbRdvAttente = $pdo->query("SELECT COUNT(*) FROM rendez_vous WHERE statut = 'en attente'")->fetchColumn();
// Notifications récentes
$notifications = [];
if (isset($_SESSION['user']['id'])) {
$stmt = $pdo->prepare("SELECT * FROM notifications WHERE id_utilisateur = ? ORDER BY date_creation DESC LIMIT 5");
$stmt->execute([$_SESSION['user']['id']]);
$notifications = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tableau de bord Secrétaire</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
</head>
<body class="d-flex flex-column min-vh-100">
<div class="container py-5 flex-grow-1">
<h1 class="text-center mb-4">Tableau de bord Secrétaire</h1>
<div class="row mb-4 g-4">
<div class="col-md-3">
<div class="card text-center shadow h-100">
<div class="card-body">
<i class="bi bi-people-fill display-5 text-primary"></i>
<h5 class="card-title mt-2">Patients</h5>
<p class="card-text fs-4 fw-bold"><?php echo $nbPatients; ?></p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-center shadow h-100">
<div class="card-body">
<i class="bi bi-person-badge-fill display-5 text-success"></i>
<h5 class="card-title mt-2">Médecins</h5>
<p class="card-text fs-4 fw-bold"><?php echo $nbMedecins; ?></p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-center shadow h-100">
<div class="card-body">
<i class="bi bi-calendar-event-fill display-5 text-warning"></i>
<h5 class="card-title mt-2">RDV du jour</h5>
<p class="card-text fs-4 fw-bold"><?php echo $nbRdvJour; ?></p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-center shadow h-100">
<div class="card-body">
<i class="bi bi-hourglass-split display-5 text-danger"></i>
<h5 class="card-title mt-2">RDV en attente</h5>
<p class="card-text fs-4 fw-bold"><?php echo $nbRdvAttente; ?></p>
</div>
</div>
</div>
</div>
<div class="row g-4">
<div class="col-md-8">
<div class="card shadow h-100">
<div class="card-header bg-primary text-white">
<i class="bi bi-calendar-check"></i> Rendez-vous du jour
</div>
<div class="card-body p-0">
<table class="table table-striped mb-0">
<thead>
<tr>
<th>Date</th>
<th>Type</th>
<th>Heure début</th>
<th>Heure fin</th>
<th>Patient</th>
<th>Médecin</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$rdvs = listerRdvJour();
foreach ($rdvs as $rdv) {
$patient = getPatientById($rdv['id_patient']);
$medecin = getMedecinById($rdv['id_medecin']);
echo "<tr>";
echo "<td>" . htmlspecialchars($rdv['date']) . "</td>";
echo "<td>" . htmlspecialchars($rdv['type']) . "</td>";
echo "<td>" . htmlspecialchars($rdv['heure_debut']) . "</td>";
echo "<td>" . htmlspecialchars($rdv['heure_fin']) . "</td>";
echo "<td>" . htmlspecialchars($patient['prenom'] . ' ' . $patient['nom']) . "</td>";
echo "<td>" . htmlspecialchars($medecin['prenom'] . ' ' . $medecin['nom']) . "</td>";
echo "<td>" . htmlspecialchars($rdv['statut']) . "</td>";
echo '<td><div class="d-flex gap-2">';
echo '<form method="post" style="display:inline;">
<input type="hidden" name="idRdv" value="' . htmlspecialchars($rdv['id']) . '">
<button type="submit" name="action" value="confirmer" class="btn btn-success btn-sm" title="Confirmer">
<i class="bi bi-check-circle"></i>
</button>
</form>';
echo '<form method="post" style="display:inline;">
<input type="hidden" name="idRdv" value="' . htmlspecialchars($rdv['id']) . '">
<button type="submit" name="action" value="annuler" class="btn btn-danger btn-sm" title="Annuler">
<i class="bi bi-x-circle"></i>
</button>
</form>';
echo '</div></td>';
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card shadow h-100">
<div class="card-header bg-info text-white">
<i class="bi bi-bell"></i> Notifications récentes
</div>
<div class="card-body">
<?php if (empty($notifications)): ?>
<div class="alert alert-info">Aucune notification récente.</div>
<?php else: ?>
<ul class="list-group">
<?php foreach ($notifications as $notif): ?>
<li class="list-group-item d-flex justify-content-between align-items-center<?php if (!$notif['lu']) echo ' list-group-item-primary fw-bold'; ?>">
<span><?= htmlspecialchars($notif['message']) ?></span>
<span class="text-muted" style="font-size:0.9em;">
<?= date('d/m/Y H:i', strtotime($notif['date_creation'])) ?>
</span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<div class="mt-auto">
<?php include "components/footer.php"; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>