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.

2483 lines
126 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
2 years ago
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
2 years ago
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
2 years ago
​
2 years ago
​
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-headquarters :: 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. .modal-fullscreen-custom {
  47. max-width: 98% !important;
  48. width: 98%;
  49. margin: 0 auto;
  50. }
  51. /* Ensure second modal is on top of the first modal */
  52. .modal-backdrop.show:nth-of-type(2) {
  53. z-index: 1055 !important; /* slightly above the first modal */
  54. }
  55. #showBookingDetails.modal {
  56. z-index: 1060 !important; /* higher than .modal-backdrop */
  57. }
  58. </style>
  59. <body>
  60. <!-- Page Container -->
  61. <div id="page-container"
  62. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  63. <!-- Side Overlay aside (right)-->
  64. <aside th:replace="~{fragments/aside-right :: aside}"></aside>
  65. <!-- END Side Overlay (right)-->
  66. <!-- Sidebar Nav-->
  67. <nav th:replace="~{fragments/nav-headquarters :: nav}"></nav>
  68. <!-- END Sidebar -->
  69. <!-- Header -->
  70. <header th:replace="~{fragments/header-headquarters :: header}"></header>
  71. <!-- END Header -->
  72. <!-- Main Container -->
  73. <main id="main-container">
  74. <!-- Page Content -->
  75. <!-- Card Container -->
  76. <div class="content">
  77. <div class="block block-rounded">
  78. <form id="myForm" th:action="@{/communityhall/headquarters/getReport}" onsubmit="return validateme()"
  79. method="post">
  80. <div class="block-header bg-primary text-white">
  81. <h3 class="block-title">Community Hall Reports</h3>
  82. </div>
  83. <div class="block-content">
  84. <div class="row">
  85. <div class="col-sm-3 mb-2">
  86. <label class="form-label" for="fromdate">From:<span
  87. class="text-danger">*</span></label> <input type="date"
  88. th:value="${fromdate}"
  89. class="form-control" name="FromDate"
  90. id="fromdate"
  91. placeholder="From Date"
  92. required="required"
  93. data-date-format="yyyy-mm-dd"/>
  94. </div>
  95. <div class="col-sm-3 mb-2">
  96. <label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
  97. <input type="date" th:value="${todate}" class="form-control" name="ToDate"
  98. id="todate" placeholder="To Date" required="required"
  99. data-date-format="yyyy-mm-dd"/>
  100. </div>
  101. <div class="col-sm-3 mb-2">
  102. <label class="form-label" for="request">Get Info:<span
  103. class="text-danger">*</span></label>
  104. <select type="text" class="form-control text-center" id="request" name="request"
  105. onchange="myRequest()" required>
  106. <option value="">Select</option>
  107. <option value="1" th:selected="${request=='1'}">Users</option>
  108. <option value="2" th:selected="${request=='2'}">Booking Details</option>
  109. <option value="3" th:selected="${request=='3'}">Payment Info</option>
  110. <option value="4" th:selected="${request=='4'}">Users Booking List</option>
  111. <option value="5" th:selected="${request=='5'}">Hall Booking List</option>
  112. <option value="6" th:selected="${request=='6'}">Refund Details</option>
  113. <option value="7" th:selected="${request=='7'}">Total Count</option>
  114. <option value="8" th:selected="${request=='8'}">Extra Payments Info</option>
  115. <option value="9" th:selected="${request=='9'}">Counter Details</option>
  116. </select>
  117. </div>
  118. <!-- UsersDropdown2 -->
  119. <div class="col-sm-3 mb-2" id="userDropdown2" style="display: none;">
  120. <label class="form-label" for="usertype">User Type: </label>
  121. <select class="form-control text-center" id="usertype" name="usertype"
  122. th:value="${usertype}">
  123. <option value="">Select User Type</option>
  124. <option value="PENSIONER" th:selected="${usertype == 'PENSIONER'}">PENSIONER
  125. </option>
  126. <option value="GCC_EMPLOYEE" th:selected="${usertype == 'GCC_EMPLOYEE'}">GCC
  127. EMPLOYEE
  128. </option>
  129. <option value="COUNCILLOR" th:selected="${usertype == 'COUNCILLOR'}">COUNCILLOR
  130. </option>
  131. <option value="PUBLIC" th:selected="${usertype == 'PUBLIC'}">PUBLIC</option>
  132. <!-- Add more options as needed -->
  133. </select>
  134. </div>
  135. <!-- UsersDropdown1 -->
  136. <div class="col-sm-3 mb-2" id="userDropdown1" style="display: none;">
  137. <label class="form-label" for="userstatus">User Status: </label>
  138. <select class="form-control text-center" id="userstatus" name="userstatus"
  139. th:value="${userstatus}">
  140. <option value="">Select a User Status</option>
  141. <option value="PENDING" th:selected="${userstatus == 'PENDING'}">PENDING
  142. </option>
  143. <option value="APPROVED" th:selected="${userstatus == 'APPROVED'}">APPROVED
  144. </option>
  145. <option value="REJECTED" th:selected="${userstatus == 'REJECTED'}">REJECTED
  146. </option>
  147. <!-- Add more options as needed -->
  148. </select>
  149. </div>
  150. <!-- bookingDetailsDropdown1 -->
  151. <div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
  152. <label class="form-label" for="bookingId">Booking Id: </label>
  153. <input type="number" class="form-control" id="bookingId" name="bookingId"
  154. th:value="${bookingId}" placeholder="BookingId">
  155. </div>
  156. <div class="col-sm-3 mb-2" id="zoneDropdown" style="display: none;">
  157. <label class="form-label" for="zone1">Select Zone: </label>
  158. <select class="form-select custom-select" name="zone1" id="zone1">
  159. <option value="ALL">--Select Zone--</option>
  160. <option th:each="zone : ${zones}" th:value="${zone}" th:text="${zone}"
  161. th:selected="${zone == selectedZone}"></option>
  162. </select>
  163. </div>
  164. <div class="col-sm-3 mb-2 hidden" id="divisionContainer" style="display: none;">
  165. <label class="form-label" for="division1">Select division: </label>
  166. <select class="form-select custom-select" name="division1" id="division1">
  167. <option value="ALL">--Select division--</option>
  168. <option th:each="division : ${divisions}" th:value="${division}"
  169. th:text="${division}" th:selected="${division == selectedDivision}">
  170. </option>
  171. </select>
  172. </div>
  173. <div class="col-sm-3 mb-2 hidden" id="hallContainer" style="display: none;">
  174. <label class="form-label" for="hall1">Select Hall: </label>
  175. <select class="form-select custom-select" name="hall1" id="hall1">
  176. <option value="1000">--Select Hall--</option>
  177. <option th:each="hall : ${halls}" th:value="${hall.id}" th:text="${hall.name}"
  178. th:selected="${hall.id == selectedHall}"></option>
  179. </select>
  180. </div>
  181. <!-- bookingDetailsDropdown 3-->
  182. <div class="col-sm-3 mb-2" id="bookingDetailsDropdown3" style="display: none;">
  183. <label class="form-label" for="filterby">Filter by:</label>
  184. <select class="form-control text-center" id="filterby" name="filterby"
  185. th:value="${filterby}">
  186. <option value="">Select Filterby</option>
  187. <option value="1" th:selected="${filterby == '1'}">Booking Date</option>
  188. <option value="2" th:selected="${filterby == '2'}">Event Date</option>
  189. <!-- Add more options as needed -->
  190. </select>
  191. </div>
  192. <!-- bookingDetailsDropdown2 -->
  193. <div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
  194. <label class="form-label" for="bookingStatus">Booking Status: </label>
  195. <select class="form-control text-center" id="bookingStatus" name="bookingStatus"
  196. th:value="${bookingStatus}">
  197. <option value="">Select Booking Status</option>
  198. <option value="PENDING" th:selected="${bookingStatus == 'PENDING'}">PENDING
  199. </option>
  200. <option value="APPROVED" th:selected="${bookingStatus == 'APPROVED'}">APPROVED
  201. </option>
  202. <option value="REJECTED" th:selected="${bookingStatus == 'REJECTED'}">REJECTED
  203. </option>
  204. <option value="CANCELED" th:selected="${bookingStatus == 'CANCELED'}">CANCELLED
  205. </option>
  206. <option value="COMPLETED" th:selected="${bookingStatus == 'COMPLETED'}">COMPLETED
  207. </option>
  208. <option value="PAYMENT_FAILURE"
  209. th:selected="${bookingStatus == 'PAYMENT_FAILURE'}">PAYMENT_FAILURE
  210. </option>
  211. <option value="GCC_BLOCKED" th:selected="${bookingStatus == 'GCC_BLOCKED'}">
  212. GCC_BLOCKED
  213. </option>
  214. <option value="REFUNDED" th:selected="${bookingStatus == 'REFUNDED'}">REFUNDED
  215. </option>
  216. <option value="WAITING_FOR_NOC" th:selected="${bookingStatus == 'WAITING_FOR_NOC'}">
  217. WAITING FOR NOC
  218. </option>
  219. <option value="WAITING_FOR_NOC_APPROVAL"
  220. th:selected="${bookingStatus == 'WAITING_FOR_NOC_APPROVAL'}">WAITING FOR NOC
  221. APPROVAL
  222. </option>
  223. </select>
  224. </div>
  225. <!--Payment Dropdown -->
  226. <div class="col-sm-3" id="paymentInfoDropdown1" style="display: none;">
  227. <label class="form-label" for="paymentStatus">Payment Status:</label>
  228. <select class="form-control text-center" id="paymentStatus" name="paymentStatus"
  229. th:value="${paymentStatus}">
  230. <option value="">Select Payment Status</option>
  231. <option value="SUCCESS" th:selected="${paymentStatus == 'SUCCESS'}">SUCCESS</option>
  232. <option value="NOT COMPLETED" th:selected="${paymentStatus == 'NOT COMPLETED'}">NOT
  233. COMPLETED
  234. </option>
  235. </select>
  236. </div>
  237. <div class="col-sm-3 mb-2" id="refundDetailsDropdown" style="display: none;">
  238. <label class="form-label" for="refundStatus">Refund Status: </label>
  239. <select class="form-control text-center" id="refundStatus" name="refundStatus"
  240. th:value="${refundStatus}">
  241. <option value="">Select Refund Status</option>
  242. <option value="WAITING" th:selected="${refundStatus == 'WAITING'}">WAITING
  243. </option>
  244. <option value="APPROVED" th:selected="${refundStatus == 'APPROVED'}">APPROVED
  245. </option>
  246. <option value="INITIATED" th:selected="${refundStatus == 'INITIATED'}">INITIATED
  247. </option>
  248. <option value="REJECTED" th:selected="${refundStatus == 'REJECTED'}">REJECTED
  249. </option>
  250. <option value="COMPLETED" th:selected="${refundStatus == 'COMPLETED'}">COMPLETED
  251. </option>
  252. <option value="NA" th:selected="${refundStatus == 'NA'}">NA
  253. </option>
  254. <option value="CLOSED" th:selected="${refundStatus == 'CLOSED'}">CLOSED
  255. </option>
  256. <option value="FAILURE" th:selected="${refundStatus == 'FAILURE'}">FAILURE
  257. </option>
  258. <!-- Add more options as needed -->
  259. </select>
  260. </div>
  261. <div class="col-sm-3 mb-2" id="bookingcountbasedonDropdown" style="display: none;">
  262. <label class="form-label" for="basedon">Based On: </label>
  263. <select class="form-control text-center" id="basedon" name="basedon"
  264. th:value="${basedon}">
  265. <option value="">Select</option>
  266. <option value="zone" th:selected="${basedon == 'zone'}">Zone
  267. </option>
  268. <option value="division" th:selected="${basedon == 'division'}">Division
  269. </option>
  270. </select>
  271. <span id="basedonError" class="text-danger"></span>
  272. </div>
  273. <div class="col-sm-3 mb-2" id="counterreportDropdown" style="display: none;">
  274. <label class="form-label" for="reporttype">Report Type: <span
  275. class="text-danger">*</span></label>
  276. <select class="form-control text-center" id="reporttype" name="reporttype"
  277. th:value="${reporttype}">
  278. <option value="">Select</option>
  279. <option value="abstract" th:selected="${reporttype == 'abstract'}">Abstract
  280. </option>
  281. <option value="detailed" th:selected="${reporttype == 'detailed'}">Detailed Report
  282. </option>
  283. </select>
  284. <span id="reportTypeError" class="text-danger"></span>
  285. </div>
  286. <div class="col-sm-3">
  287. <br>
  288. <button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
  289. id="submit">Submit
  290. </button>
  291. <button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
  292. type="reset">Reset
  293. </button>
  294. </div>
  295. </div>
  296. </div>
  297. </form>
  298. </div>
  299. <div class="table-responsive" id="usertable" th:if="${request}==1">
  300. <table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
  301. role="grid" width="99.5%">
  302. <thead class="thead-dark">
  303. <tr role="row">
  304. <th>S.No</th>
  305. <th width="130px">User Id</th>
  306. <th>Name</th>
  307. <th>Mobile</th>
  308. <th>Address</th>
  309. <th>UserType</th>
  310. <th>UserStatus</th>
  311. </tr>
  312. </thead>
  313. <tr th:each="user, iterStat : ${users}">
  314. <td th:text="${iterStat.count}">0</td>
  315. <td th:text="${user.userId}"></td>
  316. <td th:text="${user.name}"></td>
  317. <td th:text="${user.mobileNo}"></td>
  318. <td
  319. th:text="${user.DoorNo + ', ' + user.Street + ', ' + user.Area + ', ' + user.Location + ', ' + user.PinCode}">
  320. </td>
  321. <td th:text="${user.usertype}"></td>
  322. <td th:text="${user.userstatus}"></td>
  323. </tr>
  324. </table>
  325. </div>
  326. <div class="table-responsive" id="Bookingtable" th:if="${request}==2">
  327. <table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
  328. role="grid" width="99.5%">
  329. <thead class="thead-dark">
  330. <tr role="row">
  331. <th>S.No</th>
  332. <th>Booking Id</th>
  333. <th>Booking Date</th>
  334. <th>Hall Name</th>
  335. <th>User Name</th>
  336. <th>Mobile</th>
  337. <th>Address</th>
  338. <th>User type</th>
  339. <th>Reason</th>
  340. <th>Startdate_Enddate</th>
  341. <th>Deposit Amount</th>
  342. <th>Hall Amount</th>
  343. <th>GST</th>
  344. <th>Amount Paid</th>
  345. <th>Booking Status</th>
  346. <th>Action</th>
  347. </tr>
  348. </thead>
  349. <tbody>
  350. <tr th:each="booking, iterStat : ${bookings}">
  351. <td th:text="${iterStat.count}">0</td>
  352. <td th:text="${booking[0]}"></td>
  353. <td th:text="${booking[1]}"></td>
  354. <td th:text="${booking[2]}"></td>
  355. <td th:text="${booking[3]}"></td>
  356. <td th:text="${booking[4]}"></td>
  357. <td th:text="${booking[5]}"></td>
  358. <td th:text="${booking[6]}"></td>
  359. <td th:text="${booking[7]}"></td>
  360. <td th:text="${booking[8] + ' to ' + booking[9]}"></td>
  361. <td th:text="${booking[10]}"></td>
  362. <td th:text="${booking[11]}"></td>
  363. <td th:text="${booking[12]}"></td>
  364. <td th:text="${(T(java.lang.Math).round(booking[13] * 100.0) / 100.0)}"></td>
  365. <!--<td th:text="${booking[10]}"></td>-->
  366. <td th:text="${booking[14]}"></td>
  367. <td>
  368. <p>
  369. <span class="badge bg-warning" style="cursor: pointer;"
  370. th:onclick="viewDetails([[${booking[0]}]])">View</span>
  371. </p>
  372. </td>
  373. </tr>
  374. </tbody>
  375. </table>
  376. </div>
  377. <div class="table-responsive" id="Paymenttable" th:if="${request}==3">
  378. <table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
  379. role="grid" width="99.5%">
  380. <thead class="thead-dark">
  381. <tr role="row">
  382. <th>S.No</th>
  383. <th>Booking Id</th>
  384. <th>Booking Date</th>
  385. <th>Hall Name</th>
  386. <th>User Name</th>
  387. <th>User type</th>
  388. <th>Transaction ID</th>
  389. <th>Payment Type</th>
  390. <th>Deposit Amount</th>
  391. <th>Hall Amount</th>
  392. <th>GST</th>
  393. <th>Amount received</th>
  394. <th>Reason</th>
  395. <th width="1000px">Start date & end Date</th>
  396. <th>status</th>
  397. </tr>
  398. </thead>
  399. <tr th:each="payment, iterStat : ${paymentLists}">
  400. <td th:text="${iterStat.count}">0</td>
  401. <td th:text="${payment[0]}"></td>
  402. <td th:text="${payment[1]}"></td>
  403. <td th:text="${payment[2]}"></td>
  404. <td th:text="${payment[3]}"></td>
  405. <td th:text="${payment[4]}"></td>
  406. <td th:text="${payment[5]}"></td>
  407. <td th:text="${payment[6]}"></td>
  408. <td th:text="${payment[7]}"></td>
  409. <td th:text="${payment[8]}"></td>
  410. <td th:text="${payment[9]}"></td>
  411. <td th:text="${payment[10]}"></td>
  412. <td th:text="${payment[11]}"></td>
  413. <td th:text="${payment[12] + ' to ' + payment[13]}" width="1000px"></td>
  414. <td th:text="${payment[14]}"></td>
  415. </tr>
  416. </table>
  417. </div>
  418. <div class="table-responsive" id="userBookingtable" th:if="${request}==4">
  419. <table id="requestTable4" class="table table-striped table-bordered table-hover dataTable"
  420. role="grid" width="99.5%">
  421. <thead class="thead-dark">
  422. <tr role="row">
  423. <th>S.No</th>
  424. <th width="110px">User Id</th>
  425. <th>Name</th>
  426. <th>Mobile</th>
  427. <th>Address</th>
  428. <th>Total Bookings</th>
  429. </tr>
  430. </thead>
  431. <tr th:each="userbookingList, iterStat : ${userbookingLists}">
  432. <td th:text="${iterStat.count}">0</td>
  433. <td th:text="${userbookingList[0]}"></td>
  434. <td th:text="${userbookingList[1]}"></td>
  435. <td th:text="${userbookingList[2]}"></td>
  436. <td th:text="${userbookingList[3]}"></td>
  437. <td th:text="${userbookingList[4]}"
  438. th:onclick="viewbookingDetails([[${userbookingList[0]}]])" style="cursor:pointer;"></td>
  439. </tr>
  440. </table>
  441. </div>
  442. <div class="table-responsive" id="hallBookingtable" th:if="${request}==5">
  443. <table id="requestTable5" class="table table-striped table-bordered table-hover dataTable"
  444. role="grid" width="99.5%">
  445. <thead class="thead-dark">
  446. <tr role="row">
  447. <th>S.No</th>
  448. <th>Hall Id</th>
  449. <th>Hall Name</th>
  450. <th>Zone/Division</th>
  451. <th>Caretaker Name</th>
  452. <th>Caretaker Mobile</th>
  453. <th>Total Bookings</th>
  454. <th>Deposit Amount</th>
  455. <th>Hall Amount</th>
  456. <th>GST</th>
  457. <th>Amount Received</th>
  458. <th>Amount Refund</th>
  459. <th>Net Revenue</th>
  460. </tr>
  461. </thead>
  462. <tbody>
  463. <tr th:each="hallbookingList, iterStat : ${hallbookingLists}">
  464. <td th:text="${iterStat.count}">0</td>
  465. <td th:text="${hallbookingList[11]}"></td>
  466. <td th:text="${hallbookingList[0]}"></td>
  467. <td th:text="${hallbookingList[3]}"></td> <!-- Combined Zone/Division -->
  468. <td th:text="${hallbookingList[1]}"></td>
  469. <td th:text="${hallbookingList[2]}"></td>
  470. <td th:text="${hallbookingList[4]}"></td>
  471. <td th:text="${(T(java.lang.Math).round(hallbookingList[5] * 100.0) / 100.0)}"></td>
  472. <td th:text="${(T(java.lang.Math).round(hallbookingList[6] * 100.0) / 100.0)}"></td>
  473. <td th:text="${(T(java.lang.Math).round(hallbookingList[7] * 100.0) / 100.0)}"></td>
  474. <td th:text="${(T(java.lang.Math).round(hallbookingList[8] * 100.0) / 100.0)}"></td>
  475. <td th:text="${(T(java.lang.Math).round(hallbookingList[9] * 100.0) / 100.0)}"></td>
  476. <td th:text="${(T(java.lang.Math).round(hallbookingList[10] * 100.0) / 100.0)}"></td>
  477. </tr>
  478. </tbody>
  479. </table>
  480. </div>
  481. <div class="table-responsive" id="BookingSettlementtable" th:if="${request}==6">
  482. <table id="requestTable6" class="table table-striped table-bordered table-hover dataTable"
  483. role="grid" width="99.5%">
  484. <thead class="thead-dark">
  485. <tr role="row">
  486. <th>S.No</th>
  487. <th>Name</th>
  488. <th>Mobile</th>
  489. <th>Booked Hall</th>
  490. <th>Reason</th>
  491. <th>Booking Date</th>
  492. <th>Event Date</th>
  493. <th>No of Days</th>
  494. <th>User type</th>
  495. <th>Refund Status</th>
  496. <th>Booking Status</th>
  497. </tr>
  498. </thead>
  499. <tr th:each="settlementlist, iterStat : ${bookingSettlementList}">
  500. <td th:text="${iterStat.count}">0</td>
  501. <td th:text="${settlementlist.users.name}"></td>
  502. <td th:text="${settlementlist.users.mobileNo}"></td>
  503. <td th:text="${settlementlist.hallDetails.hallName}"></td>
  504. <td th:text="${settlementlist.reason}"></td>
  505. <td th:text="${settlementlist.bookingDate}"></td>
  506. <td th:text="${settlementlist.startDate +' to '+ settlementlist.endDate}"></td>
  507. <td th:text="${settlementlist.noOfDays}"></td>
  508. <td th:text="${settlementlist.users.usertype}"></td>
  509. <td th:text="${settlementlist.refundStatus}"></td>
  510. <td th:text="${settlementlist.bookingStatus}"></td>
  511. </tr>
  512. </table>
  513. </div>
  514. <div class="table-responsive" id="totalCounttable" th:if="${request == '7'}">
  515. <table id="requestTable7" class="table table-striped table-bordered table-hover dataTable"
  516. role="grid" width="99.5%">
  517. <thead class="thead-dark">
  518. <tr role="row">
  519. <th>S.No</th>
  520. <th th:text="${basedon == 'zone' ? 'Zone' : 'Division'}"></th>
  521. <th>Bookings Count</th>
  522. </tr>
  523. </thead>
  524. <tbody>
  525. <tr th:each="data, stat : ${totalcount}">
  526. <td th:text="${stat.index + 1}"></td> <!-- Serial number -->
  527. <td th:text="${data[0]}"></td> <!-- Zone or Division -->
  528. <td th:text="${data[1]}"></td> <!-- Bookings Count -->
  529. </tr>
  530. </tbody>
  531. <tfoot>
  532. <tr>
  533. <th></th>
  534. <td><strong>Total Bookings :</strong></td>
  535. <td th:text="${totalBookings}"></td> <!-- Total bookings -->
  536. </tr>
  537. </tfoot>
  538. </table>
  539. </div>
  540. <div class="table-responsive" id="extraPaymenttable" th:if="${request}==8">
  541. <table id="requestTable8" class="table table-striped table-bordered table-hover dataTable"
  542. role="grid" width="99.5%">
  543. <thead class="thead-dark">
  544. <tr role="row">
  545. <th>S.No</th>
  546. <th>Booking Id</th>
  547. <th>Booking Date</th>
  548. <th>Hall Name</th>
  549. <th>User Name</th>
  550. <th>User type</th>
  551. <th>Transaction ID</th>
  552. <th>Payment Type</th>
  553. <th>Deposit Amount</th>
  554. <th>Hall Amount</th>
  555. <th>GST</th>
  556. <th>Amount received</th>
  557. <th>Reason</th>
  558. <th width="1000px">Start date & end Date</th>
  559. <th>status</th>
  560. </tr>
  561. </thead>
  562. <tr th:each="payment, iterStat : ${extrapaymentLists}">
  563. <td th:text="${iterStat.count}">0</td>
  564. <td th:text="${payment[0]}"></td>
  565. <td th:text="${payment[1]}"></td>
  566. <td th:text="${payment[2]}"></td>
  567. <td th:text="${payment[3]}"></td>
  568. <td th:text="${payment[4]}"></td>
  569. <td th:text="${payment[5]}"></td>
  570. <td th:text="${payment[6]}"></td>
  571. <td th:text="${payment[7]}"></td>
  572. <td th:text="${payment[8]}"></td>
  573. <td th:text="${payment[9]}"></td>
  574. <td th:text="${payment[10]}"></td>
  575. <td th:text="${payment[11]}"></td>
  576. <td th:text="${payment[12] + ' to ' + payment[13]}" width="1000px"></td>
  577. <td th:text="${payment[14]}"></td>
  578. </tr>
  579. </table>
  580. </div>
  581. <div class="table-responsive" id="countertable" th:if="${request}==9">
  582. <div th:if="${reporttype == 'abstract'}">
  583. <table id="requestTable9" class="table table-striped table-bordered table-hover dataTable"
  584. role="grid" width="99.5%">
  585. <thead class="thead-dark">
  586. <tr role="row">
  587. <th>S.No</th>
  588. <th>Counter ID</th>
  589. <th>Total Bookings</th>
  590. </tr>
  591. </thead>
  592. <tbody>
  593. <tr th:each="counterdata, iterstat : ${counterBookingList}">
  594. <td th:text="${iterstat.index + 1}"></td>
  595. <td th:text="${counterdata[0]}"></td>
  596. <td>
  597. <button href="#"
  598. th:attr="data-counter-id=${counterdata[0]}"
  599. data-bs-toggle="modal"
  600. data-bs-target="#bookingModal"
  601. style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
  602. onclick="showCounterTable(this)">
  603. <span th:text="${counterdata[1]}"></span>
  604. </button>
  605. </td>
  606. </tr>
  607. </tbody>
  608. </table>
  609. </div>
  610. <div th:if="${reporttype == 'detailed'}">
  611. <table id="detailedrequestTable" class="table table-striped table-bordered table-hover dataTable"
  612. role="grid" width="99.5%">
  613. <thead class="thead-dark">
  614. <tr role="row">
  615. <th>S.No</th>
  616. <th>Booking ID</th>
  617. <th>Hall Name</th>
  618. <th>Booking Date</th>
  619. <th>Start Date</th>
  620. <th>End Date</th>
  621. <th>Starting Slot</th>
  622. <th>Ending Slot</th>
  623. <th>No.of.Days</th>
  624. <th>Reason for Booking</th>
  625. <th>Hall Amount</th>
  626. <th>Deposit Amount</th>
  627. <th>GSt</th>
  628. <th>Amount Received</th>
  629. <th>Booking Status</th>
  630. <th>Booking Type</th>
  631. <th>Counter Id</th>
  632. <th>View</th>
  633. </tr>
  634. </thead>
  635. <tbody>
  636. <tr th:each="counterdata, iterstat : ${counterBookingList}">
  637. <td th:text="${iterstat.index + 1}"></td>
  638. <td th:text="${counterdata[0]}"></td>
  639. <td th:text="${counterdata[1]}"></td>
  640. <td th:text="${counterdata[2]}"></td>
  641. <td th:text="${counterdata[3]}"></td>
  642. <td th:text="${counterdata[4]}"></td>
  643. <td th:text="${counterdata[5]}"></td>
  644. <td th:text="${counterdata[6]}"></td>
  645. <td th:text="${counterdata[7]}"></td>
  646. <td th:text="${counterdata[8]}"></td>
  647. <td th:text="${counterdata[9]}"></td>
  648. <td th:text="${counterdata[10]}"></td>
  649. <td th:text="${counterdata[11]}"></td>
  650. <td th:text="${counterdata[12]}"></td>
  651. <td th:text="${counterdata[13]}"></td>
  652. <td th:text="${counterdata[14]}"></td>
  653. <td th:text="${counterdata[15]}"></td>
  654. <td>
  655. <p>
  656. <span class="badge bg-warning" style="cursor: pointer;"
  657. th:onclick="viewDetails([[${counterdata[0]}]])">View</span>
  658. </p>
  659. </td>
  660. </tr>
  661. </tbody>
  662. </table>
  663. </div>
  664. </div>
  665. </div>
  666. <div class="modal fade backdrop" id="showBookingDetails" data-backdrop="static"
  667. tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel"
  668. aria-hidden="true">
  669. <div class="modal-dialog modal-lg" role="document">
  670. <div class="modal-content" id="printableContent">
  671. <form id="regform" onsubmit="return rejectsubmit();">
  672. <div
  673. class="block block-rounded block-themed block-transparent mb-0">
  674. <div class="block-header bg-primary-dark">
  675. <h3 class="block-title" id="2mtitle">Booking
  676. Information</h3>
  677. <div class="block-options">
  678. <button type="button" class="btn-block-option"
  679. data-bs-dismiss="modal" aria-label="Close">
  680. <i class="fa fa-fw fa-times"></i>
  681. </button>
  682. </div>
  683. </div>
  684. <div class="block-content row"
  685. style="margin-right:0px;margin:0;padding:0;">
  686. <div class="col-md-12 col-lg-12 col-sm-12">
  687. <div class="card-body">
  688. <table>
  689. <tr>
  690. <th colspan="10"
  691. style="background-color: lightgrey;">
  692. User Details
  693. </th>
  694. </tr>
  695. <tr>
  696. <th
  697. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  698. User Name:
  699. </th>
  700. <td class="fw-semibold"
  701. style="padding: 0.45rem 0.45rem;"
  702. id="td_userName"></td>
  703. <th
  704. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  705. Mobile Number:
  706. </th>
  707. <td class="fw-semibold"
  708. style="padding: 0.45rem 0.45rem;"
  709. id="td_mobileNumber"></td>
  710. <th
  711. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  712. User Type:
  713. </th>
  714. <td class="fw-semibold"
  715. style="padding: 0.45rem 0.45rem;"
  716. id="td_usertype"></td>
  717. </tr>
  718. <tr>
  719. <th
  720. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  721. User Address:
  722. </th>
  723. <td colspan="5" class="fw-semibold"
  724. style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
  725. id="td_useraddress"></td>
  726. </tr>
  727. <input type="hidden"
  728. class="form-control text-center"
  729. name="bookingid" id="bookingid" disabled/>
  730. <tr>
  731. <th colspan="10"
  732. style="background-color: lightgrey;">
  733. Hall Details
  734. </th>
  735. </tr>
  736. <tr>
  737. <th
  738. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  739. Hall Name:
  740. </th>
  741. <td colspan="10" class="fw-semibold"
  742. style="padding: 0.45rem 0.45rem;text-wrap:pretty;"
  743. id="td_hallName"></td>
  744. </tr>
  745. <th
  746. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  747. Hall Address:
  748. </th>
  749. <td colspan="10" class="fw-semibold"
  750. style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
  751. id="td_halladdress"></td>
  752. </tr>
  753. <tr>
  754. <th
  755. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  756. Caretaker Name:
  757. </th>
  758. <td colspan="2" class="fw-semibold"
  759. style="padding: 0.45rem 0.45rem;"
  760. id="td_caretakername"></td>
  761. <th
  762. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  763. Caretaker Mobile Number:
  764. </th>
  765. <td colspan="2" class="fw-semibold"
  766. style="padding: 0.45rem 0.45rem;"
  767. id="td_caretakermobileNumber"></td>
  768. </tr>
  769. <tr>
  770. <th colspan="10"
  771. style="background-color: lightgrey;">
  772. Booking
  773. Details (Booking Id:-<span
  774. id="booking_id"
  775. style="color:blue"></span>)
  776. </th>
  777. </tr>
  778. <tr>
  779. <th
  780. style="padding: 0.45rem 0.45rem;font-weight: normal">
  781. Booking Date:
  782. </th>
  783. <td colspan="2" class="fw-semibold"
  784. style="padding: 0.45rem 0.45rem;"
  785. id="td_bookingDate"></td>
  786. <th
  787. style="padding: 0.45rem 0.45rem;font-weight: normal">
  788. Deposit Amount (in Rs):
  789. </th>
  790. <td colspan="2"
  791. class="fw-semibold amount-cell"
  792. style="padding: 0.45rem 0.45rem;"
  793. id="td_depositeAmount"></td>
  794. </tr>
  795. <tr>
  796. <th
  797. style="padding: 0.45rem 0.45rem;font-weight: normal">
  798. Start Date:
  799. </th>
  800. <td colspan="2" class="fw-semibold"
  801. style="padding: 0.45rem 0.45rem;"
  802. id="td_startDate"></td>
  803. <th
  804. style="padding: 0.45rem 0.45rem;font-weight: normal">
  805. Hall Amount (in Rs):
  806. </th>
  807. <td colspan="2"
  808. class="fw-semibold amount-cell"
  809. style="padding: 0.45rem 0.45rem;"
  810. id="td_hallAmount"></td>
  811. </tr>
  812. <tr>
  813. <th
  814. style="padding: 0.45rem 0.45rem;font-weight: normal">
  815. END Date:
  816. </th>
  817. <td colspan="2" class="fw-semibold"
  818. style="padding: 0.45rem 0.45rem;"
  819. id="td_endDate"></td>
  820. <th
  821. style="padding: 0.45rem 0.45rem;font-weight: normal">
  822. GST @18% (in Rs):
  823. </th>
  824. <td colspan="2"
  825. class="fw-semibold amount-cell"
  826. style="padding: 0.45rem 0.45rem;"
  827. id="td_gst"></td>
  828. </tr>
  829. <tr>
  830. <th
  831. style="padding: 0.45rem 0.45rem;font-weight: normal">
  832. Starting Slot:
  833. </th>
  834. <td colspan="2" class="fw-semibold"
  835. style="padding: 0.45rem 0.45rem;"
  836. id="td_startingSlot"></td>
  837. <th
  838. style="padding: 0.45rem 0.45rem;font-weight: normal">
  839. Total Amount (in Rs):
  840. </th>
  841. <td colspan="2"
  842. class="fw-semibold amount-cell"
  843. style="padding: 0.45rem 0.45rem;"
  844. id="td_totalAmount"></td>
  845. </tr>
  846. <tr>
  847. <th
  848. style="padding: 0.45rem 0.45rem;font-weight: normal">
  849. Ending Slot:
  850. </th>
  851. <td colspan="2" class="fw-semibold"
  852. style="padding: 0.45rem 0.45rem;"
  853. id="td_endingSlot"></td>
  854. <!--<th style="display:none;padding: 0.45rem 0.45rem;border:none"
  855. id="rejectionreasondiv">Rejection
  856. Reason:</th>
  857. <td class="fw-semibold"
  858. style="padding: 0.45rem 0.45rem;"
  859. id="reasonforrejection"></td>-->
  860. <th
  861. style="padding: 0.45rem 0.45rem;border:none">
  862. Booking Status:
  863. </th>
  864. <td colspan="2" class="fw-semibold"
  865. style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
  866. id="bookingstatus_td"></td>
  867. </tr>
  868. <tr>
  869. <th style="display:none;padding: 0.45rem 0.45rem;border:none"
  870. id="rejectionreasondiv">Rejection
  871. Reason:
  872. </th>
  873. <td class="fw-semibold"
  874. style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
  875. id="reasonforrejection"></td>
  876. </tr>
  877. </table>
  878. </div>
  879. </div>
  880. <div class="row col-md-12 col-lg-12 col-sm-12">
  881. <div class="documents" id="documents"></div>
  882. </div>
  883. <div class="col-md-12 col-lg-12 col-sm-12 mb-2"
  884. id="paymentsdetails"
  885. style="display:none; margin-top: -16px;">
  886. <div class="card-body">
  887. <table>
  888. <tr>
  889. <th colspan="10"
  890. style="background-color: lightgrey;">
  891. Booking Payment Details
  892. </th>
  893. </tr>
  894. <tr>
  895. <th
  896. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  897. Transaction ID:
  898. </th>
  899. <td colspan="10" class="fw-semibold"
  900. style="padding: 0.45rem 0.45rem;"
  901. id="td_transactionId"></td>
  902. </tr>
  903. <th
  904. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  905. Amount Received (in Rs):
  906. </th>
  907. <td colspan="10" class="fw-semibold"
  908. style="padding: 0.45rem 0.45rem;"
  909. id="td_payamountReceived"></td>
  910. </tr>
  911. <tr>
  912. <th
  913. style="padding: 0.45rem 0.45rem;font-weight: normal;">
  914. Transaction Status:
  915. </th>
  916. <td class="fw-semibold"
  917. style="padding: 0.45rem 0.45rem;"
  918. id="td_paymentStatus"></td>
  919. </tr>
  920. </table>
  921. </div>
  922. </div>
  923. <div class="row col-md-12 col-lg-12 col-sm-12"
  924. id="ebdetails"
  925. style="display:none;margin-left: 0px;margin-top: -10px">
  926. <div class="card-body">
  927. <table>
  928. <tr>
  929. <th colspan="4"
  930. style="background-color: lightgrey;">EB
  931. Details
  932. </th>
  933. </tr>
  934. <tr>
  935. <th
  936. style="padding: 0.45rem 0.45rem;font-weight: normal">
  937. Consumer Number:
  938. </th>
  939. <td class="fw-semibold"
  940. style="padding: 0.45rem 0.45rem;"
  941. id="td_EBNumber"></td>
  942. <th
  943. style="padding: 0.45rem 0.45rem;font-weight: normal">
  944. EB Amount Per Unit (in Rs):
  945. </th>
  946. <td class="fw-semibold"
  947. style="padding: 0.45rem 0.45rem;"
  948. id="td_ebamountperunit"></td>
  949. </tr>
  950. <tr>
  951. <th
  952. style="padding: 0.45rem 0.45rem;font-weight: normal">
  953. Start Reading:
  954. </th>
  955. <td class="fw-semibold"
  956. style="padding: 0.45rem 0.45rem;"
  957. id="td_startingReading"></td>
  958. <th
  959. style="padding: 0.45rem 0.45rem;font-weight: normal">
  960. Unit Consumed:
  961. </th>
  962. <td class="fw-semibold"
  963. style="padding: 0.45rem 0.45rem;"
  964. id="td_usedunit"></td>
  965. </tr>
  966. <tr>
  967. <th
  968. style="padding: 0.45rem 0.45rem;font-weight: normal">
  969. END Reading:
  970. </th>
  971. <td class="fw-semibold"
  972. style="padding: 0.45rem 0.45rem;"
  973. id="td_endingReading"></td>
  974. <th
  975. style="padding: 0.45rem 0.45rem;font-weight: normal">
  976. EB Amount (in Rs):
  977. </th>
  978. <td class="fw-semibold"
  979. style="padding: 0.45rem 0.45rem;"
  980. id="td_electricityamount"></td>
  981. </tr>
  982. </tbody>
  983. </table>
  984. </div>
  985. </div>
  986. <div class="row col-md-12 col-lg-12 col-sm-12"
  987. id="damagelist" style="disaply:none">
  988. <div id="damageDetails"></div>
  989. </div>
  990. <div class="col-md-12 col-lg-12 col-sm-12"
  991. id="refunddetails" style="margin-top:-1px">
  992. <div class="card-body">
  993. <table>
  994. <tr>
  995. <th colspan="2"
  996. style="background-color: lightgrey;">
  997. Amount to be Refunded (in Rs)
  998. </th>
  999. </tr>
  1000. <tr>
  1001. <th
  1002. style="padding: 0.45rem 0.45rem;font-weight: normal">
  1003. Deposit Amount:
  1004. </th>
  1005. <td class="fw-semibold amount-cell"
  1006. style="padding: 0.45rem 0.45rem;"
  1007. id="td_depositeamountforrefund">0
  1008. </td>
  1009. </tr>
  1010. <tr>
  1011. <th
  1012. style="padding: 0.45rem 0.45rem;font-weight: normal">
  1013. EB Amount:
  1014. </th>
  1015. <td class="fw-semibold amount-cell"
  1016. style="padding: 0.45rem 0.45rem;"
  1017. id="td_ebAmount"></td>
  1018. </tr>
  1019. <tr>
  1020. <th
  1021. style="padding: 0.45rem 0.45rem;font-weight: normal">
  1022. Damage Amount:
  1023. </th>
  1024. <td class="fw-semibold amount-cell"
  1025. style="padding: 0.45rem 0.45rem;"
  1026. id="td_damage"></td>
  1027. </tr>
  1028. <tr id="pendingcolumn">
  1029. <th id="th_settel_label"
  1030. style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
  1031. Collection Pending Amount:
  1032. </th>
  1033. <td class="fw-semibold amount-cell"
  1034. style="padding: 0.45rem 0.45rem; color: green;"
  1035. id="td_pending_amt">0
  1036. </td>
  1037. </tr>
  1038. <tr id="collectionstatuscolumn">
  1039. <th id="label"
  1040. style="padding: 0.45rem 0.45rem;font-weight: normal">Collection
  1041. Pending Status
  1042. :
  1043. </th>
  1044. <td class="fw-semibold amount-cell"
  1045. style="padding: 0.45rem 0.45rem; color: green;"
  1046. id="td_collection_status">
  1047. </td>
  1048. </tr>
  1049. <tr>
  1050. <th
  1051. style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
  1052. Actual refundable Amount:
  1053. </th>
  1054. <td class="fw-semibold amount-cell"
  1055. style="padding: 0.45rem 0.45rem; color: green;"
  1056. id="td_settel_amt">0
  1057. </td>
  1058. </tr>
  1059. </table>
  1060. </div>
  1061. </div>
  1062. <div class="row col-md-12 col-lg-12 col-sm-12"
  1063. id="refundamountDetails"
  1064. style="display:none;margin-left: 0px;margin-top: -49px">
  1065. <div class="card-body">
  1066. <table>
  1067. <tr>
  1068. <th colspan="4"
  1069. style="background-color: lightgrey;">
  1070. Refund Details
  1071. </th>
  1072. </tr>
  1073. <tr>
  1074. <th
  1075. style="padding: 0.45rem 0.45rem;font-weight: normal">
  1076. Booking Status:
  1077. </th>
  1078. <td class="fw-semibold"
  1079. style="padding: 0.45rem 0.45rem;"
  1080. id="td_bookingStatus"></td>
  1081. <th
  1082. style="padding: 0.45rem 0.45rem;font-weight: normal">
  1083. Refund Status:
  1084. </th>
  1085. <td class="fw-semibold"
  1086. style="padding: 0.45rem 0.45rem;"
  1087. id="td_refundStatus"></td>
  1088. </tr>
  1089. <tr>
  1090. <th
  1091. style="padding: 0.45rem 0.45rem;font-weight: normal;text-wrap: pretty;">
  1092. Refund amount:
  1093. </th>
  1094. <td class="fw-semibold" colspan="5"
  1095. style="padding: 0.45rem 0.45rem;"
  1096. id="td_refundamount"></td>
  1097. </tr>
  1098. </tbody>
  1099. </table>
  1100. </div>
  1101. </div>
  1102. <div id="refundMessage" style="display: none;">
  1103. <h1 id="refundText"
  1104. style="font-size: 17px;margin-left: 20px;color: darkgreen;">
  1105. </h1>
  1106. </div>
  1107. <div id="rejectrefundMessage" style="display: none;">
  1108. <h1 id="rejectrefundText"
  1109. style="font-size: 17px;margin-left: 20px;color: darkgreen;">
  1110. </h1>
  1111. </div>
  1112. <div id="blockedrefundMessage" style="display: none;">
  1113. <h1 id="blockedrefundText"
  1114. style="font-size: 17px;margin-left: 20px;color: darkgreen;">
  1115. </h1>
  1116. </div>
  1117. </div>
  1118. </div>
  1119. <div class="block-content block-content-full text-end bg-body"
  1120. id="mbutton">
  1121. <button type="button"
  1122. style="background-color: rgb(21,69,93);color: white;"
  1123. class="btn btn-sm btn-alt-secondary"
  1124. data-bs-dismiss="modal">Close
  1125. </button>
  1126. </div>
  1127. </form>
  1128. </div>
  1129. </div>
  1130. </div>
  1131. <div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
  1132. aria-hidden="true">
  1133. <div class="modal-dialog modal-lg" role="document">
  1134. <div class="modal-content">
  1135. <div class="modal-header">
  1136. <h5 class="modal-title" id="fileModalLabel">File Preview</h5>
  1137. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  1138. <span aria-hidden="true">&times;</span>
  1139. </button>
  1140. </div>
  1141. <div class="modal-body">
  1142. <embed id="filePreview" src="" width="100%" height="600px">
  1143. </div>
  1144. <div class="modal-footer">
  1145. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  1146. </div>
  1147. </div>
  1148. </div>
  1149. </div>
  1150. <div class="modal fade" id="viewbookingDetailsdetails">
  1151. <div class="modal-dialog modal-xl">
  1152. <div class="modal-content">
  1153. <!-- Modal Header -->
  1154. <div class="modal-header">
  1155. <h4 class="modal-title">List of Bookings</h4>
  1156. <button type="button" class="btn" data-bs-dismiss="modal">&times;</button>
  1157. </div>
  1158. <!-- Modal Body -->
  1159. <div class="modal-body">
  1160. <div class="content">
  1161. <div class="block block-rounded">
  1162. <div class="block-content p-0">
  1163. <div class="p-sm-4 p-0">
  1164. <div class="table-responsive">
  1165. <table id="bookinglistdataTable"
  1166. class="table table-bordered table-striped table-vcenter js-dataTable-responsive">
  1167. <thead class="thead-light">
  1168. <tr class="table-bordered">
  1169. <th class="text-center no-sort">S.No</th>
  1170. <th class="text-center no-sort">Booking Id</th>
  1171. <th class="text-center no-sort">Booking Date</th>
  1172. <th class="text-center no-sort">Start Date</th>
  1173. <th class="text-center no-sort">End Date</th>
  1174. <th class="text-center no-sort">Starting Slot</th>
  1175. <th class="text-center no-sort">Ending Slot</th>
  1176. <th class="text-center no-sort">Reason For Booking</th>
  1177. <th class="text-center no-sort">No of days</th>
  1178. <th class="text-center no-sort">Booking Status</th>
  1179. <th class="text-center no-sort">Hall Amount</th>
  1180. <th class="text-center no-sort">Total Amount Paid</th>
  1181. </tr>
  1182. </thead>
  1183. <tbody id="bookingTableBody"></tbody>
  1184. </table>
  1185. </div>
  1186. </div>
  1187. </div>
  1188. </div>
  1189. </div>
  1190. </div>
  1191. <!-- Modal Footer -->
  1192. <div class="modal-footer">
  1193. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  1194. </div>
  1195. </div>
  1196. </div>
  1197. </div>
  1198. <div class="modal fade" id="viewbookingDetailsbyzone">
  1199. <div class="modal-dialog modal-xl">
  1200. <div class="modal-content">
  1201. <!-- Modal Header -->
  1202. <div class="modal-header">
  1203. <h4 class="modal-title">List of Bookings Based on Zone</h4>
  1204. <button type="button" class="btn" data-bs-dismiss="modal">&times;</button>
  1205. </div>
  1206. <!-- Modal Body -->
  1207. <div class="modal-body">
  1208. <div class="content">
  1209. <div class="block block-rounded">
  1210. <div class="block-content p-0">
  1211. <div class="p-sm-4 p-0">
  1212. <div class="table-responsive">
  1213. <table id="bookinglistdataTablebyzone"
  1214. class="table table-bordered table-striped table-vcenter js-dataTable-responsive">
  1215. <thead class="thead-light">
  1216. <tr class="table-bordered">
  1217. <th class="text-center no-sort">S.No</th>
  1218. <th class="text-center no-sort">Booking Id</th>
  1219. <th class="text-center no-sort">Booking Date</th>
  1220. <th class="text-center no-sort">Start Date</th>
  1221. <th class="text-center no-sort">End Date</th>
  1222. <th class="text-center no-sort">Starting Slot</th>
  1223. <th class="text-center no-sort">Ending Slot</th>
  1224. <th class="text-center no-sort">Reason For Booking</th>
  1225. <th class="text-center no-sort">No of Days</th>
  1226. <th class="text-center no-sort">Booking Status</th>
  1227. <th class="text-center no-sort">Hall Amount</th>
  1228. <th class="text-center no-sort">Total Amount Paid</th>
  1229. </tr>
  1230. </thead>
  1231. <tbody id="bookingTableBodybyzone"></tbody>
  1232. </table>
  1233. </div>
  1234. </div>
  1235. </div>
  1236. </div>
  1237. </div>
  1238. </div>
  1239. <!-- Modal Footer -->
  1240. <div class="modal-footer">
  1241. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  1242. </div>
  1243. </div>
  1244. </div>
  1245. </div>
  1246. <div class="modal fade" id="bookingModal" tabindex="-1" aria-labelledby="bookingModalLabel" aria-hidden="true">
  1247. <div class="modal-dialog modal-xl modal-dialog-scrollable">
  1248. <div class="modal-content">
  1249. <div class="modal-header">
  1250. <h5 class="modal-title">Hall-wise Booking Details</h5>
  1251. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  1252. </div>
  1253. <div class="modal-body">
  1254. <!--
  1255. <table id="modalBookingTable" class="table table-bordered table-striped dataTable" style="width: 100%;">
  1256. -->
  1257. <table id="modalBookingTable" class="table table-striped table-bordered table-hover dataTable"
  1258. role="grid" width="99.5%">
  1259. <input type="hidden" id="hallBookingJsonInput" th:value="${hallBookingJson}">
  1260. <thead>
  1261. <tr>
  1262. <th>S.No</th>
  1263. <th>Zone</th>
  1264. <th>Division</th>
  1265. <th>Hall Name</th>
  1266. <th>Total Bookings</th>
  1267. </tr>
  1268. </thead>
  1269. <tbody id="modalBookingDetails"></tbody>
  1270. </table>
  1271. </div>
  1272. </div>
  1273. </div>
  1274. </div>
  1275. <div class="modal fade" id="hallDetailModal" tabindex="-1" aria-hidden="true">
  1276. <div class="modal-dialog modal-fullscreen-custom modal-dialog-scrollable">
  1277. <div class="modal-content">
  1278. <div class="modal-header">
  1279. <h5 class="modal-title">Booking Details for Hall</h5>
  1280. <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
  1281. </div>
  1282. <div class="modal-body">
  1283. <table id="hallDetailsTable" class="table table-bordered table-striped">
  1284. <input type="hidden" id="hallBookingDetailsJsonInput" th:value="${hallBookingDetailsJson}">
  1285. <thead>
  1286. <tr>
  1287. <th>S.No</th>
  1288. <th>Booking ID</th>
  1289. <th>Hall Name</th>
  1290. <th>Booking Date</th>
  1291. <th>Start Date</th>
  1292. <th>End Date</th>
  1293. <th>Starting Slot</th>
  1294. <th>Ending Slot</th>
  1295. <th>No.of.Days</th>
  1296. <th>Reason for Booking</th>
  1297. <th>Hall Amount</th>
  1298. <th>Deposit Amount</th>
  1299. <th>GSt</th>
  1300. <th>Amount Received</th>
  1301. <th>Booking Status</th>
  1302. <th>Booking Type</th>
  1303. <th>View</th>
  1304. </tr>
  1305. </thead>
  1306. <tbody id="hallDetailsTableBody"></tbody>
  1307. </table>
  1308. </div>
  1309. </div>
  1310. </div>
  1311. </div>
  1312. <div class="modal fade" id="bookingInfoModal" tabindex="-1" aria-labelledby="bookingInfoModalLabel"
  1313. aria-hidden="true">
  1314. <div class="modal-dialog modal-xl">
  1315. <div class="modal-content">
  1316. <div class="modal-header bg-dark text-white">
  1317. <h5 class="modal-title">Booking Information</h5>
  1318. <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
  1319. </div>
  1320. <div class="modal-body" id="bookingInfoContent">
  1321. <!-- Filled by JS -->
  1322. </div>
  1323. </div>
  1324. </div>
  1325. </div>
  1326. </main>
  1327. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  1328. </div>
  1329. <div th:replace="~{fragments/resetpassword :: div}"></div>
  1330. <script th:replace="~{fragments/loginscript :: script}"></script>
  1331. <script>
  1332. /*$(document).ready(function () {
  1333. // Common buttons configuration
  1334. var buttons = [{
  1335. extend: 'pageLength',
  1336. className: 'btn btn-primary'
  1337. }, {
  1338. title: 'Data export',
  1339. extend: 'copyHtml5',
  1340. text: 'Copy',
  1341. className: 'btn btn-primary',
  1342. id: 'copyBtn'
  1343. }, {
  1344. extend: 'excelHtml5',
  1345. text: 'Excel',
  1346. className: 'btn btn-primary',
  1347. id: 'excelBtn'
  1348. }, {
  1349. extend: 'csvHtml5',
  1350. text: 'CSV',
  1351. className: 'btn btn-primary',
  1352. id: 'csvBtn'
  1353. }, {
  1354. extend: 'pdfHtml5',
  1355. text: 'PDF',
  1356. className: 'btn btn-primary',
  1357. id: 'pdfBtn'
  1358. }];
  1359. // DataTables initialization
  1360. $('#requestTable1, #requestTable2, #requestTable3, #requestTable4, #requestTable5, #requestTable6, #requestTable7').DataTable({
  1361. dom: 'Bftip',
  1362. columnDefs: [{
  1363. targets: 'no-sort',
  1364. orderable: false
  1365. }],
  1366. lengthMenu: [
  1367. [50, 100, 200, 500, -1],
  1368. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  1369. ],
  1370. scrollY: '50vh',
  1371. fixedColumns: {
  1372. left: 1,
  1373. right: 1
  1374. },
  1375. buttons: buttons,
  1376. responsive: true,
  1377. searching: true, // Enable search
  1378. select: false,
  1379. processing: false,
  1380. order: [] // Remove any default sorting
  1381. });
  1382. // Link the search input to DataTable
  1383. $('#searchInput').on('keyup', function () {
  1384. $('#bookinglistdataTable').DataTable().search(this.value).draw();
  1385. });
  1386. });*/
  1387. $(document).ready(function () {
  1388. // Common buttons (default for most tables)
  1389. var commonButtons = [{
  1390. extend: 'pageLength',
  1391. className: 'btn btn-primary'
  1392. }, {
  1393. title: 'Data export',
  1394. extend: 'copyHtml5',
  1395. text: 'Copy',
  1396. className: 'btn btn-primary',
  1397. id: 'copyBtn'
  1398. }, {
  1399. extend: 'excelHtml5',
  1400. text: 'Excel',
  1401. className: 'btn btn-primary',
  1402. id: 'excelBtn'
  1403. }, {
  1404. extend: 'csvHtml5',
  1405. text: 'CSV',
  1406. className: 'btn btn-primary',
  1407. id: 'csvBtn'
  1408. }, {
  1409. extend: 'pdfHtml5',
  1410. text: 'PDF',
  1411. className: 'btn btn-primary',
  1412. id: 'pdfBtn'
  1413. }];
  1414. // Custom PDF buttons for specific tables
  1415. function getCustomButtons(tableId) {
  1416. let orientation = 'portrait';
  1417. let pageSize = 'A4';
  1418. if (tableId === 'modalBookingTable') {
  1419. orientation = 'landscape';
  1420. pageSize = 'A4';
  1421. } else if (tableId === 'hallDetailsTable') {
  1422. orientation = 'landscape';
  1423. pageSize = 'A3';
  1424. } else if (tableId === 'detailedrequestTable') {
  1425. orientation = 'landscape';
  1426. pageSize = 'A3';
  1427. }
  1428. return [{
  1429. extend: 'pageLength',
  1430. className: 'btn btn-primary'
  1431. }, {
  1432. title: 'Data export',
  1433. extend: 'copyHtml5',
  1434. text: 'Copy',
  1435. className: 'btn btn-primary'
  1436. }, {
  1437. extend: 'excelHtml5',
  1438. text: 'Excel',
  1439. className: 'btn btn-primary'
  1440. }, {
  1441. extend: 'csvHtml5',
  1442. text: 'CSV',
  1443. className: 'btn btn-primary'
  1444. }, {
  1445. extend: 'pdfHtml5',
  1446. text: 'PDF',
  1447. className: 'btn btn-primary',
  1448. orientation: orientation,
  1449. pageSize: pageSize
  1450. }];
  1451. }
  1452. // Tables using default buttons
  1453. $('#requestTable1, #requestTable2, #requestTable3, #requestTable8, #requestTable4, #requestTable5, #requestTable6, #requestTable7').DataTable({
  1454. dom: 'Bftip',
  1455. columnDefs: [{
  1456. targets: 'no-sort',
  1457. orderable: false
  1458. }],
  1459. lengthMenu: [
  1460. [50, 100, 200, 500, -1],
  1461. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  1462. ],
  1463. fixedColumns: {
  1464. left: 1,
  1465. right: 1
  1466. },
  1467. buttons: commonButtons,
  1468. responsive: true,
  1469. searching: true,
  1470. select: false,
  1471. processing: false,
  1472. order: []
  1473. });
  1474. // Tables with custom PDF buttons
  1475. ['requestTable9', 'modalBookingTable', 'hallDetailsTable', 'detailedrequestTable'].forEach(function (tableId) {
  1476. $('#' + tableId).DataTable({
  1477. dom: 'Bftip',
  1478. columnDefs: [{
  1479. targets: 'no-sort',
  1480. orderable: false
  1481. }],
  1482. lengthMenu: [
  1483. [50, 100, 200, 500, -1],
  1484. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  1485. ],
  1486. fixedColumns: {
  1487. left: 1,
  1488. right: 1
  1489. },
  1490. buttons: getCustomButtons(tableId),
  1491. responsive: true,
  1492. searching: true,
  1493. select: false,
  1494. processing: false,
  1495. order: []
  1496. });
  1497. });
  1498. // Link the search input to DataTable
  1499. $('#searchInput').on('keyup', function () {
  1500. $('#bookinglistdataTable').DataTable().search(this.value).draw();
  1501. });
  1502. });
  1503. function validateme() {
  1504. return true;
  1505. }
  1506. var fromdate = document.getElementById("fromdate"), todate = document
  1507. .getElementById("todate");
  1508. function validateDate() {
  1509. if ($("#fromdate").val() == "" || $("#todate").val() == "") {
  1510. todate.setCustomValidity("FromDate and ToDate Must");
  1511. } else {
  1512. todate.setCustomValidity('');
  1513. }
  1514. }
  1515. fromdate.onchange = validateDate;
  1516. todate.onchange = validateDate;
  1517. $(document).ready(function () {
  1518. var today = new Date();
  1519. $('.datepicker').datepicker({
  1520. dateFormat: 'yy-mm-dd',
  1521. maxDate: '1'
  1522. })
  1523. $('.datepicker').keyup(function () {
  1524. if (this.value.match(/[^0-9]/g)) {
  1525. this.value = this.value.replace(/[^0-9^-]/g, '');
  1526. }
  1527. });
  1528. });
  1529. document.addEventListener("DOMContentLoaded", function () {
  1530. myRequest(); // Initial call to set dropdowns based on initial value
  1531. });
  1532. document.addEventListener("DOMContentLoaded", function () {
  1533. var today = new Date();
  1534. var sixMonthsLater = new Date();
  1535. sixMonthsLater.setMonth(today.getMonth() + 6);
  1536. var minDate = today.toISOString().split('T')[0];
  1537. var maxDate = sixMonthsLater.toISOString().split('T')[0];
  1538. let fromDateInput = document.getElementById('fromdate');
  1539. let toDateInput = document.getElementById('todate');
  1540. let selectedFromDate = document.getElementById('fromdate').value;
  1541. fromDateInput.setAttribute('max', maxDate);
  1542. toDateInput.setAttribute('min', selectedFromDate);
  1543. toDateInput.setAttribute('max', maxDate);
  1544. fromDateInput.addEventListener('change', function () {
  1545. let selectedFromDate = this.value;
  1546. let toDateInput = document.getElementById('todate');
  1547. toDateInput.setAttribute('min', selectedFromDate);
  1548. toDateInput.value = ''; // Reset the value of toDate
  1549. });
  1550. });
  1551. document.addEventListener("DOMContentLoaded", function () {
  1552. const form = document.getElementById('myForm');
  1553. const basedonSelect = document.getElementById('basedon');
  1554. const errorSpan = document.getElementById('basedonError');
  1555. const request = document.getElementById('request');
  1556. const reportTypeSelect = document.getElementById('reporttype');
  1557. const reportTypeerror = document.getElementById('reportTypeError');
  1558. form.addEventListener("submit", function (event) {
  1559. const requestValue = request.value;
  1560. if (requestValue === "7") {
  1561. console.log("inside 7");
  1562. console.log("basedonSelect.value=====" + basedonSelect.value);
  1563. if (basedonSelect.value === "") {
  1564. event.preventDefault(); // Stop form submission
  1565. errorSpan.textContent = "Please select a value.";
  1566. basedonSelect.classList.add("is-invalid");
  1567. } else {
  1568. errorSpan.textContent = "";
  1569. basedonSelect.classList.remove("is-invalid");
  1570. }
  1571. } else if (requestValue === "9") {
  1572. console.log("inside 9");
  1573. console.log("reportTypeSelect.value=====" + reportTypeSelect.value);
  1574. if (reportTypeSelect.value === "") {
  1575. event.preventDefault(); // Stop form submission
  1576. reportTypeerror.textContent = "Please select a value.";
  1577. reportTypeSelect.classList.add("is-invalid");
  1578. } else {
  1579. reportTypeerror.textContent = "";
  1580. reportTypeSelect.classList.remove("is-invalid");
  1581. }
  1582. }
  1583. });
  1584. document.getElementById("basedon").addEventListener("change", function () {
  1585. this.classList.remove("is-invalid");
  1586. document.getElementById("basedonError").textContent = "";
  1587. });
  1588. document.getElementById("reporttype").addEventListener("change", function () {
  1589. this.classList.remove("is-invalid");
  1590. document.getElementById("reportTypeError").textContent = "";
  1591. });
  1592. });
  1593. // Function to manage the display of dropdowns based on the request type
  1594. function myRequest() {
  1595. var requestValue = document.getElementById("request").value;
  1596. // Hide all dropdowns initially
  1597. document.getElementById("userDropdown1").style.display = "none";
  1598. document.getElementById("userDropdown2").style.display = "none";
  1599. document.getElementById("bookingDetailsDropdown1").style.display = "none";
  1600. document.getElementById("bookingDetailsDropdown2").style.display = "none";
  1601. document.getElementById("bookingDetailsDropdown3").style.display = "none";
  1602. document.getElementById("refundDetailsDropdown").style.display = "none";
  1603. document.getElementById("zoneDropdown").style.display = "none";
  1604. document.getElementById("divisionContainer").style.display = "none";
  1605. document.getElementById("hallContainer").style.display = "none";
  1606. document.getElementById("bookingcountbasedonDropdown").style.display = "none";
  1607. document.getElementById("paymentInfoDropdown1").style.display = "none";
  1608. document.getElementById("counterreportDropdown").style.display = "none";
  1609. // Reset dropdown values
  1610. document.getElementById('zone1').value = 'ALL';
  1611. document.getElementById('division1').value = '';
  1612. document.getElementById('hall1').value = '';
  1613. // Show relevant dropdowns based on the selected request value
  1614. if (requestValue === "1") {
  1615. document.getElementById("userDropdown1").style.display = "block";
  1616. document.getElementById("userDropdown2").style.display = "block";
  1617. // Add event listener to handle "User Type" selection
  1618. document.getElementById("usertype").addEventListener("change", function () {
  1619. var userTypeValue = document.getElementById("usertype").value;
  1620. if (userTypeValue === "PUBLIC") {
  1621. document.getElementById("userDropdown1").style.display = "none"; // Hide "User Status" dropdown
  1622. } else {
  1623. document.getElementById("userDropdown1").style.display = "block"; // Show "User Status" dropdown
  1624. }
  1625. });
  1626. // Trigger the change event to apply the logic on initial load if "PUBLIC" is already selected
  1627. document.getElementById("usertype").dispatchEvent(new Event('change'));
  1628. } else if (requestValue === "2") {
  1629. document.getElementById("bookingDetailsDropdown1").style.display = "block";
  1630. document.getElementById("bookingDetailsDropdown2").style.display = "block";
  1631. document.getElementById("bookingDetailsDropdown3").style.display = "block";
  1632. document.getElementById("zoneDropdown").style.display = "block";
  1633. document.getElementById("divisionContainer").style.display = "block";
  1634. document.getElementById("hallContainer").style.display = "block";
  1635. } else if (requestValue === "6") {
  1636. document.getElementById("refundDetailsDropdown").style.display = "block";
  1637. document.getElementById("bookingDetailsDropdown3").style.display = "block";
  1638. } else if (requestValue === "3") {
  1639. document.getElementById("zoneDropdown").style.display = "block";
  1640. document.getElementById("divisionContainer").style.display = "block";
  1641. document.getElementById("hallContainer").style.display = "block";
  1642. document.getElementById("paymentInfoDropdown1").style.display = "block";
  1643. } else if (requestValue === "5") {
  1644. document.getElementById("bookingDetailsDropdown3").style.display = "block";
  1645. document.getElementById("zoneDropdown").style.display = "block";
  1646. document.getElementById("divisionContainer").style.display = "block";
  1647. document.getElementById("hallContainer").style.display = "block";
  1648. } else if (requestValue === "7") {
  1649. document.getElementById("bookingcountbasedonDropdown").style.display = "block"
  1650. } else if (requestValue === "8") {
  1651. document.getElementById("zoneDropdown").style.display = "block";
  1652. document.getElementById("divisionContainer").style.display = "block";
  1653. document.getElementById("hallContainer").style.display = "block";
  1654. document.getElementById("paymentInfoDropdown1").style.display = "block";
  1655. } else if (requestValue === "9") {
  1656. document.getElementById("counterreportDropdown").style.display = "block";
  1657. }
  1658. }
  1659. document.addEventListener("DOMContentLoaded", function () {
  1660. document.getElementById("basedon").addEventListener("change", function () {
  1661. const selectedValue = this.value;
  1662. document.getElementById("bookingcountbasedonDropdown").style.display = selectedValue ? "block" : "none";
  1663. });
  1664. });
  1665. document.addEventListener("DOMContentLoaded", function () {
  1666. document.getElementById("reporttype").addEventListener("change", function () {
  1667. const selectedValue = this.value;
  1668. document.getElementById("counterreportDropdown").style.display = selectedValue ? "block" : "none";
  1669. });
  1670. });
  1671. // Function to reset date fields
  1672. function resetDate() {
  1673. window.location.href = "/communityhall/headquarters/Reports";
  1674. document.getElementById('fromdate').value = '';
  1675. document.getElementById('todate').value = '';
  1676. }
  1677. function viewDetails(bookingId) {
  1678. $.ajax({
  1679. url: '/communityhall/user/api/viewAllBookingDetails',
  1680. method: 'GET',
  1681. data: {bookingId: bookingId},
  1682. success: function (response) {
  1683. document.getElementById("td_userName").innerHTML = response.users.name;
  1684. document.getElementById("td_mobileNumber").innerHTML = response.users.mobileNo;
  1685. document.getElementById("td_usertype").innerHTML = response.users.usertype;
  1686. var userDetails = response.users;
  1687. var userDetailsString =
  1688. userDetails.doorNo + ", " +
  1689. userDetails.street + ", " +
  1690. userDetails.area + ", " +
  1691. userDetails.location + " ,Chennai- " +
  1692. userDetails.pinCode;
  1693. document.getElementById("td_useraddress").innerHTML = userDetailsString;
  1694. document.getElementById("td_hallName").innerHTML = response.hallDetails.hallName;
  1695. var hallDetails = response.hallDetails;
  1696. var hallDetailsString =
  1697. hallDetails.doorNo + ", " +
  1698. hallDetails.street + ", " +
  1699. hallDetails.area + ", " +
  1700. hallDetails.city + "- " +
  1701. hallDetails.pinCode;
  1702. document.getElementById("td_halladdress").innerHTML = hallDetailsString;
  1703. document.getElementById("td_caretakername").innerHTML = response.hallDetails.hallInchargeName;
  1704. document.getElementById("td_caretakermobileNumber").innerHTML = response.hallDetails.hallInchargeMobno;
  1705. document.getElementById("td_bookingDate").innerHTML = response.bookingDate;
  1706. document.getElementById("td_depositeAmount").innerHTML = parseFloat(response.depositAmount).toFixed(2);
  1707. document.getElementById("td_hallAmount").innerHTML = parseFloat(response.hallAmount).toFixed(2);
  1708. // Calculate GST and total amount
  1709. var gstAmount = (parseFloat(response.hallAmount) * (response.hallDetails.gst / 100)).toFixed(2);
  1710. var totalAmount = parseFloat(response.amountReceived).toFixed(2);
  1711. document.getElementById("td_gst").innerHTML = gstAmount;
  1712. document.getElementById("td_totalAmount").innerHTML = totalAmount;
  1713. document.getElementById("td_startDate").innerHTML = response.startDate;
  1714. document.getElementById("td_endDate").innerHTML = response.endDate;
  1715. document.getElementById("booking_id").innerHTML = response.bookingId;
  1716. function getTimeSlot(slotValue) {
  1717. var timeSlot;
  1718. var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
  1719. if (trimmedSlotValue === '1') {
  1720. timeSlot = 'Morning';
  1721. } else if (trimmedSlotValue === '2') {
  1722. timeSlot = 'Evening';
  1723. } else {
  1724. timeSlot = 'Unknown';
  1725. }
  1726. return timeSlot;
  1727. }
  1728. document.getElementById("td_startingSlot").innerHTML = getTimeSlot(response.startingSlot);
  1729. document.getElementById("td_endingSlot").innerHTML = getTimeSlot(response.endingSlot);
  1730. document.getElementById("bookingstatus_td").innerHTML = response.bookingStatus;
  1731. if (response.bookingStatus === 'REJECTED' && response.comments) {
  1732. document.getElementById("rejectionreasondiv").style.display = "block";
  1733. const rejectionCell = document.getElementById("reasonforrejection");
  1734. rejectionCell.innerHTML = response.comments;
  1735. } else {
  1736. document.getElementById("rejectionreasondiv").style.display = "none";
  1737. document.getElementById("reasonforrejection").style.display = "none";
  1738. }
  1739. showReasonDocuments(response);
  1740. if (response.payments) {
  1741. document.getElementById("paymentsdetails").style.display = "block";
  1742. document.getElementById("td_transactionId").innerHTML = response.payments.transactionId;
  1743. document.getElementById("td_payamountReceived").innerHTML = response.payments.amountReceived;
  1744. document.getElementById("td_paymentStatus").innerHTML = response.payments.paymentStatus;
  1745. } else {
  1746. document.getElementById("paymentsdetails").style.display = "none";
  1747. }
  1748. if (response.ebDetails) {
  1749. document.getElementById("ebdetails").style.display = "block";
  1750. document.getElementById("td_EBNumber").innerHTML = response.hallDetails.ebNumber;
  1751. document.getElementById("td_startingReading").innerHTML = response.ebDetails.startingReading;
  1752. document.getElementById("td_endingReading").innerHTML = response.ebDetails.endingReading;
  1753. document.getElementById("td_usedunit").innerHTML = response.ebDetails.usedUnit;
  1754. document.getElementById("td_ebamountperunit").innerHTML = parseFloat(response.hallDetails.ebCostPerUnit).toFixed(2);
  1755. document.getElementById("td_electricityamount").innerHTML = parseFloat(response.ebDetails.ebAmount).toFixed(2);
  1756. } else {
  1757. document.getElementById("ebdetails").style.display = "none";
  1758. }
  1759. if (response.damageList && response.damageList.length > 0) {
  1760. document.getElementById("damagelist").style.display = "block";
  1761. } else {
  1762. document.getElementById("damagelist").style.display = "none";
  1763. }
  1764. if (response.settlement) {
  1765. document.getElementById("refunddetails").style.display = "block";
  1766. document.getElementById("td_depositeamountforrefund").innerHTML = parseFloat(response.depositAmount).toFixed(2);
  1767. document.getElementById("td_electricityamount").innerHTML = parseFloat(response.ebDetails.ebAmount).toFixed(2);
  1768. document.getElementById("td_ebAmount").innerHTML = parseFloat(response.ebDetails.ebAmount).toFixed(2);
  1769. document.getElementById("td_damage").innerHTML = parseFloat(response.settlement.damageAmount).toFixed(2);
  1770. var eb_amt = parseFloat(response.ebDetails.ebAmount).toFixed(2);
  1771. var deposit_amt = parseFloat(response.depositAmount).toFixed(2);
  1772. var tem_total = (deposit_amt - eb_amt).toFixed(2);
  1773. $("#td_settel_amt").html(tem_total);
  1774. } else {
  1775. document.getElementById("refunddetails").style.display = "none";
  1776. }
  1777. showDamageDetails(response);
  1778. if (response.bookingStatus === 'CANCELED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
  1779. document.getElementById("td_refundamount").innerHTML = `Your booking has been cancelled. Deposit amount of ₹ ${parseFloat(response.depositAmount).toFixed(2)} will be refund 3 to 15 Days`;
  1780. document.getElementById("refundamountDetails").style.display = "block";
  1781. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1782. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1783. } else if (response.bookingStatus === 'CANCELED' && response.refundStatus === 'COMPLETED') {
  1784. document.getElementById("td_refundamount").innerHTML = `Deposit amount of ₹ ${parseFloat(response.depositAmount).toFixed(2)} refunded successfully`;
  1785. document.getElementById("refundamountDetails").style.display = "block";
  1786. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1787. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1788. } else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus) && response.amountReceived == 0) {
  1789. document.getElementById("refundamountDetails").style.display = "none";
  1790. } else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
  1791. document.getElementById("td_refundamount").innerHTML = `Your booking has been Rejected by GCC. Full amount of ₹ ${parseFloat(response.amountReceived).toFixed(2)} will be refunded shortly`;
  1792. document.getElementById("refundamountDetails").style.display = "block";
  1793. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1794. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1795. } else if (response.bookingStatus === 'REJECTED' && response.refundStatus === 'COMPLETED') {
  1796. document.getElementById("td_refundamount").innerHTML = `Full amount of ₹${parseFloat(response.amountReceived).toFixed(2)} refunded successfully`;
  1797. document.getElementById("refundamountDetails").style.display = "block";
  1798. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1799. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1800. } else if (response.bookingStatus === 'REJECTED' && response.refundStatus === 'NA') {
  1801. document.getElementById("td_refundamount").innerHTML = `Your Booking has been rejected by GCC`;
  1802. document.getElementById("refundamountDetails").style.display = "block";
  1803. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1804. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1805. } else if (response.bookingStatus === 'GCC_BLOCKED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
  1806. document.getElementById("td_refundamount").innerHTML = `Your booking has been Blocked by GCC. Full amount of ₹ ${parseFloat(response.amountReceived).toFixed(2)} will be refunded shortly`;
  1807. document.getElementById("refundamountDetails").style.display = "block";
  1808. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1809. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1810. } else if (response.bookingStatus === 'GCC_BLOCKED' && response.refundStatus === 'COMPLETED') {
  1811. document.getElementById("td_refundamount").innerHTML = `Full amount of ₹${parseFloat(response.amountReceived).toFixed(2)} refunded successfully`;
  1812. document.getElementById("refundamountDetails").style.display = "block";
  1813. document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
  1814. document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
  1815. } else {
  1816. document.getElementById("refundamountDetails").style.display = "none";
  1817. }
  1818. // Show the modal
  1819. $('#showBookingDetails').modal('show');
  1820. },
  1821. error: function () {
  1822. console.error("An error occurred while fetching booking details.");
  1823. }
  1824. });
  1825. }
  1826. function showDamageDetails(data) {
  1827. var damageFieldContainer = $('#damageDetails');
  1828. damageFieldContainer.empty();
  1829. // Create a div for table responsiveness
  1830. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'width': '770px'});
  1831. // Create table with similar classes and styles to the modal table
  1832. var table = $('<table>').addClass('table table-bordered table-striped').css({
  1833. 'width': '97%',
  1834. 'border-color': 'black',
  1835. 'border-top-color': 'white'
  1836. });
  1837. var thead = $('<thead>').addClass('thead-light');
  1838. var tbody = $('<tbody>');
  1839. // Create Damage Details header row
  1840. var headerRow = $('<tr>').appendTo(thead);
  1841. $('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
  1842. 'padding': '0.45rem 0.45rem',
  1843. 'background-color': 'lightgrey',
  1844. 'font-weight': 'bold',
  1845. 'color': 'black',
  1846. }).appendTo(headerRow);
  1847. // Create table header row
  1848. var columnHeadersRow = $('<tr>').css('background-color', 'white').appendTo(thead);
  1849. $('<th>').text('S.No').css('padding', '0.45rem 0.45rem').appendTo(columnHeadersRow);
  1850. $('<th>').text('Asset Name').css('padding', '0.45rem 0.45rem').appendTo(columnHeadersRow);
  1851. $('<th>').text('Damage Img').css('padding', '0.45rem 0.45rem').appendTo(columnHeadersRow);
  1852. $('<th>').text('Cost').css('padding', '0.45rem 0.45rem').appendTo(columnHeadersRow);
  1853. $('<th>').text('Qty').css('padding', '0.45rem 0.45rem').appendTo(columnHeadersRow);
  1854. $('<th>').text('Amount').css('padding', '0.45rem 0.45rem').appendTo(columnHeadersRow);
  1855. var totalAmount = 0;
  1856. $.each(data.damageList, function (index, detail) {
  1857. var row = $('<tr>').appendTo(tbody);
  1858. $('<td>').text(index + 1).css('padding', '0.45rem 0.45rem').appendTo(row);
  1859. $('<td>').text(detail.assetName).css('padding', '0.45rem 0.45rem').appendTo(row);
  1860. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
  1861. showDamageImage(detail.damageImageUrl);
  1862. });
  1863. var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
  1864. $('<td>').css('padding', '0.45rem 0.45rem').append(viewLink).appendTo(row);
  1865. $('<td>').text(assetamt).css('padding', '0.45rem 0.45rem').appendTo(row);
  1866. $('<td>').text(detail.quantity).css('padding', '0.45rem 0.45rem').appendTo(row);
  1867. var amount = detail.assetAmount;
  1868. totalAmount += amount;
  1869. $('<td>').text(amount.toFixed(2)).css('padding', '0.45rem 0.45rem').appendTo(row);
  1870. $("#td_dam_amt").html(totalAmount.toFixed(2));
  1871. });
  1872. // Add row for total amount
  1873. var totalRow = $('<tr>').appendTo(tbody);
  1874. $('<td>').attr('colspan', '5').text('Total Amount').css('padding', '0.45rem 0.45rem; font-weight: bold; background-color: #f2f2f2').appendTo(totalRow);
  1875. $('<td>').text(totalAmount.toFixed(2)).css('padding', '0.45rem 0.45rem').appendTo(totalRow);
  1876. // Append the table elements to the container div
  1877. table.append(thead, tbody);
  1878. tableResponsiveDiv.append(table);
  1879. damageFieldContainer.append(tableResponsiveDiv);
  1880. var temp_total = parseFloat($("#td_settel_amt").html());
  1881. var settleAmount = temp_total - totalAmount;
  1882. if (settleAmount < 0) {
  1883. var pendingstatus = data.settlement.collectionStatus
  1884. $("#td_settel_amt").html(0.00);
  1885. $("#pendingcolumn").show();
  1886. $("#collectionstatuscolumn").show();
  1887. $('#td_collection_status').html(pendingstatus);
  1888. $("#td_pending_amt").html(Math.abs(settleAmount).toFixed(2));
  1889. $("#td_pending_amt").css("color", "red");
  1890. } else {
  1891. $("#td_settel_amt").html(settleAmount.toFixed(2));
  1892. $("#pendingcolumn").hide();
  1893. $("#collectionstatuscolumn").hide();
  1894. $("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
  1895. }
  1896. }
  1897. function showReasonDocuments(list) {
  1898. $.ajax({
  1899. type: "GET",
  1900. url: '/communityhall/api/officer/getReasonByName',
  1901. data: {
  1902. 'reasonName': list.reason
  1903. },
  1904. success: function (x) {
  1905. // console.log(x);
  1906. showReasonWithDocument(x, list);
  1907. }
  1908. });
  1909. }
  1910. // Display booking documents
  1911. function showReasonWithDocument(reasonData, list) {
  1912. var reasonDocumentData = reasonData.reasonDocumentMasterList;
  1913. var bookingDocumentsList = list.bookingDocumentsList;
  1914. const reasonFieldsContainer = $('#documents');
  1915. reasonFieldsContainer.empty();
  1916. // Create a responsive table container
  1917. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'width': '770px', 'border': 'black'});
  1918. // Create the table with Bootstrap classes and custom styles
  1919. var table = $('<table>').addClass('table table-bordered table-striped table-vcenter js-dataTable-responsive').css({
  1920. 'width': '100%',
  1921. 'height': 'auto',
  1922. 'border': '1px solid black'
  1923. });
  1924. // Create the table header (thead)
  1925. var thead = $('<thead>').appendTo(table);
  1926. var headerRow = $('<tr>').appendTo(thead);
  1927. $('<th>').attr('colspan', '3').text('Document Details').css({
  1928. 'color': 'black',
  1929. 'background-color': '#f2f2f2',
  1930. 'padding': '0.45rem 0.45rem'
  1931. }).appendTo(headerRow);
  1932. // Create header row for columns
  1933. var columnHeadersRow = $('<tr>').appendTo(thead);
  1934. $('<th>').text('S.No').appendTo(columnHeadersRow);
  1935. $('<th>').text('Required Info').appendTo(columnHeadersRow);
  1936. $('<th>').text('Required Documents').appendTo(columnHeadersRow);
  1937. // Create the table body (tbody)
  1938. var tbody = $('<tbody>').appendTo(table);
  1939. // Iterate through the documents list and populate rows
  1940. for (var i = 0; i < bookingDocumentsList.length; i++) {
  1941. (function (index) {
  1942. var row = $('<tr>').appendTo(tbody);
  1943. $('<td>').text(index + 1).appendTo(row);
  1944. $('<td>').text(reasonDocumentData[index].fieldName + ': ' + bookingDocumentsList[index].name).appendTo(row);
  1945. // Create a link to view document image
  1946. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
  1947. showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
  1948. });
  1949. $('<td>').append(viewLink).appendTo(row);
  1950. })(i);
  1951. }
  1952. // Append table to the responsive container
  1953. tableResponsiveDiv.append(table);
  1954. // Append table to the container in the DOM
  1955. reasonFieldsContainer.append(tableResponsiveDiv);
  1956. }
  1957. function showDocumentImage(fileURL) {
  1958. //console.log(fileURL);
  1959. openFileModal(fileURL);
  1960. }
  1961. // Event delegation for dynamically added elements
  1962. $(document).on('click', '.view-document', function () {
  1963. const fileURL = $(this).data('url');
  1964. openFileModal(fileURL);
  1965. });
  1966. function openFileModal(fileURL) {
  1967. $('#filePreview').attr('src', fileURL);
  1968. $('#fileModal').modal('show');
  1969. }
  1970. $('#fileModal').on('shown.bs.modal', function () {
  1971. // boost the last backdrop above everything else
  1972. $('.modal-backdrop').last().css({
  1973. 'z-index': 1095,
  1974. 'pointer-events': 'none'
  1975. });
  1976. // boost this modal
  1977. $(this).css('z-index', 1100);
  1978. });
  1979. function viewbookingDetails(userId) {
  1980. $.ajax({
  1981. type: "GET",
  1982. url: '/communityhall/admin/api/bookingdetailsByuserId',
  1983. data: {'userId': userId},
  1984. success: function (response) {
  1985. // console.log(response);
  1986. $("#bookingTableBody").empty(); // Ensure bookingTableBody is the correct ID of the table body
  1987. $.each(response, function (index, booking) {
  1988. // Create table row with the data from response
  1989. var row = '<tr>' + // Added <tr> tag
  1990. '<td class="text-center">' + (index + 1) + '</td>' +
  1991. '<td class="text-center">' + booking.bookingId + '</td>' +
  1992. '<td class="text-center">' + booking.bookingDate + '</td>' +
  1993. '<td class="text-center">' + booking.startDate + '</td>' +
  1994. '<td class="text-center">' + booking.endDate + '</td>' +
  1995. '<td class="text-center">' + booking.startingSlot + '</td>' +
  1996. '<td class="text-center">' + booking.endingSlot + '</td>' +
  1997. '<td class="text-center">' + booking.reason + '</td>' +
  1998. '<td class="text-center">' + booking.noOfDays + '</td>' +
  1999. '<td class="text-center">' + booking.bookingStatus + '</td>' +
  2000. '<td class="text-center">' + booking.hallAmount + '</td>' +
  2001. '<td class="text-center">' + booking.amountReceived + '</td>' +
  2002. '</tr>'; // Close <tr> tag
  2003. // Append the row to the table body
  2004. $("#bookingTableBody").append(row);
  2005. });
  2006. $('#viewbookingDetailsdetails').modal('show');
  2007. },
  2008. error: function (xhr, status, error) {
  2009. console.error(xhr.responseText);
  2010. // Handle error here
  2011. }
  2012. });
  2013. }
  2014. function viewbookingDetailsbasedonzone(zone) {
  2015. $.ajax({
  2016. type: "GET",
  2017. url: '/communityhall/admin/api/bookingdetailsByzone',
  2018. data: {'zone': zone},
  2019. success: function (response) {
  2020. // console.log(response);
  2021. // Clear existing table data and destroy DataTable instance if it exists
  2022. var table = $('#bookinglistdataTablebyzone').DataTable();
  2023. if (table) {
  2024. table.clear().destroy();
  2025. }
  2026. // Populate table with new data
  2027. var tableBody = $("#bookingTableBodybyzone");
  2028. tableBody.empty(); // Clear the table body
  2029. $.each(response, function (index, booking) {
  2030. var row = '<tr>' +
  2031. '<td class="text-center">' + (index + 1) + '</td>' +
  2032. '<td class="text-center">' + booking.bookingId + '</td>' +
  2033. '<td class="text-center">' + booking.bookingDate + '</td>' +
  2034. '<td class="text-center">' + booking.startDate + '</td>' +
  2035. '<td class="text-center">' + booking.endDate + '</td>' +
  2036. '<td class="text-center">' + booking.startingSlot + '</td>' +
  2037. '<td class="text-center">' + booking.endingSlot + '</td>' +
  2038. '<td class="text-center">' + booking.reason + '</td>' +
  2039. '<td class="text-center">' + booking.noOfDays + '</td>' +
  2040. '<td class="text-center">' + booking.bookingStatus + '</td>' +
  2041. '<td class="text-center">' + booking.hallAmount + '</td>' +
  2042. '<td class="text-center">' + booking.amountReceived + '</td>' +
  2043. '</tr>';
  2044. tableBody.append(row);
  2045. });
  2046. // Initialize DataTable
  2047. $('#bookinglistdataTablebyzone').DataTable({
  2048. "paging": true,
  2049. "searching": true,
  2050. "ordering": true,
  2051. "info": true
  2052. });
  2053. // Show the modal
  2054. $('#viewbookingDetailsbyzone').modal('show');
  2055. },
  2056. error: function (xhr, status, error) {
  2057. console.error(xhr.responseText);
  2058. // Handle error here
  2059. }
  2060. });
  2061. }
  2062. document.addEventListener('DOMContentLoaded', function () {
  2063. fetchData();
  2064. restoreSelectedValues();
  2065. document.getElementById('request').addEventListener('change', function () {
  2066. myRequest(); // Handle request change
  2067. });
  2068. document.getElementById('zone1').addEventListener('change', function () {
  2069. updateDivisions();
  2070. });
  2071. document.getElementById('division1').addEventListener('change', function () {
  2072. updateHalls();
  2073. });
  2074. });
  2075. function fetchData() {
  2076. fetch('/communityhall/user/api/getZonehalls') // Replace with your actual API endpoint
  2077. .then(response => response.json())
  2078. .then(data => {
  2079. populateDropdowns(data);
  2080. restoreSelectedValues();
  2081. })
  2082. .catch(error => console.error('Error fetching data:', error));
  2083. }
  2084. function populateDropdowns(data) {
  2085. const zoneDropdown = document.getElementById('zone1');
  2086. const divisionDropdown = document.getElementById('division1');
  2087. const hallDropdown = document.getElementById('hall1');
  2088. const zones = new Set();
  2089. const divisionsByZone = {};
  2090. const hallsByDivision = {};
  2091. data.forEach(item => {
  2092. zones.add(item.zone);
  2093. if (!divisionsByZone[item.zone]) {
  2094. divisionsByZone[item.zone] = [];
  2095. }
  2096. if (!divisionsByZone[item.zone].includes(item.division)) {
  2097. divisionsByZone[item.zone].push(item.division);
  2098. }
  2099. if (!hallsByDivision[item.division]) {
  2100. hallsByDivision[item.division] = [];
  2101. }
  2102. hallsByDivision[item.division].push({hallName: item.hall_name, hallId: item.hall_id});
  2103. });
  2104. // Populate zones
  2105. zones.forEach(zone => {
  2106. const option = document.createElement('option');
  2107. option.value = zone;
  2108. option.textContent = zone;
  2109. zoneDropdown.appendChild(option);
  2110. });
  2111. zoneDropdown.dataset.divisionsByZone = JSON.stringify(divisionsByZone);
  2112. divisionDropdown.dataset.hallsByDivision = JSON.stringify(hallsByDivision);
  2113. // Initialize divisions and halls
  2114. updateDivisions();
  2115. }
  2116. function updateDivisions() {
  2117. const zoneDropdown = document.getElementById('zone1');
  2118. const selectedZone = zoneDropdown.value;
  2119. const divisionsByZone = JSON.parse(zoneDropdown.dataset.divisionsByZone || '{}');
  2120. const divisionDropdown = document.getElementById('division1');
  2121. divisionDropdown.innerHTML = '';
  2122. const allOption = document.createElement('option');
  2123. allOption.value = '';
  2124. allOption.textContent = '--Select Division--';
  2125. divisionDropdown.appendChild(allOption);
  2126. if (selectedZone === '') {
  2127. document.getElementById('divisionContainer').classList.add('hidden');
  2128. } else {
  2129. document.getElementById('divisionContainer').classList.remove('hidden');
  2130. (divisionsByZone[selectedZone] || []).forEach(division => {
  2131. const option = document.createElement('option');
  2132. option.value = division;
  2133. option.textContent = division;
  2134. divisionDropdown.appendChild(option);
  2135. });
  2136. updateHalls();
  2137. }
  2138. }
  2139. function updateHalls() {
  2140. const divisionDropdown = document.getElementById('division1');
  2141. const selectedDivision = divisionDropdown.value;
  2142. const hallsByDivision = JSON.parse(divisionDropdown.dataset.hallsByDivision || '{}');
  2143. const hallDropdown = document.getElementById('hall1');
  2144. hallDropdown.innerHTML = '';
  2145. const allOption = document.createElement('option');
  2146. allOption.value = '';
  2147. allOption.textContent = '--Select Hall--';
  2148. hallDropdown.appendChild(allOption);
  2149. if (selectedDivision === '') {
  2150. document.getElementById('hallContainer').classList.add('hidden');
  2151. } else {
  2152. document.getElementById('hallContainer').classList.remove('hidden');
  2153. (hallsByDivision[selectedDivision] || []).forEach(hall => {
  2154. const option = document.createElement('option');
  2155. option.value = hall.hallId;
  2156. option.textContent = hall.hallName;
  2157. hallDropdown.appendChild(option);
  2158. });
  2159. }
  2160. }
  2161. function restoreSelectedValues() {
  2162. const selectedZone = localStorage.getItem('selectedZone') || '';
  2163. const selectedDivision = localStorage.getItem('selectedDivision') || '';
  2164. const selectedHall = localStorage.getItem('selectedHall') || '';
  2165. const zoneDropdown = document.getElementById('zone1');
  2166. const divisionDropdown = document.getElementById('division1');
  2167. const hallDropdown = document.getElementById('hall1');
  2168. zoneDropdown.value = selectedZone;
  2169. updateDivisions(); // Populate divisions based on selected zone
  2170. // Make sure to set the division and hall values after the dropdowns are populated
  2171. divisionDropdown.value = selectedDivision;
  2172. updateHalls(); // Populate halls based on selected division
  2173. hallDropdown.value = selectedHall;
  2174. }
  2175. // Store selected values before form submission
  2176. function storeSelectedValues() {
  2177. const zoneDropdown = document.getElementById('zone1');
  2178. const divisionDropdown = document.getElementById('division1');
  2179. const hallDropdown = document.getElementById('hall1');
  2180. localStorage.setItem('selectedZone', zoneDropdown.value);
  2181. localStorage.setItem('selectedDivision', divisionDropdown.value);
  2182. localStorage.setItem('selectedHall', hallDropdown.value);
  2183. }
  2184. document.getElementById('myForm').addEventListener('submit', function () {
  2185. storeSelectedValues();
  2186. });
  2187. let hallBookingData = [];
  2188. let hallDetailsData = [];
  2189. window.addEventListener("DOMContentLoaded", () => {
  2190. try {
  2191. const jsonString1 = document.getElementById("hallBookingJsonInput")?.value;
  2192. if (jsonString1) {
  2193. hallBookingData = JSON.parse(jsonString1);
  2194. console.log("Parsed hallBookingData:", hallBookingData);
  2195. }
  2196. const jsonString2 = document.getElementById("hallBookingDetailsJsonInput")?.value;
  2197. if (jsonString2) {
  2198. hallDetailsData = JSON.parse(jsonString2);
  2199. console.log("Parsed hallDetailsData:", hallDetailsData);
  2200. }
  2201. } catch (e) {
  2202. console.error("Failed to parse JSON inputs", e);
  2203. }
  2204. // Delegate click event for dynamically added booking links
  2205. $(document).on('click', '.hall-detail-link', function (e) {
  2206. e.preventDefault();
  2207. const hallName = $(this).data('hall-name');
  2208. showHallBookingDetails(hallName);
  2209. });
  2210. });
  2211. function showCounterTable(elem) {
  2212. const counterId = elem.getAttribute("data-counter-id");
  2213. const filtered = hallBookingData.filter(row => row[0] == counterId);
  2214. const table = $('#modalBookingTable').DataTable();
  2215. table.clear();
  2216. filtered.forEach((row, index) => {
  2217. table.row.add([
  2218. index + 1,
  2219. row[1], // Zone
  2220. row[2], // Division
  2221. row[3], // Hall Name
  2222. `<button href="#" class="hall-detail-link"
  2223. style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
  2224. data-hall-name="${row[3]}">${row[4]}</button>`
  2225. ]);
  2226. });
  2227. table.draw();
  2228. table.columns.adjust().responsive.recalc();
  2229. // Show modal after data is loaded
  2230. $('#bookingModal').modal('show');
  2231. }
  2232. function formatDateFromTimestamp(timestamp) {
  2233. const date = new Date(parseInt(timestamp));
  2234. const year = date.getFullYear();
  2235. const month = String(date.getMonth() + 1).padStart(2, '0');
  2236. const day = String(date.getDate()).padStart(2, '0');
  2237. return `${year}-${month}-${day}`;
  2238. }
  2239. function getSlotLabel(slot) {
  2240. return slot === 1 ? 'Morning' : (slot === 2 ? 'Evening' : '');
  2241. }
  2242. function showHallBookingDetails(hallName) {
  2243. const filtered = hallDetailsData.filter(row => row[1] === hallName);
  2244. const table = $('#hallDetailsTable').DataTable();
  2245. table.clear();
  2246. filtered.forEach((row, index) => {
  2247. table.row.add([
  2248. index + 1,
  2249. row[0],
  2250. row[1],
  2251. formatDateFromTimestamp(row[2]),
  2252. row[3],
  2253. row[4],
  2254. getSlotLabel(row[5]),
  2255. getSlotLabel(row[6]),
  2256. row[7],
  2257. row[8],
  2258. row[9],
  2259. row[10],
  2260. row[11],
  2261. row[12],
  2262. row[13],
  2263. row[14],
  2264. ` <button class="btn btn-sm btn-primary" onclick="viewDetails('${row[0]}')">View</button>`
  2265. ]);
  2266. });
  2267. table.draw();
  2268. table.columns.adjust().responsive.recalc();
  2269. $('#hallDetailModal').modal('show');
  2270. }
  2271. function viewCounterBookingDetails(bookingId) {
  2272. viewDetails(bookingId);
  2273. }
  2274. </script>
  2275. </body>
  2276. </html>