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.

559 lines
23 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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-md-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="row col-md-12" id="gisentrycontainer" style="display: none;padding-left: 0px;padding-right: 0px;margin-left: 3px;">
  217. <div class="col-md-6">
  218. <label for="gisentry" class="form-label fw-bold">GIS Entry Type</label>
  219. <input type="text" id="gisentry" class="form-control" readonly>
  220. </div>
  221. <div class="col-md-6">
  222. <label for="gisamount" class="form-label fw-bold">
  223. Sanctioned GIS Advance
  224. </label>
  225. <div class="d-flex align-items-center">
  226. <div class="form-check" style="padding-right:10px;">
  227. <input type="radio" id="gisyes" name="gisamount" class="form-check-input" value="Yes" disabled>
  228. <label for="gisyes" class="form-check-label">Yes</label>
  229. </div>
  230. <div class="form-check">
  231. <input type="radio" id="gisno" name="gisamount" class="form-check-input" value="No" disabled>
  232. <label for="gisno" class="form-check-label">No</label>
  233. </div>
  234. </div>
  235. <div class="dropdown" id="gisAmountInputContainer" style="display: none; margin-top: 10px;">
  236. <input type="text" id="gisAmountInput" class="form-control" readonly>
  237. </div>
  238. </div>
  239. </div>
  240. <div class="col-md-6">
  241. <label for="sanctionalGISDate " class="form-label fw-bold">Sanctional GIS Date</label>
  242. <input type="date" id="sanctionalGISDate" class="form-control" readonly>
  243. </div>
  244. <div class="col-md-6">
  245. <label for="sanctionalGisAmount " class="form-label fw-bold">Sanctional GIS Amount </label>
  246. <input type="number" id="sanctionalGisAmount" class="form-control" readonly>
  247. </div>
  248. <div class="col-md-6">
  249. <label for="licDate " class="form-label fw-bold">File Forward To LIC On</label>
  250. <input type="date" id="licDate" class="form-control" readonly>
  251. </div>
  252. <!-- Date File Sent to Audit -->
  253. <div class="col-md-6">
  254. <label for="datefile_modal" class="form-label fw-bold">File Completed Date </label>
  255. <input type="date" id="datefile_modal" class="form-control" readonly>
  256. </div>
  257. <!-- Remarks -->
  258. <div class="col-md-12">
  259. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label>
  260. <textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea>
  261. </div>
  262. <!-- new -->
  263. <div class="col-md-12 mt-4">
  264. <h5>File History</h5>
  265. <div id="fileHistoryContainer" class="file-history-list">
  266. <!-- File History will be dynamically loaded here -->
  267. </div>
  268. </div>
  269. </div>
  270. <div class="row mb-2 mt-2">
  271. <div class="col-md-12 d-flex justify-content-center">
  272. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  273. </div>
  274. </div>
  275. <div style="display :none" id="receivedcard">
  276. <div class="row">
  277. </div>
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  284. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  285. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  286. <!-- Bootstrap 5 JS -->
  287. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  288. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  289. <script>
  290. // Initialize DataTable
  291. const table = $('#GISDatatable').DataTable({
  292. dom: 'Bftip',
  293. columnDefs: [
  294. { targets: 'no-sort', orderable: false }
  295. ],
  296. lengthMenu: [
  297. [50, 100, 200, 500, -1],
  298. ['50 rows', '100 rows', '200 rows', 'Show all']
  299. ],
  300. scrollY: '50vh',
  301. buttons: [
  302. { extend: 'pageLength', className: 'btn btn-warning' },
  303. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  304. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  305. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  306. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  307. ],
  308. fixedHeader: true,
  309. autoWidth: true,
  310. responsive: true,
  311. searching: true,
  312. select: false,
  313. processing: false
  314. });
  315. //model function
  316. function fetchEmployeeDetails(tempId) {
  317. $.ajax({
  318. url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details
  319. type: 'GET',
  320. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  321. success: function (response) {
  322. if (response && response.length > 0) {
  323. let employeeDetails = response[0]; // Access the first object in the array
  324. console.log("response:",response);
  325. // Populate modal fields
  326. $('#employeenomodel').val(employeeDetails.emp_no);
  327. $('#employeename').val(employeeDetails.emp_name);
  328. $('#department').val(employeeDetails.dept_name);
  329. $('#designation').val(employeeDetails.designation);
  330. $('#classes').val(employeeDetails.relationship_deceased);
  331. $('#datefile_modal').val(employeeDetails.file_moved_date);
  332. $('#remarks_modal').val(employeeDetails.remarks);
  333. $('#retirementdate').val(employeeDetails.service_death);
  334. $('#sanctionalGISDate').val(employeeDetails.sanctional_gis_date);
  335. $('#sanctionalGisAmount').val(employeeDetails.sanctional_gis_amount);
  336. $('#licDate').val(employeeDetails.lic_date);
  337. /* gisyes
  338. gisno
  339. gisAmountInputContainer
  340. gisAmountInput */
  341. // Populate gis advance Section based on response or data
  342. if(employeeDetails.gis_entry!=null && employeeDetails.gis_advance!=null){
  343. $('#gisentrycontainer').show();
  344. $('#gisentry').val(employeeDetails.gis_entry);
  345. // Populate gis advance Section based on response or data
  346. if (employeeDetails.gis_advance === "yes") {
  347. $('#gisyes').prop('checked', true); // Check Yes radio button
  348. $('#gisno').prop('disabled', true); // Disable No radio button
  349. $('#gisAmountInputContainer').show(); // Show CPS amount input field
  350. $('#gisAmountInput').val(employeeDetails.gis_advance_amount || '').prop('readonly', true); // Set CPS amount and make readonly
  351. } else if (employeeDetails.gis_advance === "no") {
  352. $('#gisno').prop('checked', true); // Check No radio button
  353. $('#gisyes').prop('disabled', true); // Disable Yes radio button
  354. $('#gisAmountInputContainer').hide(); // Hide CPS amount input field
  355. }
  356. }
  357. else{
  358. $('#gisentrycontainer').hide();
  359. }
  360. // Update the modal title with the employee code
  361. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  362. // Show the modal
  363. $('#returnretrieddetailsModal').modal('show');
  364. //additional card display function
  365. document.getElementById("submitbutton").addEventListener("click", function() {
  366. // $('#datefile').val('');
  367. $('#remarks').val('');
  368. document.getElementById("receivedcard").style.display = "block";
  369. });
  370. /* document.getElementById('auditsubmit').addEventListener('click', function () {
  371. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  372. // Trigger the save function and pass the value
  373. saveEntryDetails(tempId,employeeNo);
  374. }); */
  375. } else {
  376. Swal.fire({
  377. icon: 'info',
  378. title: 'No Data',
  379. text: 'No details found for the selected employee.',
  380. confirmButtonText: 'OK',
  381. });
  382. }
  383. },
  384. error: function () {
  385. Swal.fire({
  386. icon: 'error',
  387. title: 'Error',
  388. text: 'Failed to fetch employee details. Please try again.',
  389. confirmButtonText: 'OK',
  390. });
  391. },
  392. });
  393. }
  394. $(document).ready(function () {
  395. $(document).on('click', '.view-btn', function () {
  396. const empCode = $(this).data('id'); // Fetch `data-id` value
  397. console.log("empCode====="+empCode);
  398. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  399. // Hide the receivedcard section before showing the modal
  400. $("#receivedcard").hide();
  401. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  402. loadFileHistory(tempId); // Load the file history for the selected employee
  403. });
  404. // Initialize the modal with static backdrop and disabled keyboard closing
  405. $('#returnretrieddetailsModal').modal({
  406. backdrop: 'static',
  407. keyboard: false,
  408. show: false // Ensure it doesn't auto-show on page load
  409. });
  410. // Handle close button click
  411. $('#back').click(function () {
  412. $('#returnretrieddetailsModal').modal('hide');
  413. });
  414. $('.close').click(function () {
  415. $('#returnretrieddetailsModal').modal('hide');
  416. });
  417. });
  418. function loadFileHistory(tempId) {
  419. $.ajax({
  420. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  421. type: 'GET',
  422. data: { tempId: tempId }, // Pass empCode as a parameter
  423. success: function (response) {
  424. if (response.length > 0) {
  425. let historyHtml = '';
  426. response.forEach(item => {
  427. historyHtml += `
  428. <div class="file-history-item">
  429. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  430. <div class="file-history-content">
  431. <div class="file-history-status">${item.fileStatusHistory}</div>
  432. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  433. </div>
  434. </div>
  435. `;
  436. });
  437. $('#fileHistoryContainer').html(historyHtml);
  438. } else {
  439. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  440. }
  441. },
  442. error: function () {
  443. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  444. }
  445. });
  446. }
  447. // Function to format date and time
  448. function formatDateTime(dateString) {
  449. const options = {
  450. day: '2-digit',
  451. month: '2-digit',
  452. year: 'numeric',
  453. };
  454. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  455. }
  456. </script>
  457. </body>
  458. </html>