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.

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