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.

218 lines
6.4 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-counter :: head}">
  4. <body>
  5. <!-- Page Container -->
  6. <div id="page-container"
  7. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  8. <!-- Side Overlay aside (right)-->
  9. <!-- <aside th:replace="~{fragments/aside-right :: aside}"></aside> -->
  10. <!-- END Side Overlay (right)-->
  11. <!-- Sidebar Nav-->
  12. <nav th:replace="~{fragments/nav-counter :: nav}"></nav>
  13. <!-- END Sidebar -->
  14. <!-- Header -->
  15. <header th:replace="~{fragments/header-counter :: header}"></header>
  16. <!-- END Header -->
  17. <!-- Main Container -->
  18. <main id="main-container">
  19. <!-- Page Content -->
  20. <div class="content">
  21. <div class="block block-rounded">
  22. <div class="block-header block-header-default">
  23. <h3 class="block-title"> List of Counter Bookings</h3>
  24. </div>
  25. <div class="block-content p-0">
  26. <div class="p-sm-4 p-0">
  27. <div class="table-responsive">
  28. <table id="halldetailsList"
  29. class="table table-bordered table-striped table-vcenter js-dataTable-responsive">
  30. <thead class="thead-light">
  31. <tr class="table-bordered">
  32. <th class="text-center no-sort">S.No</th>
  33. <th class="text-center" width="20%">Bank Name</th>
  34. <th class="text-center">Bank Account No</th>
  35. <th class="text-center">DD Number</th>
  36. <th class="text-center">Total Amount</th>
  37. <th class="text-center">Cheque Amount</th>
  38. <th class="text-center">DD Image</th>
  39. <th class="text-center">User Details</th>
  40. <th class="text-center">Booking Details</th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. <!-- Use Thymeleaf to loop through the bookingList -->
  45. <tr th:each="list, i : ${counterlist}" class="${counterlist}" id="ddRow">
  46. <td th:text="${i.count}">0</td>
  47. <td class="text-center" th:text="${list.bankName}"></td>
  48. <td class="text-center" th:text="${list.bankAccNo}"></td>
  49. <td class="text-center" th:text="${list.ddNumber}"></td>
  50. <td class="text-center">
  51. <span th:if="${list.bookingDetails != null}"
  52. th:text="${list.bookingDetails.amountReceived}">N/A</span>
  53. <span th:if="${list.bookingDetails == null}">N/A</span>
  54. </td>
  55. <td class="text-center" th:text="${list.amountReceived}"></td>
  56. <td>
  57. <a class="view-button"><span class="badge bg-primary"
  58. style="cursor: pointer;"
  59. th:onclick="viewDdImage([[${list.counterId}]])">View</span></a>
  60. </td>
  61. <td>
  62. <a class="view-button"><span class="badge bg-primary"
  63. style="cursor: pointer;">View</span></a>
  64. </td>
  65. <td>
  66. <a class="view-button"><span class="badge bg-primary"
  67. style="cursor: pointer;">View</span></a>
  68. </td>
  69. </tr>
  70. </tbody>
  71. </table>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- END Page Content -->
  78. </main>
  79. <!-- END Main Container -->
  80. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  81. <!-- END Footer -->
  82. </div>
  83. <!-- END Page Container -->
  84. <!-- Modal -->
  85. <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  86. <div class="modal-dialog" style="max-width: 800px;">
  87. <div class="modal-content">
  88. <div class="modal-header">
  89. <h5 class="modal-title" id="exampleModalLabel">DD Image</h5>
  90. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  91. </div>
  92. <div class="modal-body">
  93. <div class="image-container"></div>
  94. </div>
  95. <div class="modal-footer">
  96. <!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>-->
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <script th:replace="~{fragments/loginscript :: script}"></script>
  102. <script type="text/javascript">
  103. function viewDdImage(counterId) {
  104. $.ajax({
  105. type: "GET",
  106. url: '/communityhall/user/api/getImageByDdId',
  107. data: {
  108. 'counterId': counterId
  109. },
  110. success: function (res) {
  111. if (res && res.ddphoto) {
  112. getDdImagesById(res);
  113. } else {
  114. console.error('No images found for DDId:', counterId);
  115. }
  116. },
  117. error: function (xhr, status, error) {
  118. console.error('Error fetching images:', error);
  119. }
  120. });
  121. }
  122. function getDdImagesById(image) {
  123. const imageContainer = document.querySelector('.image-container');
  124. imageContainer.innerHTML = ''; // Clear existing content
  125. if (image.ddphoto) {
  126. const img = document.createElement('img');
  127. img.src = image.ddphoto;
  128. img.alt = `Image ${image.counterId}`;
  129. img.style.maxHeight = '550px'; // Adjust image size
  130. img.style.maxWidth = '750px'; // Maintain aspect ratio
  131. imageContainer.appendChild(img);
  132. } else {
  133. const noImageMessage = document.createElement('p');
  134. noImageMessage.textContent = 'No image available.';
  135. imageContainer.appendChild(noImageMessage);
  136. }
  137. $('#exampleModal').modal('show'); // Show Bootstrap modal
  138. }
  139. $(document).ready(
  140. function () {
  141. var buttons = [{
  142. extend: 'pageLength',
  143. className: 'btn btn-primary'
  144. }, {
  145. title: 'Data export',
  146. extend: 'copyHtml5',
  147. text: 'Copy',
  148. className: 'btn btn-primary',
  149. id: 'copyBtn'
  150. }, {
  151. extend: 'excelHtml5',
  152. text: 'Excel',
  153. className: 'btn btn-primary',
  154. id: 'excelBtn'
  155. }, {
  156. extend: 'csvHtml5',
  157. text: 'CSV',
  158. className: 'btn btn-primary',
  159. id: 'csvBtn'
  160. }, {
  161. extend: 'pdfHtml5',
  162. text: 'PDF',
  163. className: 'btn btn-primary',
  164. id: 'pdfBtn'
  165. },
  166. ];
  167. $('#halldetailsList').DataTable(
  168. {
  169. dom: 'Bftip',
  170. columnDefs: [{
  171. targets: 'no-sort',
  172. orderable: false
  173. }],
  174. lengthMenu: [
  175. [50, 100, 200, 500, -1],
  176. ['50 rows', '100 rows', '200 rows',
  177. '500 rows', 'Show all']],
  178. scrollY: '50vh',
  179. fixedColumns: {
  180. left: 1,
  181. right: 1
  182. },
  183. buttons: [buttons],
  184. responsive: true,
  185. searching: true, // Enable search
  186. select: false,
  187. processing: false,
  188. });
  189. // Link the search input to DataTable
  190. $('#searchInput').on('keyup', function () {
  191. dataTable.search(this.value).draw();
  192. });
  193. });
  194. </script>
  195. </body>
  196. </html>