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.

654 lines
32 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/modules/base/head :: head}"></head>
  4. <style>
  5. .width1 {
  6. width: 120px;
  7. }
  8. .width2 {
  9. width: 150px;
  10. }
  11. </style>
  12. <body>
  13. <div class="wrapper">
  14. <!-- header top menu Start -->
  15. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  16. <!-- header top menu end -->
  17. <div class="page-wrap">
  18. <!--=============== Left Menu side Start ================-->
  19. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  20. <!--=============== Left side End ================-->
  21. <div class="main-content">
  22. <div class="container-fluid">
  23. <div class="page-header mb-2">
  24. <div class="row align-items-end">
  25. <div class="col-lg-8">
  26. <div class="page-header-title">
  27. <!-- <i class="far fa-calendar-plus bg-blue"></i> -->
  28. <div class="d-inline">
  29. <h5>Updation</h5>
  30. <span>View and Update</span>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. <!-- <div class="row">
  37. <div class="col-md-12">
  38. <div class="card">
  39. <div class="card-header">
  40. <span>Fill in the details </span>
  41. </div>
  42. <div class="card-body">
  43. <div class="row">
  44. <div class="col-md-3 col-sm-12">
  45. <label class="form-label" for="unique_num">Unique Number</label>
  46. <input type="text" class="form-control" id="unique_num">
  47. </div>
  48. <div class="col-md-1 col-sm-12 text-center pt-4">
  49. <span style="font-weight: bold;">OR</span>
  50. </div>
  51. <div class="col-md-3 col-sm-12">
  52. <label class="form-label" for="batch_num">Batch No</label>
  53. <input type="text" class="form-control" id="batch_num">
  54. </div>
  55. <div class="col-md-1 col-sm-12 text-center pt-4">
  56. <span style="font-weight: bold;">OR</span>
  57. </div>
  58. <div class="col-md-3 col-sm-12">
  59. <label class="form-label" for="mobile_num">Mobile Number</label>
  60. <input type="text" class="form-control" id="mobile_num">
  61. </div>
  62. </div>
  63. <div class="row mt-3">
  64. <div class="col-12 d-flex justify-content-center">
  65. <button type="submit" id="searchBtn"
  66. class="btn btn-primary mx-2">Search</button>
  67. <button class="btn btn-danger mx-2" id="resetBtn"
  68. name="reset">Reset</button>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div> -->
  75. <div class="row mb-3">
  76. <div class="col-md-12 d-flex justify-content-end">
  77. <button type="button" class="btn btn-primary mx-2" id="pendingListBtn"
  78. onclick="loadPendingList()">Pending List</button>
  79. <button type="button" class="btn btn-success" id="updatedListBtn"
  80. onclick="loadUpdatedList()">Updated List</button>
  81. </div>
  82. </div>
  83. <div class="row" id="detailscard">
  84. <div class="col-md-12">
  85. <div class="card">
  86. <div class="card-body">
  87. <div class="table-responsive">
  88. <table id="DetailsDatatable"
  89. class="table table-striped table-bordered table-hover dataTable"
  90. role="grid">
  91. <thead class="thead-dark">
  92. <tr role="row">
  93. <th class="text-center">S.No</th>
  94. <th class="text-center">Unique No</th>
  95. <th class="text-center width1">Name</th>
  96. <th class="text-center">Sex</th>
  97. <th class="text-center">Designation</th>
  98. <th class="text-center">State / Central</th>
  99. <th class="text-center width2">Office Address</th>
  100. <th class="text-center">Mobile Number</th>
  101. <th class="text-center">Residential Address</th>
  102. <th class="text-center">Native Constituency</th>
  103. <th class="text-center">Residential Constituency</th>
  104. <th class="text-center">Working Constituency</th>
  105. <th class="text-center">Enrolled - Part / Sl.No / EPIC / Assembly
  106. Constituency</th>
  107. <!-- <th class="text-center">Photo</th> -->
  108. <th class="text-center">Action</th>
  109. </tr>
  110. </thead>
  111. <tbody>
  112. </tbody>
  113. </table>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. <!-- Modal for Updated Details -->
  122. <div class="modal fade" id="updatedDetailsModal" tabindex="-1" role="dialog"
  123. aria-labelledby="updatedDetailsModalLabel" aria-hidden="true">
  124. <div class="modal-dialog modal-lg" role="document">
  125. <div class="modal-content">
  126. <div class="modal-header bg-primary text-white">
  127. <h5 class="modal-title" id="updatedDetailsModalLabel">Updated Details</h5>
  128. <button type="button" class="close text-white" data-dismiss="modal" aria-label="Close"
  129. onclick="$('#updatedDetailsModal').modal('hide')">
  130. <span aria-hidden="true">&times;</span>
  131. </button>
  132. </div>
  133. <div class="modal-body" id="updatedDetailsContent" style="max-height: 70vh; overflow-y: auto;">
  134. <div class="text-center" id="modalLoader" style="display: none;">
  135. <div class="spinner-border text-primary" role="status">
  136. <span class="sr-only">Loading...</span>
  137. </div>
  138. </div>
  139. <div id="modalDataContainer" style="display: none;">
  140. <table class="table table-bordered table-striped">
  141. <thead class="bg-light">
  142. <tr>
  143. <th>Field</th>
  144. <th>Requested Details</th>
  145. <th>Updated Details (poll_person)</th>
  146. </tr>
  147. </thead>
  148. <tbody>
  149. <tr>
  150. <th>slno</th>
  151. <td id="req_slno"></td>
  152. <td id="upd_slno"></td>
  153. </tr>
  154. <tr>
  155. <th>Name</th>
  156. <td id="req_name"></td>
  157. <td id="upd_name"></td>
  158. </tr>
  159. <tr>
  160. <th>Gender</th>
  161. <td id="req_gender"></td>
  162. <td id="upd_gender"></td>
  163. </tr>
  164. <tr>
  165. <th>Designation</th>
  166. <td id="req_designation"></td>
  167. <td id="upd_designation"></td>
  168. </tr>
  169. <tr>
  170. <th>Mobile Number</th>
  171. <td id="req_mobile"></td>
  172. <td id="upd_mobile"></td>
  173. </tr>
  174. <tr>
  175. <th>Residential Address</th>
  176. <td id="req_address"></td>
  177. <td id="upd_address"></td>
  178. </tr>
  179. <tr>
  180. <th>Office Name/Address</th>
  181. <td id="req_office"></td>
  182. <td id="upd_office"></td>
  183. </tr>
  184. <tr>
  185. <th>Native AC</th>
  186. <td id="req_native_ac"></td>
  187. <td id="upd_native_ac"></td>
  188. </tr>
  189. <tr>
  190. <th>Electoral AC</th>
  191. <td id="req_elector_ac"></td>
  192. <td id="upd_elector_ac"></td>
  193. </tr>
  194. <tr>
  195. <th>Part No / Sl No</th>
  196. <td id="req_part_slno"></td>
  197. <td id="upd_part_slno"></td>
  198. </tr>
  199. <tr>
  200. <th>Photo URL</th>
  201. <td id="req_photo"></td>
  202. <td id="upd_photo"></td>
  203. </tr>
  204. <tr>
  205. <th>Updated Date & Time</th>
  206. <td id="req_updatedate"></td>
  207. <td id="upd_updatedate"></td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. </div>
  212. </div>
  213. <div class="modal-footer">
  214. <button type="button" class="btn btn-secondary"
  215. onclick="$('#updatedDetailsModal').modal('hide')">Close</button>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <div id="pageLoader"
  221. style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
  222. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  223. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  224. <span class="sr-only">Loading...</span>
  225. </div>
  226. <!-- Add the 'Please wait' text below the spinner -->
  227. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  228. </div>
  229. </div>
  230. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  231. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  232. </div>
  233. </div>
  234. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  235. <script type="text/javascript">
  236. let currentMode = 'pending';
  237. $(document).ready(function () {
  238. loadPendingList();
  239. });
  240. function loadPendingList() {
  241. currentMode = 'pending';
  242. $('#pendingListBtn').removeClass('btn-secondary').addClass('btn-primary');
  243. $('#updatedListBtn').removeClass('btn-success').addClass('btn-secondary');
  244. loadTableData(`/election/api/pollpersonupdateadmin/getPollPersonUpdateRequest`, false);
  245. }
  246. function loadUpdatedList() {
  247. currentMode = 'updated';
  248. $('#updatedListBtn').removeClass('btn-secondary').addClass('btn-success');
  249. $('#pendingListBtn').removeClass('btn-primary').addClass('btn-secondary');
  250. loadTableData(`/election/api/pollpersonupdateadmin/getUpdatedPollPersonRequests`, true);
  251. }
  252. function loadTableData(apiUrl, isUpdated) {
  253. $('#pageLoader').show();
  254. $.ajax({
  255. type: "GET",
  256. url: apiUrl,
  257. contentType: "application/json",
  258. success: function (response) {
  259. console.log("API Response:", response);
  260. $('#pageLoader').hide();
  261. let records = response || [];
  262. let table = $('#DetailsDatatable').DataTable({
  263. destroy: true,
  264. searching: true,
  265. autoWidth: true,
  266. paging: true,
  267. info: true,
  268. data: records,
  269. columns: [
  270. {
  271. data: null,
  272. render: (data, type, row, meta) => meta.row + 1,
  273. className: 'text-center'
  274. },
  275. {
  276. data: 'slno',
  277. className: 'text-center',
  278. render: r => `${r || '-'}`
  279. },
  280. {
  281. data: 'name',
  282. className: 'text-center width1',
  283. render: r => `${r || '-'}`
  284. },
  285. { data: 'sex', className: 'text-center' },
  286. { data: 'designation_id', className: 'text-center' },
  287. { data: null, className: 'text-center', render: () => '-' },
  288. {
  289. data: null,
  290. className: 'text-center width2',
  291. render: () => '-'
  292. },
  293. { data: 'mobile_no', className: 'text-center' },
  294. { data: 'address1', className: 'text-center', render: r => `${r || '-'}` },
  295. {
  296. data: 'native_ac_name',
  297. className: 'text-center'
  298. },
  299. {
  300. data: 'reside_ac_name',
  301. className: 'text-center'
  302. },
  303. {
  304. data: null,
  305. className: 'text-center',
  306. render: () => '-'
  307. },
  308. {
  309. data: null,
  310. className: 'text-center',
  311. render: {
  312. display: r => `
  313. Part: ${r.elector_part_no || '-'}<br>
  314. Sl: ${r.elector_sl_no || '-'}<br>
  315. ${r.elector_epic_no || '-'}<br>
  316. ${r.elector_ac_no || '-'}
  317. `,
  318. export: r =>
  319. `Part: ${r.elector_part_no || '-'}\n` +
  320. `Sl: ${r.elector_sl_no || '-'}\n` +
  321. `${r.elector_epic_no || '-'}\n` +
  322. `${r.elector_ac_no || '-'}`
  323. }
  324. },
  325. // {
  326. // data: 'photo_upload_url',
  327. // className: 'text-center',
  328. // render: function (url, type, row) {
  329. // if (!url) {
  330. // return `<span style="color:red;">No Image</span>`;
  331. // }
  332. // return `
  333. // <img src="${url}"
  334. // style="height: 100px; width: 100px; object-fit: cover; border:1px solid #ccc;"
  335. // alt="Photo">
  336. // `;
  337. // }
  338. // },
  339. {
  340. data: null,
  341. className: 'text-center',
  342. render: function (data) {
  343. let id = data.id;
  344. let slno = data.slno;
  345. if (isUpdated) {
  346. return `
  347. <button class="btn btn-success btn-sm view-btn"
  348. onclick="viewUpdatedDetailsModal('${id}', '${slno}')">
  349. Updated Details
  350. </button>
  351. `;
  352. } else {
  353. return `
  354. <button class="btn btn-info btn-sm view-btn"
  355. onclick="viewDetails('${id}', '${slno}')">
  356. View
  357. </button>
  358. `;
  359. }
  360. }
  361. }
  362. ],
  363. dom: 'Bfrtip',
  364. buttons: [
  365. {
  366. extend: 'pageLength',
  367. className: 'btn btn-warning'
  368. },
  369. {
  370. title: 'Data export',
  371. extend: 'copyHtml5',
  372. text: 'Copy',
  373. className: 'btn btn-secondary',
  374. id: 'copyBtn'
  375. },
  376. {
  377. extend: 'excelHtml5',
  378. text: 'Excel',
  379. className: 'btn btn-secondary',
  380. id: 'excelBtn',
  381. filename: function () {
  382. return 'polling_personnel_details_' + getTimestamp();
  383. }
  384. },
  385. {
  386. extend: 'csvHtml5',
  387. text: 'CSV',
  388. className: 'btn btn-secondary',
  389. id: 'csvBtn',
  390. filename: function () {
  391. return 'polling_personnel_details_' + getTimestamp();
  392. }
  393. },
  394. {
  395. extend: 'pdfHtml5',
  396. text: 'PDF',
  397. className: 'btn btn-secondary',
  398. id: 'pdfBtn',
  399. title: 'Polling Personnel Details',
  400. filename: function () {
  401. return 'polling_personnel_details_' + getTimestamp();
  402. },
  403. orientation: 'landscape',
  404. pageSize: 'A4',
  405. customize: function (doc) {
  406. doc.pageOrientation = 'landscape';
  407. // Reduce page margins to use full width
  408. doc.pageMargins = [10, 10, 10, 10];
  409. // Reduce default font size so columns fit
  410. doc.defaultStyle.fontSize = 7;
  411. doc.styles.tableHeader.fontSize = 8;
  412. // Force table to shrink inside page
  413. doc.content[1].table.widths = [
  414. 20, // S.No
  415. 30, // Unique/Batch
  416. 60, // Name / Pay Scale
  417. 20, // Sex
  418. 60, // Designation
  419. 30, // State / Central
  420. 100, // Office Address
  421. 40, // Mobile
  422. 90, // Residence Address
  423. 40, // Native
  424. 40, // Reside
  425. 40, // Work
  426. 70, // Enrolled
  427. // 50, // Photo
  428. 30
  429. ];
  430. // Remove large default paddings
  431. var objLayout = {};
  432. objLayout['hLineWidth'] = function (i) { return 0.3; };
  433. objLayout['vLineWidth'] = function (i) { return 0.3; };
  434. objLayout['hLineColor'] = function (i) { return '#000'; };
  435. objLayout['vLineColor'] = function (i) { return '#000'; };
  436. objLayout['paddingLeft'] = function (i) { return 2; };
  437. objLayout['paddingRight'] = function (i) { return 2; };
  438. objLayout['paddingTop'] = function (i) { return 2; };
  439. objLayout['paddingBottom'] = function (i) { return 2; };
  440. doc.content[1].layout = objLayout;
  441. }
  442. }
  443. ],
  444. columnDefs: [
  445. { width: "150px", targets: 2 },
  446. { width: "150px", targets: 6 },
  447. { width: "120px", targets: 8 },
  448. { width: "150px", targets: 12 },
  449. { width: "150px", targets: 13 }
  450. ],
  451. lengthMenu: [
  452. [50, 100, 200, 500, -1],
  453. ['50 rows', '100 rows', '200 rows', 'Show all']
  454. ],
  455. scrollY: '80vh',
  456. scrollX: true,
  457. responsive: false,
  458. searching: true
  459. });
  460. },
  461. error: function (error) {
  462. $('#pageLoader').hide();
  463. Swal.fire({
  464. icon: 'error',
  465. title: 'Error',
  466. text: 'Failed to fetch data'
  467. });
  468. }
  469. });
  470. }
  471. function getTimestamp() {
  472. const now = new Date();
  473. const yyyy = now.getFullYear();
  474. const mm = String(now.getMonth() + 1).padStart(2, '0');
  475. const dd = String(now.getDate()).padStart(2, '0');
  476. const hh = String(now.getHours()).padStart(2, '0');
  477. const mi = String(now.getMinutes()).padStart(2, '0');
  478. const ss = String(now.getSeconds()).padStart(2, '0');
  479. return `${yyyy}${mm}${dd}_${hh}${mi}${ss}`;
  480. }
  481. function viewDetails(id, slno) {
  482. // Save values in sessionStorage if needed
  483. sessionStorage.setItem("upd_id", id);
  484. sessionStorage.setItem("upd_slno", slno);
  485. // Redirect to form page or handle view logic
  486. window.location.href = "/election/dataentryadmin/updatepollpersonform";
  487. }
  488. function viewUpdatedDetailsModal(id, slno) {
  489. $('#updatedDetailsModal').modal('show');
  490. $('#modalLoader').show();
  491. $('#modalDataContainer').hide();
  492. let reqPromise = $.ajax({
  493. type: "GET",
  494. url: `/election/api/pollpersonupdateadmin/getUpdatedRequestDetailsById?id=${id}`
  495. });
  496. let updPromise = $.ajax({
  497. type: "GET",
  498. url: `/election/api/pollpersonupdateadmin/getPollPersonDetailsBySlno?slno=${slno}`
  499. });
  500. Promise.all([reqPromise, updPromise]).then(function(results) {
  501. $('#modalLoader').hide();
  502. let reqRes = results[0];
  503. let updRes = results[1];
  504. // Populate Requested Details (poll_person_new)
  505. if (reqRes && reqRes.length > 0) {
  506. let req = reqRes[0];
  507. $('#req_slno').text(req.slno || '-');
  508. $('#req_name').text(req.name || '-');
  509. $('#req_gender').text(req.sex || '-');
  510. $('#req_designation').text(req.designation || req.designation_id || '-');
  511. $('#req_mobile').text(req.r_mobile_no || req.mobile_no || req.phone_no || '-');
  512. let reqAddr = [req.r_address1, req.r_address2, req.r_address3].filter(Boolean).join(', ');
  513. $('#req_address').text(reqAddr || '-');
  514. let reqOffice = [req.office, req.address1, req.address2, req.address3].filter(Boolean).join(', ');
  515. $('#req_office').text(reqOffice || '-');
  516. $('#req_native_ac').text(req.native_ac_name || req.native_ac_no || '-');
  517. $('#req_elector_ac').text(req.elector_ac_no || '-');
  518. $('#req_part_slno').text((req.elector_part_no || '-') + ' / ' + (req.elector_sl_no || '-'));
  519. let reqDate = req.updatedate || req.cdate || req.updated_date;
  520. if (reqDate) {
  521. let d = new Date(reqDate);
  522. let dd = String(d.getDate()).padStart(2, '0');
  523. let mm = String(d.getMonth() + 1).padStart(2, '0');
  524. let yyyy = d.getFullYear();
  525. let hours = d.getHours();
  526. let minutes = String(d.getMinutes()).padStart(2, '0');
  527. let ampm = hours >= 12 ? 'PM' : 'AM';
  528. hours = hours % 12;
  529. hours = hours ? hours : 12;
  530. $('#req_updatedate').text(`${dd}-${mm}-${yyyy} ${String(hours).padStart(2, '0')}:${minutes} ${ampm}`);
  531. } else {
  532. $('#req_updatedate').text('-');
  533. }
  534. if (req.img_full_path) {
  535. $('#req_photo').html(`<a href="${req.img_full_path}" target="_blank">View Photo</a>`);
  536. } else {
  537. $('#req_photo').text('-');
  538. }
  539. }
  540. // Populate Updated Details (poll_person)
  541. if (updRes && updRes.length > 0) {
  542. let upd = updRes[0];
  543. $('#upd_slno').text(upd.slno || '-');
  544. $('#upd_name').text(upd.name || '-');
  545. $('#upd_gender').text(upd.sex || '-');
  546. $('#upd_designation').text(upd.designation || '-');
  547. $('#upd_mobile').text(upd.r_mobile_no || upd.mobile_no || upd.phone_no || '-');
  548. let updAddr = [upd.r_address1, upd.r_address2, upd.r_address3].filter(Boolean).join(', ');
  549. $('#upd_address').text(updAddr || '-');
  550. let updOffice = [upd.office, upd.address1, upd.address2, upd.address3].filter(Boolean).join(', ');
  551. $('#upd_office').text(updOffice || '-');
  552. $('#upd_native_ac').text(upd.native_ac_name || upd.native_ac_no || '-');
  553. $('#upd_elector_ac').text(upd.elector_ac_no || '-');
  554. $('#upd_part_slno').text((upd.elector_part_no || '-') + ' / ' + (upd.elector_sl_no || '-'));
  555. let updDate = upd.updatedate || upd.cdate || upd.updated_date;
  556. if (updDate) {
  557. let d = new Date(updDate);
  558. let dd = String(d.getDate()).padStart(2, '0');
  559. let mm = String(d.getMonth() + 1).padStart(2, '0');
  560. let yyyy = d.getFullYear();
  561. let hours = d.getHours();
  562. let minutes = String(d.getMinutes()).padStart(2, '0');
  563. let ampm = hours >= 12 ? 'PM' : 'AM';
  564. hours = hours % 12;
  565. hours = hours ? hours : 12;
  566. $('#upd_updatedate').text(`${dd}-${mm}-${yyyy} ${String(hours).padStart(2, '0')}:${minutes} ${ampm}`);
  567. } else {
  568. $('#upd_updatedate').text('-');
  569. }
  570. if (upd.img_full_path) {
  571. $('#upd_photo').html(`<a href="${upd.img_full_path}" target="_blank">View Photo</a>`);
  572. } else {
  573. $('#upd_photo').text('-');
  574. }
  575. }
  576. $('#modalDataContainer').show();
  577. }).catch(function(err) {
  578. $('#modalLoader').hide();
  579. Swal.fire({ icon: 'error', title: 'Error', text: 'Failed to fetch updated details!' });
  580. });
  581. }
  582. </script>
  583. </body>
  584. </html>