1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Accommodation_Management/view/view_manager.php

54 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2021-01-14 19:01:32 +01:00
<?php
require_once('template/head.php');
?>
<div class="container-fluid section">
<h2>Gestions des réservations de "<?=htmlspecialchars($hotel->getName())?>"</h2>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Email VIP</th>
<th scope="col">Nombre d'occupants</th>
<th scope="col">Nombre de chambres</th>
2021-01-14 19:01:32 +01:00
<th scope="col">Date d'arrivée</th>
<th scope="col">Date de sortie</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
forEach($reservations as $reservation){
?>
<tr>
<th scope="row"><a href="<?=genURL('vip/' . $reservation->getUserEmail() . '/view')?>"><?=$reservation->getUserEmail()?></a></th>
2021-01-14 19:01:32 +01:00
<td><?=$reservation->getPeopleCount()?></td>
<td><?=$reservation->getRoomCount()?></td>
2021-01-14 19:01:32 +01:00
<td><?=$reservation->getStartDate()?></td>
<td><?=$reservation->getEndDate()?></td>
<td><button onclick="deleteReservation('<?=$reservation->getUserEmail()?>', '<?=$reservation->getStartDate()?>')" class="btn btn-danger">Supprimer</button></td>
2021-01-14 19:01:32 +01:00
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<script>
function deleteReservation(email, date){
2021-01-14 19:01:32 +01:00
var xhr = new XMLHttpRequest();
xhr.onreadystatechange=function()
{
if (xhr.readyState==4 && xhr.status==200)
{
if(xhr.responseText == 'ok'){
location.reload();
}
}
}
2021-01-14 19:01:32 +01:00
xhr.open("POST", "<?=genURL('manager/') . $hotel->getId() . '/delete'?>", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send('email=' + email + '&start=' + date);
2021-01-14 19:01:32 +01:00
}
</script>
<?php
require_once('template/footer.php');
?>