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.

1647 lines
60 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-headquarters :: head}"></head>
  4. <style>
  5. .card-body table {
  6. width: 100%;
  7. padding: 100px;
  8. }
  9. .card-body th,
  10. td {
  11. padding: 8px;
  12. text-align: left;
  13. }
  14. .amount-cell {
  15. text-align: right;
  16. padding-right: 1rem;
  17. /* Adjust padding as needed */
  18. }
  19. .table {
  20. width: 100% !important;
  21. }
  22. </style>
  23. <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
  24. integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
  25. crossorigin="anonymous"></script>
  26. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"
  27. integrity="sha384-vUDzXQ+PSziH/FUbe0YVEv7qEoRJRT5D02B1RWZC1yyP3+n6K8N7q0clmKf3nDOJ"
  28. crossorigin="anonymous"></script>
  29. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
  30. integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
  31. crossorigin="anonymous"></script>
  32. <body>
  33. <!-- Page Container -->
  34. <div id="page-container"
  35. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  36. <!-- Side Overlay aside (right)-->
  37. <aside th:replace="~{fragments/aside-right :: aside}"></aside>
  38. <!-- END Side Overlay (right)-->
  39. <!-- Sidebar Nav-->
  40. <nav th:replace="~{fragments/nav-headquarters :: nav}"></nav>
  41. <!-- END Sidebar -->
  42. <!-- Header -->
  43. <header th:replace="~{fragments/header-headquarters :: header}"></header>
  44. <!-- Main Container -->
  45. <main id="main-container" class="container mt-5">
  46. <ul class="nav nav-tabs" id="myTab" role="tablist">
  47. <li class="nav-item" role="presentation">
  48. <a class="nav-link active" id="settlement-tab" data-toggle="tab" href="#settlement" role="tab"
  49. aria-controls="settlement" aria-selected="true">Settlement Refund</a>
  50. </li>
  51. <li class="nav-item" role="presentation">
  52. <a class="nav-link" id="cancel-tab" data-toggle="tab" href="#cancel" role="tab"
  53. aria-controls="cancel" aria-selected="false">Cancelled Bookings Refund</a>
  54. </li>
  55. <li class="nav-item" role="presentation">
  56. <a class="nav-link" id="gcc-tab" data-toggle="tab" href="#gcc" role="tab" aria-controls="gcc"
  57. aria-selected="false">GCC Blocked/Rejected Refund</a>
  58. </li>
  59. <li class="nav-item" role="presentation">
  60. <a class="nav-link" id="settlement-initiated-tab"
  61. data-toggle="tab"
  62. href="#settlement-initiated"
  63. role="tab"
  64. aria-controls="settlement-initiated"
  65. aria-selected="false">Settlement Initiated</a>
  66. </li>
  67. </ul>
  68. <div class="tab-content" id="myTabContent">
  69. <!-- Settlement Approval Tab -->
  70. <div class="tab-pane fade show active" id="settlement" role="tabpanel" aria-labelledby="settlement-tab">
  71. <div class="block-header block-header-default">
  72. <h3 class="block-title">List of Settlement Refund Pending</h3>
  73. </div>
  74. <div class="block-content p-0">
  75. <div class="p-sm-4 p-0">
  76. <div class="table-responsive">
  77. <table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="SettlementApprovedListTable">
  78. <thead class="thead-light">
  79. <tr>
  80. <th>S.no</th>
  81. <th>Zone</th>
  82. <th>Division</th>
  83. <th>Hall Name</th>
  84. <th>Booking Id</th>
  85. <th>Booking Date</th>
  86. <th>Settlement Id</th>
  87. <th>Settlement raised Date</th>
  88. <th>Deposit Amount</th>
  89. <th>Collection Pending</th>
  90. <th>Refund Amount</th>
  91. <th>Status</th>
  92. <th>Action</th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <!--<tr th:each="settlement, rowStat : ${settlementlist}">-->
  97. <tr th:each="settlement, rowStat : ${settlementlist}"
  98. th:if="${settlement.settlement.approvedFlag == 0 or settlement.settlement.approvedFlag == null}">
  99. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  100. <td class="text-center" th:text="${settlement.hallDetails.zone}"></td>
  101. <td class="text-center" th:text="${settlement.hallDetails.division}"></td>
  102. <td class="text-center" th:text="${settlement.hallDetails.hallName}"></td>
  103. <td class="text-center" th:text="${settlement.bookingId}"></td>
  104. <td class="text-center" th:text="${settlement.bookingDate}"></td>
  105. <td class="text-center" th:text="${settlement.settlement.settlementId}">
  106. </td>
  107. <td class="text-center" th:text="${settlement.settlement.cdate}"></td>
  108. <td class="text-center" th:text="${settlement.depositAmount}"></td>
  109. <td class="text-center"
  110. th:text="${settlement.settlement.collectionPending}"></td>
  111. <td class="text-center" th:text="${settlement.settlement.refundedAmount}">
  112. </td>
  113. <td class="text-center" th:text="${settlement.refundStatus}"></td>
  114. <td>
  115. <p>
  116. <span class="badge bg-warning" style="cursor: pointer;"
  117. th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
  118. </p>
  119. </td>
  120. </tr>
  121. </tbody>
  122. </table>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <!-- CancelBooking Tab -->
  128. <div class="tab-pane fade" id="cancel" role="tabpanel" aria-labelledby="cancel-tab">
  129. <div class="block-header block-header-default">
  130. <h3 class="block-title">Cancelled Bookings with Refund Pending</h3>
  131. </div>
  132. <div class="block-content p-0">
  133. <div class="p-sm-4 p-0">
  134. <div class="table-responsive">
  135. <table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="cancelledApprovedListTable">
  136. <thead class="thead-light">
  137. <tr>
  138. <th>S.no</th>
  139. <th>Booking Id</th>
  140. <th>Booking Date</th>
  141. <th>Hall Name</th>
  142. <th>User Name</th>
  143. <th>User type</th>
  144. <th>Reason for Booking</th>
  145. <th>Refund Amount</th>
  146. <th>Action</th>
  147. </tr>
  148. </thead>
  149. <tbody>
  150. <tr th:each="cancelledbookings, rowStat : ${cancelledbookings}">
  151. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  152. <td class="text-center" th:text="${cancelledbookings.bookingId}"></td>
  153. <td class="text-center" th:text="${cancelledbookings.bookingDate}"></td>
  154. <td class="text-center" th:text="${cancelledbookings.hallDetails.hallName}">
  155. </td>
  156. <td class="text-center" th:text="${cancelledbookings.users.name}"></td>
  157. <td class="text-center" th:text="${cancelledbookings.users.usertype}"></td>
  158. <td class="text-center" th:text="${cancelledbookings.reason}"></td>
  159. <td class="text-center"
  160. th:text="${cancelledbookings.depositAmount}"></td>
  161. <td>
  162. <p>
  163. <span class="badge bg-warning" style="cursor: pointer;"
  164. th:onclick="cancelledbooking([[${cancelledbookings.bookingId}]])">Approve</span>
  165. </p>
  166. </td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <!-- GCC Blocked/Rejected Approved Tab -->
  175. <div class="tab-pane fade" id="gcc" role="tabpanel" aria-labelledby="gcc-tab">
  176. <div class="block-header block-header-default">
  177. <h3 class="block-title">GCC Blocked/Rejected Bookings with Refund Pending</h3>
  178. </div>
  179. <div class="block-content p-0">
  180. <div class="p-sm-4 p-0">
  181. <div class="table-responsive">
  182. <table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="rejectedApprovedListTable">
  183. <thead class="thead-light">
  184. <tr>
  185. <th>S.no</th>
  186. <th>Booking Id</th>
  187. <th>Booking Date</th>
  188. <th>Hall Name</th>
  189. <th>User Name</th>
  190. <th>User type</th>
  191. <th>Reason for Booking</th>
  192. <th>Reason for Rejection</th>
  193. <th>Refund Amount</th>
  194. <th>Action</th>
  195. </tr>
  196. </thead>
  197. <tbody>
  198. <tr th:each="rejectedbookings, rowStat : ${rejectedbookings}">
  199. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  200. <td class="text-center" th:text="${rejectedbookings.bookingId}"></td>
  201. <td class="text-center" th:text="${rejectedbookings.bookingDate}"></td>
  202. <td class="text-center" th:text="${rejectedbookings.hallDetails.hallName}">
  203. </td>
  204. <td class="text-center" th:text="${rejectedbookings.users.name}"></td>
  205. <td class="text-center" th:text="${rejectedbookings.users.usertype}"></td>
  206. <td class="text-center" th:text="${rejectedbookings.reason}"></td>
  207. <td class="text-center" th:text="${rejectedbookings.comments}"></td>
  208. <td class="text-center" th:text="${rejectedbookings.amountReceived}"></td>
  209. <td>
  210. <p>
  211. <span class="badge bg-warning" style="cursor: pointer;"
  212. th:onclick="rejectedbooking([[${rejectedbookings.bookingId}]])">Approve</span>
  213. </p>
  214. </td>
  215. </tr>
  216. </tbody>
  217. </table>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <div class="tab-pane fade " id="settlement-initiated" role="tabpanel">
  223. <div class="block-header block-header-default">
  224. <h3 class="block-title"> Settlement Initiated</h3>
  225. </div>
  226. <div class="block-content p-0">
  227. <div class="p-sm-4 p-0">
  228. <div class="table-responsive">
  229. <table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
  230. id="SettlementInitiatedListTable">
  231. <thead class="thead-light">
  232. <tr>
  233. <th>S.nos</th>
  234. <th>Zone</th>
  235. <th>Division</th>
  236. <th>Hall Name</th>
  237. <th>Booking Id</th>
  238. <th>Booking Date</th>
  239. <th>Settlement Id</th>
  240. <th>Settlement raised Date</th>
  241. <th>Deposit Amount</th>
  242. <th>Collection Pending</th>
  243. <th>Refund Amount</th>
  244. <th>Status</th>
  245. <th>Last Initade date</th>
  246. <th>Action</th>
  247. </tr>
  248. </thead>
  249. <tbody>
  250. <!--<tr th:each="settlement, rowStat : ${settlementlist}">-->
  251. <tr th:each="settlement, rowStat : ${settlementIntiated}"
  252. th:if="${settlement.settlement.approvedFlag == 1 }">
  253. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  254. <td class="text-center" th:text="${settlement.hallDetails.zone}"></td>
  255. <td class="text-center" th:text="${settlement.hallDetails.division}"></td>
  256. <td class="text-center" th:text="${settlement.hallDetails.hallName}"></td>
  257. <td class="text-center" th:text="${settlement.bookingId}"></td>
  258. <td class="text-center" th:text="${settlement.bookingDate}"></td>
  259. <td class="text-center" th:text="${settlement.settlement.settlementId}">
  260. </td>
  261. <td class="text-center" th:text="${settlement.settlement.cdate}"></td>
  262. <td class="text-center" th:text="${settlement.depositAmount}"></td>
  263. <td class="text-center"
  264. th:text="${settlement.settlement.collectionPending}"></td>
  265. <td class="text-center" th:text="${settlement.settlement.refundedAmount}">
  266. </td>
  267. <td class="text-center" th:text="${settlement.refundStatus}"></td>
  268. <td th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}"></td>
  269. <td>
  270. <p>
  271. <span class="badge bg-warning" style="cursor: pointer;"
  272. th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
  273. </p>
  274. </td>
  275. </tr>
  276. </tbody>
  277. </table>
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. </main>
  284. <!-- End User Details Modal-->
  285. <!-- END Main Container -->
  286. <!-- Modal for Pending -->
  287. <div class="modal fade backdrop" id="pendingSettlementForm" data-backdrop="static" tabindex="-1" role="dialog"
  288. aria-labelledby="staticBackdropLabel" aria-hidden="true">
  289. <div class="modal-dialog modal-lg" role="document">
  290. <div class="modal-content">
  291. <form id="ownform" onsubmit="return rejectsubmit();">
  292. <div class="block block-rounded block-themed block-transparent mb-0">
  293. <div class="block-header bg-primary-dark">
  294. <h3 class="block-title" id="2mtitle">Settlement Information</h3>
  295. <div class="block-options">
  296. <button type="button" class="btn-block-option" data-bs-dismiss="modal"
  297. aria-label="Close">
  298. <i class="fa fa-fw fa-times"></i>
  299. </button>
  300. </div>
  301. </div>
  302. <div class="block-content row">
  303. <div class="col-md-12 col-lg-12 col-sm-12">
  304. <input type="hidden" class="form-control text-center" name="settlementid"
  305. id="settlementid" disabled />
  306. <div class="card-body">
  307. <table>
  308. <tr>
  309. <th colspan="10" style="background-color: #f2f2f2;">User Details</th>
  310. </tr>
  311. <tr>
  312. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:
  313. </th>
  314. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  315. id="td_userName"></td>
  316. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
  317. </th>
  318. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  319. id="td_mobileNumber"></td>
  320. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:
  321. </th>
  322. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  323. id="td_usertype"></td>
  324. </tr>
  325. <tr>
  326. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:
  327. </th>
  328. <td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  329. id="td_useraddress"></td>
  330. </tr>
  331. <input type="hidden" class="form-control text-center" name="bookingid"
  332. id="bookingid" disabled />
  333. <tr>
  334. <th colspan="10" style="background-color: #f2f2f2;">Hall Details</th>
  335. </tr>
  336. <tr>
  337. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Name:
  338. </th>
  339. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  340. id="td_hallName"></td>
  341. </tr>
  342. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Address:</th>
  343. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  344. id="td_halladdress"></td>
  345. </tr>
  346. <tr>
  347. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
  348. Name:</th>
  349. <td colspan="2" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  350. id="td_caretakername"></td>
  351. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
  352. Mobile Number:</th>
  353. <td colspan="2" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  354. id="td_caretakermobileNumber"></td>
  355. </tr>
  356. </table>
  357. </div>
  358. </div>
  359. <div class="col-md-12 col-lg-12 col-sm-12">
  360. <input type="hidden" class="form-control text-center" name="settlementid"
  361. id="settlementid" disabled />
  362. <div class="card-body">
  363. <table>
  364. <tr>
  365. <th colspan="4" style="background-color: #f2f2f2;">Booking
  366. Details (Booking Id:-<span id="booking_id"
  367. style="color:blue"></span>)</th>
  368. </tr>
  369. <tr>
  370. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:
  371. </th>
  372. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  373. id="td_bookingDate"></td>
  374. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit
  375. Amount:</th>
  376. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  377. id="td_depositeAmount"></td>
  378. </tr>
  379. <tr>
  380. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:
  381. </th>
  382. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  383. id="td_startDate"></td>
  384. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:
  385. </th>
  386. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  387. id="td_hallAmount"></td>
  388. </tr>
  389. <tr>
  390. <th style="padding: 0.45rem 0.45rem;font-weight: normal">END
  391. Date:</th>
  392. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  393. id="td_endDate"></td>
  394. <th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
  395. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  396. id="td_gst"></td>
  397. </tr>
  398. <tr>
  399. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:
  400. </th>
  401. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  402. id="td_startingSlot"></td>
  403. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:
  404. </th>
  405. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  406. id="td_totalAmount"></td>
  407. </tr>
  408. <tr>
  409. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:
  410. </th>
  411. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  412. id="td_endingSlot"></td>
  413. </tr>
  414. <tr>
  415. <th colspan="4" style="background-color: #f2f2f2;">EB
  416. Details</th>
  417. </tr>
  418. <tr>
  419. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:</th>
  420. <td class="fw-semibold"
  421. style="padding: 0.45rem 0.45rem; text-align:center"
  422. id="td_EBNumber"></td>
  423. <th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
  424. Unit:</th>
  425. <td class="fw-semibold"
  426. style="padding: 0.45rem 0.45rem;text-align:right"
  427. id="td_ebamountperunit"></td>
  428. </tr>
  429. <tr>
  430. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
  431. </th>
  432. <td class="fw-semibold"
  433. style="padding: 0.45rem 0.45rem;text-align:center"
  434. id="td_startingReading"></td>
  435. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
  436. </th>
  437. <td class="fw-semibold"
  438. style="padding: 0.45rem 0.45rem;text-align:right" id="td_usedunit">
  439. </td>
  440. </tr>
  441. <tr>
  442. <th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
  443. </th>
  444. <td class="fw-semibold"
  445. style="padding: 0.45rem 0.45rem;text-align:center"
  446. id="td_endingReading"></td>
  447. <th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
  448. <td class="fw-semibold"
  449. style="padding: 0.45rem 0.45rem;text-align:right"
  450. id="td_electricityamount"></td>
  451. </tr>
  452. </table>
  453. </div>
  454. </div>
  455. <div id="damageDetails" style="margin-bottom: -17px;"></div>
  456. <div class="col-md-12 col-lg-12 col-sm-12">
  457. <div class="card-body">
  458. <table>
  459. <tr>
  460. <th colspan="2" style="background-color: #f2f2f2;font-weight: normal">
  461. Amount to be Refunded</th>
  462. </tr>
  463. <tr>
  464. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit
  465. Amount:</th>
  466. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  467. id="td_depositeamountforrefund">0</td>
  468. </tr>
  469. <tr>
  470. <th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
  471. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  472. id="td_ebAmount"></td>
  473. </tr>
  474. <tr>
  475. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Damage Amount:
  476. </th>
  477. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  478. id="td_damage"></td>
  479. </tr>
  480. <tr id="pendingcolumn">
  481. <th id="th_settel_label"
  482. style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
  483. Collection Pending Amount:</th>
  484. <td class="fw-semibold amount-cell"
  485. style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">
  486. 0</td>
  487. </tr>
  488. <tr id="collectionstatuscolumn">
  489. <th id="label"
  490. style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
  491. :</th>
  492. <td class="fw-semibold amount-cell"
  493. style="padding: 0.45rem 0.45rem; color: green;" id="td_collection_status">
  494. </td>
  495. </tr>
  496. <tr>
  497. <th
  498. style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
  499. Actual refundable Amount:</th>
  500. <td class="fw-semibold amount-cell"
  501. style="padding: 0.45rem 0.45rem; color: green;" id="td_settel_amt">0
  502. </td>
  503. </tr>
  504. </table>
  505. </div>
  506. </div>
  507. <div class="mb-12">
  508. <label class="form-label">Reject Reason:<span class="text-danger"></span></label>
  509. <textarea class="form-control" name="reason" id="reason" style="width: 100%;"
  510. required></textarea>
  511. </div>
  512. </div>
  513. <div class="block-content block-content-full text-end bg-body" id="mbutton2">
  514. <button type="button" class="btn btn-sm btn-alt-success" id="approvebutton"
  515. th:onclick="accept()">Approve</button>
  516. <button type="button" class="btn btn-sm btn-alt-secondary"
  517. data-bs-dismiss="modal">Close</button>
  518. <button type="submit" class="btn btn-sm btn-primary">Reject</button>
  519. <a id="downloadLink" style="display: none;"></a>
  520. </div>
  521. </div>
  522. </form>
  523. </div>
  524. </div>
  525. </div>
  526. <!-- Cancellation booking Details-->
  527. <div class="modal fade backdrop" id="cancelledBookingForm" data-backdrop="static" tabindex="-1" role="dialog"
  528. aria-labelledby="staticBackdropLabel" aria-hidden="true">
  529. <div class="modal-dialog modal-lg" role="document">
  530. <div class="modal-content">
  531. <form id="ownform">
  532. <div class="block block-rounded block-themed block-transparent mb-0">
  533. <div class="block-header bg-primary-dark">
  534. <h3 class="block-title" id="2mtitle">Booking Information</h3>
  535. <div class="block-options">
  536. <button type="button" class="btn-block-option" data-bs-dismiss="modal"
  537. aria-label="Close">
  538. <i class="fa fa-fw fa-times"></i>
  539. </button>
  540. </div>
  541. </div>
  542. <div class="block-content row">
  543. <div class="col-md-12 col-lg-12 col-sm-12 mb-2">
  544. <input type="hidden" class="form-control text-center" name="booksid" id="booksId"
  545. disabled />
  546. <div class="card-body">
  547. <table>
  548. <tr>
  549. <th colspan="10" style="background-color: #f2f2f2;">User Details</th>
  550. </tr>
  551. <tr>
  552. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:
  553. </th>
  554. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="username">
  555. </td>
  556. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
  557. </th>
  558. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="mobileno">
  559. </td>
  560. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:
  561. </th>
  562. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="usertype">
  563. </td>
  564. </tr>
  565. <tr>
  566. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:
  567. </th>
  568. <td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  569. id="useraddress"></td>
  570. </tr>
  571. </table>
  572. </div>
  573. </div>
  574. <div class="col-md-12 col-lg-12 col-sm-12 mb-2">
  575. <div class="card-body">
  576. <table>
  577. <tr>
  578. <th colspan="10" style="background-color: #f2f2f2;">Hall Details</th>
  579. </tr>
  580. <tr>
  581. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Name:
  582. </th>
  583. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  584. id="hallname"></td>
  585. </tr>
  586. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Address:</th>
  587. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  588. id="halladdress"></td>
  589. </tr>
  590. <tr>
  591. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
  592. Name:</th>
  593. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  594. id="caretakername"></td>
  595. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
  596. Mobile Number:</th>
  597. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  598. id="caretakermobileNumber"></td>
  599. </tr>
  600. </table>
  601. </div>
  602. </div>
  603. <div class="col-md-12 col-lg-12 col-sm-12">
  604. <div class="card-body">
  605. <table>
  606. <tr>
  607. <th colspan="4" style="background-color: #f2f2f2;">Booking
  608. Details (Booking Id:-<span id="bookid" style="color:blue"></span>)
  609. </th>
  610. </tr>
  611. <tr>
  612. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:
  613. </th>
  614. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  615. id="bookingDate"></td>
  616. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Status:
  617. </th>
  618. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  619. id="bookingStatus"></td>
  620. </tr>
  621. <tr>
  622. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:
  623. </th>
  624. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  625. id="startDate"></td>
  626. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit
  627. Amount:</th>
  628. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  629. id="depositeAmount"></td>
  630. </tr>
  631. <tr>
  632. <th style="padding: 0.45rem 0.45rem;font-weight: normal">END
  633. Date:</th>
  634. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="endDate">
  635. </td>
  636. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:
  637. </th>
  638. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  639. id="hallAmount"></td>
  640. </tr>
  641. <tr>
  642. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:
  643. </th>
  644. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  645. id="startingSlot"></td>
  646. <th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
  647. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  648. id="gst"></td>
  649. </tr>
  650. <tr>
  651. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:
  652. </th>
  653. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  654. id="endingSlot"></td>
  655. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:
  656. </th>
  657. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  658. id="totalAmount"></td>
  659. </tr>
  660. </table>
  661. </div>
  662. </div>
  663. <div class="col-sm-12">
  664. <!--<label class="form-label">Documents:<span class="text-danger"></span></label>-->
  665. <div class="documents" id="documents"></div>
  666. </div>
  667. <div class="col-md-12 col-lg-12 col-sm-12 mb-2">
  668. <input type="hidden" class="form-control text-center" name="bookingid"
  669. id="bookingid" disabled />
  670. <div class="card-body">
  671. <table>
  672. <tr>
  673. <th colspan="10" style="background-color: #f2f2f2;">Booking Payment
  674. Details</th>
  675. </tr>
  676. <tr>
  677. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Transaction
  678. ID:</th>
  679. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  680. id="transactionId"></td>
  681. </tr>
  682. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Amount Received:
  683. </th>
  684. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  685. id="payamountReceived"></td>
  686. </tr>
  687. <tr>
  688. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Transaction
  689. Status:</th>
  690. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  691. id="paymentStatus"></td>
  692. </tr>
  693. </table>
  694. </div>
  695. </div>
  696. </div>
  697. </div>
  698. <div class="block-content block-content-full text-end bg-body" id="mbutton2">
  699. <button type="button" class="btn btn-sm btn-alt-secondary"
  700. data-bs-dismiss="modal">Close</button>
  701. <button id="approvedButton" type="button" class="btn btn-sm btn-primary"
  702. th:onclick="approverefund()">Approve</button>
  703. </div>
  704. </form>
  705. </div>
  706. </div>
  707. </div>
  708. <!-- end of Cancellation booking details-->
  709. <div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
  710. aria-hidden="true">
  711. <div class="modal-dialog modal-lg" role="document">
  712. <div class="modal-content">
  713. <div class="modal-header">
  714. <h5 class="modal-title" id="fileModalLabel">File Preview</h5>
  715. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  716. <span aria-hidden="true">&times;</span>
  717. </button>
  718. </div>
  719. <div class="modal-body">
  720. <embed id="filePreview" src="" width="100%" height="600px">
  721. </div>
  722. <div class="modal-footer">
  723. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  724. </div>
  725. </div>
  726. </div>
  727. </div>
  728. </div>
  729. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  730. <!-- End modal for pending -->
  731. <div th:replace="~{fragments/resetpassword :: div}"></div>
  732. <script th:replace="~{fragments/loginscript :: script}"></script>
  733. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  734. <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  735. <script>
  736. $(document).ready(function () {
  737. var buttons = [
  738. {
  739. extend: 'pageLength',
  740. className: 'btn btn-primary'
  741. },
  742. {
  743. title: 'Data export',
  744. extend: 'copyHtml5',
  745. text: 'Copy',
  746. className: 'btn btn-primary',
  747. id: 'copyBtn'
  748. },
  749. {
  750. extend: 'excelHtml5',
  751. text: 'Excel',
  752. className: 'btn btn-primary',
  753. id: 'excelBtn'
  754. },
  755. {
  756. extend: 'csvHtml5',
  757. text: 'CSV',
  758. className: 'btn btn-primary',
  759. id: 'csvBtn'
  760. },
  761. {
  762. extend: 'pdfHtml5',
  763. text: 'PDF',
  764. className: 'btn btn-primary',
  765. id: 'pdfBtn'
  766. }
  767. ];
  768. // Initialize DataTable for each tab on tab shown event
  769. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  770. var targetTable = $(e.target).attr('href'); // activated tab
  771. $(targetTable).find('.dataTable').DataTable().columns.adjust();
  772. });
  773. //ak
  774. // Initialize DataTable for SettlementInitiatedListTable
  775. $('#SettlementInitiatedListTable').DataTable({
  776. dom: 'Bftip',
  777. columnDefs: [
  778. { targets: 'no-sort', orderable: false }
  779. ],
  780. lengthMenu: [
  781. [50, 100, 200, 500, -1],
  782. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  783. ],
  784. buttons: buttons,
  785. responsive: true,
  786. searching: true,
  787. select: false,
  788. processing: false,
  789. // Set width to 100%
  790. "autoWidth": true
  791. });
  792. // Initialize DataTable for Settlement Approved tab
  793. $('#SettlementApprovedListTable').DataTable({
  794. dom: 'Bftip',
  795. columnDefs: [
  796. {targets: 'no-sort', orderable: false}
  797. ],
  798. lengthMenu: [
  799. [50, 100, 200, 500, -1],
  800. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  801. ],
  802. buttons: buttons,
  803. responsive: true,
  804. searching: true,
  805. select: false,
  806. processing: false,
  807. // Set width to 100%
  808. "autoWidth": true
  809. });
  810. // Initialize DataTable for Cancelled Bookings Approved tab
  811. $('#cancelledApprovedListTable').DataTable({
  812. dom: 'Bftip',
  813. columnDefs: [
  814. {targets: 'no-sort', orderable: false}
  815. ],
  816. lengthMenu: [
  817. [50, 100, 200, 500, -1],
  818. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  819. ],
  820. buttons: buttons,
  821. responsive: true,
  822. searching: true,
  823. select: false,
  824. processing: false,
  825. // Set width to 100%
  826. "autoWidth": true
  827. });
  828. // Initialize DataTable for GCC Blocked/Rejected Approved tab
  829. $('#rejectedApprovedListTable').DataTable({
  830. dom: 'Bftip',
  831. columnDefs: [
  832. {targets: 'no-sort', orderable: false}
  833. ],
  834. lengthMenu: [
  835. [50, 100, 200, 500, -1],
  836. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  837. ],
  838. buttons: buttons,
  839. responsive: true,
  840. searching: true,
  841. select: false,
  842. processing: false,
  843. // Set width to 100%
  844. "autoWidth": true
  845. });
  846. });
  847. function pending(settlementId) {
  848. $.ajax({
  849. type: "GET",
  850. url: '/communityhall/api/officer/getSettlementList',
  851. data: {
  852. 'settlementsid': settlementId
  853. },
  854. success: function (x) {
  855. showSettlementInfo(x)
  856. showDamageDetails(x);
  857. //ak for headquarters
  858. if (x.settlement && x.settlement.approvedFlag === 1) {
  859. $("#approvebutton").hide();
  860. } else {
  861. $("#approvebutton").show();
  862. }
  863. }
  864. });
  865. }
  866. function showSettlementInfo(list) {
  867. // console.log(list); // Log the damageList array
  868. // console.log(list.damageList[0]);
  869. $('#pendingSettlementForm').modal({
  870. backdrop: 'static',
  871. keyboard: false
  872. });
  873. $('#pendingSettlementForm').modal('show');
  874. document.getElementById("settlementid").value = list.settlement.settlementId;
  875. document.getElementById("td_userName").innerHTML = list.users.name;
  876. document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
  877. document.getElementById("td_usertype").innerHTML = list.users.usertype;
  878. var userDetails = list.users;
  879. var userDetailsString =
  880. userDetails.doorNo + ", " +
  881. userDetails.street + ", " +
  882. userDetails.area + ", " +
  883. userDetails.location + " ,Chennai- " +
  884. userDetails.pinCode;
  885. document.getElementById("td_useraddress").innerHTML = userDetailsString;
  886. document.getElementById("td_hallName").innerHTML = list.hallDetails.hallName;
  887. var hallDetails = list.hallDetails;
  888. var hallDetailsString =
  889. hallDetails.doorNo + ", " +
  890. hallDetails.street + ", " +
  891. hallDetails.area + ", " +
  892. hallDetails.city + "- " +
  893. hallDetails.pinCode;
  894. document.getElementById("td_halladdress").innerHTML = hallDetailsString;
  895. document.getElementById("td_caretakername").innerHTML = list.hallDetails.hallInchargeName;
  896. document.getElementById("td_caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno;
  897. document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
  898. document.getElementById("td_depositeAmount").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  899. document.getElementById("td_hallAmount").innerHTML = '₹ ' + parseFloat(list.hallAmount).toFixed(2);
  900. // Calculate GST and total amount
  901. var gstAmount = (parseFloat(list.hallAmount) * (list.hallDetails.gst / 100)).toFixed(2);
  902. var totalAmount = parseFloat(list.amountReceived).toFixed(2);
  903. document.getElementById("td_gst").innerHTML = '₹ ' + gstAmount;
  904. document.getElementById("td_totalAmount").innerHTML = '₹ ' + totalAmount;
  905. document.getElementById("td_startDate").innerHTML = list.startDate;
  906. document.getElementById("td_endDate").innerHTML = list.endDate;
  907. document.getElementById("booking_id").innerHTML = list.bookingId;
  908. function getTimeSlot(slotValue) {
  909. var timeSlot;
  910. var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
  911. if (trimmedSlotValue === '1') {
  912. timeSlot = 'Morning';
  913. } else if (trimmedSlotValue === '2') {
  914. timeSlot = 'Evening';
  915. } else {
  916. timeSlot = 'Unknown';
  917. }
  918. return timeSlot;
  919. }
  920. document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
  921. document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
  922. document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
  923. document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
  924. document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
  925. document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
  926. document.getElementById("td_ebamountperunit").innerHTML = '₹ ' + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
  927. document.getElementById("td_depositeamountforrefund").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  928. document.getElementById("td_electricityamount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2);
  929. document.getElementById("td_ebAmount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2);
  930. document.getElementById("td_damage").innerHTML = '₹ ' + parseFloat(list.settlement.damageAmount).toFixed(2);
  931. var eb_amt = parseFloat(list.ebDetails.ebAmount).toFixed(2);
  932. var deposit_amt = parseFloat(list.depositAmount).toFixed(2);
  933. var tem_total = (deposit_amt - eb_amt).toFixed(2);
  934. $("#td_settel_amt").html(tem_total);
  935. }
  936. function showDamageDetails(data) {
  937. var damageFieldContainer = $('#damageDetails');
  938. damageFieldContainer.empty();
  939. // Create a div for table responsiveness
  940. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
  941. // Create table with similar classes and styles to the modal table
  942. var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
  943. var thead = $('<thead>').addClass('thead-light');
  944. var tbody = $('<tbody>');
  945. // Create Damage Details header row
  946. var headerRow = $('<tr>').appendTo(thead);
  947. $('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
  948. 'padding': '0.45rem 0.45rem',
  949. 'background-color': '#f2f2f2',
  950. 'font-weight': 'bold',
  951. 'color': 'black',
  952. }).appendTo(headerRow);
  953. // Create table header row
  954. var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
  955. $('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  956. $('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  957. $('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  958. $('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  959. $('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  960. $('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  961. var totalAmount = 0;
  962. // Check if damageList is empty
  963. if (data.damageList.length === 0) {
  964. var row = $('<tr>').appendTo(tbody);
  965. $('<td>').attr('colspan', '6').text('No Damaged Items').css({
  966. 'padding': '0.45rem 0.45rem',
  967. 'text-align': 'center',
  968. 'font-weight': 'bold',
  969. 'background-color': '#f2f2f2'
  970. }).appendTo(row);
  971. } else {
  972. $.each(data.damageList, function (index, detail) {
  973. var row = $('<tr>').appendTo(tbody);
  974. $('<td>').text(index + 1).css({
  975. 'padding': '0.45rem 0.45rem',
  976. 'text-align': 'center'
  977. }).appendTo(row);
  978. $('<td>').text(detail.assetName).css({
  979. 'padding': '0.45rem 0.45rem',
  980. 'text-align': 'center'
  981. }).appendTo(row);
  982. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
  983. showDamageImage(detail.damageImageUrl);
  984. });
  985. $('<td>').css({
  986. 'padding': '0.45rem 0.45rem',
  987. 'text-align': 'center'
  988. }).append(viewLink).appendTo(row);
  989. var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
  990. $('<td>').text('₹ ' + assetamt).css({
  991. 'padding': '0.45rem 0.45rem',
  992. 'text-align': 'center'
  993. }).appendTo(row);
  994. $('<td>').text(detail.quantity).css({
  995. 'padding': '0.45rem 0.45rem',
  996. 'text-align': 'center'
  997. }).appendTo(row);
  998. var amount = detail.assetAmount;
  999. totalAmount += amount;
  1000. $('<td>').text('₹ ' + amount.toFixed(2)).css({
  1001. 'padding': '0.45rem 0.45rem',
  1002. 'text-align': 'right'
  1003. }).appendTo(row);
  1004. });
  1005. // Add row for total amount
  1006. var totalRow = $('<tr>').appendTo(tbody);
  1007. $('<td>').attr('colspan', '5').text('Total Amount').css({
  1008. 'padding': '0.45rem 0.45rem',
  1009. 'font-weight': 'bold',
  1010. 'background-color': '#f2f2f2'
  1011. }).appendTo(totalRow);
  1012. $('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
  1013. 'padding': '0.45rem 0.45rem',
  1014. 'text-align': 'right'
  1015. }).appendTo(totalRow);
  1016. $("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
  1017. }
  1018. // Append the table elements to the container div
  1019. table.append(thead, tbody);
  1020. tableResponsiveDiv.append(table);
  1021. damageFieldContainer.append(tableResponsiveDiv);
  1022. var temp_total = parseFloat($("#td_settel_amt").html());
  1023. var settleAmount = temp_total - totalAmount;
  1024. var refundStatus = data.refundStatus;
  1025. var pendingstatus=data.settlement.collectionStatus
  1026. if (settleAmount < 0) {
  1027. // console.log(settleAmount);
  1028. $("#td_settel_amt").html(0.00);
  1029. $("#pendingcolumn").show();
  1030. $("#collectionstatuscolumn").show();
  1031. $('#td_collection_status').html(pendingstatus);
  1032. $("#td_pending_amt").html('₹ ' + Math.abs(settleAmount).toFixed(2));
  1033. $("#td_pending_amt").css("color", "red");
  1034. $("#approvebutton").prop("disabled", true);
  1035. $("#rejectbutton").show();
  1036. } else {
  1037. $("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
  1038. $("#pendingcolumn").hide();
  1039. $("#collectionstatuscolumn").hide();
  1040. $("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
  1041. $("#approvebutton").prop("disabled", false);
  1042. }
  1043. }
  1044. function showDamageImage(damageImageUrl) {
  1045. document.getElementById('filePreview').src = damageImageUrl;
  1046. $('#fileModal').modal('show');
  1047. }
  1048. function accept() {
  1049. let id = document.getElementById("settlementid").value;
  1050. const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
  1051. Swal.fire({
  1052. title: 'Do you want to Approve this Settlement?',
  1053. showDenyButton: true,
  1054. showCancelButton: true,
  1055. confirmButtonText: 'YES',
  1056. denyButtonText: 'NO',
  1057. }).then((result) => {
  1058. if (result.isConfirmed) {
  1059. // Disable the button to prevent multiple clicks
  1060. acceptButton.disabled = true;
  1061. // Show the loading screen
  1062. const loadingSwal = Swal.fire({
  1063. title: 'Processing...',
  1064. text: 'Please wait while we approve the settlement.',
  1065. allowOutsideClick: false, // Prevent closing the popup
  1066. didOpen: () => {
  1067. Swal.showLoading(); // Show the loading spinner
  1068. },
  1069. showConfirmButton: false, // Hide the confirm button during loading
  1070. });
  1071. $.ajax({
  1072. type: "POST",
  1073. url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
  1074. data: {
  1075. 'status': 'APPROVED',
  1076. 'comments': 'Accepted',
  1077. 'settlementId': id
  1078. },
  1079. success: function (data, textStatus, xhr) {
  1080. loadingSwal.close(); // Close the loading popup
  1081. if (xhr.status === 200) {
  1082. Swal.fire(
  1083. 'Done',
  1084. 'Successfully Accepted to the ID: ' + id,
  1085. 'success'
  1086. ).then(() => {
  1087. location.reload(); // Reload the page after success
  1088. });
  1089. } else {
  1090. Swal.fire(
  1091. 'Error',
  1092. 'Failed to accept the user',
  1093. 'error'
  1094. );
  1095. }
  1096. },
  1097. /*error: function (xhr, textStatus, errorThrown) {
  1098. loadingSwal.close(); // Close the loading popup
  1099. Swal.fire(
  1100. 'Error',
  1101. 'Failed to accept the user',
  1102. 'error'
  1103. );*/
  1104. //ak for headquarters
  1105. error: function (xhr, textStatus, errorThrown) {
  1106. loadingSwal.close();
  1107. console.log("textstaus"+xhr.responseText);
  1108. let responseData;
  1109. try {
  1110. responseData = JSON.parse(xhr.responseText);
  1111. } catch (e) {
  1112. responseData = null;
  1113. }
  1114. console.log("Response Data:", responseData);
  1115. /* if (responseData && responseData.approvedFlag === 1) {
  1116. $("#approvebutton").hide(); // hide approve button if already approved
  1117. Swal.fire(
  1118. 'Error',
  1119. 'Failed to Approve the Settlement',
  1120. 'error'
  1121. );*/
  1122. if (responseData && responseData.approvedFlag === 1) {
  1123. $("#approvebutton").hide(); // hide approve button if already approved
  1124. Swal.fire(
  1125. 'Error',
  1126. 'Failed to Approve the Settlement',
  1127. 'error'
  1128. ).then(() => {
  1129. location.reload(); // reload page after user closes the alert
  1130. });
  1131. } else {
  1132. Swal.fire(
  1133. 'Error',
  1134. 'Failed to Approve24 the Settlement',
  1135. 'error'
  1136. );
  1137. }
  1138. },
  1139. complete: function() {
  1140. // Re-enable the button after request completes (success or error)
  1141. acceptButton.disabled = false;
  1142. }
  1143. });
  1144. } else if (result.isDenied) {
  1145. Swal.fire('Changes are not saved', '', 'info');
  1146. }
  1147. });
  1148. }
  1149. function rejectsubmit() {
  1150. let id = document.getElementById("settlementid").value;
  1151. let reason = $("#reason").val();
  1152. Swal.fire({
  1153. title: 'Do you want to Reject this Settlement ?',
  1154. showDenyButton: true,
  1155. showCancelButton: true,
  1156. confirmButtonText: 'YES',
  1157. denyButtonText: 'NO',
  1158. }).then((result) => {
  1159. /* Read more about isConfirmed, isDenied below */
  1160. if (result.isConfirmed) {
  1161. // console.log("Submitting rejection...");
  1162. $.ajax({
  1163. type: "POST",
  1164. url: '/communityhall/api/officer/updateRejectSettlementStatus/' + id,
  1165. data: {
  1166. 'status': 'REJECTED',
  1167. 'comments': reason,
  1168. 'settlementId': id
  1169. },
  1170. success: function (data, textStatus, xhr) {
  1171. // console.log("Rejection successful");
  1172. if (xhr.status === 200) { // Check if the response status is OK
  1173. Swal.fire(
  1174. 'Done',
  1175. 'Successfully Rejected to the ID:' + id,
  1176. 'success'
  1177. ).then(() => {
  1178. location.reload();
  1179. });
  1180. } else {
  1181. Swal.fire(
  1182. 'Error',
  1183. 'Failed to reject the user',
  1184. 'error'
  1185. );
  1186. }
  1187. },
  1188. error: function (xhr, textStatus, errorThrown) {
  1189. console.error("Error:", errorThrown);
  1190. Swal.fire(
  1191. 'Error',
  1192. 'Failed to reject the user',
  1193. 'error'
  1194. );
  1195. }
  1196. });
  1197. } else if (result.isDenied) {
  1198. Swal.fire('Changes are not saved', '', 'info')
  1199. }
  1200. });
  1201. return false; // Prevent form submission
  1202. }
  1203. $(document).ready(function () {
  1204. $("#generatechallon").click(function () {
  1205. // Generate plain text content (replace with your actual content generation logic)
  1206. let textContent = "This is the content of the text file.";
  1207. // Create a Blob containing the text
  1208. let blob = new Blob([textContent], {type: "text/plain"});
  1209. // Create URL for the Blob
  1210. let url = URL.createObjectURL(blob);
  1211. // Get the download link element
  1212. let downloadLink = $("#downloadLink");
  1213. if (downloadLink.length === 0) {
  1214. console.error("Download link element not found");
  1215. return;
  1216. }
  1217. // Set download link attributes
  1218. downloadLink.attr({
  1219. href: url,
  1220. download: "challon.txt" // Specify the filename for download
  1221. });
  1222. // Simulate click on the download link
  1223. downloadLink[0].click();
  1224. // Clean up
  1225. URL.revokeObjectURL(url);
  1226. });
  1227. });
  1228. function cancelledbooking(bookingId) {
  1229. $.ajax({
  1230. type: "GET",
  1231. url: '/communityhall/api/officer/getBookingDetails',
  1232. data: {
  1233. 'bookingsId': bookingId
  1234. },
  1235. success: function (x) {
  1236. // console.log(x);
  1237. showcancelledbookingDetails(x);
  1238. }
  1239. });
  1240. }
  1241. function rejectedbooking(bookingId) {
  1242. $.ajax({
  1243. type: "GET",
  1244. url: '/communityhall/api/officer/getBookingDetails',
  1245. data: {
  1246. 'bookingsId': bookingId
  1247. },
  1248. success: function (x) {
  1249. // console.log(x);
  1250. showcancelledbookingDetails(x);
  1251. }
  1252. });
  1253. }
  1254. function showcancelledbookingDetails(list) {
  1255. $('#cancelledBookingForm').modal({
  1256. backdrop: 'static',
  1257. keyboard: false
  1258. });
  1259. $('#cancelledBookingForm').modal('show');
  1260. document.getElementById("username").innerHTML = list.users.name;
  1261. document.getElementById("mobileno").innerHTML = list.users.mobileNo;
  1262. document.getElementById("usertype").innerHTML = list.users.usertype;
  1263. document.getElementById("booksId").value = list.bookingId;
  1264. var userDetails = list.users;
  1265. var userDetailsString =
  1266. userDetails.doorNo + ", " +
  1267. userDetails.street + ", " +
  1268. userDetails.area + ", " +
  1269. userDetails.location + "- " +
  1270. userDetails.pinCode;
  1271. document.getElementById("useraddress").innerHTML = userDetailsString;
  1272. document.getElementById("hallname").innerHTML = list.hallDetails.hallName;
  1273. var hallDetails = list.hallDetails;
  1274. var hallDetailsString =
  1275. hallDetails.doorNo + ", " +
  1276. hallDetails.street + ", " +
  1277. hallDetails.area + ", " +
  1278. hallDetails.city + "- " +
  1279. hallDetails.pinCode;
  1280. document.getElementById("halladdress").innerHTML = hallDetailsString;
  1281. document.getElementById("caretakername").innerHTML = list.hallDetails.hallInchargeName;
  1282. document.getElementById("caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno;
  1283. document.getElementById("bookingDate").innerHTML = list.bookingDate;
  1284. document.getElementById("depositeAmount").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  1285. document.getElementById("hallAmount").innerHTML = '₹ ' + parseFloat(list.hallAmount).toFixed(2);
  1286. document.getElementById("totalAmount").innerHTML = '₹ ' + parseFloat(list.amountReceived).toFixed(2);
  1287. var gstcl = (list.hallAmount * (list.hallDetails.gst / 100));
  1288. var formattedGst = gstcl.toFixed(2);
  1289. document.getElementById("gst").innerHTML = '₹ ' + formattedGst;
  1290. document.getElementById("startDate").innerHTML = list.startDate;
  1291. document.getElementById("endDate").innerHTML = list.endDate;
  1292. document.getElementById("bookid").innerHTML = list.bookingId;
  1293. function getTimeSlot(slotValue) {
  1294. // console.log("Slot Value in getTimeSlot function:", slotValue);
  1295. var timeSlot;
  1296. var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
  1297. if (trimmedSlotValue === '1') {
  1298. timeSlot = 'Morning';
  1299. } else if (trimmedSlotValue === '2') {
  1300. timeSlot = 'Evening';
  1301. } else {
  1302. timeSlot = 'Unknown';
  1303. }
  1304. // console.log("Time Slot:", timeSlot);
  1305. return timeSlot;
  1306. }
  1307. document.getElementById("startingSlot").innerHTML = getTimeSlot(list.startingSlot);
  1308. document.getElementById("endingSlot").innerHTML = getTimeSlot(list.endingSlot);
  1309. document.getElementById("bookingStatus").innerHTML = list.bookingStatus;
  1310. document.getElementById("transactionId").innerHTML = list.payments.transactionId;
  1311. document.getElementById("payamountReceived").innerHTML = '₹ ' + list.payments.amountReceived;
  1312. document.getElementById("paymentStatus").innerHTML = list.payments.paymentStatus;
  1313. showReasonDocuments(list);
  1314. }
  1315. function showReasonDocuments(list) {
  1316. $.ajax({
  1317. type: "GET",
  1318. url: '/communityhall/api/officer/getReasonByName',
  1319. data: {
  1320. 'reasonName': list.reason
  1321. },
  1322. success: function (x) {
  1323. // console.log(x);
  1324. showReasonWithDocument(x, list);
  1325. }
  1326. });
  1327. }
  1328. // Display booking documents
  1329. function showReasonWithDocument(reasonData, list) {
  1330. var reasonDocumentData = reasonData.reasonDocumentMasterList;
  1331. var bookingDocumentsList = list.bookingDocumentsList;
  1332. const reasonFieldsContainer = $('#documents');
  1333. reasonFieldsContainer.empty();
  1334. // Create a responsive table container
  1335. var tableResponsiveDiv = $('<div>').addClass('table-responsive');
  1336. // Create the table with Bootstrap classes and custom styles
  1337. var table = $('<table>').addClass('table table-bordered table-striped table-vcenter js-dataTable-responsive').css({
  1338. 'width': '100%',
  1339. 'height': 'auto',
  1340. 'border': '1px solid black'
  1341. });
  1342. // Create the table header (thead)
  1343. var thead = $('<thead>').appendTo(table);
  1344. var headerRow = $('<tr>').appendTo(thead);
  1345. $('<th>').attr('colspan', '3').text('Document Details').css({
  1346. 'color': 'black',
  1347. 'font-weight': 'bold',
  1348. 'background-color': '#f2f2f2',
  1349. 'padding': '0.45rem 0.45rem'
  1350. }).appendTo(headerRow);
  1351. // Create header row for columns
  1352. var columnHeadersRow = $('<tr>').appendTo(thead);
  1353. $('<th>').text('S.No').appendTo(columnHeadersRow);
  1354. $('<th>').text('Required Info').appendTo(columnHeadersRow);
  1355. $('<th>').text('Required Documents').appendTo(columnHeadersRow);
  1356. // Create the table body (tbody)
  1357. var tbody = $('<tbody>').appendTo(table);
  1358. // Iterate through the documents list and populate rows
  1359. for (var i = 0; i < bookingDocumentsList.length; i++) {
  1360. (function (index) {
  1361. var row = $('<tr>').appendTo(tbody);
  1362. $('<td>').text(index + 1).appendTo(row);
  1363. $('<td>').text(reasonDocumentData[index].fieldName + ': ' + bookingDocumentsList[index].name).appendTo(row);
  1364. // Create a link to view document image
  1365. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
  1366. showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
  1367. });
  1368. $('<td>').append(viewLink).appendTo(row);
  1369. })(i);
  1370. }
  1371. // Append table to the responsive container
  1372. tableResponsiveDiv.append(table);
  1373. // Append table to the container in the DOM
  1374. reasonFieldsContainer.append(tableResponsiveDiv);
  1375. }
  1376. function showDocumentImage(fileURL) {
  1377. //console.log(fileURL);
  1378. openFileModal(fileURL);
  1379. }
  1380. // Event delegation for dynamically added elements
  1381. $(document).on('click', '.view-document', function () {
  1382. const fileURL = $(this).data('url');
  1383. openFileModal(fileURL);
  1384. });
  1385. function openFileModal(fileURL) {
  1386. $('#filePreview').attr('src', fileURL);
  1387. $('#fileModal').modal('show');
  1388. }
  1389. function approverefund() {
  1390. let id = document.getElementById("booksId").value;
  1391. const approveButton = document.getElementById("approvedButton");
  1392. Swal.fire({
  1393. title: 'Do you want to Approve this Settlement?',
  1394. showDenyButton: true,
  1395. showCancelButton: true,
  1396. confirmButtonText: 'YES',
  1397. denyButtonText: 'NO',
  1398. }).then((result) => {
  1399. if (result.isConfirmed) {
  1400. // Disable the button after user confirms
  1401. approveButton.disabled = true;
  1402. // Show the loading popup
  1403. const loadingSwal = Swal.fire({
  1404. title: 'Processing...',
  1405. text: 'Please wait while we approve the settlement.',
  1406. allowOutsideClick: false, // Prevent closing the popup
  1407. didOpen: () => {
  1408. Swal.showLoading(); // Show the loading spinner
  1409. },
  1410. showConfirmButton: false, // Hide the confirm button during loading
  1411. });
  1412. $.ajax({
  1413. type: "POST",
  1414. url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
  1415. data: {
  1416. 'status': 'APPROVED',
  1417. },
  1418. success: function (data, textStatus, xhr) {
  1419. loadingSwal.close(); // Close the loading popup
  1420. if (xhr.status === 200) {
  1421. Swal.fire(
  1422. 'Done',
  1423. 'Successfully Accepted to the ID:' + id,
  1424. 'success'
  1425. ).then(() => {
  1426. location.reload(); // Reload page after success
  1427. });
  1428. } else {
  1429. Swal.fire(
  1430. 'Error',
  1431. 'Failed to Approve the Refund',
  1432. 'error'
  1433. );
  1434. }
  1435. },
  1436. error: function (xhr, textStatus, errorThrown) {
  1437. loadingSwal.close(); // Close the loading popup
  1438. Swal.fire(
  1439. 'Error',
  1440. 'Failed to Approve the Refund',
  1441. 'error'
  1442. );
  1443. },
  1444. complete: function() {
  1445. // Re-enable the button after request completes (success or error)
  1446. approveButton.disabled = false;
  1447. }
  1448. });
  1449. } else if (result.isDenied) {
  1450. Swal.fire('Changes are not saved', '', 'info');
  1451. }
  1452. });
  1453. }
  1454. document.addEventListener('DOMContentLoaded', function () {
  1455. var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');
  1456. var ddDetailsFields = document.querySelectorAll('.dd-details input');
  1457. var ddDetailsContainer = document.querySelector('.dd-details');
  1458. var challonDetailsForm = document.getElementById('challonDetailsForm');
  1459. var submitButton = document.getElementById('submitChallonDetails');
  1460. // Toggle DD Details visibility and required status based on checkbox state
  1461. ddDetailsCheckbox.addEventListener('change', function () {
  1462. if (ddDetailsCheckbox.checked) {
  1463. ddDetailsContainer.style.display = 'flex';
  1464. ddDetailsFields.forEach(function (field) {
  1465. field.setAttribute('required', 'required');
  1466. });
  1467. } else {
  1468. ddDetailsContainer.style.display = 'none';
  1469. ddDetailsFields.forEach(function (field) {
  1470. field.removeAttribute('required');
  1471. field.value = ''; // Optionally clear the fields
  1472. field.classList.remove('is-invalid'); // Remove invalid class if any
  1473. });
  1474. }
  1475. });
  1476. // Handle form submission
  1477. submitButton.addEventListener('click', function () {
  1478. var isValid = challonDetailsForm.checkValidity();
  1479. if (isValid) {
  1480. // Form is valid, proceed with submission (e.g., via AJAX)
  1481. // Custom submission code here
  1482. } else {
  1483. // Trigger browser's validation messages
  1484. challonDetailsForm.classList.add('was-validated');
  1485. }
  1486. });
  1487. // Prevent form submission on Enter key
  1488. challonDetailsForm.addEventListener('submit', function (event) {
  1489. event.preventDefault();
  1490. event.stopPropagation();
  1491. });
  1492. });
  1493. $('#challonDetails').on('hidden.bs.modal', function () {
  1494. // Clear all input fields
  1495. $(this).find('form')[0].reset();
  1496. // Optionally, reset any custom styling or classes
  1497. $(this).find('input').removeClass('is-valid is-invalid');
  1498. });
  1499. </script>
  1500. </body>
  1501. </html>