[d24f17c] | 1 | <html lang="en" xmlns:th="http://www.thymeleaf.org">
|
---|
| 2 | <head>
|
---|
| 3 | <meta charset="UTF-8">
|
---|
| 4 | <title>Reservations</title>
|
---|
| 5 | <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
---|
| 6 | <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
---|
| 7 | <!-- jQuery -->
|
---|
| 8 | <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
---|
| 9 |
|
---|
| 10 | <!-- Bootstrap JS -->
|
---|
| 11 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
---|
| 12 |
|
---|
| 13 | </head>
|
---|
| 14 | <h2>Reservation List</h2>
|
---|
| 15 |
|
---|
| 16 | <table class="table">
|
---|
| 17 | <thead class="thead-dark">
|
---|
| 18 | <tr>
|
---|
| 19 | <th scope="col">Reservation ID</th>
|
---|
| 20 | <th scope="col">Restaurant</th>
|
---|
| 21 | <th scope="col">Table Number</th>
|
---|
| 22 | <th scope="col">Reservation Date</th>
|
---|
| 23 | <th scope="col">Party Size</th>
|
---|
| 24 | <th scope="col">SpecialRequest</th>
|
---|
| 25 | <th scope="col">Status</th>
|
---|
| 26 | <th scope="col">Actions</th>
|
---|
| 27 | </tr>
|
---|
| 28 | </thead>
|
---|
| 29 | <tbody>
|
---|
| 30 | <tr th:each="reservation : ${reservations}">
|
---|
| 31 | <td th:text="${reservation?.getReservationID()}"></td>
|
---|
| 32 | <td th:text="${reservation?.getRestaurant().getName()}"></td>
|
---|
| 33 | <td th:text="${reservation?.getTable().getId()}"></td>
|
---|
| 34 | <td th:text="${reservation?.getCheckInTime()}"></td>
|
---|
| 35 | <td th:text="${reservation?.getPartySize()}"></td>
|
---|
| 36 | <td th:text="${reservation?.getSpecialRequests()}"></td>
|
---|
| 37 | <td th:text="${reservation?.getStatus()}"></td>
|
---|
| 38 | <td>
|
---|
| 39 | <form th:method="POST" th:action="@{'/reservations/delete/{reservationId}' (reservationId=${reservation?.getReservationID()})}">
|
---|
| 40 | <button type="submit" class="btn btn-danger" onclick="cancelReservation()">
|
---|
| 41 | Cancel Reservation
|
---|
| 42 | </button>
|
---|
| 43 | <input type="hidden" id="reasonInput" name="reason">
|
---|
| 44 | </form>
|
---|
| 45 | <a th:href="@{'/reservations/edit/{reservationId}' (reservationId=${reservation?.getReservationID()})}" class="btn btn-primary edit-item">Edit</a>
|
---|
| 46 | </td>
|
---|
| 47 | </tr>
|
---|
| 48 | </tbody>
|
---|
| 49 | </table>
|
---|
| 50 | <script>
|
---|
| 51 | function cancelReservation() {
|
---|
| 52 | // Prompt the user to enter a reason
|
---|
| 53 | var reason = prompt("Please enter the reason for canceling the reservation:", "");
|
---|
| 54 |
|
---|
| 55 | // Check if the user entered a reason
|
---|
| 56 | if (reason !== null) {
|
---|
| 57 | // Set the reason value in the form
|
---|
| 58 | document.getElementById("reasonInput").value = reason;
|
---|
| 59 |
|
---|
| 60 | // Submit the form
|
---|
| 61 | document.getElementById("cancelForm").submit();
|
---|
| 62 | }
|
---|
| 63 | }
|
---|
| 64 | </script> |
---|