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.

735 lines
28 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #returnretrieddetailsModal .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. </style>
  138. <body>
  139. <!--[if lt IE 8]>
  140. <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>
  141. <![endif]-->
  142. <div class="wrapper">
  143. <!-- header top menu Start -->
  144. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  145. <!-- header top menu end -->
  146. <div class="page-wrap">
  147. <!--=============== Left Menu side Start ================-->
  148. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  149. <!--=============== Left side End ================-->
  150. <div class="main-content">
  151. <div class="container-fluid">
  152. <div class="page-header mb-2">
  153. <div class="row align-items-end">
  154. <div class="col-lg-8">
  155. <div class="page-header-title">
  156. <i class="fa fa-list-alt bg-blue"></i>
  157. <div class="d-inline">
  158. <h5>Pendency</h5>
  159. <span>Department Entries</span>
  160. </div>
  161. </div>
  162. </div>
  163. <div class="col-lg-4">
  164. <nav class="breadcrumb-container" aria-label="breadcrumb">
  165. <ol class="breadcrumb">
  166. <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
  167. <li class="breadcrumb-item" aria-current="page">Department Entries</li>
  168. <li class="breadcrumb-item" aria-current="page">Audit</li>
  169. <li class="breadcrumb-item active" aria-current="page">Pendency</li>
  170. </ol>
  171. </nav>
  172. </div>
  173. </div>
  174. </div>
  175. <div class="row mt-4">
  176. <div class="col-md-12">
  177. <div class="card">
  178. <div class="card-block">
  179. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span>
  180. <h5 style="font-weight:bold;">Audit - Pendency</h5>
  181. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5>
  182. <span th:text="${userId}" id="userId" style="display:none"></span>
  183. <div id="audittable">
  184. <table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
  185. <thead class="thead-dark">
  186. <tr role="row">
  187. <th class="text-center">S.No</th>
  188. <th class="text-center">Employee Code</th>
  189. <th class="text-center">Name </th>
  190. <th class="text-center">Department</th>
  191. <th class="text-center">Designation</th>
  192. <th class="text-center">File Sent Date</th>
  193. <th class="text-center">File Category Type</th>
  194. <th class="text-center">File Type</th>
  195. <th class="text-center">View</th>
  196. </tr>
  197. </thead>
  198. <tbody style="text-align:center;">
  199. <!-- Thymeleaf loop to populate data -->
  200. <tr th:each="audit, iterStat : ${auditlist}">
  201. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  202. <td th:text="${audit['emp_no']}" class="text-center"></td>
  203. <td th:text="${audit['emp_name']}" class="text-center"></td>
  204. <td th:text="${audit['dept_name']}" class="text-center"></td>
  205. <td th:text="${audit['designation']}" class="text-center"></td>
  206. <td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
  207. <td th:text="${audit['file_category_name']}" class="text-center"></td>
  208. <td th:text="${audit['file_entry_type']}" class="text-center"></td>
  209. <td class="text-center">
  210. <button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}">
  211. View
  212. </button>
  213. </td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  225. </div>
  226. </div>
  227. <!-- Modal Box -->
  228. <div class="modal fade" id="returnpendencydetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  229. <div class="modal-dialog modal-xl" role="document">
  230. <div class="modal-content">
  231. <div class="modal-header">
  232. <h5 class="modal-title" id="detailsModalLabel">
  233. Audit -Pendency(<span id="modalEmployeeCode"></span>)
  234. </h5>
  235. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  236. <span aria-hidden="true">&times;</span>
  237. </button>
  238. </div>
  239. <div class="modal-body">
  240. <div class="row">
  241. <!-- Employee No -->
  242. <div class="col-md-6">
  243. <label for="employeeno" class="form-label fw-bold">Employee No </label>
  244. <input type="number" id="employeeno" class="form-control" readonly>
  245. </div>
  246. <!-- Employee Name -->
  247. <div class="col-md-6">
  248. <label for="employeename" class="form-label fw-bold">Employee Name </label>
  249. <input type="text" id="employeename" class="form-control" readonly>
  250. </div>
  251. <!-- Department -->
  252. <div class="col-md-6">
  253. <label for="department" class="form-label fw-bold">Department </label>
  254. <input type="text" id="department" class="form-control" readonly>
  255. </div>
  256. <!-- Designation -->
  257. <div class="col-md-6">
  258. <label for="designation" class="form-label fw-bold">Designation </label>
  259. <input type="text" id="designation" class="form-control" readonly>
  260. </div>
  261. <!-- Class -->
  262. <div class="col-md-6">
  263. <label for="classes" class="form-label fw-bold">Class </label>
  264. <input type="text" id="classes" class="form-control" readonly>
  265. </div>
  266. <div class="col-md-6">
  267. <label for="retirementdate" class="form-label fw-bold">Retirement Date </label>
  268. <input type="date" id="retirementdate" class="form-control" readonly>
  269. </div>
  270. <div class="col-md-6" id="retirementDetailsContainer" style="display: none; margin-top: 10px;">
  271. <label for="retirement" class="form-label fw-bold">Type Of Retirement </label>
  272. <input type="text" id="retirement" class="form-control" readonly>
  273. </div>
  274. <div class="col-md-6">
  275. <label for="pendingDuration" class="form-label fw-bold">
  276. Pending Duration
  277. </label>
  278. <div class="d-flex align-items-center">
  279. <div class="form-check" style="padding-right:10px;">
  280. <input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled>
  281. <label for="yes" class="form-check-label">Yes</label>
  282. </div>
  283. <div class="form-check">
  284. <input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled>
  285. <label for="no" class="form-check-label">No</label>
  286. </div>
  287. </div>
  288. <div class="text" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;">
  289. <input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly>
  290. </div>
  291. </div>
  292. <!-- Date File Sent to Audit -->
  293. <div class="col-md-6">
  294. <label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label>
  295. <input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly>
  296. </div>
  297. <!-- Remarks -->
  298. <div class="col-md-12">
  299. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks</label>
  300. <textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea>
  301. </div>
  302. <!-- file history -->
  303. <div class="col-md-12 mt-4">
  304. <h5>File History</h5>
  305. <div id="fileHistoryContainer" class="file-history-list">
  306. <!-- File History will be dynamically loaded here -->
  307. </div>
  308. </div>
  309. </div>
  310. <div class="row mb-2 mt-2">
  311. <div class="col-md-12 d-flex justify-content-center">
  312. <button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Returned From Audit</button>
  313. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  314. </div>
  315. </div>
  316. <div style="display :none" id="receivedcard">
  317. <div class="row">
  318. <div class="col-md-6">
  319. <label for="datefile " class="form-label fw-bold">Date File Received From Audit <span class="text-danger">*</span></label>
  320. <input type="text" id="datefile" class="form-control" readonly >
  321. </div>
  322. <div class="col-md-12">
  323. <label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label>
  324. <textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
  325. </div>
  326. </div>
  327. <div class="row mb-2 mt-2">
  328. <div class="col-md-12 d-flex justify-content-center">
  329. <button type="button" class="btn btn-primary" id="auditbutton">Submit</button>
  330. </div>
  331. </div>
  332. </div>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  338. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  339. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  340. <!-- Bootstrap 5 JS -->
  341. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  342. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  343. <script>
  344. $(document).ready(function () {
  345. // Initialize the DataTable
  346. const dataTable = $('#AuditDatatable').DataTable({
  347. dom: 'Bftip',
  348. columnDefs: [
  349. { targets: 'no-sort', orderable: false }
  350. ],
  351. lengthMenu: [
  352. [50, 100, 200, 500, -1],
  353. ['50 rows', '100 rows', '200 rows', 'Show all']
  354. ],
  355. scrollY: '50vh',
  356. buttons: [
  357. { extend: 'pageLength', className: 'btn btn-warning' },
  358. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  359. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  360. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  361. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  362. ],
  363. fixedHeader: true,
  364. autoWidth: true,
  365. responsive: true,
  366. searching: true,
  367. paging: true,
  368. info: true,
  369. ordering: false,
  370. });
  371. });
  372. document.addEventListener("DOMContentLoaded", function() {
  373. // Get today's date
  374. const today = new Date();
  375. // Format the date as DD-MM-YYYY for display
  376. const day = String(today.getDate()).padStart(2, '0');
  377. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  378. const year = today.getFullYear();
  379. // Combine into DD-MM-YYYY format for display
  380. const formattedDateDisplay = `${day}-${month}-${year}`;
  381. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  382. document.getElementById("datefile").value = formattedDateDisplay;
  383. });
  384. function convertDateFormat(dateString) {
  385. if (!dateString) return '';
  386. let [day, month, year] = dateString.split('-');
  387. return `${year}-${month}-${day}`;
  388. }
  389. //model function
  390. function fetchEmployeeDetails(tempId) {
  391. $.ajax({
  392. url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details
  393. type: 'GET',
  394. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  395. success: function (response) {
  396. if (response && response.length > 0) {
  397. let employeeDetails = response[0]; // Access the first object in the array
  398. console.log("response:",response);
  399. console.log("employeecode:",tempId);
  400. // Populate modal fields
  401. $('#employeeno').val(employeeDetails.emp_no);
  402. $('#employeename').val(employeeDetails.emp_name);
  403. $('#department').val(employeeDetails.dept_name);
  404. $('#designation').val(employeeDetails.designation);
  405. $('#classes').val(employeeDetails.retirement_class);
  406. $('#retirementdate').val(employeeDetails.retirement_date);
  407. $('#datefile_modal').val(employeeDetails.file_moved_date);
  408. $('#remarks_modal').val(employeeDetails.remarks);
  409. $('#typeofcategory').val(employeeDetails.file_category_name);
  410. // Show Pending Duration and Input based on the value
  411. let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response
  412. let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response
  413. if (pendingDuration === "yes") {
  414. $('#pendingDurationInputContainer').show(); // Show the text box
  415. $('#pendingDurationInput').val(pendingReason); // Populate the input field
  416. } else {
  417. $('#pendingDurationInputContainer').hide(); // Hide the text box
  418. }
  419. // Update radio button selection
  420. if (pendingDuration === "yes") {
  421. $('#yes').prop('checked', true);
  422. } else {
  423. $('#no').prop('checked', true);
  424. }
  425. let typeOfCategory=employeeDetails.file_category_name;
  426. let typeOfRetirement=employeeDetails.type_of_retirement;
  427. if (typeOfCategory === "Retirement") {
  428. $('#retirementDetailsContainer').show(); // Show the text box
  429. $('#retirement').val(typeOfRetirement); // Populate the input field
  430. } else {
  431. $('#retirementDetailsContainer').hide(); // Hide the text box
  432. }
  433. // Update the modal title with the employee code
  434. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  435. // Show the modal
  436. $('#returnpendencydetailsModal').modal('show');
  437. //additional card display function
  438. document.getElementById("submitbutton").addEventListener("click", function() {
  439. // $('#datefile').val('');
  440. $('#remarks').val('');
  441. document.getElementById("receivedcard").style.display = "block";
  442. // Scroll the receivedcard section into view
  443. document.getElementById("receivedcard").scrollIntoView({
  444. behavior: "smooth", // Smooth scrolling effect
  445. block: "center" // Aligns the element to the center of the viewport
  446. });
  447. });
  448. /* document.getElementById('auditbutton').addEventListener('click', function () {
  449. let employeeNo = $('#employeeno').val(); // Using jQuery to get the value
  450. // Trigger the save function and pass the value
  451. saveEntryDetails(tempId,employeeNo);
  452. }); */
  453. $('#auditbutton').off('click').on('click', function () {
  454. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  455. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  456. });
  457. } else {
  458. Swal.fire({
  459. icon: 'info',
  460. title: 'No Data',
  461. text: 'No details found for the selected employee.',
  462. confirmButtonText: 'OK',
  463. });
  464. }
  465. },
  466. error: function () {
  467. Swal.fire({
  468. icon: 'error',
  469. title: 'Error',
  470. text: 'Failed to fetch employee details. Please try again.',
  471. confirmButtonText: 'OK',
  472. });
  473. },
  474. });
  475. }
  476. $(document).ready(function () {
  477. $(document).on('click', '.view-btn', function () {
  478. const empCode = $(this).data('id'); // Fetch `data-id` value
  479. const tempId = $(this).data('temp-id');
  480. console.log("empCode====="+empCode);
  481. console.log("tempId====="+tempId);
  482. // Hide the receivedcard section before showing the modal
  483. $("#receivedcard").hide();
  484. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  485. loadFileHistory(tempId); // Load the file history for the selected employee
  486. });
  487. // Initialize the modal with static backdrop and disabled keyboard closing
  488. $('#returnfamilypensiondetailsModal').modal({
  489. backdrop: 'static',
  490. keyboard: false,
  491. show: false // Ensure it doesn't auto-show on page load
  492. });
  493. // Handle close button click
  494. $('#back').click(function () {
  495. $('#returnpendencydetailsModal').modal('hide');
  496. });
  497. $('.close').click(function () {
  498. $('#returnpendencydetailsModal').modal('hide');
  499. });
  500. });
  501. function loadFileHistory(tempId) {
  502. $.ajax({
  503. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  504. type: 'GET',
  505. data: { tempId: tempId }, // Pass empCode as a parameter
  506. success: function (response) {
  507. if (response.length > 0) {
  508. let historyHtml = '';
  509. response.forEach(item => {
  510. historyHtml += `
  511. <div class="file-history-item">
  512. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  513. <div class="file-history-content">
  514. <div class="file-history-status">${item.fileStatusHistory}</div>
  515. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  516. </div>
  517. </div>
  518. `;
  519. });
  520. $('#fileHistoryContainer').html(historyHtml);
  521. } else {
  522. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  523. }
  524. },
  525. error: function () {
  526. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  527. }
  528. });
  529. }
  530. function formatDateTime(dateString) {
  531. const options = {
  532. day: '2-digit',
  533. month: '2-digit',
  534. year: 'numeric',
  535. };
  536. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  537. }
  538. function saveEntryDetails(tempId,empNo) {
  539. //console.log("emp_no inside=="+empCode);
  540. let entryDetails = {
  541. empNo: $('#employeeno').val(),
  542. tempId: tempId,
  543. dateToAudit:convertDateFormat($('#datefile').val()?.trim()),
  544. remarks: $('#remarks').val(),
  545. deptId:$('#deptId').text().trim(),
  546. filemovedby:$('#userId').text().trim()
  547. };
  548. console.log("entryDetails:",entryDetails);
  549. if (!entryDetails.remarks) {
  550. Swal.fire({
  551. icon: 'warning',
  552. title: 'Validation Error!',
  553. text: 'Remarks are required.',
  554. confirmButtonText: 'OK'
  555. });
  556. return;
  557. }
  558. // Disable the button to prevent multiple submissions
  559. $('#auditbutton').prop('disabled', true).text('Processing...');
  560. $.ajax({
  561. url: '/gcc/api/department/audit/updatePendencyDetails',
  562. type: 'POST',
  563. contentType: 'application/json',
  564. data: JSON.stringify(entryDetails),
  565. success: function (response) {
  566. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  567. Swal.fire({
  568. icon: 'success',
  569. title: 'Success',
  570. text: response,
  571. allowOutsideClick: false,
  572. allowEscapeKey: false,
  573. allowEnterKey: false,
  574. confirmButtonText: 'OK'
  575. }).then((result) => {
  576. if (result.isConfirmed) {
  577. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  578. window.location.href = "/gcc/department/audit/pendency";
  579. console.log("Continue clicked");
  580. }
  581. });
  582. },
  583. error: function (xhr, status, error) {
  584. $('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit');
  585. Swal.fire({
  586. icon: 'error',
  587. title: 'Error',
  588. text: 'Failed to save details. Please try again.',
  589. confirmButtonText: 'OK'
  590. });
  591. console.error('Error:', xhr.responseText);
  592. }
  593. });
  594. }
  595. </script>
  596. </body>
  597. </html>