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.

690 lines
29 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
​
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
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. #completedDetailsModal .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. #completedDetailsModal label{
  138. padding-top: 3%;
  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>Contributory Pension Scheme</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">Completed</li>
  172. <li class="breadcrumb-item active" aria-current="page">Contributory Pension Scheme</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;">Completed - Contributory Pension Scheme</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="completedCPSTable">
  187. <table id="CompletedCPSDatatable" 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 Created 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="cps, iterStat : ${completedCPSList}">
  203. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  204. <td th:text="${cps['emp_no']}" class="text-center"></td>
  205. <td th:text="${cps['emp_name']}" class="text-center"></td>
  206. <td th:text="${cps['dept_name']}" class="text-center"></td>
  207. <td th:text="${cps['designation']}" class="text-center"></td>
  208. <td th:text="${cps['created_date'] != null ? #dates.format(cps['created_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
  209. <td th:text="${cps['file_entry_type']}" class="text-center"></td>
  210. <td class="text-center">
  211. <button class="btn btn-primary btn-sm view-btn"
  212. th:attr="data-id=${cps['emp_no']}, data-temp-id=${cps['temp_id']}">
  213. View
  214. </button>
  215. </td>
  216. </tr>
  217. </tbody>
  218. </table>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  227. </div>
  228. </div>
  229. <!-- Modal Box for CompletedDetails -->
  230. <!-- Modal Box for CompletedDetails -->
  231. <div class="modal fade" id="completedDetailsModal" tabindex="-1" role="dialog" aria-labelledby="completedDetailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  232. <div class="modal-dialog modal-lg" role="document">
  233. <div class="modal-content">
  234. <div class="modal-header">
  235. <h5 class="modal-title" id="completedDetailsModalLabel">
  236. Contributory pension Scheme Completed Details - (<span id="completedModalEmployeeCode"></span>)
  237. </h5>
  238. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  239. <span aria-hidden="true">&times;</span>
  240. </button>
  241. </div>
  242. <div class="modal-body">
  243. <div class="row">
  244. <div class="col-md-6">
  245. <label for="completedEmployeeNo" class="form-label fw-bold">Employee No </label>
  246. <input type="text" id="completedEmployeeNo" class="form-control" readonly>
  247. </div>
  248. <div class="col-md-6">
  249. <label for="completedEmployeeName" class="form-label fw-bold">Employee Name </label>
  250. <input type="text" id="completedEmployeeName" class="form-control" readonly>
  251. </div>
  252. <div class="col-md-6">
  253. <label for="completedDepartment" class="form-label fw-bold">Department </label>
  254. <input type="text" id="completedDepartment" class="form-control" readonly>
  255. </div>
  256. <div class="col-md-6">
  257. <label for="completedDesignation" class="form-label fw-bold">Designation </label>
  258. <input type="text" id="completedDesignation" class="form-control" readonly>
  259. </div>
  260. <div class="col-md-6">
  261. <label for="completedClass" class="form-label fw-bold">Class </label>
  262. <input type="text" id="completedClass" class="form-control" readonly>
  263. </div>
  264. <div class="col-sm-6">
  265. <label for="completedretirementdate" class="form-label fw-bold">Retirement Date </label>
  266. <input type="date" id="completedretirementdate" class="form-control" readonly>
  267. </div>
  268. <div class="col-md-6">
  269. <label for="completedType" class="form-label fw-bold">Type of Retirement </label>
  270. <input type="text" id="completedType" class="form-control" readonly>
  271. </div>
  272. <!-- UAC Section -->
  273. <div class="col-md-6">
  274. <label class="form-label fw-bold" for="uac">Whether File Sent UAC Date </label>
  275. <div class="d-flex">
  276. <div class="form-check" style="padding-right:10px;">
  277. <input type="radio" id="uacYes" name="uac" class="form-check-input" value="Yes" >
  278. <label for="uacYes" class="form-check-label">Yes</label>
  279. </div>
  280. <div class="form-check">
  281. <input type="radio" id="uacNo" name="uac" class="form-check-input" value="No" >
  282. <label for="uacNo" class="form-check-label">No</label>
  283. </div>
  284. </div>
  285. <div class="mt-3" id="uacInputDiv" style="display: none;">
  286. <input type="date" id="uacDate" class="form-control" readonly>
  287. </div>
  288. </div>
  289. <!-- Pending Duration -->
  290. <div class="col-md-6">
  291. <label for="pendingDuration" class="form-label fw-bold">Pending Duration </label>
  292. <div class="d-flex align-items-center">
  293. <div class="form-check" style="padding-right:10px;">
  294. <input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" disabled>
  295. <label for="yespen" class="form-check-label">Yes</label>
  296. </div>
  297. <div class="form-check">
  298. <input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" disabled>
  299. <label for="nopen" class="form-check-label">No</label>
  300. </div>
  301. </div>
  302. <div id="clickyesdiv" style="display: none; margin-top: 10px;">
  303. <label for="clickyes" class="form-label">Please specify:</label>
  304. <input type="text" id="Clickyes" class="form-control">
  305. </div>
  306. </div>
  307. <!-- CPS Section -->
  308. <div class="col-md-6">
  309. <label class="form-label fw-bold">Whether CPS Amount Settled</label>
  310. <div class="d-flex">
  311. <div class="form-check" style="padding-right:10px;">
  312. <input type="radio" id="cpsYes" name="cps" class="form-check-input" value="Yes" >
  313. <label for="cpsYes" class="form-check-label">Yes</label>
  314. </div>
  315. <div class="form-check">
  316. <input type="radio" id="cpsNo" name="cps" class="form-check-input" value="No">
  317. <label for="cpsNo" class="form-check-label">No</label>
  318. </div>
  319. </div>
  320. <div class="mt-3" id="cpsInputDiv" style="display: none;">
  321. <input type="text" id="cpsAmount" class="form-control" readonly>
  322. </div>
  323. </div>
  324. <!-- EL/LPA Section -->
  325. <div class="col-md-6">
  326. <label class="form-label fw-bold">Whether EL/LPA Amount Settled </label>
  327. <div class="d-flex">
  328. <div class="form-check" style="padding-right:10px;">
  329. <input type="radio" id="elLpaYes" name="el_or_lpa" class="form-check-input" value="yes" >
  330. <label for="elLpaYes" class="form-check-label">Yes</label>
  331. </div>
  332. <div class="form-check">
  333. <input type="radio" id="elLpaNo" name="el_or_lpa" class="form-check-input" value="no" >
  334. <label for="elLpaNo" class="form-check-label">No</label>
  335. </div>
  336. </div>
  337. <div class="mt-3" id="elLpaInputDiv" style="display: none;">
  338. <input type="text" id="elLpaAmount" class="form-control" readonly>
  339. </div>
  340. </div>
  341. <!-- SPFGS Section -->
  342. <div class="col-md-6">
  343. <label class="form-label fw-bold">Whether SPFGS Amount Settled </label>
  344. <div class="d-flex">
  345. <div class="form-check" style="padding-right:10px;">
  346. <input type="radio" id="spfgsYes" name="spfgs" class="form-check-input" value="yes" >
  347. <label for="spfgsYes" class="form-check-label">Yes</label>
  348. </div>
  349. <div class="form-check">
  350. <input type="radio" id="spfgsNo" name="spfgs" class="form-check-input" value="no" >
  351. <label for="spfgsNo" class="form-check-label">No</label>
  352. </div>
  353. </div>
  354. <div class="mt-3" id="spfgsInputDiv" style="display: none;">
  355. <input type="text" id="spfgsAmount" class="form-control" readonly>
  356. </div>
  357. </div>
  358. <div class="col-md-12">
  359. <label for="completedRemarks" class="form-label fw-bold">Comments/Remarks </label>
  360. <textarea id="completedRemarks" class="form-control" rows="4" placeholder="Enter remarks" readonly></textarea>
  361. </div>
  362. <div class="col-md-12 mt-4">
  363. <h5>File History</h5>
  364. <div id="fileHistoryContainer" class="file-history-list">
  365. <!-- File History will be dynamically loaded here -->
  366. </div>
  367. </div>
  368. </div>
  369. <div class="row mb-2 mt-2">
  370. <div class="col-md-12 d-flex justify-content-center">
  371. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="completedBackButton">Back</button>
  372. </div>
  373. </div>
  374. </div>
  375. </div>
  376. </div>
  377. </div>
  378. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  379. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  380. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  381. <!-- Bootstrap 5 JS -->
  382. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  383. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  384. <script>
  385. const table = $('#CompletedCPSDatatable').DataTable({
  386. dom: 'Bftip',
  387. columnDefs: [
  388. { targets: 'no-sort', orderable: false }
  389. ],
  390. lengthMenu: [
  391. [50, 100, 200, 500, -1],
  392. ['50 rows', '100 rows', '200 rows', 'Show all']
  393. ],
  394. scrollY: '50vh',
  395. buttons: [
  396. { extend: 'pageLength', className: 'btn btn-warning' },
  397. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  398. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  399. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  400. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  401. ],
  402. fixedHeader: true,
  403. autoWidth: true,
  404. responsive: true,
  405. searching: true,
  406. select: false,
  407. processing: false
  408. });
  409. $(document).ready(function () {
  410. // Handle view button click to fetch completed details
  411. $(document).on('click', '.view-btn', function () {
  412. const empCode = $(this).data('id');
  413. const tempId = $(this).data('temp-id');
  414. if (!tempId) {
  415. console.error("tempId is missing!");
  416. return;
  417. }
  418. console.log("empCode:", empCode || "Not Provided");
  419. console.log("tempId:", tempId);
  420. fetchCPSDetails(tempId);
  421. loadFileHistory(tempId);
  422. });
  423. // Initialize modal
  424. $('#completedDetailsModal').modal({
  425. backdrop: 'static',
  426. keyboard: false,
  427. show: false
  428. });
  429. // Handle Close and Back button click
  430. $('.close, #back').click(function () {
  431. $('#completedDetailsModal').modal('hide');
  432. //clearFields();
  433. });
  434. function fetchCPSDetails(tempId) {
  435. $.ajax({
  436. url: '/gcc/api/department/audit/getemployeedetailscps',
  437. type: 'GET',
  438. data: { tempId: tempId },
  439. success: function (response) {
  440. if (response && response.length > 0) {
  441. let cpsDetails = response[0]; // Access the first object in the array
  442. console.log("response:", response);
  443. // Populate modal fields with CPS details
  444. $('#completedModalEmployeeCode').text(cpsDetails.emp_no);
  445. $('#completedEmployeeNo').val(cpsDetails.emp_no);
  446. $('#completedEmployeeName').val(cpsDetails.emp_name);
  447. $('#completedDepartment').val(cpsDetails.dept_name);
  448. $('#completedDesignation').val(cpsDetails.designation);
  449. $('#completedClass').val(cpsDetails.retirement_class);
  450. $('#completedType').val(cpsDetails.type_of_retirement);
  451. $('#completedRemarks').val(cpsDetails.remarks);
  452. $('#completedretirementdate').val(cpsDetails.retirement_date)
  453. // Populate UAC Section
  454. if (cpsDetails.uac === "yes") {
  455. $('#uacYes').prop('checked', true); // Check Yes radio button
  456. $('#uacNo').prop('disabled', true); // Disable No radio button
  457. $('#uacInputDiv').show(); // Show date input field
  458. $('#uacDate').val(cpsDetails.uac_date || '').prop('readonly', true); // Set UAC date and make readonly
  459. } else if (cpsDetails.uac === "no") {
  460. $('#uacNo').prop('checked', true); // Check No radio button
  461. $('#uacYes').prop('disabled', true); // Disable Yes radio button
  462. $('#uacInputDiv').hide(); // Hide date input field
  463. }
  464. // Populate Pending Duration and Reason fields
  465. if (cpsDetails.pending_duration === "Yes") {
  466. $('#yespen').prop('checked', true); // Check the Yes radio button
  467. $('#clickyesdiv').show(); // Show the reason input
  468. $('#Clickyes').val(cpsDetails.reason_for_pending || '').prop('readonly' ,true); // Set reason and make readonly
  469. } else if (cpsDetails.pending_duration === "No") {
  470. $('#nopen').prop('checked', true); // Check the No radio button
  471. $('#clickyesdiv').hide(); // Hide the reason input
  472. }
  473. /* // Populate Pending Duration and Reason for Pending pendingDurationYes pendingDurationNo pendingDurationInputContainer pendingDurationInput
  474. if (cpsDetails.pending_duration === "yes") {
  475. $('#pendingDurationYes').prop('checked', true);
  476. $('#pendingDurationNo').prop('disabled', true); // Disable the other option
  477. $('#pendingDurationInputContainer').show(); // Hide reason input
  478. $('#pendingDurationInput').val(cpsDetails.reason_for_pending || '').prop('readonly', true);
  479. } else if (cpsDetails.pending_duration === "no") {
  480. $('#pendingDurationYes').prop('disabled', true);
  481. $('#pendingDurationNo').prop('checked', true);
  482. $('#pendingDurationInputContainer').hide(); // Show reason input field
  483. } */
  484. // Populate CPS Section based on response or data
  485. if (cpsDetails.cps === "yes") {
  486. $('#cpsYes').prop('checked', true); // Check Yes radio button
  487. $('#cpsNo').prop('disabled', true); // Disable No radio button
  488. $('#cpsInputDiv').show(); // Show CPS amount input field
  489. $('#cpsAmount').val(cpsDetails.cps_amount || '').prop('readonly', true); // Set CPS amount and make readonly
  490. } else if (cpsDetails.cps === "no") {
  491. $('#cpsNo').prop('checked', true); // Check No radio button
  492. $('#cpsYes').prop('disabled', true); // Disable Yes radio button
  493. $('#cpsInputDiv').hide(); // Hide CPS amount input field
  494. }
  495. // Populate EL or LPA Section based on response or data
  496. if (cpsDetails.el_or_lpa === "yes") {
  497. $('#elLpaYes').prop('checked', true); // Check Yes radio button
  498. $('#elLpaNo').prop('disabled', true); // Disable No radio button
  499. $('#elLpaInputDiv').show(); // Show input field for EL or LPA Amount
  500. $('#elLpaAmount').val(cpsDetails.el_or_lpa_amount || '').prop('readonly', true); // Set the amount and make readonly
  501. } else if (cpsDetails.el_or_lpa === "no") {
  502. $('#elLpaNo').prop('checked', true); // Check No radio button
  503. $('#elLpaYes').prop('disabled', true); // Disable Yes radio button
  504. $('#elLpaInputDiv').hide(); // Hide input field for EL or LPA Amount
  505. }
  506. // Populate SPFGS Section based on response or data
  507. if (cpsDetails.spfgs === "yes") {
  508. $('#spfgsYes').prop('checked', true); // Check Yes radio button
  509. $('#spfgsNo').prop('disabled', true); // Disable No radio button
  510. $('#spfgsInputDiv').show(); // Show SPFGS amount input field
  511. $('#spfgsAmount').val(cpsDetails.spfgs_amount || '').prop('readonly', true); // Set SPFGS amount and make readonly
  512. } else if (cpsDetails.spfgs === "no") {
  513. $('#spfgsNo').prop('checked', true); // Check No radio button
  514. $('#spfgsYes').prop('disabled', true); // Disable Yes radio button
  515. $('#spfgsInputDiv').hide(); // Hide SPFGS amount input field
  516. }
  517. // Handle SPFGS changes
  518. $('#spfgsYes').change(function () {
  519. if ($(this).is(':checked')) {
  520. $('#spfgsNo').prop('disabled', true); // Disable No radio button
  521. $('#spfgsInputDiv').show(); // Show SPFGS amount input field
  522. }
  523. });
  524. $('#spfgsNo').change(function () {
  525. if ($(this).is(':checked')) {
  526. $('#spfgsYes').prop('disabled', true); // Disable Yes radio button
  527. $('#spfgsInputDiv').hide(); // Hide SPFGS amount input field
  528. }
  529. });
  530. // Show the modal after fetching details
  531. $('#completedDetailsModal').modal('show');
  532. } else {
  533. Swal.fire({
  534. icon: 'info',
  535. title: 'No Data',
  536. text: 'No details found for the selected CPS record.',
  537. confirmButtonText: 'OK',
  538. });
  539. }
  540. },
  541. error: function () {
  542. Swal.fire({
  543. icon: 'error',
  544. title: 'Error',
  545. text: 'Failed to fetch CPS details. Please try again.',
  546. confirmButtonText: 'OK',
  547. });
  548. },
  549. });
  550. }
  551. });
  552. $('#completedBackButton').on('click', function () {
  553. $('#completedDetailsModal').modal('hide'); // Replace 'yourModalId' with the actual modal ID
  554. });
  555. ///history function to show in modal
  556. function loadFileHistory(tempId) {
  557. $.ajax({
  558. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  559. type: 'GET',
  560. data: { tempId: tempId }, // Pass empCode as a parameter
  561. success: function (response) {
  562. if (response.length > 0) {
  563. let historyHtml = '';
  564. response.forEach(item => {
  565. historyHtml += `
  566. <div class="file-history-item">
  567. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  568. <div class="file-history-content">
  569. <div class="file-history-status">${item.fileStatusHistory}</div>
  570. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  571. </div>
  572. </div>
  573. `;
  574. });
  575. $('#fileHistoryContainer').html(historyHtml);
  576. } else {
  577. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  578. }
  579. },
  580. error: function () {
  581. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  582. }
  583. });
  584. }
  585. // Function to format date and time
  586. function formatDateTime(dateString) {
  587. const options = {
  588. day: '2-digit',
  589. month: '2-digit',
  590. year: 'numeric',
  591. };
  592. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  593. }
  594. </script>
  595. </body>
  596. </html>