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.

748 lines
28 KiB

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. #returnretrieddetailsModal .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-xl" 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. </div>
  286. <!-- Relationship of Deceased -->
  287. <div class="col-md-6">
  288. <label for="relationship" class="form-label fw-bold">Relationship of Deceased </label>
  289. <input type="text" id="relationship" class="form-control" readonly>
  290. </div>
  291. <div class="col-md-6">
  292. <label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS </label>
  293. <input type="text" id="sanctionedgis" class="form-control" readonly>
  294. </div>
  295. <!-- Date File Sent to Audit -->
  296. <div class="col-md-6">
  297. <label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label>
  298. <input type="date" id="datefile_modal" class="form-control" readonly>
  299. </div>
  300. <!-- Remarks -->
  301. <div class="col-md-12">
  302. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label>
  303. <textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea>
  304. </div>
  305. <div class="col-md-12 mt-4">
  306. <h5>File History</h5>
  307. <div id="fileHistoryContainer" class="file-history-list">
  308. <!-- File History will be dynamically loaded here -->
  309. </div>
  310. </div>
  311. </div>
  312. <div class="row mb-2 mt-2">
  313. <div class="col-md-12 d-flex justify-content-center">
  314. <button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Returned From Audit</button>
  315. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  316. </div>
  317. </div>
  318. <div style="display :none" id="receivedcard">
  319. <div class="row">
  320. <div class="col-md-6">
  321. <label for="datefile" class="form-label fw-bold">Date File Received From Audit <span class="text-danger">*</span></label>
  322. <input type="text" id="datefile" class="form-control" readonly>
  323. </div>
  324. <div class="col-md-12">
  325. <label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
  326. <textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
  327. </div>
  328. </div>
  329. <div class="row mb-2 mt-2">
  330. <div class="col-md-12 d-flex justify-content-center">
  331. <button type="button" class="btn btn-primary" id="auditbutton">Submit</button>
  332. </div>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  340. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  341. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  342. <!-- Bootstrap 5 JS -->
  343. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  344. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  345. <script>
  346. $(document).ready(function () {
  347. // Initialize the DataTable
  348. const dataTable = $('#AuditDatatable').DataTable({
  349. dom: 'Bftip',
  350. columnDefs: [
  351. { targets: 'no-sort', orderable: false }
  352. ],
  353. lengthMenu: [
  354. [50, 100, 200, 500, -1],
  355. ['50 rows', '100 rows', '200 rows', 'Show all']
  356. ],
  357. scrollY: '50vh',
  358. buttons: [
  359. { extend: 'pageLength', className: 'btn btn-warning' },
  360. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  361. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  362. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  363. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  364. ],
  365. fixedHeader: true,
  366. autoWidth: true,
  367. responsive: true,
  368. searching: true,
  369. paging: true,
  370. info: true,
  371. ordering: false,
  372. });
  373. });
  374. document.addEventListener("DOMContentLoaded", function() {
  375. // Get today's date
  376. const today = new Date();
  377. // Format the date as DD-MM-YYYY for display
  378. const day = String(today.getDate()).padStart(2, '0');
  379. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  380. const year = today.getFullYear();
  381. // Combine into DD-MM-YYYY format for display
  382. const formattedDateDisplay = `${day}-${month}-${year}`;
  383. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  384. document.getElementById("datefile").value = formattedDateDisplay;
  385. });
  386. function convertDateFormat(dateString) {
  387. if (!dateString) return '';
  388. let [day, month, year] = dateString.split('-');
  389. return `${year}-${month}-${day}`;
  390. }
  391. document.getElementById("submitbutton").addEventListener("click", function () {
  392. // Clear the inputs in the receivedcard section
  393. //$('#datefile').val('');
  394. $('#remarks').val('');
  395. // Make the receivedcard section visible
  396. document.getElementById("receivedcard").style.display = "block";
  397. // Scroll the receivedcard section into view
  398. document.getElementById("receivedcard").scrollIntoView({
  399. behavior: "smooth", // Smooth scrolling effect
  400. block: "center" // Aligns the element to the center of the viewport
  401. });
  402. });
  403. //model function
  404. function fetchEmployeeDetails(tempId) {
  405. $.ajax({
  406. url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details
  407. type: 'GET',
  408. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  409. success: function (response) {
  410. if (response && response.length > 0) {
  411. let employeeDetails = response[0]; // Access the first object in the array
  412. console.log("response:",response);
  413. console.log("employeecode:",tempId);
  414. // Populate modal fields
  415. $('#employeenomodel').val(employeeDetails.emp_no);
  416. $('#employeename').val(employeeDetails.emp_name);
  417. $('#department').val(employeeDetails.dept_name);
  418. $('#designation').val(employeeDetails.designation);
  419. $('#servicedeath').val(employeeDetails.service_death);
  420. $('#relationship').val(employeeDetails.relationship_deceased);
  421. $('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount);
  422. $('#datefile_modal').val(employeeDetails.file_moved_date);
  423. $('#remarks_modal').val(employeeDetails.remarks);
  424. // Show Pending Duration and Input based on the value
  425. let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response
  426. let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response
  427. if (pendingDuration === "yes") {
  428. $('#pendingDurationInputContainer').show(); // Show the text box
  429. $('#pendingDurationInput').val(pendingReason); // Populate the input field
  430. } else {
  431. $('#pendingDurationInputContainer').hide(); // Hide the text box
  432. }
  433. // Update radio button selection
  434. if (pendingDuration === "yes") {
  435. $('#yes').prop('checked', true);
  436. } else {
  437. $('#no').prop('checked', true);
  438. }
  439. // Update the modal title with the employee code
  440. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  441. // Show the modal
  442. $('#returnfamilypensiondetailsModal').modal('show');
  443. //additional card display function
  444. document.getElementById("submitbutton").addEventListener("click", function() {
  445. //$('#datefile').val('');
  446. $('#remarks').val('');
  447. document.getElementById("receivedcard").style.display = "block";
  448. });
  449. /* document.getElementById('auditbutton').addEventListener('click', function () {
  450. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  451. // Trigger the save function and pass the value
  452. saveEntryDetails(tempId,employeeNo);
  453. }); */
  454. $('#auditbutton').off('click').on('click', function () {
  455. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  456. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  457. });
  458. } else {
  459. Swal.fire({
  460. icon: 'info',
  461. title: 'No Data',
  462. text: 'No details found for the selected employee.',
  463. confirmButtonText: 'OK',
  464. });
  465. }
  466. },
  467. error: function () {
  468. Swal.fire({
  469. icon: 'error',
  470. title: 'Error',
  471. text: 'Failed to fetch employee details. Please try again.',
  472. confirmButtonText: 'OK',
  473. });
  474. },
  475. });
  476. }
  477. $(document).ready(function () {
  478. $(document).on('click', '.view-btn', function () {
  479. const empCode = $(this).data('id'); // Fetch `data-id` value
  480. const tempId = $(this).data('temp-id');
  481. console.log("empCode====="+empCode);
  482. console.log("tempId====="+tempId);
  483. // Hide the receivedcard section before showing the modal
  484. $("#receivedcard").hide();
  485. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  486. loadFileHistory(tempId); // Load the file history for the selected employee
  487. });
  488. // Initialize the modal with static backdrop and disabled keyboard closing
  489. $('#returnfamilypensiondetailsModal').modal({
  490. backdrop: 'static',
  491. keyboard: false,
  492. show: false // Ensure it doesn't auto-show on page load
  493. });
  494. // Handle close button click
  495. $('#back').click(function () {
  496. $('#returnfamilypensiondetailsModal').modal('hide');
  497. });
  498. $('.close').click(function () {
  499. $('#returnfamilypensiondetailsModal').modal('hide');
  500. });
  501. });
  502. function loadFileHistory(tempId) {
  503. $.ajax({
  504. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  505. type: 'GET',
  506. data: { tempId: tempId }, // Pass empCode as a parameter
  507. success: function (response) {
  508. if (response.length > 0) {
  509. let historyHtml = '';
  510. response.forEach(item => {
  511. historyHtml += `
  512. <div class="file-history-item">
  513. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  514. <div class="file-history-content">
  515. <div class="file-history-status">${item.fileStatusHistory}</div>
  516. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  517. </div>
  518. </div>
  519. `;
  520. });
  521. $('#fileHistoryContainer').html(historyHtml);
  522. } else {
  523. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  524. }
  525. },
  526. error: function () {
  527. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  528. }
  529. });
  530. }
  531. function formatDateTime(dateString) {
  532. const options = {
  533. day: '2-digit',
  534. month: '2-digit',
  535. year: 'numeric',
  536. };
  537. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  538. }
  539. function saveEntryDetails(tempId,empNo) {
  540. //console.log("emp_no inside=="+empCode);
  541. let entryDetails = {
  542. empNo: empNo,
  543. tempId: tempId,
  544. dateToAudit: convertDateFormat($('#datefile').val()?.trim()),
  545. remarks: $('#remarks').val(),
  546. deptId:$('#deptId').text().trim(),
  547. filemovedby:$('#userId').text().trim()
  548. };
  549. console.log("entryDetails:",entryDetails);
  550. if (!entryDetails.remarks) {
  551. Swal.fire({
  552. icon: 'warning',
  553. title: 'Validation Error!',
  554. text: 'Remarks are required.',
  555. confirmButtonText: 'OK'
  556. });
  557. return;
  558. }
  559. // Disable the button to prevent multiple submissions
  560. $('#auditbutton').prop('disabled', true).text('Processing...');
  561. $.ajax({
  562. url: '/gcc/api/department/audit/updateFamilyPensionDetails',
  563. type: 'POST',
  564. contentType: 'application/json',
  565. data: JSON.stringify(entryDetails),
  566. success: function (response) {
  567. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  568. Swal.fire({
  569. icon: 'success',
  570. title: 'Success',
  571. text: response,
  572. allowOutsideClick: false,
  573. allowEscapeKey: false,
  574. allowEnterKey: false,
  575. confirmButtonText: 'OK'
  576. }).then((result) => {
  577. if (result.isConfirmed) {
  578. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  579. window.location.href = "/gcc/department/audit/familypension";
  580. console.log("Continue clicked");
  581. }
  582. });
  583. },
  584. error: function (xhr, status, error) {
  585. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  586. Swal.fire({
  587. icon: 'error',
  588. title: 'Error',
  589. text: 'Failed to save details. Please try again.',
  590. confirmButtonText: 'OK'
  591. });
  592. console.error('Error:', xhr.responseText);
  593. }
  594. });
  595. }
  596. </script>
  597. </body>
  598. </html>