You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

568 lines
20 KiB

6 days ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Booking Acknowledgement</title>
  7. <!-- Links to Bootstrap CSS and JS, jQuery, and SweetAlert -->
  8. <!-- Bootstrap CSS -->
  9. <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
  10. <style>
  11. label {
  12. color: black;
  13. }
  14. /* Header Styling */
  15. .header {
  16. background-color: #1d495a;
  17. padding: 10px 20px;
  18. display: flex;
  19. align-items: center;
  20. justify-content: space-between;
  21. color: white;
  22. font-family: Arial, sans-serif;
  23. }
  24. .header .logo {
  25. display: flex;
  26. align-items: center;
  27. }
  28. .header .logo img {
  29. height: 60px;
  30. }
  31. .header .center-text {
  32. position: absolute;
  33. /* Centered text */
  34. left: 50%;
  35. transform: translateX(-50%);
  36. text-align: center;
  37. font-size: 24px;
  38. }
  39. .header .menu-btn {
  40. background-color: transparent;
  41. border: none;
  42. font-size: 24px;
  43. color: white;
  44. }
  45. .header .menu-btn:hover {
  46. /* text-decoration: underline; */
  47. color: #ccc;
  48. }
  49. /* Menu Dropdown */
  50. .menu-dropdown {
  51. position: relative;
  52. margin-top: 10px;
  53. background-color: #1d495a;
  54. padding: 10px 20px;
  55. display: none;
  56. flex-direction: column;
  57. width: 100%;
  58. }
  59. .menu-dropdown a {
  60. color: white;
  61. margin-bottom: 5px;
  62. text-decoration: none;
  63. }
  64. .menu-dropdown a:hover {
  65. text-decoration: underline;
  66. }
  67. .menu-dropdown {
  68. right: 0;
  69. left: 0;
  70. z-index: 1000;
  71. /* Add z-index to bring the menu above other elements */
  72. }
  73. /* Mobile Specific Styling */
  74. @media (max-width : 768px) {
  75. .header {
  76. display: flex;
  77. justify-content: space-between;
  78. align-items: center;
  79. }
  80. .center-text {
  81. font-size: 18px !important;
  82. flex-grow: 1;
  83. text-align: center;
  84. }
  85. .menu-dropdown {
  86. right: 0;
  87. left: 0;
  88. z-index: 1000;
  89. /* Add z-index to bring the menu above other elements */
  90. }
  91. }
  92. /* Ensure content is not hidden behind the fixed navbar */
  93. body {
  94. margin: 0;
  95. /* margin-top: 90px; Adjust based on your header height */
  96. }
  97. /* Smooth horizontal scroll on mobile */
  98. @media (max-width: 768px) {
  99. .dataTables_wrapper {
  100. overflow-x: auto;
  101. }
  102. table.dataTable {
  103. width: 100% !important;
  104. white-space: nowrap;
  105. }
  106. }
  107. </style>
  108. </head>
  109. <body class="bg-light">
  110. <!-- Header Start-->
  111. <header>
  112. <div class="header d-flex justify-content-between align-items-center">
  113. <!-- Left: Logo -->
  114. <div class="logo">
  115. <img src="https://gccservices.in/gcc/assets/images/logo.png" alt="Logo">
  116. </div>
  117. <!-- Center: Text -->
  118. <div class="center-text">VICTORIA PUBLIC HALL</div>
  119. <!-- Right: Button for Menu -
  120. <div class="menu">
  121. <button class="menu-btn" onclick="toggleMenu()">
  122. &#9776;
  123. Unicode for hamburger menu icon
  124. </button>
  125. </div> -->
  126. </div>
  127. </header>
  128. <!-- Header End-->
  129. <div class="container my-4">
  130. <div class="card shadow">
  131. <!-- HEADER -->
  132. <div class="card-header bg-success text-white text-center">
  133. <h5 class="mb-0">Bulk Booking Acknowledgement</h5>
  134. <small>Reference ID: <span id="refId"></span></small>
  135. </div>
  136. <!-- BODY -->
  137. <div class="card-body">
  138. <h6 class="text-center mb-3">Your Previous Bulk Bookings</h6>
  139. <div class="table-responsive">
  140. <table class="table table-bordered table-striped align-middle text-center" id="bookingTable"
  141. style="width:100%">
  142. <thead class="table-dark">
  143. <tr>
  144. <th class="text-center">S.No</th>
  145. <th class="text-center">Ref ID</th>
  146. <th class="text-center">Prefer Date</th>
  147. <th class="text-center">ContactDetails</th>
  148. <th class="text-center">Category</th>
  149. <th class="text-center">No. of People</th>
  150. <th class="text-center">ID Proof</th>
  151. <th class="text-center">Total Amount (₹)</th>
  152. <th class="text-center">Booked On</th>
  153. <th class="text-center">Action</th>
  154. </tr>
  155. </thead>
  156. <tbody></tbody>
  157. </table>
  158. </div>
  159. </div>
  160. <!-- FOOTER -->
  161. <div class="card-footer text-center">
  162. <button class="btn btn-primary me-2" onclick="window.print()">Print</button>
  163. <button class="btn btn-secondary" onclick="goHome()">Home</button>
  164. </div>
  165. </div>
  166. </div>
  167. <div class="modal fade" id="viewModal" tabindex="-1">
  168. <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
  169. <div class="modal-content">
  170. <div class="modal-header text-white" style="background-color:#1d495a;">
  171. <h5 class="modal-title">Booking Details</h5>
  172. <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
  173. </div>
  174. <div class="modal-body">
  175. <div class="row mb-2">
  176. <div class="col-md-6"><strong>Name:</strong> <span id="m_name"></span></div>
  177. <div class="col-md-6"><strong>Contact:</strong> <span id="m_contact"></span></div>
  178. </div>
  179. <div class="row mb-2">
  180. <div class="col-md-6"><strong>Visit Date:</strong> <span id="m_visit"></span></div>
  181. <div class="col-md-6"><strong>Category:</strong> <span id="m_category"></span></div>
  182. </div>
  183. <hr>
  184. <h6>Visitor Breakup</h6>
  185. <table class="table table-sm table-bordered">
  186. <thead class="table-secondary">
  187. <tr>
  188. <th>User Type</th>
  189. <th>No. of People</th>
  190. <th>Amount</th>
  191. </tr>
  192. </thead>
  193. <tbody id="m_visitors"></tbody>
  194. </table>
  195. <div class="d-flex justify-content-between">
  196. <strong>Total People:</strong> <span id="m_totalPeople"></span>
  197. </div>
  198. <div class="d-flex justify-content-between">
  199. <strong>Total Amount:</strong> ₹<span id="m_totalAmount"> ₹</span>
  200. </div>
  201. <div class="alert alert-warning text-center mb-0">
  202. <strong>Your request has been submitted successfully.</strong><br>
  203. <span class="small">
  204. <strong>Payment is pending.</strong> Currently your application is under review by the
  205. competent authority.
  206. The status update and payment link will be shared shortly.
  207. </span>
  208. </div>
  209. <div class="card mt-3">
  210. <div class="card-header bg-dark text-white">
  211. <h6 class="mb-0">Disclaimer</h6>
  212. </div>
  213. <div class="card-body">
  214. <!-- Disclaimer Content -->
  215. <ul class="small text-muted mb-3">
  216. <li>
  217. Submission of this application shall be treated as a <strong>request only</strong>
  218. and shall not be considered as confirmation of booking.
  219. </li>
  220. <li>
  221. The preferred visit date indicated is <strong>subject to availability</strong> and
  222. verification by the Competent Authority.
  223. </li>
  224. <li>
  225. In the event of non-availability of the preferred date, the Competent Authority
  226. reserves the right to allot an <strong>alternate visit date</strong>.
  227. </li>
  228. <li>
  229. The final visit date shall be communicated to the applicant upon approval.
  230. </li>
  231. <li>
  232. The booking shall be deemed confirmed only upon
  233. <strong>administrative approval and successful payment confirmation</strong>,
  234. wherever applicable.
  235. </li>
  236. <li>
  237. Payment shall be made within <strong>24 hours</strong> from the date and time of
  238. approval, failing which the request shall be liable for
  239. <strong>automatic cancellation</strong> without further notice.
  240. </li>
  241. </ul>
  242. <hr>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. <!-- jQuery -->
  250. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  251. <!-- Bootstrap 5 -->
  252. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  253. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  254. <!-- DataTables -->
  255. <link rel="stylesheet" href="https://cdn.datatables.net/1.13.8/css/dataTables.bootstrap5.min.css">
  256. <link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.2/css/buttons.bootstrap5.min.css">
  257. <script src="https://cdn.datatables.net/1.13.8/js/jquery.dataTables.min.js"></script>
  258. <script src="https://cdn.datatables.net/1.13.8/js/dataTables.bootstrap5.min.js"></script>
  259. <script src="https://cdn.datatables.net/responsive/2.5.0/js/dataTables.responsive.min.js"></script>
  260. <!-- DataTable Buttons -->
  261. <script src="https://cdn.datatables.net/buttons/2.4.2/js/dataTables.buttons.min.js"></script>
  262. <script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.bootstrap5.min.js"></script>
  263. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  264. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  265. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  266. <script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.html5.min.js"></script>
  267. <!-- SweetAlert -->
  268. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  269. <script>
  270. $(document).ready(function () {
  271. const refId = new URLSearchParams(window.location.search).get("refId");
  272. if (!refId) {
  273. Swal.fire("Error", "Invalid Reference ID", "error");
  274. return;
  275. }
  276. $("#refId").text(refId);
  277. $.get("/victoriapublichall/bookingapi/getAcknowledgement",
  278. { refId: refId },
  279. function (res) {
  280. const tbody = $("#bookingTable tbody"); // DEFINE FIRST
  281. tbody.empty();
  282. if (res.status !== "success" || !res.bookings || res.status === "error") {
  283. tbody.append(`
  284. <tr>
  285. <td colspan="10" class="text-center text-muted fw-semibold">
  286. No bookings found for this reference ID
  287. </td>
  288. </tr>
  289. `);
  290. // Destroy existing DataTable if any
  291. if ($.fn.DataTable.isDataTable("#bookingTable")) {
  292. $("#bookingTable").DataTable().clear().destroy();
  293. }
  294. // Init DataTable (minimal, no buttons)
  295. $("#bookingTable").DataTable({
  296. paging: false,
  297. searching: false,
  298. info: false,
  299. ordering: false
  300. });
  301. return; // stop further processing
  302. }
  303. res.bookings.forEach(b => {
  304. const idProof = b.id_proof_name
  305. ? `${b.id_proof_name} - ${b.id_proof_number}`
  306. : "—";
  307. // store FULL booking object on row
  308. const row = $(`
  309. <tr>
  310. <td></td> <!-- S.No (auto-filled) -->
  311. <td>${b.ref_id}</td>
  312. <td>${b.visit_date}</td>
  313. <td>${res.contact}</td>
  314. <td>${b.category}</td>
  315. <td class="text-center">${b.no_of_people}</td>
  316. <td>${idProof}</td>
  317. <td class="text-end">${b.total_amount}</td>
  318. <td>${b.booked_on}</td>
  319. <td>
  320. <button class="btn btn-sm btn-info viewBtn mt-2">View</button>
  321. <button class="btn btn-sm btn-danger cancelBtn mt-2">Cancel</button>
  322. </td>
  323. </tr>
  324. `);
  325. row.data("booking", b);
  326. row.data("contact", res.contact);
  327. tbody.append(row);
  328. });
  329. if ($.fn.DataTable.isDataTable("#bookingTable")) {
  330. $("#bookingTable").DataTable().clear().destroy();
  331. }
  332. const table = $("#bookingTable").DataTable({
  333. scrollX: true, // horizontal scroll
  334. responsive: false, // disable column collapsing
  335. pageLength: 5,
  336. ordering: false,
  337. dom: 'Bfrtip',
  338. buttons: [
  339. {
  340. extend: 'excelHtml5',
  341. title: 'Victoria Public Hall - Bulk Booking Acknowledgement',
  342. exportOptions: {
  343. columns: ':visible:not(:last-child)' // exclude Action column
  344. }
  345. },
  346. {
  347. extend: 'pdfHtml5',
  348. title: 'Victoria Public Hall - Bulk Booking Acknowledgement',
  349. orientation: 'landscape',
  350. pageSize: 'A4',
  351. exportOptions: {
  352. columns: ':visible:not(:last-child)' // exclude Action column
  353. }
  354. }
  355. ],
  356. columnDefs: [
  357. {
  358. targets: 0, // S.No column
  359. orderable: false,
  360. searchable: false,
  361. className: "text-center"
  362. }
  363. ]
  364. });
  365. /* Auto increment S.No */
  366. table.on('order.dt search.dt draw.dt', function () {
  367. table.column(0, { search: 'applied', order: 'applied' })
  368. .nodes()
  369. .each(function (cell, i) {
  370. cell.innerHTML = i + 1;
  371. });
  372. }).draw();
  373. }
  374. );
  375. $(document).on("click", ".viewBtn", function () {
  376. const row = $(this).closest("tr");
  377. const booking = row.data("booking");
  378. const contact = row.data("contact");
  379. // Basic details
  380. $("#m_name").text(booking.name);
  381. $("#m_contact").text(contact);
  382. $("#m_visit").text(booking.visit_date);
  383. $("#m_category").text(booking.category);
  384. $("#m_totalPeople").text(booking.no_of_people);
  385. $("#m_totalAmount").text(booking.total_amount);
  386. // Visitor breakup
  387. const tbody = $("#m_visitors");
  388. tbody.empty();
  389. if (!booking.visitorBreakup || booking.visitorBreakup.length === 0) {
  390. tbody.append(`
  391. <tr>
  392. <td colspan="3" class="text-center text-muted">
  393. Visitor breakup not available
  394. </td>
  395. </tr>
  396. `);
  397. } else {
  398. booking.visitorBreakup.forEach(v => {
  399. tbody.append(`
  400. <tr>
  401. <td>${v.user_type}</td>
  402. <td class="text-center">${v.count}</td>
  403. <td class="text-center"><h9>Per Person: ${v.amount}</h9></td>
  404. </tr>
  405. `);
  406. });
  407. }
  408. new bootstrap.Modal("#viewModal").show();
  409. });
  410. });
  411. function goHome() {
  412. window.location.href = "/victoriapublichall";
  413. }
  414. // cancel the request
  415. $(document).on("click", ".cancelBtn", function () {
  416. const row = $(this).closest("tr");
  417. const booking = row.data("booking");
  418. const refId = booking.ref_id;
  419. Swal.fire({
  420. title: "Cancel Booking?",
  421. text: "Are you Cancel the Request",
  422. icon: "warning",
  423. showCancelButton: true,
  424. confirmButtonText: "Yes, Cancel",
  425. cancelButtonText: "No"
  426. }).then((result) => {
  427. if (result.isConfirmed) {
  428. $.ajax({
  429. url: "/victoriapublichall/bookingapi/cancelBulkRequest",
  430. type: "POST",
  431. data: { refId: refId },
  432. success: function (res) {
  433. if (res.status === "SUCCESS") {
  434. Swal.fire({
  435. title: "Cancelled",
  436. text: res.message,
  437. icon: "success"
  438. }).then(() => {
  439. window.location.href = "/victoriapublichall/register";
  440. });
  441. }
  442. else {
  443. Swal.fire("Warning", res.message, "warning");
  444. }
  445. },
  446. error: function () {
  447. Swal.fire("Error", "Unable to cancel request", "error");
  448. }
  449. });
  450. }
  451. });
  452. });
  453. </script>
  454. </body>
  455. </html>