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.

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