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.

694 lines
28 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 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. #receivedprovisionalModal .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>Provisional Retirement</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">Completed</li>
  169. <li class="breadcrumb-item active" aria-current="page">Provisional Retirement</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. <span th:text="${filecategory}" id="filecategory" style="display:none"></span>
  180. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5>
  181. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Provisional Retirement</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 Type</th>
  194. <th class="text-center">View</th>
  195. </tr>
  196. </thead>
  197. <tbody style="text-align:center;">
  198. <!-- Thymeleaf loop to populate data -->
  199. <tr th:each="provisional, iterStat : ${provisionallist}">
  200. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  201. <td th:text="${provisional['emp_no']}" class="text-center"></td>
  202. <td th:text="${provisional['emp_name']}" class="text-center"></td>
  203. <td th:text="${provisional['dept_name']}" class="text-center"></td>
  204. <td th:text="${provisional['designation']}" class="text-center"></td>
  205. <td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
  206. <td th:text="${provisional['file_entry_type']}" class="text-center"></td>
  207. <td class="text-center">
  208. <button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}">
  209. View
  210. </button>
  211. </td>
  212. </tr>
  213. </tbody>
  214. </table>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  223. </div>
  224. </div>
  225. <!-- Modal Box -->
  226. <div class="modal fade" id="receivedprovisionalModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  227. <div class="modal-dialog modal-xl" role="document">
  228. <div class="modal-content">
  229. <div class="modal-header">
  230. <h5 class="modal-title" id="detailsModalLabel">
  231. Received From Department - Provisional Retirement (<span id="modalEmployeeCode"></span>)
  232. </h5>
  233. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  234. <span aria-hidden="true">&times;</span>
  235. </button>
  236. </div>
  237. <div class="modal-body">
  238. <div class="row">
  239. <!-- Employee No -->
  240. <div class="col-md-6">
  241. <label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label>
  242. <input type="number" id="employeenomodel" class="form-control" readonly>
  243. </div>
  244. <!-- Employee Name -->
  245. <div class="col-md-6">
  246. <label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label>
  247. <input type="text" id="employeename" class="form-control" readonly>
  248. </div>
  249. <!-- Department -->
  250. <div class="col-md-6">
  251. <label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label>
  252. <input type="text" id="department" class="form-control" readonly>
  253. </div>
  254. <!-- Designation -->
  255. <div class="col-md-6">
  256. <label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label>
  257. <input type="text" id="designation" class="form-control" readonly>
  258. </div>
  259. <!-- Class -->
  260. <div class="col-md-6">
  261. <label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label>
  262. <input type="text" id="classes" class="form-control" readonly>
  263. </div>
  264. <!-- Type Of Retirement -->
  265. <div class="col-md-6">
  266. <label for="typeofretirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label>
  267. <input type="text" id="typeofretirement" class="form-control" readonly>
  268. </div>
  269. <div class="col-sm-6">
  270. <label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label>
  271. <input type="date" id="retirementdate" class="form-control" readonly>
  272. </div>
  273. <!-- Reason For Provisional Pension is given -->
  274. <!-- provisionalreason
  275. otherReason -->
  276. <div class="col-md-6">
  277. <label for="provisionalreason" class="form-label fw-bold">Reason For Provisional Pension is given <span class="text-danger">*</span></label>
  278. <input type="text" id="provisionalreason" class="form-control" readonly>
  279. <div id="otherReasonDiv" style="display: none; margin-top: 10px;">
  280. <label for="otherReason" class="form-label">Please specify:</label>
  281. <input type="text" id="otherReason" class="form-control" placeholder="Enter reason" readonly>
  282. </div>
  283. </div>
  284. <!-- Date File Sent to Pension Section -->
  285. <div class="col-md-6">
  286. <label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension Section <span class="text-danger">*</span></label>
  287. <input type="date" id="datefile_modal" class="form-control" readonly onclick="this.showPicker()">
  288. </div>
  289. <!-- Pending Duration -->
  290. <div class="col-md-6">
  291. <label for="pendingDuration" class="form-label fw-bold">Pending Duration <span class="text-danger">*</span></label>
  292. <div class="d-flex align-items-center">
  293. <div class="form-check" style="padding-right:10px;">
  294. <input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" disabled>
  295. <label for="yespen" class="form-check-label">yes</label>
  296. </div>
  297. <div class="form-check">
  298. <input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" disabled>
  299. <label for="nopen" class="form-check-label">no</label>
  300. </div>
  301. </div>
  302. <div id="clickyesdiv" style="display: none; margin-top: 10px;">
  303. <label for="clickyes" class="form-label">Please specify:</label>
  304. <input type="text" id="Clickyes" class="form-control" placeholder="Enter reason">
  305. </div>
  306. </div>
  307. <!-- dp -->
  308. <div class="col-md-6">
  309. <label for="DP" class="form-label fw-bold">DP<span class="text-danger">*</span></label>
  310. <div class="d-flex align-items-center">
  311. <div class="form-check " style="padding-right:10px;">
  312. <input type="radio" id="yes" name="DP" value="yes" class="form-check-input" disabled>
  313. <label for="yes" class="form-check-label">yes</label>
  314. </div>
  315. <br>
  316. <div class="form-check" >
  317. <input type="radio" id="no" name="DP" value="no" class="form-check-input" disabled>
  318. <label for="no" class="form-check-label" >no</label>
  319. </div>
  320. </div>
  321. </div>
  322. <!-- Retirement Amount -->
  323. <div class="col-md-6">
  324. <label for="RetirementAmount" class="form-label fw-bold">
  325. Provisional Retirement Amount <span class="text-danger">*</span>
  326. </label>
  327. <div class="d-flex align-items-center">
  328. <div class="form-check" style="padding-right:10px;">
  329. <input type="radio" id="fifty" name="RetirementAmount" value="50" class="form-check-input" disabled>
  330. <label for="fifty" class="form-check-label">50%</label>
  331. </div>
  332. <div class="form-check" style="padding-right:10px;">
  333. <input type="radio" id="seventyfive" name="RetiremesntAmount" value="75" class="form-check-input" disabled>
  334. <label for="seventyfive" class="form-check-label">75%</label>
  335. </div>
  336. <div class="form-check" style="padding-right:10px;">
  337. <input type="radio" id="hundred" name="RetirementAmount" value="100" class="form-check-input" disabled>
  338. <label for="hundred" class="form-check-label">100%</label>
  339. </div>
  340. </div>
  341. <!-- Additional Input Field -->
  342. <div class="mt-3" id="additionalInputDiv" style="display: none;">
  343. <input type="number" id="additionalInput" class="form-control" placeholder="Enter Amount" readonly>
  344. </div>
  345. </div>
  346. <!-- Remarks -->
  347. <div class="col-md-12">
  348. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label>
  349. <textarea id="remarks_modal" class="form-control" rows="2" placeholder="Enter your remarks here" readonly></textarea>
  350. </div>
  351. <!-- new -->
  352. <div class="col-md-12 mt-4">
  353. <h5>File History</h5>
  354. <div id="fileHistoryContainer" class="file-history-list">
  355. <!-- File History will be dynamically loaded here -->
  356. </div>
  357. </div>
  358. </div>
  359. <div class="row mb-2 mt-2">
  360. <div class="col-md-12 d-flex justify-content-center">
  361. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. </div>
  367. </div>
  368. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  369. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  370. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  371. <!-- Bootstrap 5 JS -->
  372. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  373. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  374. <script>
  375. // Initialize DataTable
  376. const table = $('#AuditDatatable').DataTable({
  377. dom: 'Bftip',
  378. columnDefs: [
  379. { targets: 'no-sort', orderable: false }
  380. ],
  381. lengthMenu: [
  382. [50, 100, 200, 500, -1],
  383. ['50 rows', '100 rows', '200 rows', 'Show all']
  384. ],
  385. scrollY: '50vh',
  386. buttons: [
  387. { extend: 'pageLength', className: 'btn btn-warning' },
  388. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  389. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  390. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  391. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  392. ],
  393. fixedHeader: true,
  394. autoWidth: true,
  395. responsive: true,
  396. searching: true,
  397. select: false,
  398. processing: false
  399. });
  400. $(document).ready(function () {
  401. $(document).on('click', '.view-btn', function () {
  402. const empCode = $(this).data('id'); // Fetch `data-id` value
  403. console.log("empCode====="+empCode);
  404. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  405. // Hide the receivedcard section before showing the modal
  406. $("#receivedcard").hide();
  407. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  408. loadFileHistory(tempId); // Load the file history for the selected employee
  409. });
  410. // Initialize the modal with static backdrop and disabled keyboard closing
  411. $('#receivedprovisionalModal').modal({
  412. backdrop: 'static',
  413. keyboard: false,
  414. show: false // Ensure it doesn't auto-show on page load
  415. });
  416. // Handle Close button click
  417. $('.close').click(function () {
  418. $('#receivedprovisionalModal').modal('hide'); // Hide the modal
  419. clearFields(); // Clear input fields
  420. });
  421. // Handle Back button click
  422. $('#back').click(function () {
  423. $('#receivedprovisionalModal').modal('hide'); // Hide the modal
  424. clearFields(); // Clear input fields
  425. });
  426. // Function to clear input fields
  427. /* function clearFields() {
  428. $('#datefile').val(''); // Clear date input
  429. $('#remarks').val(''); // Clear textarea
  430. } */
  431. });
  432. //model function
  433. function fetchEmployeeDetails(tempId) {
  434. $.ajax({
  435. url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details
  436. type: 'GET',
  437. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  438. success: function (response) {
  439. if (response && response.length > 0) {
  440. let employeeDetails = response[0]; // Access the first object in the array
  441. console.log("response:",response);
  442. // Populate modal fields
  443. $('#employeenomodel').val(employeeDetails.emp_no);
  444. $('#employeename').val(employeeDetails.emp_name);
  445. $('#department').val(employeeDetails.dept_name);
  446. $('#designation').val(employeeDetails.designation);
  447. $('#typeofretirement').val(employeeDetails.type_of_retirement);
  448. $('#retirementdate').val(employeeDetails.retirement_date);
  449. $('#classes').val(employeeDetails.retirement_class);
  450. $('#datefile_modal').val(employeeDetails.file_moved_date);
  451. $('#remarks_modal').val(employeeDetails.remarks);
  452. $('#provisionalreason').val(employeeDetails.reason_for_provisional_pension);
  453. // Ensure employeeDetails exists
  454. if (employeeDetails) {
  455. let prPercentage = employeeDetails.pr_percentage;
  456. let prAmount = employeeDetails.pr_amount || '';
  457. // Convert pr_percentage to string to avoid type mismatches
  458. prPercentage = prPercentage ? prPercentage.toString() : '';
  459. // Reset any previously selected radio buttons (in case of multiple calls)
  460. $('#fifty').prop('checked', false).prop('disabled', false);
  461. $('#seventyfive').prop('checked', false).prop('disabled', false);
  462. $('#hundred').prop('checked', false).prop('disabled', false);
  463. // Hide the additional input field initially
  464. $('#additionalInputDiv').hide();
  465. // Check if pr_percentage is a valid percentage
  466. if (prPercentage === "50") {
  467. // Select 50% radio button and disable all
  468. $('#fifty').prop('checked', true).prop('disabled', true);
  469. $('#seventyfive').prop('disabled', true);
  470. $('#hundred').prop('disabled', true);
  471. } else if (prPercentage === "75" || prPercentage === "75.00") {
  472. // Select 75% radio button and disable all
  473. $('#seventyfive').prop('checked', true).prop('disabled', true);
  474. $('#fifty').prop('disabled', true);
  475. $('#hundred').prop('disabled', true);
  476. // If pr_amount exists, set it in the additional input
  477. $('#additionalInputDiv').show();
  478. $('#additionalInput').val(prAmount).prop('readonly', true);
  479. } else if (prPercentage === "100") {
  480. // Select 100% radio button and disable all
  481. $('#hundred').prop('checked', true).prop('disabled', true);
  482. $('#fifty').prop('disabled', true);
  483. $('#seventyfive').prop('disabled', true);
  484. } else {
  485. // If pr_percentage is NOT 50, 75, or 100, show the additional input field
  486. $('#additionalInputDiv').show();
  487. $('#additionalInput').val(prAmount).prop('readonly', true);
  488. }
  489. }
  490. // Populate Pending Duration and Reason fields
  491. if (employeeDetails.pending_duration === "Yes") {
  492. $('#yespen').prop('checked', true); // Check the Yes radio button
  493. $('#clickyesdiv').show(); // Show the reason input
  494. $('#Clickyes').val(employeeDetails.reason_for_pending || '').prop('readonly' ,true); // Set reason and make readonly
  495. } else if (employeeDetails.pending_duration === "No") {
  496. $('#nopen').prop('checked', true); // Check the No radio button
  497. $('#clickyesdiv').hide(); // Hide the reason input
  498. }
  499. //populate reason for provisional pension
  500. if (employeeDetails.reason_for_provisional_pension === "Others") {
  501. $('#otherReasonDiv').show(); // Show the input field for 'Others'
  502. $('#otherReason')
  503. .val(employeeDetails.others_provisional_pension || '')
  504. .prop('readonly' ,true); // Populate and make readonly
  505. } else {
  506. $('#otherReasonDiv').hide(); // Hide the input field if reason is not 'Others'
  507. }
  508. // Handle DP value
  509. if (employeeDetails.dp === "yes") {
  510. $('#yes').prop('checked', true); // Select 'yes' radio button
  511. } else if (employeeDetails.dp === "no") {
  512. $('#no').prop('checked', true); // Select 'no' radio button
  513. }
  514. // Update the modal title with the employee code
  515. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  516. // Show the modal
  517. $('#receivedprovisionalModal').modal('show');
  518. } else {
  519. Swal.fire({
  520. icon: 'info',
  521. title: 'No Data',
  522. text: 'No details found for the selected employee.',
  523. confirmButtonText: 'OK',
  524. });
  525. }
  526. },
  527. error: function () {
  528. Swal.fire({
  529. icon: 'error',
  530. title: 'Error',
  531. text: 'Failed to fetch employee details. Please try again.',
  532. confirmButtonText: 'OK',
  533. });
  534. },
  535. });
  536. }
  537. ///history function to show in modal
  538. function loadFileHistory(tempId) {
  539. $.ajax({
  540. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  541. type: 'GET',
  542. data: { tempId: tempId }, // Pass empCode as a parameter
  543. success: function (response) {
  544. if (response.length > 0) {
  545. let historyHtml = '';
  546. response.forEach(item => {
  547. historyHtml += `
  548. <div class="file-history-item">
  549. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  550. <div class="file-history-content">
  551. <div class="file-history-status">${item.fileStatusHistory}</div>
  552. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  553. </div>
  554. </div>
  555. `;
  556. });
  557. $('#fileHistoryContainer').html(historyHtml);
  558. } else {
  559. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  560. }
  561. },
  562. error: function () {
  563. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  564. }
  565. });
  566. }
  567. // Function to format date and time
  568. function formatDateTime(dateString) {
  569. const options = {
  570. day: '2-digit',
  571. month: '2-digit',
  572. year: 'numeric',
  573. };
  574. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  575. }
  576. </script>
  577. </body>
  578. </html>