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.

684 lines
28 KiB

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