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.

749 lines
28 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" dir="">
  3. <html xmlns:th="http://www.thymeleaf.org">
  4. <head th:replace="~{fragments/modules/base/head :: head}"></head>
  5. <style>
  6. .required{
  7. color: red;
  8. }
  9. #modalBody h4 {
  10. font-weight: bold;
  11. margin-top: 15px;
  12. margin-bottom: 10px;
  13. }
  14. #modalBody p {
  15. margin: 5px 0;
  16. }
  17. #modalBody hr {
  18. margin: 15px 0;
  19. }
  20. .comment {
  21. margin-bottom: 20px;
  22. }
  23. .comment p {
  24. margin: 0;
  25. }
  26. hr {
  27. border: 1px solid #ccc;
  28. margin-top: 20px;
  29. margin-bottom: 20px;
  30. }
  31. h5 {
  32. font-size: bold;
  33. }
  34. /* Limit the height of the dropdown menu and make it scrollable */
  35. .dropdown-menu {
  36. max-height: 200px; /* Adjust this value as needed */
  37. overflow-y: auto;
  38. }
  39. .col-4 {
  40. font-weight: bold;
  41. text-align: right;
  42. }
  43. .col-8 {
  44. padding-left: 20px;
  45. }
  46. .comment {
  47. padding: 10px 0;
  48. }
  49. .comment .text-muted {
  50. font-size: 0.9em;
  51. color: #6c757d;
  52. }
  53. .comment hr {
  54. border-top: 1px solid #ccc;
  55. }
  56. .comment .btn-link {
  57. font-size: 0.9em;
  58. text-decoration: underline;
  59. color: #007bff;
  60. }
  61. /* Make the modal body scrollable */
  62. #detailsModal .modal-body {
  63. max-height: 70vh; /* Limit the height to 70% of the viewport */
  64. overflow-y: auto; /* Enable vertical scrolling */
  65. }
  66. .card-box {
  67. border-radius: 20px;
  68. box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px;
  69. }
  70. #followupCard {
  71. transition: transform 0.2s ease; /* Smooth scaling transition */
  72. cursor: pointer; /* Default cursor change */
  73. }
  74. #followupCard:hover {
  75. transform: scale(1.05); /* Slightly scale up on hover */
  76. cursor: pointer; /* Change cursor to hand symbol */
  77. }
  78. #returnfamilypensiondetailsModal .modal-body{
  79. max-height:80vh;
  80. overflow-y:auto;
  81. }
  82. .file-history-list {
  83. margin-top: 10px;
  84. padding-left: 0;
  85. }
  86. .file-history-item {
  87. display: flex;
  88. padding: 5px 10px;
  89. font-family: Arial, sans-serif;
  90. align-items: flex-start;
  91. position: relative; /* For vertical line positioning */
  92. margin-bottom: 1px; /* Add space between items */
  93. }
  94. .file-history-item::before {
  95. content: '';
  96. position: absolute;
  97. top: 0;
  98. bottom: 0;
  99. left: 120px; /* Position of the vertical line */
  100. width: 1px;
  101. background-color: #ddd;
  102. }
  103. .file-history-date {
  104. margin-top: 10px;
  105. flex: 0 0 100px;
  106. font-weight: bold;
  107. font-size: 0.8rem;
  108. color: #333;
  109. text-align: center;
  110. white-space: nowrap; /* Prevent wrapping */
  111. }
  112. .file-history-content {
  113. flex: 5;
  114. padding-left: 20px; /* Adds space after the vertical line */
  115. display: flex;
  116. flex-direction: column;
  117. gap: 5px; /* Adds spacing between status and remarks */
  118. white-space: pre-wrap; /* Prevents wrapping */
  119. overflow: visible; /* Prevents content overflow */
  120. text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */
  121. }
  122. .file-history-status {
  123. font-size: 0.8rem;
  124. font-weight: bold;
  125. color: #555;
  126. white-space:pre-wrap; /* Prevent wrapping */
  127. overflow: visible;
  128. text-overflow: ellipsis;
  129. }
  130. .file-history-remarks {
  131. font-size: 0.8rem;
  132. color: #777;
  133. white-space: pre-wrap; /* Prevent wrapping */
  134. overflow: visible;
  135. text-overflow: ellipsis;
  136. }
  137. .is-invalid {
  138. border: 1px solid red;
  139. }
  140. </style>
  141. <body>
  142. <!--[if lt IE 8]>
  143. <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
  144. <![endif]-->
  145. <div class="wrapper">
  146. <!-- header top menu Start -->
  147. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  148. <!-- header top menu end -->
  149. <div class="page-wrap">
  150. <!--=============== Left Menu side Start ================-->
  151. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  152. <!--=============== Left side End ================-->
  153. <div class="main-content">
  154. <div class="container-fluid">
  155. <div class="page-header mb-2">
  156. <div class="row align-items-end">
  157. <div class="col-lg-8">
  158. <div class="page-header-title">
  159. <i class="fa fa-list-alt bg-blue"></i>
  160. <div class="d-inline">
  161. <h5>Family Pension</h5>
  162. <span>Department Entries</span>
  163. </div>
  164. </div>
  165. </div>
  166. <div class="col-lg-4">
  167. <nav class="breadcrumb-container" aria-label="breadcrumb">
  168. <ol class="breadcrumb">
  169. <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
  170. <li class="breadcrumb-item" aria-current="page">Department Entries</li>
  171. <li class="breadcrumb-item" aria-current="page">Audit</li>
  172. <li class="breadcrumb-item active" aria-current="page">Family Pension</li>
  173. </ol>
  174. </nav>
  175. </div>
  176. </div>
  177. </div>
  178. <div class="row mt-4">
  179. <div class="col-md-12">
  180. <div class="card">
  181. <div class="card-block">
  182. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5>
  183. <h5 style="font-weight:bold;">Audit- Family Pension</h5>
  184. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5>
  185. <span th:text="${userId}" id="userId" style="display:none"></span>
  186. <div id="audittable">
  187. <table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
  188. <thead class="thead-dark">
  189. <tr role="row">
  190. <th class="text-center">S.No</th>
  191. <th class="text-center">Employee Code</th>
  192. <th class="text-center">Name </th>
  193. <th class="text-center">Department</th>
  194. <th class="text-center">Designation</th>
  195. <th class="text-center">File Sent Date</th>
  196. <th class="text-center">File Type</th>
  197. <th class="text-center">View</th>
  198. </tr>
  199. </thead>
  200. <tbody style="text-align:center;">
  201. <!-- Thymeleaf loop to populate data -->
  202. <tr th:each="audit, iterStat : ${auditlist}">
  203. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  204. <td th:text="${audit['emp_no']}" class="text-center"></td>
  205. <td th:text="${audit['emp_name']}" class="text-center"></td>
  206. <td th:text="${audit['dept_name']}" class="text-center"></td>
  207. <td th:text="${audit['designation']}" class="text-center"></td>
  208. <td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
  209. <td th:text="${audit['file_entry_type']}" class="text-center"></td>
  210. <td class="text-center">
  211. <button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}">
  212. View
  213. </button>
  214. </td>
  215. </tr>
  216. </tbody>
  217. </table>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  226. </div>
  227. </div>
  228. <!-- Modal Box -->
  229. <div class="modal fade" id="returnfamilypensiondetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  230. <div class="modal-dialog modal-lg" role="document">
  231. <div class="modal-content">
  232. <div class="modal-header">
  233. <h5 class="modal-title" id="detailsModalLabel">
  234. Audit - Family Pension (<span id="modalEmployeeCode"></span>)
  235. </h5>
  236. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  237. <span aria-hidden="true">&times;</span>
  238. </button>
  239. </div>
  240. <div class="modal-body">
  241. <div class="row">
  242. <!-- Employee No -->
  243. <div class="col-md-6">
  244. <label for="employeenomodel" class="form-label fw-bold">Employee No </label>
  245. <input type="number" id="employeenomodel" class="form-control" readonly>
  246. </div>
  247. <!-- Employee Name -->
  248. <div class="col-md-6">
  249. <label for="employeename" class="form-label fw-bold">Employee Name </label>
  250. <input type="text" id="employeename" class="form-control" readonly>
  251. </div>
  252. <!-- Department -->
  253. <div class="col-md-6">
  254. <label for="department" class="form-label fw-bold">Department </label>
  255. <input type="text" id="department" class="form-control" readonly>
  256. </div>
  257. <!-- Designation -->
  258. <div class="col-md-6">
  259. <label for="designation" class="form-label fw-bold">Designation </label>
  260. <input type="text" id="designation" class="form-control" readonly>
  261. </div>
  262. <!-- pending duration-->
  263. <div class="col-md-6">
  264. <label for="pendingDuration" class="form-label fw-bold">
  265. Pending Duration
  266. </label>
  267. <div class="d-flex align-items-center">
  268. <div class="form-check" style="padding-right:10px;">
  269. <input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled>
  270. <label for="yes" class="form-check-label">Yes</label>
  271. </div>
  272. <div class="form-check">
  273. <input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled>
  274. <label for="no" class="form-check-label">No</label>
  275. </div>
  276. </div>
  277. <div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;">
  278. <input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly>
  279. </div>
  280. </div>
  281. <!-- While in Service Death -->
  282. <div class="col-md-6">
  283. <label for="servicedeath" class="form-label fw-bold">While in Service Death </label>
  284. <!-- <input type="text" id="servicedeath" class="form-control" readonly> -->
  285. <input type="date" id="servicedeath" class="form-control" readonly>
  286. </div>
  287. <!-- Relationship of Deceased -->
  288. <div class="col-md-6">
  289. <label for="relationship" class="form-label fw-bold">Relationship of Deceased </label>
  290. <input type="text" id="relationship" class="form-control" readonly>
  291. </div>
  292. <div class="col-md-6">
  293. <label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS </label>
  294. <input type="text" id="sanctionedgis" class="form-control" readonly>
  295. </div>
  296. <!-- Date File Sent to Audit -->
  297. <div class="col-md-6">
  298. <label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label>
  299. <input type="date" id="datefile_modal" class="form-control" readonly>
  300. </div>
  301. <!-- Remarks -->
  302. <div class="col-md-12">
  303. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label>
  304. <textarea id="remarks_modal" class="form-control" rows="4" readonly></textarea>
  305. </div>
  306. <div class="col-md-12 mt-4">
  307. <h5>File History</h5>
  308. <div id="fileHistoryContainer" class="file-history-list">
  309. <!-- File History will be dynamically loaded here -->
  310. </div>
  311. </div>
  312. </div>
  313. <div class="row mb-2 mt-2">
  314. <div class="col-md-12 d-flex justify-content-center">
  315. <button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Returned From Audit</button>
  316. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  317. </div>
  318. </div>
  319. <div style="display :none" id="receivedcard">
  320. <div class="row">
  321. <div class="col-md-6">
  322. <label for="datefile" class="form-label fw-bold">Date File Received From Audit <span class="text-danger">*</span></label>
  323. <input type="text" id="datefile" class="form-control" readonly>
  324. </div>
  325. <div class="col-md-12">
  326. <label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
  327. <textarea id="remarks" class="form-control" rows="4" ></textarea>
  328. </div>
  329. </div>
  330. <div class="row mb-2 mt-2">
  331. <div class="col-md-12 d-flex justify-content-center">
  332. <button type="button" class="btn btn-primary" id="auditbutton">Submit</button>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  341. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  342. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  343. <!-- Bootstrap 5 JS -->
  344. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  345. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  346. <script>
  347. $(document).ready(function () {
  348. // Initialize the DataTable
  349. const dataTable = $('#AuditDatatable').DataTable({
  350. dom: 'Bftip',
  351. columnDefs: [
  352. { targets: 'no-sort', orderable: false }
  353. ],
  354. lengthMenu: [
  355. [50, 100, 200, 500, -1],
  356. ['50 rows', '100 rows', '200 rows', 'Show all']
  357. ],
  358. scrollY: '50vh',
  359. buttons: [
  360. { extend: 'pageLength', className: 'btn btn-warning' },
  361. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  362. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  363. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  364. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  365. ],
  366. fixedHeader: true,
  367. autoWidth: true,
  368. responsive: true,
  369. searching: true,
  370. paging: true,
  371. info: true,
  372. ordering: false,
  373. });
  374. });
  375. document.addEventListener("DOMContentLoaded", function() {
  376. // Get today's date
  377. const today = new Date();
  378. // Format the date as DD-MM-YYYY for display
  379. const day = String(today.getDate()).padStart(2, '0');
  380. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  381. const year = today.getFullYear();
  382. // Combine into DD-MM-YYYY format for display
  383. const formattedDateDisplay = `${day}-${month}-${year}`;
  384. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  385. document.getElementById("datefile").value = formattedDateDisplay;
  386. document.getElementById("servicedeath").value = formattedDateDisplay;
  387. });
  388. function convertDateFormat(dateString) {
  389. if (!dateString) return '';
  390. let [day, month, year] = dateString.split('-');
  391. return `${year}-${month}-${day}`;
  392. }
  393. document.getElementById("submitbutton").addEventListener("click", function () {
  394. // Clear the inputs in the receivedcard section
  395. //$('#datefile').val('');
  396. $('#remarks').val('');
  397. // Make the receivedcard section visible
  398. document.getElementById("receivedcard").style.display = "block";
  399. // Scroll the receivedcard section into view
  400. document.getElementById("receivedcard").scrollIntoView({
  401. behavior: "smooth", // Smooth scrolling effect
  402. block: "center" // Aligns the element to the center of the viewport
  403. });
  404. });
  405. //model function
  406. function fetchEmployeeDetails(tempId) {
  407. $.ajax({
  408. url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details
  409. type: 'GET',
  410. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  411. success: function (response) {
  412. if (response && response.length > 0) {
  413. let employeeDetails = response[0]; // Access the first object in the array
  414. console.log("response:",response);
  415. console.log("employeecode:",tempId);
  416. // Populate modal fields
  417. $('#employeenomodel').val(employeeDetails.emp_no);
  418. $('#employeename').val(employeeDetails.emp_name);
  419. $('#department').val(employeeDetails.dept_name);
  420. $('#designation').val(employeeDetails.designation);
  421. $('#servicedeath').val(employeeDetails.service_death);
  422. $('#relationship').val(employeeDetails.relationship_deceased);
  423. $('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount);
  424. $('#datefile_modal').val(employeeDetails.file_moved_date);
  425. $('#remarks_modal').val(employeeDetails.remarks);
  426. // Show Pending Duration and Input based on the value
  427. let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response
  428. let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response
  429. if (pendingDuration === "yes") {
  430. $('#pendingDurationInputContainer').show(); // Show the text box
  431. $('#pendingDurationInput').val(pendingReason); // Populate the input field
  432. } else {
  433. $('#pendingDurationInputContainer').hide(); // Hide the text box
  434. }
  435. // Update radio button selection
  436. if (pendingDuration === "yes") {
  437. $('#yes').prop('checked', true);
  438. } else {
  439. $('#no').prop('checked', true);
  440. }
  441. // Update the modal title with the employee code
  442. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  443. // Show the modal
  444. $('#returnfamilypensiondetailsModal').modal('show');
  445. //additional card display function
  446. document.getElementById("submitbutton").addEventListener("click", function() {
  447. //$('#datefile').val('');
  448. $('#remarks').val('');
  449. document.getElementById("receivedcard").style.display = "block";
  450. });
  451. /* document.getElementById('auditbutton').addEventListener('click', function () {
  452. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  453. // Trigger the save function and pass the value
  454. saveEntryDetails(tempId,employeeNo);
  455. }); */
  456. $('#auditbutton').off('click').on('click', function () {
  457. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  458. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  459. });
  460. } else {
  461. Swal.fire({
  462. icon: 'info',
  463. title: 'No Data',
  464. text: 'No details found for the selected employee.',
  465. confirmButtonText: 'OK',
  466. });
  467. }
  468. },
  469. error: function () {
  470. Swal.fire({
  471. icon: 'error',
  472. title: 'Error',
  473. text: 'Failed to fetch employee details. Please try again.',
  474. confirmButtonText: 'OK',
  475. });
  476. },
  477. });
  478. }
  479. $(document).ready(function () {
  480. $(document).on('click', '.view-btn', function () {
  481. const empCode = $(this).data('id'); // Fetch `data-id` value
  482. const tempId = $(this).data('temp-id');
  483. console.log("empCode====="+empCode);
  484. console.log("tempId====="+tempId);
  485. // Hide the receivedcard section before showing the modal
  486. $("#receivedcard").hide();
  487. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  488. loadFileHistory(tempId); // Load the file history for the selected employee
  489. });
  490. // Initialize the modal with static backdrop and disabled keyboard closing
  491. $('#returnfamilypensiondetailsModal').modal({
  492. backdrop: 'static',
  493. keyboard: false,
  494. show: false // Ensure it doesn't auto-show on page load
  495. });
  496. // Handle close button click
  497. $('#back').click(function () {
  498. $('#returnfamilypensiondetailsModal').modal('hide');
  499. });
  500. $('.close').click(function () {
  501. $('#returnfamilypensiondetailsModal').modal('hide');
  502. });
  503. });
  504. function loadFileHistory(tempId) {
  505. $.ajax({
  506. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  507. type: 'GET',
  508. data: { tempId: tempId }, // Pass empCode as a parameter
  509. success: function (response) {
  510. if (response.length > 0) {
  511. let historyHtml = '';
  512. response.forEach(item => {
  513. historyHtml += `
  514. <div class="file-history-item">
  515. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  516. <div class="file-history-content">
  517. <div class="file-history-status">${item.fileStatusHistory}</div>
  518. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  519. </div>
  520. </div>
  521. `;
  522. });
  523. $('#fileHistoryContainer').html(historyHtml);
  524. } else {
  525. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  526. }
  527. },
  528. error: function () {
  529. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  530. }
  531. });
  532. }
  533. function formatDateTime(dateString) {
  534. const options = {
  535. day: '2-digit',
  536. month: '2-digit',
  537. year: 'numeric',
  538. };
  539. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  540. }
  541. function saveEntryDetails(tempId,empNo) {
  542. //console.log("emp_no inside=="+empCode);
  543. let entryDetails = {
  544. empNo: empNo,
  545. tempId: tempId,
  546. dateToAudit: convertDateFormat($('#datefile').val()?.trim()),
  547. remarks: $('#remarks').val(),
  548. deptId:$('#deptId').text().trim(),
  549. filemovedby:$('#userId').text().trim()
  550. };
  551. console.log("entryDetails:",entryDetails);
  552. if (!entryDetails.remarks) {
  553. Swal.fire({
  554. icon: 'warning',
  555. title: 'Validation Error!',
  556. text: 'Remarks are required.',
  557. confirmButtonText: 'OK'
  558. });
  559. return;
  560. }
  561. // Disable the button to prevent multiple submissions
  562. $('#auditbutton').prop('disabled', true).text('Processing...');
  563. $.ajax({
  564. url: '/gcc/api/department/audit/updateFamilyPensionDetails',
  565. type: 'POST',
  566. contentType: 'application/json',
  567. data: JSON.stringify(entryDetails),
  568. success: function (response) {
  569. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  570. Swal.fire({
  571. icon: 'success',
  572. title: 'Success',
  573. text: response,
  574. allowOutsideClick: false,
  575. allowEscapeKey: false,
  576. allowEnterKey: false,
  577. confirmButtonText: 'OK'
  578. }).then((result) => {
  579. if (result.isConfirmed) {
  580. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  581. window.location.href = "/gcc/department/audit/familypension";
  582. console.log("Continue clicked");
  583. }
  584. });
  585. },
  586. error: function (xhr, status, error) {
  587. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  588. Swal.fire({
  589. icon: 'error',
  590. title: 'Error',
  591. text: 'Failed to save details. Please try again.',
  592. confirmButtonText: 'OK'
  593. });
  594. console.error('Error:', xhr.responseText);
  595. }
  596. });
  597. }
  598. </script>
  599. </body>
  600. </html>