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.

429 lines
16 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/modules/base/head :: head}">
  4. </head>
  5. <style>
  6. .required{
  7. color: red;
  8. }
  9. .card-box {
  10. box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px;
  11. }
  12. @media (max-width: 768px) {
  13. .card-box {
  14. text-align: center;
  15. }
  16. }
  17. </style>
  18. <body>
  19. <div class="wrapper">
  20. <!-- Header -->
  21. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  22. <div class="page-wrap">
  23. <!-- Left Menu -->
  24. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  25. <div class="main-content">
  26. <div class="container-fluid">
  27. <div class="page-header">
  28. <div class="row align-items-end">
  29. <div class="col-lg-6">
  30. <div class="page-header-title">
  31. <i class="fa fa-list-alt bg-blue"></i>
  32. <div class="d-inline">
  33. <h5>Less 1 Ton List</h5>
  34. <span>C & N Manager System</span>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="col-lg-6">
  39. <nav class="breadcrumb-container" aria-label="breadcrumb">
  40. <ol class="breadcrumb">
  41. <li class="breadcrumb-item">
  42. <a href="/gcc/index"><i class="ik ik-home"></i></a>
  43. </li>
  44. <li class="breadcrumb-item" aria-current="page">C & N Manager System</li>
  45. <li class="breadcrumb-item active" aria-current="page">Less 1 Ton List</li>
  46. </ol>
  47. </nav>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="row mt-4">
  52. <div class="col-md-12">
  53. <div class="card">
  54. <div class="card-header">
  55. <h3>Less 1 Ton List</h3>
  56. </div>
  57. <!-- <div class="row mt-3 ml-2">
  58. <div class="col-md-3">
  59. <label for="startDate" class="form-label" style="font-size: medium;">From Date:</label>
  60. <input type="date" id="startDate" class="form-control" placeholder="Start Date" onclick="this.showPicker()">
  61. </div>
  62. <div class="col-md-3">
  63. <label for="endDate" class="form-label" style="font-size: medium;">To Date:</label>
  64. <input type="date" id="endDate" class="form-control" placeholder="End Date" onclick="this.showPicker()">
  65. </div>
  66. <div class="col-md-3" style="margin-top: 30px;">
  67. <button id="searchBtn" class="btn btn-primary">Search</button>
  68. <button id="resetBtn" class="btn btn-secondary">Reset</button>
  69. </div>
  70. </div> -->
  71. <div class="card-body">
  72. <table id="QaqcDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
  73. <thead class="thead-dark">
  74. <tr role="row">
  75. <th class="text-center no-sort" style="text-align: center;">S.No</th>
  76. <th class="text-center no-sort" style="text-align: center;">Reference ID</th>
  77. <th class="text-center no-sort" style="text-align: center;">Name</th>
  78. <th class="text-center no-sort" style="text-align: center;">Request Date</th>
  79. <th class="text-center no-sort" style="text-align: center;">Quantity</th>
  80. <th class="text-center no-sort" style="text-align: center;">Mobile No</th>
  81. </tr>
  82. </thead>
  83. <tbody>
  84. </tbody>
  85. </table>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  93. </div>
  94. </div>
  95. <!-- Modal -->
  96. <div class="modal fade" id="publicinfodetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  97. <div class="modal-dialog modal-lg" role="document">
  98. <div class="modal-content">
  99. <div class="modal-header">
  100. <h5 class="modal-title" id="detailsModalLabel">
  101. Public Information (<span id="modalEmployeeCode"></span>)
  102. </h5>
  103. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  104. <span aria-hidden="true">&times;</span>
  105. </button>
  106. </div>
  107. <div class="modal-body">
  108. <div class="row">
  109. <!-- requester Name-->
  110. <div class="col-md-6">
  111. <label for="userName" class="form-label fw-bold">Name</label>
  112. <input type="text" id="userName" class="form-control" readonly>
  113. </div>
  114. <!-- Phone Number -->
  115. <div class="col-md-6">
  116. <label for="contactNumber" class="form-label fw-bold">Phone Number</label>
  117. <input type="number" id="contactNumber" class="form-control" readonly>
  118. </div>
  119. <!-- waste Selection -->
  120. <div class="col-md-6">
  121. <label for="wasteSelection" class="form-label fw-bold">Waste Selection</label>
  122. <input type="text" id="wasteSelection" class="form-control" readonly>
  123. </div>
  124. <!-- vehicle Selection -->
  125. <div class="col-md-6">
  126. <label for="vehicleSelection" class="form-label fw-bold">Vehicle Selection </label>
  127. <input type="text" id="vehicleSelection" class="form-control" readonly>
  128. </div>
  129. <!-- Request Date -->
  130. <div class="col-md-6">
  131. <label for="requestDate" class="form-label fw-bold">Request Date </label>
  132. <input type="text" id="requestDate" class="form-control" readonly>
  133. </div>
  134. <!-- Zone -->
  135. <div class="col-md-6">
  136. <label for="zone" class="form-label fw-bold">Zone </label>
  137. <input type="text" id="zone" class="form-control" readonly>
  138. </div>
  139. <!-- Wards -->
  140. <div class="col-md-6">
  141. <label for="ward" class="form-label fw-bold">Ward </label>
  142. <input type="text" id="ward" class="form-control" readonly>
  143. </div>
  144. <!-- Waste Type -->
  145. <div class="col-md-6">
  146. <label for="wasteType" class="form-label fw-bold">Waste Type </label>
  147. <input type="text" id="wasteType" class="form-control" readonly>
  148. </div>
  149. <!-- Location -->
  150. <div class="col-md-6">
  151. <label for="location" class="form-label fw-bold">Location </label>
  152. <input type="text" id="location" class="form-control" readonly>
  153. </div>
  154. </div>
  155. </div>
  156. <div class="modal-footer">
  157. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  163. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  164. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  165. <!-- sweet alert -->
  166. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  167. <script type="text/javascript">
  168. $(document).ready(function() {
  169. var table = $('#QaqcDatatable').DataTable({
  170. dom: 'Bftip',
  171. columnDefs: [
  172. { targets: 'no-sort', orderable: false }
  173. ],
  174. lengthMenu: [
  175. [50, 100, 200, 500, -1],
  176. ['50 rows', '100 rows', '200 rows', 'Show all']
  177. ],
  178. scrollY: '50vh',
  179. fixedColumns: {
  180. left: 1,
  181. right: 1
  182. },
  183. buttons: [
  184. {
  185. extend: 'pageLength',
  186. className: 'btn btn-warning'
  187. },
  188. {
  189. title: 'Data export',
  190. extend: 'copyHtml5',
  191. text: 'Copy',
  192. className: 'btn btn-secondary',
  193. id: 'copyBtn'
  194. },
  195. {
  196. extend: 'excelHtml5',
  197. text: 'Excel',
  198. className: 'btn btn-secondary',
  199. id: 'excelBtn'
  200. },
  201. {
  202. extend: 'csvHtml5',
  203. text: 'CSV',
  204. className: 'btn btn-secondary',
  205. id: 'csvBtn'
  206. },
  207. {
  208. extend: 'pdfHtml5',
  209. text: 'PDF',
  210. className: 'btn btn-secondary',
  211. id: 'pdfBtn'
  212. }
  213. ],
  214. fixedHeader: true,
  215. autoWidth: true,
  216. responsive: true,
  217. searching:true,
  218. select: false,
  219. processing: false
  220. });
  221. // Initialize DataTable with export buttons
  222. const tableApiUrl = "/gcc/api/dumpregistration/getless1tonlist";
  223. // Fetch and Populate Table Data Function
  224. const fetchTableData = async (startDate = "", endDate = "") => {
  225. try {
  226. const params = new URLSearchParams();
  227. if (startDate) params.append("startDate", startDate);
  228. if (endDate) params.append("endDate", endDate);
  229. const response = await fetch(`${tableApiUrl}?${params.toString()}`);
  230. const tableData = await response.json();
  231. // Update DataTable with new data
  232. table.clear(); // Clear existing data
  233. tableData.forEach((row, index) => {
  234. table.row.add([
  235. `<div style="text-align: center;">${index + 1}</div>`,
  236. `<button class="btn btn-success" data-ref_id="${row.refid}"
  237. onclick="fetchRequestDetails('${row.refid}')" style="text-align: center;">${row.refid}</button>`,
  238. `<div style="text-align: center;">${row.name}</div>`,
  239. `<div style="text-align: center;">${row.request_date}</div>`,
  240. `<div style="text-align: center;">${row.quantity}</div>`,
  241. `<div style="text-align: center;">${row.mobile_no}</div>`,
  242. ]);
  243. });
  244. table.draw(); // Redraw the DataTable with the updated data
  245. } catch (error) {
  246. console.error("Error fetching table data:", error);
  247. }
  248. };
  249. // Example: Fetch Data initially without filters
  250. fetchTableData();
  251. // ✅ This makes fetchRequestDetails globally available for the onclick
  252. window.fetchRequestDetails = function (refId) {
  253. console.log("refId", refId);
  254. $.ajax({
  255. url: '/gcc/api/dumpregistration/getless1tonlistbyId',
  256. type: 'GET',
  257. data: { refId: refId },
  258. dataType: "json",
  259. success: function (response) {
  260. let details = null;
  261. if (Array.isArray(response) && response.length > 0) {
  262. details = response[0];
  263. } else if (response && typeof response === 'object') {
  264. details = response;
  265. }
  266. if (details) {
  267. $('#userName').val(details.name);
  268. $('#contactNumber').val(details.mobile_no);
  269. $('#wasteSelection').val(details.quantity);
  270. $('#vehicleSelection').val(details.vehicle_name);
  271. $('#requestDate').val(details.request_date);
  272. $('#zone').val(details.zone);
  273. $('#ward').val(details.ward);
  274. $('#wasteType').val(details.waste_type);
  275. $('#location').val(details.location);
  276. $('#modalEmployeeCode').text(details.refid);
  277. // ✅ Show the modal
  278. $('#publicinfodetailsModal').modal('show');
  279. } else {
  280. Swal.fire({
  281. icon: 'info',
  282. title: 'No Data',
  283. text: 'No details found for the selected entry.',
  284. confirmButtonText: 'OK'
  285. });
  286. }
  287. },
  288. error: function () {
  289. Swal.fire({
  290. icon: 'error',
  291. title: 'Error',
  292. text: 'Failed to fetch details. Please try again.',
  293. confirmButtonText: 'OK'
  294. });
  295. }
  296. });
  297. };
  298. /*
  299. // Event listener for From Date selection
  300. $("#startDate").on("change", function() {
  301. const startDate = $(this).val(); // Get the selected start date
  302. // Set the min value for To Date to be the selected From Date
  303. $("#endDate").attr("min", startDate);
  304. });
  305. // Event listener for To Date selection
  306. $("#endDate").on("change", function() {
  307. const endDate = $(this).val(); // Get the selected end date
  308. // Set the max value for From Date to be the selected To Date
  309. $("#startDate").attr("max", endDate);
  310. });
  311. // Search Button Click
  312. document.getElementById("searchBtn").addEventListener("click", () => {
  313. const startDate = document.getElementById("startDate").value;
  314. const endDate = document.getElementById("endDate").value;
  315. //console.log("xsnskjx");
  316. console.log(startDate);
  317. // Check if startDate or endDate is empty
  318. if (!startDate || !endDate) {
  319. Swal.fire({
  320. icon: "warning",
  321. title: "Incomplete Search",
  322. text: "Please select the Date Before searching",
  323. confirmButtonText: "OK",
  324. });
  325. } else {
  326. // Call fetchTableData if dates are provided
  327. fetchTableData(startDate, endDate);
  328. }
  329. }); */
  330. // Reset Button Click
  331. document.getElementById("resetBtn").addEventListener("click", () => {
  332. window.location.reload();
  333. });
  334. fetchTableData();
  335. });
  336. </script>
  337. </body>
  338. </html>