mirror of
https://github.com/BreizhHardware/ProjetS4COMWEB.git
synced 2026-01-18 16:47:35 +01:00
89 lines
4.1 KiB
PHP
89 lines
4.1 KiB
PHP
<body>
|
|
<div class="h-100">
|
|
<div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">
|
|
|
|
<?php try {
|
|
$token = tokenDecode();
|
|
$rdv = getAllNiche($pdo, $token[1]);
|
|
if ($rdv != null && count($rdv) > 0){
|
|
foreach ($rdv as $row) {
|
|
$dateStr = $row["rdv_date"];
|
|
$dateString = new DateTime($dateStr);
|
|
$date = $dateString->format('d F Y');
|
|
$uglyTime = $row["rdv_time"];
|
|
$dateTime = new DateTime($uglyTime);
|
|
$time = $dateTime->format('H:i');
|
|
$patient = $row["patient"];
|
|
$mail = $row["p_mail"];
|
|
$phone = $row["p_phone"];
|
|
if ($mail != null){
|
|
echo '<div class="card rounded-4 mx-2 pointer">';
|
|
echo '<div class="card-header bg-danger">';
|
|
echo '<div class="d-flex flex-row justify-content-between text-white">';
|
|
echo "<p>$date</p>";
|
|
echo "<p>$time</p>";
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '<div class="card-body">';
|
|
echo "<h5 class='card-title'>$patient</h5>";
|
|
echo "<a href='mailto:" . $mail . "' class='card-subtitle mb-2 text-body-secondary'>$mail</a>";
|
|
echo '<br>';
|
|
echo "<a href='tel:" . "0" . $phone . "' class='card-subtitle mb-2 text-body-secondary'>$phone</a>";
|
|
echo '</div>';
|
|
echo '</div>';
|
|
} else {
|
|
echo '<div class="card rounded-4 mx-2 pointer">';
|
|
echo '<div class="card-header bg-danger">';
|
|
echo '<div class="d-flex flex-row justify-content-between text-white">';
|
|
echo "<p>$date</p>";
|
|
echo "<p>$time</p>";
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '<div class="card-body">';
|
|
echo "<h5 class='card-title'>Vous n'avez pas de" . "<br>" . "patient pour ce créneau</h5>";
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
}
|
|
} else {
|
|
echo 'error';
|
|
}
|
|
} catch (PDOException $e) {
|
|
error_log('Database query error: ' . $e->getMessage());
|
|
echo "Error fetching data from the database";
|
|
} ?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">
|
|
<?php
|
|
$token = tokenDecode();
|
|
$medID = $token[1];
|
|
$lieux = getAllLieux($pdo);
|
|
echo "<form action='src/php/db/scripts/createRDVToDB.php' method='post'>";
|
|
echo "<input type='hidden' name='medID' value='$medID'>";
|
|
echo "<input class='form-control' type='date' name='date'>";
|
|
echo "<input class='form-control' type='time' name='time'>";
|
|
echo "<select class='form-select' name='lieu' id='lieu'>";
|
|
echo "<option value=''>Choisissez un lieu</option>";
|
|
if ($lieux != null && count($lieux) > 0){
|
|
foreach ($lieux as $row){
|
|
$adress = $row["l_adress"];
|
|
$postal = $row["l_postal"];
|
|
$city = $row["l_city"];
|
|
$lieu = $adress . ', ' . $postal . ', ' . $city;
|
|
echo "<option value='$lieu'>$adress, $postal, $city</option>";
|
|
}
|
|
}
|
|
echo "</select>";
|
|
echo "<br><br>";
|
|
echo "<button type='submit' name='createRDV' class='btn btn-danger'>Créer un rendez-vous</button>";
|
|
echo "</form>";
|
|
?>
|
|
</div>
|
|
</div>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
|
</body>
|
|
</html>
|