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.

546 lines
22 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 p {
  10. margin: 5px 0;
  11. }
  12. #modalBody hr {
  13. margin: 15px 0;
  14. }
  15. hr {
  16. border: 1px solid #ccc;
  17. margin-top: 20px;
  18. margin-bottom: 20px;
  19. }
  20. h5 {
  21. font-size: bold;
  22. }
  23. #returnretrieddetailsModal .modal-body{
  24. max-height:80vh;
  25. overflow-y:auto;
  26. }
  27. #returnretrieddetailsModal .col-md-6{
  28. padding-bottom: 10px;
  29. }
  30. .file-history-list {
  31. margin-top: 10px;
  32. padding-left: 0;
  33. }
  34. .file-history-item {
  35. display: flex;
  36. padding: 5px 10px;
  37. font-family: Arial, sans-serif;
  38. align-items: flex-start;
  39. position: relative; /* For vertical line positioning */
  40. margin-bottom: 1px; /* Add space between items */
  41. }
  42. .file-history-item::before {
  43. content: '';
  44. position: absolute;
  45. top: 0;
  46. bottom: 0;
  47. left: 120px; /* Position of the vertical line */
  48. width: 1px;
  49. background-color: #ddd;
  50. }
  51. .file-history-date {
  52. margin-top: 10px;
  53. flex: 0 0 100px;
  54. font-weight: bold;
  55. font-size: 0.8rem;
  56. color: #333;
  57. text-align: center;
  58. white-space: nowrap; /* Prevent wrapping */
  59. }
  60. .file-history-content {
  61. flex: 5;
  62. padding-left: 20px; /* Adds space after the vertical line */
  63. display: flex;
  64. flex-direction: column;
  65. gap: 5px; /* Adds spacing between status and remarks */
  66. white-space: pre-wrap; /* Prevents wrapping */
  67. overflow: visible; /* Prevents content overflow */
  68. text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */
  69. }
  70. .file-history-status {
  71. font-size: 0.8rem;
  72. font-weight: bold;
  73. color: #555;
  74. white-space:pre-wrap; /* Prevent wrapping */
  75. overflow: visible;
  76. text-overflow: ellipsis;
  77. }
  78. .file-history-remarks {
  79. font-size: 0.8rem;
  80. color: #777;
  81. white-space: pre-wrap; /* Prevent wrapping */
  82. overflow: visible;
  83. text-overflow: ellipsis;
  84. }
  85. </style>
  86. <body>
  87. <!--[if lt IE 8]>
  88. <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>
  89. <![endif]-->
  90. <div class="wrapper">
  91. <!-- header top menu Start -->
  92. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  93. <!-- header top menu end -->
  94. <div class="page-wrap">
  95. <!--=============== Left Menu side Start ================-->
  96. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  97. <!--=============== Left side End ================-->
  98. <div class="main-content">
  99. <div class="container-fluid">
  100. <div class="page-header mb-2">
  101. <div class="row align-items-end">
  102. <div class="col-lg-8">
  103. <div class="page-header-title">
  104. <i class="fa fa-list-alt bg-blue"></i>
  105. <div class="d-inline">
  106. <h5>GIS</h5>
  107. <span>Department Entries</span>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="col-lg-4">
  112. <nav class="breadcrumb-container" aria-label="breadcrumb">
  113. <ol class="breadcrumb">
  114. <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
  115. <li class="breadcrumb-item" aria-current="page">Department Entries</li>
  116. <li class="breadcrumb-item" aria-current="page">Completed</li>
  117. <li class="breadcrumb-item active" aria-current="page">GIS</li>
  118. </ol>
  119. </nav>
  120. </div>
  121. </div>
  122. </div>
  123. <div class="row mt-4">
  124. <div class="col-md-12">
  125. <div class="card">
  126. <div class="card-block">
  127. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5>
  128. <h5 style="font-weight:bold;">Completed-GIS</h5>
  129. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5>
  130. <span th:text="${userId}" id="userId" style="display:none"></span>
  131. <div id="audittable">
  132. <table id="GISDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
  133. <thead class="thead-dark">
  134. <tr role="row">
  135. <th class="text-center">S.No</th>
  136. <th class="text-center">Employee Code</th>
  137. <th class="text-center">Name </th>
  138. <th class="text-center">Department</th>
  139. <th class="text-center">Designation</th>
  140. <th class="text-center">File Sent Date</th>
  141. <th class="text-center">File Type</th>
  142. <th class="text-center">View</th>
  143. </tr>
  144. </thead>
  145. <tbody style="text-align:center;">
  146. <!-- Thymeleaf loop to populate data -->
  147. <tr th:each="audit, iterStat : ${auditlist}">
  148. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  149. <td th:text="${audit['emp_no']}" class="text-center"></td>
  150. <td th:text="${audit['emp_name']}" class="text-center"></td>
  151. <td th:text="${audit['dept_name']}" class="text-center"></td>
  152. <td th:text="${audit['designation']}" class="text-center"></td>
  153. <td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
  154. <td th:text="${audit['file_entry_type']}" class="text-center"></td>
  155. <td class="text-center">
  156. <button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']}, data-temp-id=${audit['temp_id']}">
  157. View
  158. </button>
  159. </td>
  160. </tr>
  161. </tbody>
  162. </table>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  171. </div>
  172. </div>
  173. <!-- Modal Box -->
  174. <div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  175. <div class="modal-dialog modal-lg" role="document">
  176. <div class="modal-content">
  177. <div class="modal-header">
  178. <h5 class="modal-title" id="detailsModalLabel">
  179. GIS - Completed (<span id="modalEmployeeCode"></span>)
  180. </h5>
  181. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  182. <span aria-hidden="true">&times;</span>
  183. </button>
  184. </div>
  185. <div class="modal-body">
  186. <div class="row">
  187. <!-- Employee No -->
  188. <div class="col-md-6">
  189. <label for="employeenomodel" class="form-label fw-bold">Employee No</label>
  190. <input type="text" id="employeenomodel" class="form-control" readonly>
  191. </div>
  192. <!-- Employee Name -->
  193. <div class="col-md-6">
  194. <label for="employeename" class="form-label fw-bold">Employee Name </label>
  195. <input type="text" id="employeename" class="form-control" readonly>
  196. </div>
  197. <!-- Department -->
  198. <div class="col-md-6">
  199. <label for="department" class="form-label fw-bold">Department </label>
  200. <input type="text" id="department" class="form-control" readonly>
  201. </div>
  202. <!-- Designation -->
  203. <div class="col-md-6">
  204. <label for="designation" class="form-label fw-bold">Designation </label>
  205. <input type="text" id="designation" class="form-control" readonly>
  206. </div>
  207. <div class="col-sm-6">
  208. <label for="retirementdate" class="form-label fw-bold">While in service Death </label>
  209. <input type="date" id="retirementdate" class="form-control" readonly>
  210. </div>
  211. <!-- Class -->
  212. <div class="col-md-6">
  213. <label for="classes" class="form-label fw-bold">Relationship of Deceased </label>
  214. <input type="text" id="classes" class="form-control" readonly>
  215. </div>
  216. <div class="col-md-6">
  217. <label for="gisentry" class="form-label fw-bold">GIS Entry Type<span class="text-danger">*</span></label>
  218. <input type="text" id="gisentry" class="form-control" readonly>
  219. </div>
  220. <div class="col-md-6">
  221. <label for="gisamount" class="form-label fw-bold">
  222. Sanctioned GIS Advance
  223. </label>
  224. <div class="d-flex align-items-center">
  225. <div class="form-check" style="padding-right:10px;">
  226. <input type="radio" id="gisyes" name="gisamount" class="form-check-input" value="Yes">
  227. <label for="gisyes" class="form-check-label">Yes</label>
  228. </div>
  229. <div class="form-check">
  230. <input type="radio" id="gisno" name="gisamount" class="form-check-input" value="No">
  231. <label for="gisno" class="form-check-label">No</label>
  232. </div>
  233. </div>
  234. <div class="dropdown" id="gisAmountInputContainer" style="display: none; margin-top: 10px;">
  235. <input type="text" id="gisAmountInput" class="form-control" readonly>
  236. </div>
  237. </div>
  238. <div class="col-md-6">
  239. <label for="sanctionalGISDate " class="form-label fw-bold">Sanctional GIS Date</label>
  240. <input type="date" id="sanctionalGISDate" class="form-control" readonly>
  241. </div>
  242. <div class="col-md-6">
  243. <label for="sanctionalGisAmount " class="form-label fw-bold">Sanctional GIS Amount </label>
  244. <input type="number" id="sanctionalGisAmount" class="form-control" readonly>
  245. </div>
  246. <div class="col-md-6">
  247. <label for="licDate " class="form-label fw-bold">File Forward To LIC On</label>
  248. <input type="date" id="licDate" class="form-control" readonly>
  249. </div>
  250. <!-- Date File Sent to Audit -->
  251. <div class="col-md-6">
  252. <label for="datefile_modal" class="form-label fw-bold">File Completed Date </label>
  253. <input type="date" id="datefile_modal" class="form-control" readonly>
  254. </div>
  255. <!-- Remarks -->
  256. <div class="col-md-12">
  257. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label>
  258. <textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea>
  259. </div>
  260. <!-- new -->
  261. <div class="col-md-12 mt-4">
  262. <h5>File History</h5>
  263. <div id="fileHistoryContainer" class="file-history-list">
  264. <!-- File History will be dynamically loaded here -->
  265. </div>
  266. </div>
  267. </div>
  268. <div class="row mb-2 mt-2">
  269. <div class="col-md-12 d-flex justify-content-center">
  270. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  271. </div>
  272. </div>
  273. <div style="display :none" id="receivedcard">
  274. <div class="row">
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. </div>
  281. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  282. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  283. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  284. <!-- Bootstrap 5 JS -->
  285. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  286. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  287. <script>
  288. // Initialize DataTable
  289. const table = $('#GISDatatable').DataTable({
  290. dom: 'Bftip',
  291. columnDefs: [
  292. { targets: 'no-sort', orderable: false }
  293. ],
  294. lengthMenu: [
  295. [50, 100, 200, 500, -1],
  296. ['50 rows', '100 rows', '200 rows', 'Show all']
  297. ],
  298. scrollY: '50vh',
  299. buttons: [
  300. { extend: 'pageLength', className: 'btn btn-warning' },
  301. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  302. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  303. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  304. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  305. ],
  306. fixedHeader: true,
  307. autoWidth: true,
  308. responsive: true,
  309. searching: true,
  310. select: false,
  311. processing: false
  312. });
  313. //model function
  314. function fetchEmployeeDetails(tempId) {
  315. $.ajax({
  316. url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details
  317. type: 'GET',
  318. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  319. success: function (response) {
  320. if (response && response.length > 0) {
  321. let employeeDetails = response[0]; // Access the first object in the array
  322. console.log("response:",response);
  323. // Populate modal fields
  324. $('#employeenomodel').val(employeeDetails.emp_no);
  325. $('#employeename').val(employeeDetails.emp_name);
  326. $('#department').val(employeeDetails.dept_name);
  327. $('#designation').val(employeeDetails.designation);
  328. $('#gisentry').val(employeeDetails.gis_entry);
  329. $('#classes').val(employeeDetails.relationship_deceased);
  330. $('#datefile_modal').val(employeeDetails.file_moved_date);
  331. $('#remarks_modal').val(employeeDetails.remarks);
  332. $('#retirementdate').val(employeeDetails.service_death);
  333. $('#sanctionalGISDate').val(employeeDetails.sanctional_gis_date);
  334. $('#sanctionalGisAmount').val(employeeDetails.sanctional_gis_amount);
  335. $('#licDate').val(employeeDetails.lic_date);
  336. /* gisyes
  337. gisno
  338. gisAmountInputContainer
  339. gisAmountInput */
  340. // Populate gis advance Section based on response or data
  341. if (employeeDetails.gis_advance === "yes") {
  342. $('#gisyes').prop('checked', true); // Check Yes radio button
  343. $('#gisno').prop('disabled', true); // Disable No radio button
  344. $('#gisAmountInputContainer').show(); // Show CPS amount input field
  345. $('#gisAmountInput').val(employeeDetails.gis_advance_amount || '').prop('readonly', true); // Set CPS amount and make readonly
  346. } else if (employeeDetails.gis_advance === "no") {
  347. $('#gisno').prop('checked', true); // Check No radio button
  348. $('#gisyes').prop('disabled', true); // Disable Yes radio button
  349. $('#gisAmountInputContainer').hide(); // Hide CPS amount input field
  350. }
  351. // Update the modal title with the employee code
  352. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  353. // Show the modal
  354. $('#returnretrieddetailsModal').modal('show');
  355. //additional card display function
  356. document.getElementById("submitbutton").addEventListener("click", function() {
  357. // $('#datefile').val('');
  358. $('#remarks').val('');
  359. document.getElementById("receivedcard").style.display = "block";
  360. });
  361. /* document.getElementById('auditsubmit').addEventListener('click', function () {
  362. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  363. // Trigger the save function and pass the value
  364. saveEntryDetails(tempId,employeeNo);
  365. }); */
  366. } else {
  367. Swal.fire({
  368. icon: 'info',
  369. title: 'No Data',
  370. text: 'No details found for the selected employee.',
  371. confirmButtonText: 'OK',
  372. });
  373. }
  374. },
  375. error: function () {
  376. Swal.fire({
  377. icon: 'error',
  378. title: 'Error',
  379. text: 'Failed to fetch employee details. Please try again.',
  380. confirmButtonText: 'OK',
  381. });
  382. },
  383. });
  384. }
  385. $(document).ready(function () {
  386. $(document).on('click', '.view-btn', function () {
  387. const empCode = $(this).data('id'); // Fetch `data-id` value
  388. console.log("empCode====="+empCode);
  389. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  390. // Hide the receivedcard section before showing the modal
  391. $("#receivedcard").hide();
  392. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  393. loadFileHistory(tempId); // Load the file history for the selected employee
  394. });
  395. // Initialize the modal with static backdrop and disabled keyboard closing
  396. $('#returnretrieddetailsModal').modal({
  397. backdrop: 'static',
  398. keyboard: false,
  399. show: false // Ensure it doesn't auto-show on page load
  400. });
  401. // Handle close button click
  402. $('#back').click(function () {
  403. $('#returnretrieddetailsModal').modal('hide');
  404. });
  405. $('.close').click(function () {
  406. $('#returnretrieddetailsModal').modal('hide');
  407. });
  408. });
  409. function loadFileHistory(tempId) {
  410. $.ajax({
  411. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  412. type: 'GET',
  413. data: { tempId: tempId }, // Pass empCode as a parameter
  414. success: function (response) {
  415. if (response.length > 0) {
  416. let historyHtml = '';
  417. response.forEach(item => {
  418. historyHtml += `
  419. <div class="file-history-item">
  420. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  421. <div class="file-history-content">
  422. <div class="file-history-status">${item.fileStatusHistory}</div>
  423. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  424. </div>
  425. </div>
  426. `;
  427. });
  428. $('#fileHistoryContainer').html(historyHtml);
  429. } else {
  430. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  431. }
  432. },
  433. error: function () {
  434. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  435. }
  436. });
  437. }
  438. // Function to format date and time
  439. function formatDateTime(dateString) {
  440. const options = {
  441. day: '2-digit',
  442. month: '2-digit',
  443. year: 'numeric',
  444. };
  445. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  446. }
  447. </script>
  448. </body>
  449. </html>