Victoria Hall Booking for Events
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.

431 lines
14 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-admin :: head}"></head>
  4. <meta charset="ISO-8859-1">
  5. <!-- Include DataTables CSS -->
  6. </head>
  7. <style>
  8. .block-content {
  9. padding-bottom: 10px;
  10. }
  11. .small-input {
  12. width: 150px;
  13. /* Adjust the width as needed */
  14. }
  15. .small-table th,
  16. .small-table td {
  17. font-size: 14px;
  18. /* Adjust font size as needed */
  19. }
  20. /* Reduce padding for table cells */
  21. .small-table td,
  22. .small-table th {
  23. padding: 5px;
  24. /* Adjust padding as needed */
  25. }
  26. .card-body table {
  27. width: 100%;
  28. padding: 100px;
  29. }
  30. .card-body th,
  31. td {
  32. padding: 8px;
  33. text-align: left;
  34. }
  35. .amount-cell {
  36. text-align: right;
  37. padding-right: 1rem;
  38. /* Adjust padding as needed */
  39. }
  40. .table {
  41. width: 100% !important;
  42. }
  43. .hidden {
  44. display: none;
  45. }
  46. </style>
  47. <body>
  48. <!-- Page Container -->
  49. <div id="page-container"
  50. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  51. <!-- Side Overlay aside (right)-->
  52. <aside th:replace="~{fragments/aside-right :: aside}"></aside>
  53. <!-- END Side Overlay (right)-->
  54. <!-- Sidebar Nav-->
  55. <nav th:replace="~{fragments/nav-admin :: nav}"></nav>
  56. <!-- END Sidebar -->
  57. <!-- Header -->
  58. <header th:replace="~{fragments/header-admin :: header}"></header>
  59. <!-- END Header -->
  60. <!-- Main Container -->
  61. <main id="main-container">
  62. <!-- Page Content -->
  63. <!-- Card Container -->
  64. <div class="content">
  65. <div class="block block-rounded">
  66. <form id="myForm" th:action="@{/victoriahallbooking/admin/getDeveloperdetails}" onsubmit="return validateme()"
  67. method="post">
  68. <div class="block-header bg-primary text-white">
  69. <h3 class="block-title">Community Hall Reports</h3>
  70. </div>
  71. <div class="block-content">
  72. <div class="row">
  73. <div class="col-sm-3 mb-2">
  74. <label class="form-label" for="fromdate">From:<span
  75. class="text-danger">*</span></label> <input type="date"
  76. th:value="${fromdate}" class="form-control" name="FromDate" id="fromdate"
  77. placeholder="From Date" required="required" data-date-format="yyyy-mm-dd" />
  78. </div>
  79. <div class="col-sm-3 mb-2">
  80. <label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
  81. <input type="date" th:value="${todate}" class="form-control" name="ToDate"
  82. id="todate" placeholder="To Date" required="required"
  83. data-date-format="yyyy-mm-dd" />
  84. </div>
  85. <div class="col-sm-3 mb-2">
  86. <label class="form-label" for="request">Get Info:<span
  87. class="text-danger">*</span></label>
  88. <select type="text" class="form-control text-center" id="request" name="request"
  89. onchange="myRequest()" required>
  90. <option value="">Select</option>
  91. <option value="1" th:selected="${request=='1'}">Transaction Response</option>
  92. <option value="2" th:selected="${request=='2'}">Refund Response</option>
  93. <option value="3" th:selected="${request=='3'}">Booking Calendar</option>
  94. </select>
  95. </div>
  96. <!-- bookingDetailsDropdown1 -->
  97. <div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
  98. <label class="form-label" for="bookingId">Booking Id: </label>
  99. <input type="number" class="form-control" id="bookingId" name="bookingId"
  100. th:value="${bookingId}" placeholder="BookingId">
  101. </div>
  102. <!-- bookingDetailsDropdown2 -->
  103. <div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
  104. <label class="form-label" for="hallId">Hall Id: </label>
  105. <input type="number" class="form-control" id="hallId" name="hallId"
  106. th:value="${hallId}" placeholder="HallId">
  107. </div>
  108. <div class="col-sm-3 mb-2" id="bookingDetailsDropdown3" style="display: none;">
  109. <label class="form-label" for="hallNameDropdown">Hall Name:</label>
  110. <select class="form-select custom-select" name="hallName" id="hallNameDropdown">
  111. <option th:value="${hallName}">--Select Hall--</option>
  112. <!-- Initial population using Thymeleaf -->
  113. <th:block th:each="hall : ${halls}">
  114. <option th:value="${hall.hallName}"
  115. th:text="${hall.hallName}">
  116. </option>
  117. </th:block>
  118. </select>
  119. </div>
  120. <div class="col-sm-3">
  121. <br>
  122. <button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
  123. id="submit">Submit</button>
  124. <button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
  125. type="reset">Reset</button>
  126. </div>
  127. </div>
  128. </div>
  129. </form>
  130. </div>
  131. <div class="table-responsive" id="requestTable1Container" th:if="${request}==1">
  132. <table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
  133. role="grid" width="99.5%">
  134. <thead class="thead-dark">
  135. <tr role="row">
  136. <th>S.No</th>
  137. <th>Booking Id</th>
  138. <th>Hall Id</th>
  139. <th>Amount</th>
  140. <th>Status Code</th>
  141. <th>Transaction Id</th>
  142. <th>User Id</th>
  143. <!--<th>Payment Status</th>-->
  144. </tr>
  145. </thead>
  146. <tr th:each="transaction, iterStat : ${TransactionResponse}">
  147. <td th:text="${iterStat.count}">0</td>
  148. <td th:text="${transaction[0]}"></td>
  149. <td th:text="${transaction[1]}"></td>
  150. <td th:text="${transaction[2]}"></td>
  151. <td th:text="${transaction[3]}"></td>
  152. <td th:text="${transaction[4]}"></td>
  153. <td th:text="${transaction[5]}"></td>
  154. <!--
  155. <td th:text="${transaction[6]}"></td>
  156. -->
  157. </tr>
  158. </table>
  159. </div>
  160. <div class="table-responsive" id="requestTable2Container" th:if="${request}==2">
  161. <table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
  162. role="grid" width="99.5%">
  163. <thead class="thead-dark">
  164. <tr role="row">
  165. <th>S.No</th>
  166. <th>Booking Id</th>
  167. <th>Booking Date</th>
  168. <th>Refund Status</th>
  169. <th>Amount</th>
  170. <th>Transaction Id</th>
  171. <th>User Id</th>
  172. </tr>
  173. </thead>
  174. <tbody>
  175. <tr th:each="refund, iterStat : ${RefundResponse}">
  176. <td th:text="${iterStat.count}">0</td>
  177. <td th:text="${refund[0]}"></td>
  178. <td th:text="${refund[1] != null ? refund[1] : '-'}"></td>
  179. <td th:text="${refund[2]}"></td>
  180. <td th:text="${refund[3]}"></td>
  181. <td th:text="${refund[4]}"></td>
  182. <td th:text="${refund[5]}"></td>
  183. </tr>
  184. </tbody>
  185. </table>
  186. </div>
  187. <div class="table-responsive" id="requestTable3Container" th:if="${request}==3">
  188. <table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
  189. role="grid" width="99.5%">
  190. <thead class="thead-dark">
  191. <tr role="row">
  192. <th>S.No</th>
  193. <th>Booking Date</th>
  194. <th>Booking Id1</th>
  195. <th>Booking Id2</th>
  196. <th>Morning Slot</th>
  197. <th>Evening Slot</th>
  198. <th>Hall Name</th>
  199. <th>Hall Id</th>
  200. </tr>
  201. </thead>
  202. <tbody>
  203. <tr th:each="booking, iterStat : ${BookingCalendar}">
  204. <td th:text="${iterStat.count}">0</td>
  205. <td th:text="${booking[0]}"></td>
  206. <td th:text="${booking[1] != null ? booking[1] : '-'}"></td>
  207. <td th:text="${booking[2] != null ? booking[2] : '-'}"></td>
  208. <td th:text="${booking[3]}"></td>
  209. <td th:text="${booking[4]}"></td>
  210. <td th:text="${booking[5]}"></td>
  211. <td th:text="${booking[6]}"></td>
  212. </tr>
  213. </tbody>
  214. </table>
  215. </div>
  216. </div>
  217. </main>
  218. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  219. </div>
  220. <div th:replace="~{fragments/resetpassword :: div}"></div>
  221. <script th:replace="~{fragments/loginscript :: script}"></script>
  222. <script>
  223. $(document).ready(function () {
  224. // Common buttons configuration
  225. var buttons = [{
  226. extend: 'pageLength',
  227. className: 'btn btn-primary'
  228. }, {
  229. title: 'Data export',
  230. extend: 'copyHtml5',
  231. text: 'Copy',
  232. className: 'btn btn-primary',
  233. id: 'copyBtn'
  234. }, {
  235. extend: 'excelHtml5',
  236. text: 'Excel',
  237. className: 'btn btn-primary',
  238. id: 'excelBtn'
  239. }, {
  240. extend: 'csvHtml5',
  241. text: 'CSV',
  242. className: 'btn btn-primary',
  243. id: 'csvBtn'
  244. }, {
  245. extend: 'pdfHtml5',
  246. text: 'PDF',
  247. className: 'btn btn-primary',
  248. id: 'pdfBtn'
  249. }];
  250. // DataTables initialization
  251. $('#requestTable1, #requestTable2, #requestTable3').DataTable({
  252. dom: 'Bftip',
  253. columnDefs: [{
  254. targets: 'no-sort',
  255. orderable: false
  256. }],
  257. lengthMenu: [
  258. [50, 100, 200, 500, -1],
  259. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  260. ],
  261. scrollY: '50vh',
  262. fixedColumns: {
  263. left: 1,
  264. right: 1
  265. },
  266. buttons: buttons,
  267. responsive: true,
  268. searching: true, // Enable search
  269. select: false,
  270. processing: false,
  271. order: [] // Remove any default sorting
  272. });
  273. // Link the search input to DataTable
  274. $('#searchInput').on('keyup', function () {
  275. $('#bookinglistdataTable').DataTable().search(this.value).draw();
  276. });
  277. });
  278. function validateme() {
  279. return true;
  280. }
  281. var fromdate = document.getElementById("fromdate"), todate = document
  282. .getElementById("todate");
  283. function validateDate() {
  284. if ($("#fromdate").val() == "" || $("#todate").val() == "") {
  285. todate.setCustomValidity("FromDate and ToDate Must");
  286. } else {
  287. todate.setCustomValidity('');
  288. }
  289. }
  290. fromdate.onchange = validateDate;
  291. todate.onchange = validateDate;
  292. $(document).ready(function () {
  293. var today = new Date();
  294. $('.datepicker').datepicker({
  295. dateFormat: 'yy-mm-dd',
  296. maxDate: '1'
  297. })
  298. $('.datepicker').keyup(function () {
  299. if (this.value.match(/[^0-9]/g)) {
  300. this.value = this.value.replace(/[^0-9^-]/g, '');
  301. }
  302. });
  303. });
  304. document.addEventListener("DOMContentLoaded", function () {
  305. myRequest(); // Initial call to set dropdowns based on initial value
  306. });
  307. document.addEventListener("DOMContentLoaded", function () {
  308. var today = new Date();
  309. var sixMonthsLater = new Date();
  310. sixMonthsLater.setMonth(today.getMonth() + 6);
  311. var minDate = today.toISOString().split('T')[0];
  312. var maxDate = sixMonthsLater.toISOString().split('T')[0];
  313. let fromDateInput = document.getElementById('fromdate');
  314. let toDateInput = document.getElementById('todate');
  315. fromDateInput.setAttribute('max', maxDate);
  316. toDateInput.setAttribute('max', maxDate);
  317. fromDateInput.addEventListener('change', function () {
  318. let selectedFromDate = this.value;
  319. let toDateInput = document.getElementById('todate');
  320. toDateInput.setAttribute('min', selectedFromDate);
  321. toDateInput.value = ''; // Reset the value of toDate
  322. });
  323. });
  324. function myRequest() {
  325. // Hide all dropdowns initially
  326. document.getElementById("bookingDetailsDropdown1").style.display = "none";
  327. document.getElementById("bookingDetailsDropdown2").style.display = "none";
  328. document.getElementById("bookingDetailsDropdown3").style.display = "none";
  329. // Get the selected value from the 'Get Info' dropdown
  330. var requestValue = document.getElementById("request").value;
  331. // Show relevant dropdowns based on the selected value
  332. if (requestValue === "1") {
  333. document.getElementById("bookingDetailsDropdown1").style.display = "block";
  334. document.getElementById("bookingDetailsDropdown2").style.display = "block";
  335. } else if (requestValue === "2") {
  336. document.getElementById("bookingDetailsDropdown1").style.display = "block";
  337. } else if (requestValue === "3") {
  338. document.getElementById("bookingDetailsDropdown1").style.display = "block";
  339. document.getElementById("bookingDetailsDropdown3").style.display = "block";
  340. // Fetch and populate Hall Names dropdown
  341. fetch('/victoriahallbooking/user/api/gethallnames')
  342. .then(response => response.json())
  343. .then(data => {
  344. // console.log('Hall Names Data:', data); // Debug log
  345. const hallNameDropdown = document.getElementById('hallNameDropdown');
  346. const selectedHall = hallNameDropdown.value; // Retain current selection
  347. // Reset dropdown options
  348. hallNameDropdown.innerHTML = '<option value="">--Select Hall--</option>';
  349. // Populate options dynamically
  350. data.forEach(hall => {
  351. const option = document.createElement('option');
  352. option.value = hall.hallName;
  353. option.textContent = hall.hallName;
  354. // Preserve selection
  355. if (hall.hallName === selectedHall) {
  356. option.selected = true;
  357. }
  358. hallNameDropdown.appendChild(option);
  359. });
  360. })
  361. .catch(error => console.error('Error fetching hall names:', error));
  362. }
  363. }
  364. document.addEventListener("DOMContentLoaded", function() {
  365. document.getElementById("basedon").addEventListener("change", function() {
  366. const selectedValue = this.value;
  367. document.getElementById("bookingcountbasedonDropdown").style.display = selectedValue ? "block" : "none";
  368. });
  369. });
  370. // Function to reset date fields
  371. function resetDate() {
  372. window.location.href = "/victoriahallbooking/admin/developer";
  373. document.getElementById('fromdate').value = '';
  374. document.getElementById('todate').value = '';
  375. }
  376. document.addEventListener('DOMContentLoaded', function () {
  377. document.getElementById('request').addEventListener('change', function () {
  378. myRequest(); // Handle request change
  379. });
  380. });
  381. </script>
  382. </body>
  383. </html>