Victoria Hall Booking for Events
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

421 lines
14 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-public :: head}"></head>
  4. <style>
  5. table {
  6. width: 100%;
  7. padding: 100px;
  8. }
  9. th,
  10. td {
  11. padding: 8px;
  12. text-align: left;
  13. }
  14. </style>
  15. <body>
  16. <!-- Page Container -->
  17. <div id="page-container"
  18. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  19. <!-- Sidebar Nav-->
  20. <nav th:replace="~{fragments/nav-officer :: nav}"></nav>
  21. <!-- END Sidebar -->
  22. <!-- Header -->
  23. <header th:replace="~{fragments/header-officer :: header}"></header>
  24. <!-- END Header -->
  25. <!-- Main Container -->
  26. <main id="main-container">
  27. <div class="block-header block-header-default">
  28. <h3 class="block-title"> List of Bookings</h3>
  29. </div>
  30. <div class="block-content p-0">
  31. <div class="p-sm-4 p-0">
  32. <div class="table-responsive">
  33. <table class="table table-bordered table-striped table-vcenter js-dataTable-responsive">
  34. <thead class="thead-light">
  35. <tr>
  36. <th class="text-center no-sort" width="10%">S.No</th>
  37. <th class="text-center" width="20%">User Details</th>
  38. <th class="text-center" width="20%">Booking Details</th>
  39. <th class="text-center" width="20%">Status</th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. <tr th:each="counterRefund, rowStat : ${counterRefund}">
  44. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  45. <td class="text-center">
  46. <button type="button" class="btn btn-primary" data-bs-toggle="modal"
  47. data-bs-target="#exampleModal"
  48. th:onclick="UserDetails([[${counterRefund.counterDetails}]])">View</button>
  49. </td>
  50. <td class="text-center">
  51. <button type="button" class="btn btn-primary" data-bs-toggle="modal"
  52. data-bs-target="#exampleModal"
  53. th:onclick="BookingDetails([[${counterRefund.counterDetails}]])">View</button>
  54. </td>
  55. <td>
  56. <p>
  57. <span class="badge bg-warning" style="cursor: pointer;"
  58. th:onclick="approve([[${counterRefund.letterdocument}]],[[${counterRefund.id}]])">INITIATED</span>
  59. </p>
  60. </td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. </div>
  65. </div>
  66. </div>
  67. </main>
  68. <div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
  69. aria-hidden="true">
  70. <div class="modal-dialog modal-lg" role="document">
  71. <div class="modal-content">
  72. <div class="modal-header">
  73. <h5 class="modal-title" id="fileModalLabel">File Preview</h5>
  74. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  75. <span aria-hidden="true">&times;</span>
  76. </button>
  77. </div>
  78. <div class="modal-body">
  79. <embed id="filePreview" src="" width="100%" height="600px">
  80. </div>
  81. <div class="modal-footer">
  82. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  83. <button type="button" class="btn btn-primary" id="acceptButton"
  84. onclick="accept()">ACCEPT</button>
  85. <button type="button" class="btn btn-primary" id="rejectButton"
  86. onclick="reject()">REJECT</button>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="modal fade" id="userDetails" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  92. <div class="modal-dialog modal-lg">
  93. <div class="modal-content">
  94. <div class="modal-header">
  95. <h5 class="modal-title" id="exampleModalLabel">User Details</h5>
  96. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  97. </div>
  98. <div class="modal-body">
  99. <div class="row">
  100. <div class="col-sm-4">
  101. <label class="form-label" for="name">Name:<span class="text-danger"></span></label>
  102. <input type="text" class="form-control text-center" name="name" id="name" readonly />
  103. </div>
  104. <div class="col-sm-4">
  105. <label class="form-label" for="mobileno">Mobile Number:<span
  106. class="text-danger"></span></label>
  107. <input type="text" class="form-control text-center" name="mobileno" id="mobileno"
  108. readonly />
  109. </div>
  110. <div class="col-sm-4">
  111. <label class="form-label" for="email">E-Mail ID:<span class="text-danger"></span></label>
  112. <input type="text" class="form-control text-center" name="email" id="email" readonly />
  113. </div>
  114. <div class="col-sm-4">
  115. <label class="form-label" for="usertype">User type:<span
  116. class="text-danger"></span></label>
  117. <input type="text" class="form-control text-center" name="usertype" id="usertype"
  118. readonly />
  119. </div>
  120. <div class="col-sm-4">
  121. <label class="form-label" for="street">Street:<span class="text-danger"></span></label>
  122. <input type="text" class="form-control text-center" name="street" id="street"
  123. readonly />
  124. </div>
  125. <div class="col-sm-4">
  126. <label class="form-label" for="area">Area:<span class="text-danger"></span></label>
  127. <input type="text" class="form-control text-center" name="area" id="area" readonly />
  128. </div>
  129. <div class="col-sm-4">
  130. <label class="form-label" for="location">Location:<span
  131. class="text-danger"></span></label>
  132. <input type="text" class="form-control text-center" name="location" id="location"
  133. readonly />
  134. </div>
  135. <div class="col-sm-4">
  136. <label class="form-label" for="pincode">Pincode:<span
  137. class="text-danger"></span></label>
  138. <input type="text" class="form-control text-center" name="pincode" id="pincode"
  139. readonly />
  140. </div>
  141. </div>
  142. </div>
  143. <div class="modal-footer">
  144. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="modal fade" id="bookingDetails" tabindex="-1" aria-labelledby="exampleModalLabel"
  150. aria-hidden="true">
  151. <div class="modal-dialog modal-lg">
  152. <div class="modal-content">
  153. <div class="modal-header">
  154. <h5 class="modal-title" id="exampleModalLabel">Booking Details</h5>
  155. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  156. </div>
  157. <div class="modal-body">
  158. <div class="row">
  159. <div class="col-sm-4">
  160. <label class="form-label" for="noofdays">No of Days:<span
  161. class="text-danger"></span></label>
  162. <input type="text" class="form-control text-center" name="noofdays" id="noofdays"
  163. readonly />
  164. </div>
  165. <div class="col-sm-4">
  166. <label class="form-label" for="startdate">Start Date:<span
  167. class="text-danger"></span></label>
  168. <input type="text" class="form-control text-center" name="startdate" id="startdate"
  169. readonly />
  170. </div>
  171. <div class="col-sm-4">
  172. <label class="form-label" for="enddate">End Date:<span
  173. class="text-danger"></span></label>
  174. <input type="text" class="form-control text-center" name="enddate" id="enddate"
  175. readonly />
  176. </div>
  177. <div class="col-sm-4">
  178. <label class="form-label" for="startingslot">Starting Slot<span
  179. class="text-danger"></span></label>
  180. <input type="text" class="form-control text-center" name="startingslot"
  181. id="startingslot" readonly />
  182. </div>
  183. <div class="col-sm-4">
  184. <label class="form-label" for="endingslot">Ending Slot<span
  185. class="text-danger"></span></label>
  186. <input type="text" class="form-control text-center" name="endingslot" id="endingslot"
  187. readonly />
  188. </div>
  189. <div class="col-sm-4">
  190. <label class="form-label" for="bookingdate">Booking Date<span
  191. class="text-danger"></span></label>
  192. <input type="text" class="form-control text-center" name="bookingdate" id="bookingdate"
  193. readonly />
  194. </div>
  195. <div class="col-sm-4">
  196. <label class="form-label" for="bookingstatus">Booking Status<span
  197. class="text-danger"></span></label>
  198. <input type="text" class="form-control text-center" name="bookingstatus"
  199. id="bookingstatus" readonly />
  200. </div>
  201. <div class="col-sm-4">
  202. <label class="form-label" for="bankname">Bank Name<span
  203. class="text-danger"></span></label>
  204. <input type="text" class="form-control text-center" name="bankname" id="bankname"
  205. readonly />
  206. </div>
  207. <div class="col-sm-4">
  208. <label class="form-label" for="bankaccno">Bank Account No<span
  209. class="text-danger"></span></label>
  210. <input type="text" class="form-control text-center" name="bankaccno" id="bankaccno"
  211. readonly />
  212. </div>
  213. <div class="col-sm-4">
  214. <label class="form-label" for="amountreceived">Amount Received<span
  215. class="text-danger"></span></label>
  216. <input type="text" class="form-control text-center" name="amountreceived"
  217. id="amountreceived" readonly />
  218. </div>
  219. <div class="col-sm-4">
  220. <label class="form-label" for="ddnumber">DD Number<span
  221. class="text-danger"></span></label>
  222. <input type="text" class="form-control text-center" name="ddnumber" id="ddnumber"
  223. readonly />
  224. </div>
  225. </div>
  226. </div>
  227. <div class="modal-footer">
  228. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. <!--Booking Information model -->
  234. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  235. </div>
  236. <script th:replace="~{fragments/script :: script}"></script>
  237. <script>
  238. function UserDetails(counterDetails) {
  239. //console.log("Initial Counter Details:", counterDetails);
  240. var counterId = counterDetails.counterId;
  241. $.ajax({
  242. url: '/victoriahallbooking/user/api/counterdetails',
  243. type: 'GET',
  244. data: {counterId: counterId},
  245. success: function (response) {
  246. //console.log("Fetched User Details:", response);
  247. // Assuming the response is an array and we need the first element
  248. if (response.length > 0) {
  249. var userDetails = response[0].users;
  250. // Populate booking information
  251. $('#name').val(userDetails.name);
  252. $('#mobileno').val(userDetails.mobileNo);
  253. $('#email').val(userDetails.email);
  254. $('#usertype').val(userDetails.usertype);
  255. $('#street').val(userDetails.street);
  256. $('#area').val(userDetails.area);
  257. $('#location').val(userDetails.location);
  258. $('#pincode').val(userDetails.pinCode);
  259. // Show the modal
  260. $('#userDetails').modal('show');
  261. } else {
  262. console.error('No user details found for the given counter ID');
  263. }
  264. },
  265. error: function (xhr, status, error) {
  266. console.error('Failed to fetch user details:', error);
  267. }
  268. });
  269. }
  270. function BookingDetails(counterDetails) {
  271. var counterId = counterDetails.counterId;
  272. $.ajax({
  273. url: '/victoriahallbooking/user/api/counterdetails',
  274. type: 'GET',
  275. data: {counterId: counterId},
  276. success: function (response) {
  277. if (response.length > 0) {
  278. var bookingDetails = response[0];
  279. $('#noofdays').val(bookingDetails.noOfDays);
  280. $('#startdate').val(bookingDetails.startDate);
  281. $('#enddate').val(bookingDetails.endDate);
  282. $('#startingslot').val(bookingDetails.startingSlot);
  283. $('#endingslot').val(bookingDetails.endingSlot);
  284. $('#bookingdate').val(bookingDetails.bookingDate);
  285. $('#bookingstatus').val(bookingDetails.bookingStatus);
  286. $('#bankname').val(bookingDetails.counterDetails.bankName);
  287. $('#bankaccno').val(bookingDetails.counterDetails.bankAccNo);
  288. $('#amountreceived').val(bookingDetails.counterDetails.amountReceived);
  289. $('#ddnumber').val(bookingDetails.counterDetails.ddNumber);
  290. $('#bookingDetails').modal('show');
  291. } else {
  292. console.error('No booking details found for the given counter ID');
  293. }
  294. },
  295. error: function (xhr, status, error) {
  296. console.error('Failed to fetch booking details:', error);
  297. }
  298. });
  299. }
  300. function approve(letterdocument, id) {
  301. document.getElementById('filePreview').src = letterdocument;
  302. $('#acceptButton').data('id', id);
  303. $('#rejectButton').data('id', id);
  304. $('#fileModal').modal('show');
  305. }
  306. function accept() {
  307. const id = $('#acceptButton').data('id');
  308. Swal.fire({
  309. title: 'Do you want to Accept this Refund?',
  310. showDenyButton: true,
  311. showCancelButton: true,
  312. confirmButtonText: 'YES',
  313. }).then((result) => {
  314. if (result.isConfirmed) {
  315. $.ajax({
  316. type: "POST",
  317. url: '/victoriahallbooking/api/officer/approveRefund/' + id,
  318. data: {'id': id},
  319. success: function (data, textStatus, xhr) {
  320. if (xhr.status === 200) { // Check if the response status is OK
  321. Swal.fire(
  322. 'Done',
  323. 'Successfully Approved the Refund to the ID:' + id,
  324. 'success'
  325. ).then(() => {
  326. location.reload(); // Reload the page after success message
  327. });
  328. } else {
  329. Swal.fire(
  330. 'Error',
  331. 'Failed to accept the user',
  332. 'error'
  333. );
  334. }
  335. },
  336. error: function (xhr, textStatus, errorThrown) {
  337. Swal.fire(
  338. 'Error',
  339. 'Failed to accept the user',
  340. 'error'
  341. );
  342. }
  343. });
  344. } else if (result.isDenied) {
  345. Swal.fire('Changes are not saved', '', 'info');
  346. }
  347. });
  348. }
  349. function reject() {
  350. const id = $('#rejectButton').data('id');
  351. Swal.fire({
  352. title: 'Do you want to Reject this Refund?',
  353. showDenyButton: true,
  354. showCancelButton: true,
  355. confirmButtonText: 'YES',
  356. }).then((result) => {
  357. if (result.isConfirmed) {
  358. $.ajax({
  359. type: "POST",
  360. url: '/victoriahallbooking/api/officer/rejectRefund/' + id,
  361. data: {'id': id},
  362. success: function (data, textStatus, xhr) {
  363. if (xhr.status === 200) { // Check if the response status is OK
  364. Swal.fire(
  365. 'Done',
  366. 'Successfully Rejected the Refund for the ID: ' + id,
  367. 'success'
  368. ).then(() => {
  369. window.location.reload(); // Reload the page after success message
  370. });
  371. } else {
  372. Swal.fire(
  373. 'Error',
  374. 'Failed to reject the refund',
  375. 'error'
  376. );
  377. }
  378. },
  379. error: function (xhr, textStatus, errorThrown) {
  380. Swal.fire(
  381. 'Error',
  382. 'Failed to reject the refund',
  383. 'error'
  384. );
  385. }
  386. });
  387. } else if (result.isDenied) {
  388. Swal.fire('Changes are not saved', '', 'info');
  389. }
  390. });
  391. }
  392. </script>
  393. </body>
  394. </html>