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.

1641 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-admin :: 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-admin :: nav}"></nav>
  41. <!-- END Sidebar -->
  42. <!-- Header -->
  43. <header th:replace="~{fragments/header-admin :: 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. if (x.settlement && x.settlement.approvedFlag === 1) {
  858. $("#approvebutton").hide();
  859. } else {
  860. $("#approvebutton").show();
  861. }
  862. }
  863. });
  864. }
  865. function showSettlementInfo(list) {
  866. // console.log(list); // Log the damageList array
  867. // console.log(list.damageList[0]);
  868. $('#pendingSettlementForm').modal({
  869. backdrop: 'static',
  870. keyboard: false
  871. });
  872. $('#pendingSettlementForm').modal('show');
  873. document.getElementById("settlementid").value = list.settlement.settlementId;
  874. document.getElementById("td_userName").innerHTML = list.users.name;
  875. document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
  876. document.getElementById("td_usertype").innerHTML = list.users.usertype;
  877. var userDetails = list.users;
  878. var userDetailsString =
  879. userDetails.doorNo + ", " +
  880. userDetails.street + ", " +
  881. userDetails.area + ", " +
  882. userDetails.location + " ,Chennai- " +
  883. userDetails.pinCode;
  884. document.getElementById("td_useraddress").innerHTML = userDetailsString;
  885. document.getElementById("td_hallName").innerHTML = list.hallDetails.hallName;
  886. var hallDetails = list.hallDetails;
  887. var hallDetailsString =
  888. hallDetails.doorNo + ", " +
  889. hallDetails.street + ", " +
  890. hallDetails.area + ", " +
  891. hallDetails.city + "- " +
  892. hallDetails.pinCode;
  893. document.getElementById("td_halladdress").innerHTML = hallDetailsString;
  894. document.getElementById("td_caretakername").innerHTML = list.hallDetails.hallInchargeName;
  895. document.getElementById("td_caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno;
  896. document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
  897. document.getElementById("td_depositeAmount").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  898. document.getElementById("td_hallAmount").innerHTML = '₹ ' + parseFloat(list.hallAmount).toFixed(2);
  899. // Calculate GST and total amount
  900. var gstAmount = (parseFloat(list.hallAmount) * (list.hallDetails.gst / 100)).toFixed(2);
  901. var totalAmount = parseFloat(list.amountReceived).toFixed(2);
  902. document.getElementById("td_gst").innerHTML = '₹ ' + gstAmount;
  903. document.getElementById("td_totalAmount").innerHTML = '₹ ' + totalAmount;
  904. document.getElementById("td_startDate").innerHTML = list.startDate;
  905. document.getElementById("td_endDate").innerHTML = list.endDate;
  906. document.getElementById("booking_id").innerHTML = list.bookingId;
  907. function getTimeSlot(slotValue) {
  908. var timeSlot;
  909. var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
  910. if (trimmedSlotValue === '1') {
  911. timeSlot = 'Morning';
  912. } else if (trimmedSlotValue === '2') {
  913. timeSlot = 'Evening';
  914. } else {
  915. timeSlot = 'Unknown';
  916. }
  917. return timeSlot;
  918. }
  919. document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
  920. document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
  921. document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
  922. document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
  923. document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
  924. document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
  925. document.getElementById("td_ebamountperunit").innerHTML = '₹ ' + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
  926. document.getElementById("td_depositeamountforrefund").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  927. document.getElementById("td_electricityamount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2);
  928. document.getElementById("td_ebAmount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2);
  929. document.getElementById("td_damage").innerHTML = '₹ ' + parseFloat(list.settlement.damageAmount).toFixed(2);
  930. var eb_amt = parseFloat(list.ebDetails.ebAmount).toFixed(2);
  931. var deposit_amt = parseFloat(list.depositAmount).toFixed(2);
  932. var tem_total = (deposit_amt - eb_amt).toFixed(2);
  933. $("#td_settel_amt").html(tem_total);
  934. }
  935. function showDamageDetails(data) {
  936. var damageFieldContainer = $('#damageDetails');
  937. damageFieldContainer.empty();
  938. // Create a div for table responsiveness
  939. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
  940. // Create table with similar classes and styles to the modal table
  941. var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
  942. var thead = $('<thead>').addClass('thead-light');
  943. var tbody = $('<tbody>');
  944. // Create Damage Details header row
  945. var headerRow = $('<tr>').appendTo(thead);
  946. $('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
  947. 'padding': '0.45rem 0.45rem',
  948. 'background-color': '#f2f2f2',
  949. 'font-weight': 'bold',
  950. 'color': 'black',
  951. }).appendTo(headerRow);
  952. // Create table header row
  953. var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
  954. $('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  955. $('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  956. $('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  957. $('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  958. $('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  959. $('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  960. var totalAmount = 0;
  961. // Check if damageList is empty
  962. if (data.damageList.length === 0) {
  963. var row = $('<tr>').appendTo(tbody);
  964. $('<td>').attr('colspan', '6').text('No Damaged Items').css({
  965. 'padding': '0.45rem 0.45rem',
  966. 'text-align': 'center',
  967. 'font-weight': 'bold',
  968. 'background-color': '#f2f2f2'
  969. }).appendTo(row);
  970. } else {
  971. $.each(data.damageList, function (index, detail) {
  972. var row = $('<tr>').appendTo(tbody);
  973. $('<td>').text(index + 1).css({
  974. 'padding': '0.45rem 0.45rem',
  975. 'text-align': 'center'
  976. }).appendTo(row);
  977. $('<td>').text(detail.assetName).css({
  978. 'padding': '0.45rem 0.45rem',
  979. 'text-align': 'center'
  980. }).appendTo(row);
  981. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
  982. showDamageImage(detail.damageImageUrl);
  983. });
  984. $('<td>').css({
  985. 'padding': '0.45rem 0.45rem',
  986. 'text-align': 'center'
  987. }).append(viewLink).appendTo(row);
  988. var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
  989. $('<td>').text('₹ ' + assetamt).css({
  990. 'padding': '0.45rem 0.45rem',
  991. 'text-align': 'center'
  992. }).appendTo(row);
  993. $('<td>').text(detail.quantity).css({
  994. 'padding': '0.45rem 0.45rem',
  995. 'text-align': 'center'
  996. }).appendTo(row);
  997. var amount = detail.assetAmount;
  998. totalAmount += amount;
  999. $('<td>').text('₹ ' + amount.toFixed(2)).css({
  1000. 'padding': '0.45rem 0.45rem',
  1001. 'text-align': 'right'
  1002. }).appendTo(row);
  1003. });
  1004. // Add row for total amount
  1005. var totalRow = $('<tr>').appendTo(tbody);
  1006. $('<td>').attr('colspan', '5').text('Total Amount').css({
  1007. 'padding': '0.45rem 0.45rem',
  1008. 'font-weight': 'bold',
  1009. 'background-color': '#f2f2f2'
  1010. }).appendTo(totalRow);
  1011. $('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
  1012. 'padding': '0.45rem 0.45rem',
  1013. 'text-align': 'right'
  1014. }).appendTo(totalRow);
  1015. $("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
  1016. }
  1017. // Append the table elements to the container div
  1018. table.append(thead, tbody);
  1019. tableResponsiveDiv.append(table);
  1020. damageFieldContainer.append(tableResponsiveDiv);
  1021. var temp_total = parseFloat($("#td_settel_amt").html());
  1022. var settleAmount = temp_total - totalAmount;
  1023. var refundStatus = data.refundStatus;
  1024. var pendingstatus=data.settlement.collectionStatus
  1025. if (settleAmount < 0) {
  1026. // console.log(settleAmount);
  1027. $("#td_settel_amt").html(0.00);
  1028. $("#pendingcolumn").show();
  1029. $("#collectionstatuscolumn").show();
  1030. $('#td_collection_status').html(pendingstatus);
  1031. $("#td_pending_amt").html('₹ ' + Math.abs(settleAmount).toFixed(2));
  1032. $("#td_pending_amt").css("color", "red");
  1033. $("#approvebutton").prop("disabled", true);
  1034. $("#rejectbutton").show();
  1035. } else {
  1036. $("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
  1037. $("#pendingcolumn").hide();
  1038. $("#collectionstatuscolumn").hide();
  1039. $("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
  1040. $("#approvebutton").prop("disabled", false);
  1041. }
  1042. }
  1043. function showDamageImage(damageImageUrl) {
  1044. document.getElementById('filePreview').src = damageImageUrl;
  1045. $('#fileModal').modal('show');
  1046. }
  1047. function accept() {
  1048. let id = document.getElementById("settlementid").value;
  1049. const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
  1050. Swal.fire({
  1051. title: 'Do you want to Approve this Settlement?',
  1052. showDenyButton: true,
  1053. showCancelButton: true,
  1054. confirmButtonText: 'YES',
  1055. denyButtonText: 'NO',
  1056. }).then((result) => {
  1057. if (result.isConfirmed) {
  1058. // Disable the button to prevent multiple clicks
  1059. acceptButton.disabled = true;
  1060. // Show the loading screen
  1061. const loadingSwal = Swal.fire({
  1062. title: 'Processing...',
  1063. text: 'Please wait while we approve the settlement.',
  1064. allowOutsideClick: false, // Prevent closing the popup
  1065. didOpen: () => {
  1066. Swal.showLoading(); // Show the loading spinner
  1067. },
  1068. showConfirmButton: false, // Hide the confirm button during loading
  1069. });
  1070. $.ajax({
  1071. type: "POST",
  1072. url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
  1073. data: {
  1074. 'status': 'APPROVED',
  1075. 'comments': 'Accepted',
  1076. 'settlementId': id
  1077. },
  1078. success: function (data, textStatus, xhr) {
  1079. loadingSwal.close(); // Close the loading popup
  1080. if (xhr.status === 200) {
  1081. Swal.fire(
  1082. 'Done',
  1083. 'Successfully Accepted to the ID: ' + id,
  1084. 'success'
  1085. ).then(() => {
  1086. location.reload(); // Reload the page after success
  1087. });
  1088. } else {
  1089. Swal.fire(
  1090. 'Error',
  1091. 'Failed to accept the user',
  1092. 'error'
  1093. );
  1094. }
  1095. },
  1096. /*error: function (xhr, textStatus, errorThrown) {
  1097. loadingSwal.close(); // Close the loading popup
  1098. Swal.fire(
  1099. 'Error',
  1100. 'Failed to accept the user',
  1101. 'error'
  1102. );
  1103. },*/
  1104. error: function (xhr, textStatus, errorThrown) {
  1105. loadingSwal.close();
  1106. console.log("textstaus"+xhr.responseText);
  1107. let responseData;
  1108. try {
  1109. responseData = JSON.parse(xhr.responseText);
  1110. } catch (e) {
  1111. responseData = null;
  1112. }
  1113. /* if (responseData && responseData.approvedFlag === 1) {
  1114. $("#approvebutton").hide(); // hide approve button if already approved
  1115. Swal.fire(
  1116. 'Error',
  1117. 'Failed to Approve the Settlement',
  1118. 'error'
  1119. );*/
  1120. if (responseData && responseData.approvedFlag === 1) {
  1121. $("#approvebutton").hide(); // hide approve button if already approved
  1122. Swal.fire(
  1123. 'Error',
  1124. 'Failed to Approve the Settlement',
  1125. 'error'
  1126. ).then(() => {
  1127. location.reload(); // reload page after user closes the alert
  1128. });
  1129. } else {
  1130. Swal.fire(
  1131. 'Error',
  1132. 'Failed to Approve the Settlement',
  1133. 'error'
  1134. );
  1135. }
  1136. },
  1137. complete: function() {
  1138. // Re-enable the button after request completes (success or error)
  1139. acceptButton.disabled = false;
  1140. }
  1141. });
  1142. } else if (result.isDenied) {
  1143. Swal.fire('Changes are not saved', '', 'info');
  1144. }
  1145. });
  1146. }
  1147. function rejectsubmit() {
  1148. let id = document.getElementById("settlementid").value;
  1149. let reason = $("#reason").val();
  1150. Swal.fire({
  1151. title: 'Do you want to Reject this Settlement ?',
  1152. showDenyButton: true,
  1153. showCancelButton: true,
  1154. confirmButtonText: 'YES',
  1155. denyButtonText: 'NO',
  1156. }).then((result) => {
  1157. /* Read more about isConfirmed, isDenied below */
  1158. if (result.isConfirmed) {
  1159. // console.log("Submitting rejection...");
  1160. $.ajax({
  1161. type: "POST",
  1162. url: '/communityhall/api/officer/updateRejectSettlementStatus/' + id,
  1163. data: {
  1164. 'status': 'REJECTED',
  1165. 'comments': reason,
  1166. 'settlementId': id
  1167. },
  1168. success: function (data, textStatus, xhr) {
  1169. // console.log("Rejection successful");
  1170. if (xhr.status === 200) { // Check if the response status is OK
  1171. Swal.fire(
  1172. 'Done',
  1173. 'Successfully Rejected to the ID:' + id,
  1174. 'success'
  1175. ).then(() => {
  1176. location.reload();
  1177. });
  1178. } else {
  1179. Swal.fire(
  1180. 'Error',
  1181. 'Failed to reject the user',
  1182. 'error'
  1183. );
  1184. }
  1185. },
  1186. error: function (xhr, textStatus, errorThrown) {
  1187. console.error("Error:", errorThrown);
  1188. Swal.fire(
  1189. 'Error',
  1190. 'Failed to reject the user',
  1191. 'error'
  1192. );
  1193. }
  1194. });
  1195. } else if (result.isDenied) {
  1196. Swal.fire('Changes are not saved', '', 'info')
  1197. }
  1198. });
  1199. return false; // Prevent form submission
  1200. }
  1201. $(document).ready(function () {
  1202. $("#generatechallon").click(function () {
  1203. // Generate plain text content (replace with your actual content generation logic)
  1204. let textContent = "This is the content of the text file.";
  1205. // Create a Blob containing the text
  1206. let blob = new Blob([textContent], {type: "text/plain"});
  1207. // Create URL for the Blob
  1208. let url = URL.createObjectURL(blob);
  1209. // Get the download link element
  1210. let downloadLink = $("#downloadLink");
  1211. if (downloadLink.length === 0) {
  1212. console.error("Download link element not found");
  1213. return;
  1214. }
  1215. // Set download link attributes
  1216. downloadLink.attr({
  1217. href: url,
  1218. download: "challon.txt" // Specify the filename for download
  1219. });
  1220. // Simulate click on the download link
  1221. downloadLink[0].click();
  1222. // Clean up
  1223. URL.revokeObjectURL(url);
  1224. });
  1225. });
  1226. function cancelledbooking(bookingId) {
  1227. $.ajax({
  1228. type: "GET",
  1229. url: '/communityhall/api/officer/getBookingDetails',
  1230. data: {
  1231. 'bookingsId': bookingId
  1232. },
  1233. success: function (x) {
  1234. // console.log(x);
  1235. showcancelledbookingDetails(x);
  1236. }
  1237. });
  1238. }
  1239. function rejectedbooking(bookingId) {
  1240. $.ajax({
  1241. type: "GET",
  1242. url: '/communityhall/api/officer/getBookingDetails',
  1243. data: {
  1244. 'bookingsId': bookingId
  1245. },
  1246. success: function (x) {
  1247. // console.log(x);
  1248. showcancelledbookingDetails(x);
  1249. }
  1250. });
  1251. }
  1252. function showcancelledbookingDetails(list) {
  1253. $('#cancelledBookingForm').modal({
  1254. backdrop: 'static',
  1255. keyboard: false
  1256. });
  1257. $('#cancelledBookingForm').modal('show');
  1258. document.getElementById("username").innerHTML = list.users.name;
  1259. document.getElementById("mobileno").innerHTML = list.users.mobileNo;
  1260. document.getElementById("usertype").innerHTML = list.users.usertype;
  1261. document.getElementById("booksId").value = list.bookingId;
  1262. var userDetails = list.users;
  1263. var userDetailsString =
  1264. userDetails.doorNo + ", " +
  1265. userDetails.street + ", " +
  1266. userDetails.area + ", " +
  1267. userDetails.location + "- " +
  1268. userDetails.pinCode;
  1269. document.getElementById("useraddress").innerHTML = userDetailsString;
  1270. document.getElementById("hallname").innerHTML = list.hallDetails.hallName;
  1271. var hallDetails = list.hallDetails;
  1272. var hallDetailsString =
  1273. hallDetails.doorNo + ", " +
  1274. hallDetails.street + ", " +
  1275. hallDetails.area + ", " +
  1276. hallDetails.city + "- " +
  1277. hallDetails.pinCode;
  1278. document.getElementById("halladdress").innerHTML = hallDetailsString;
  1279. document.getElementById("caretakername").innerHTML = list.hallDetails.hallInchargeName;
  1280. document.getElementById("caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno;
  1281. document.getElementById("bookingDate").innerHTML = list.bookingDate;
  1282. document.getElementById("depositeAmount").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  1283. document.getElementById("hallAmount").innerHTML = '₹ ' + parseFloat(list.hallAmount).toFixed(2);
  1284. document.getElementById("totalAmount").innerHTML = '₹ ' + parseFloat(list.amountReceived).toFixed(2);
  1285. var gstcl = (list.hallAmount * (list.hallDetails.gst / 100));
  1286. var formattedGst = gstcl.toFixed(2);
  1287. document.getElementById("gst").innerHTML = '₹ ' + formattedGst;
  1288. document.getElementById("startDate").innerHTML = list.startDate;
  1289. document.getElementById("endDate").innerHTML = list.endDate;
  1290. document.getElementById("bookid").innerHTML = list.bookingId;
  1291. function getTimeSlot(slotValue) {
  1292. // console.log("Slot Value in getTimeSlot function:", slotValue);
  1293. var timeSlot;
  1294. var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
  1295. if (trimmedSlotValue === '1') {
  1296. timeSlot = 'Morning';
  1297. } else if (trimmedSlotValue === '2') {
  1298. timeSlot = 'Evening';
  1299. } else {
  1300. timeSlot = 'Unknown';
  1301. }
  1302. // console.log("Time Slot:", timeSlot);
  1303. return timeSlot;
  1304. }
  1305. document.getElementById("startingSlot").innerHTML = getTimeSlot(list.startingSlot);
  1306. document.getElementById("endingSlot").innerHTML = getTimeSlot(list.endingSlot);
  1307. document.getElementById("bookingStatus").innerHTML = list.bookingStatus;
  1308. document.getElementById("transactionId").innerHTML = list.payments.transactionId;
  1309. document.getElementById("payamountReceived").innerHTML = '₹ ' + list.payments.amountReceived;
  1310. document.getElementById("paymentStatus").innerHTML = list.payments.paymentStatus;
  1311. showReasonDocuments(list);
  1312. }
  1313. function showReasonDocuments(list) {
  1314. $.ajax({
  1315. type: "GET",
  1316. url: '/communityhall/api/officer/getReasonByName',
  1317. data: {
  1318. 'reasonName': list.reason
  1319. },
  1320. success: function (x) {
  1321. // console.log(x);
  1322. showReasonWithDocument(x, list);
  1323. }
  1324. });
  1325. }
  1326. // Display booking documents
  1327. function showReasonWithDocument(reasonData, list) {
  1328. var reasonDocumentData = reasonData.reasonDocumentMasterList;
  1329. var bookingDocumentsList = list.bookingDocumentsList;
  1330. const reasonFieldsContainer = $('#documents');
  1331. reasonFieldsContainer.empty();
  1332. // Create a responsive table container
  1333. var tableResponsiveDiv = $('<div>').addClass('table-responsive');
  1334. // Create the table with Bootstrap classes and custom styles
  1335. var table = $('<table>').addClass('table table-bordered table-striped table-vcenter js-dataTable-responsive').css({
  1336. 'width': '100%',
  1337. 'height': 'auto',
  1338. 'border': '1px solid black'
  1339. });
  1340. // Create the table header (thead)
  1341. var thead = $('<thead>').appendTo(table);
  1342. var headerRow = $('<tr>').appendTo(thead);
  1343. $('<th>').attr('colspan', '3').text('Document Details').css({
  1344. 'color': 'black',
  1345. 'font-weight': 'bold',
  1346. 'background-color': '#f2f2f2',
  1347. 'padding': '0.45rem 0.45rem'
  1348. }).appendTo(headerRow);
  1349. // Create header row for columns
  1350. var columnHeadersRow = $('<tr>').appendTo(thead);
  1351. $('<th>').text('S.No').appendTo(columnHeadersRow);
  1352. $('<th>').text('Required Info').appendTo(columnHeadersRow);
  1353. $('<th>').text('Required Documents').appendTo(columnHeadersRow);
  1354. // Create the table body (tbody)
  1355. var tbody = $('<tbody>').appendTo(table);
  1356. // Iterate through the documents list and populate rows
  1357. for (var i = 0; i < bookingDocumentsList.length; i++) {
  1358. (function (index) {
  1359. var row = $('<tr>').appendTo(tbody);
  1360. $('<td>').text(index + 1).appendTo(row);
  1361. $('<td>').text(reasonDocumentData[index].fieldName + ': ' + bookingDocumentsList[index].name).appendTo(row);
  1362. // Create a link to view document image
  1363. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
  1364. showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
  1365. });
  1366. $('<td>').append(viewLink).appendTo(row);
  1367. })(i);
  1368. }
  1369. // Append table to the responsive container
  1370. tableResponsiveDiv.append(table);
  1371. // Append table to the container in the DOM
  1372. reasonFieldsContainer.append(tableResponsiveDiv);
  1373. }
  1374. function showDocumentImage(fileURL) {
  1375. //console.log(fileURL);
  1376. openFileModal(fileURL);
  1377. }
  1378. // Event delegation for dynamically added elements
  1379. $(document).on('click', '.view-document', function () {
  1380. const fileURL = $(this).data('url');
  1381. openFileModal(fileURL);
  1382. });
  1383. function openFileModal(fileURL) {
  1384. $('#filePreview').attr('src', fileURL);
  1385. $('#fileModal').modal('show');
  1386. }
  1387. function approverefund() {
  1388. let id = document.getElementById("booksId").value;
  1389. const approveButton = document.getElementById("approvedButton");
  1390. Swal.fire({
  1391. title: 'Do you want to Approve this Settlement?',
  1392. showDenyButton: true,
  1393. showCancelButton: true,
  1394. confirmButtonText: 'YES',
  1395. denyButtonText: 'NO',
  1396. }).then((result) => {
  1397. if (result.isConfirmed) {
  1398. // Disable the button after user confirms
  1399. approveButton.disabled = true;
  1400. // Show the loading popup
  1401. const loadingSwal = Swal.fire({
  1402. title: 'Processing...',
  1403. text: 'Please wait while we approve the settlement.',
  1404. allowOutsideClick: false, // Prevent closing the popup
  1405. didOpen: () => {
  1406. Swal.showLoading(); // Show the loading spinner
  1407. },
  1408. showConfirmButton: false, // Hide the confirm button during loading
  1409. });
  1410. $.ajax({
  1411. type: "POST",
  1412. url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
  1413. data: {
  1414. 'status': 'APPROVED',
  1415. },
  1416. success: function (data, textStatus, xhr) {
  1417. loadingSwal.close(); // Close the loading popup
  1418. if (xhr.status === 200) {
  1419. Swal.fire(
  1420. 'Done',
  1421. 'Successfully Accepted to the ID:' + id,
  1422. 'success'
  1423. ).then(() => {
  1424. location.reload(); // Reload page after success
  1425. });
  1426. } else {
  1427. Swal.fire(
  1428. 'Error',
  1429. 'Failed to Approve the Refund',
  1430. 'error'
  1431. );
  1432. }
  1433. },
  1434. error: function (xhr, textStatus, errorThrown) {
  1435. loadingSwal.close(); // Close the loading popup
  1436. Swal.fire(
  1437. 'Error',
  1438. 'Failed to Approve the Refund',
  1439. 'error'
  1440. );
  1441. },
  1442. complete: function() {
  1443. // Re-enable the button after request completes (success or error)
  1444. approveButton.disabled = false;
  1445. }
  1446. });
  1447. } else if (result.isDenied) {
  1448. Swal.fire('Changes are not saved', '', 'info');
  1449. }
  1450. });
  1451. }
  1452. document.addEventListener('DOMContentLoaded', function () {
  1453. var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');
  1454. var ddDetailsFields = document.querySelectorAll('.dd-details input');
  1455. var ddDetailsContainer = document.querySelector('.dd-details');
  1456. var challonDetailsForm = document.getElementById('challonDetailsForm');
  1457. var submitButton = document.getElementById('submitChallonDetails');
  1458. // Toggle DD Details visibility and required status based on checkbox state
  1459. ddDetailsCheckbox.addEventListener('change', function () {
  1460. if (ddDetailsCheckbox.checked) {
  1461. ddDetailsContainer.style.display = 'flex';
  1462. ddDetailsFields.forEach(function (field) {
  1463. field.setAttribute('required', 'required');
  1464. });
  1465. } else {
  1466. ddDetailsContainer.style.display = 'none';
  1467. ddDetailsFields.forEach(function (field) {
  1468. field.removeAttribute('required');
  1469. field.value = ''; // Optionally clear the fields
  1470. field.classList.remove('is-invalid'); // Remove invalid class if any
  1471. });
  1472. }
  1473. });
  1474. // Handle form submission
  1475. submitButton.addEventListener('click', function () {
  1476. var isValid = challonDetailsForm.checkValidity();
  1477. if (isValid) {
  1478. // Form is valid, proceed with submission (e.g., via AJAX)
  1479. // Custom submission code here
  1480. } else {
  1481. // Trigger browser's validation messages
  1482. challonDetailsForm.classList.add('was-validated');
  1483. }
  1484. });
  1485. // Prevent form submission on Enter key
  1486. challonDetailsForm.addEventListener('submit', function (event) {
  1487. event.preventDefault();
  1488. event.stopPropagation();
  1489. });
  1490. });
  1491. $('#challonDetails').on('hidden.bs.modal', function () {
  1492. // Clear all input fields
  1493. $(this).find('form')[0].reset();
  1494. // Optionally, reset any custom styling or classes
  1495. $(this).find('input').removeClass('is-valid is-invalid');
  1496. });
  1497. </script>
  1498. </body>
  1499. </html>