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.

971 lines
40 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. #returnretrieddetailsModal .modal-body{
  10. max-height:80vh;
  11. overflow-y:auto;
  12. }
  13. #returnretrieddetailsModal .col-md-4,.col-md-12{
  14. padding-bottom: 10px;
  15. }
  16. .file-history-list {
  17. margin-top: 10px;
  18. padding-left: 0;
  19. }
  20. .file-history-item {
  21. display: flex;
  22. padding: 5px 10px;
  23. font-family: Arial, sans-serif;
  24. align-items: flex-start;
  25. position: relative; /* For vertical line positioning */
  26. margin-bottom: 1px; /* Add space between items */
  27. }
  28. .file-history-item::before {
  29. content: '';
  30. position: absolute;
  31. top: 0;
  32. bottom: 0;
  33. left: 120px; /* Position of the vertical line */
  34. width: 1px;
  35. background-color: #ddd;
  36. }
  37. .file-history-date {
  38. margin-top: 10px;
  39. flex: 0 0 100px;
  40. font-weight: bold;
  41. font-size: 0.8rem;
  42. color: #333;
  43. text-align: center;
  44. white-space: nowrap; /* Prevent wrapping */
  45. }
  46. .file-history-content {
  47. flex: 5;
  48. padding-left: 20px; /* Adds space after the vertical line */
  49. display: flex;
  50. flex-direction: column;
  51. gap: 5px; /* Adds spacing between status and remarks */
  52. white-space: pre-wrap; /* Prevents wrapping */
  53. overflow: visible; /* Prevents content overflow */
  54. text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */
  55. }
  56. .file-history-status {
  57. font-size: 0.8rem;
  58. font-weight: bold;
  59. color: #555;
  60. white-space:pre-wrap; /* Prevent wrapping */
  61. overflow: visible;
  62. text-overflow: ellipsis;
  63. }
  64. .file-history-remarks {
  65. font-size: 0.8rem;
  66. color: #777;
  67. white-space: pre-wrap; /* Prevent wrapping */
  68. overflow: visible;
  69. text-overflow: ellipsis;
  70. }
  71. .col-md-4 .form-check{
  72. width: 25%;
  73. }
  74. .form-check-label{
  75. padding-top: 4%;
  76. }
  77. </style>
  78. <body>
  79. <!--[if lt IE 8]>
  80. <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>
  81. <![endif]-->
  82. <div class="wrapper">
  83. <!-- header top menu Start -->
  84. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  85. <!-- header top menu end -->
  86. <div class="page-wrap">
  87. <!--=============== Left Menu side Start ================-->
  88. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  89. <!--=============== Left side End ================-->
  90. <div class="main-content">
  91. <div class="container-fluid">
  92. <div class="page-header mb-2">
  93. <div class="row align-items-end">
  94. <div class="col-lg-8">
  95. <div class="page-header-title">
  96. <i class="fa fa-list-alt bg-blue"></i>
  97. <div class="d-inline">
  98. <h5>Pendency</h5>
  99. <span>Department Entries</span>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="col-lg-4">
  104. <nav class="breadcrumb-container" aria-label="breadcrumb">
  105. <ol class="breadcrumb">
  106. <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
  107. <li class="breadcrumb-item" aria-current="page">Department Entries</li>
  108. <li class="breadcrumb-item" aria-current="page">Received From Pension</li>
  109. <li class="breadcrumb-item active" aria-current="page">Pendency</li>
  110. </ol>
  111. </nav>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="row mt-4">
  116. <div class="col-md-12">
  117. <div class="card">
  118. <div class="card-block">
  119. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5>
  120. <h5 style="font-weight:bold;">Received From Pension - Pendency</h5>
  121. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5>
  122. <span th:text="${userId}" id="userId" style="display:none"></span>
  123. <div id="returnretriedtable">
  124. <table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
  125. <thead class="thead-dark">
  126. <tr role="row">
  127. <th class="text-center">S.No</th>
  128. <th class="text-center">Employee Code</th>
  129. <th class="text-center">Name </th>
  130. <th class="text-center">Department</th>
  131. <th class="text-center">Designation</th>
  132. <th class="text-center">File Sent Date</th>
  133. <th class="text-center">File Type</th>
  134. <th class="text-center">View</th>
  135. </tr>
  136. </thead>
  137. <tbody style="text-align:center;">
  138. <!-- Thymeleaf loop to populate data -->
  139. <tr th:each="received, iterStat : ${receivedlist}">
  140. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  141. <td th:text="${received['emp_no']}" class="text-center"></td>
  142. <td th:text="${received['emp_name']}" class="text-center"></td>
  143. <td th:text="${received['dept_name']}" class="text-center"></td>
  144. <td th:text="${received['designation']}" class="text-center"></td>
  145. <td th:text="${received['file_moved_date'] != null ? #dates.format(received['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
  146. <td th:text="${received['file_entry_type']}" class="text-center"></td>
  147. <td class="text-center">
  148. <button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${received['emp_no']}, data-temp-id=${received['temp_id']}">
  149. View
  150. </button>
  151. </td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  163. </div>
  164. </div>
  165. <!-- Modal Box -->
  166. <div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  167. <div class="modal-dialog modal-xl" role="document">
  168. <div class="modal-content">
  169. <div class="modal-header">
  170. <h5 class="modal-title" id="detailsModalLabel">
  171. Received From Pension - Pendency (<span id="modalEmployeeCode"></span>)
  172. </h5>
  173. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  174. <span aria-hidden="true">&times;</span>
  175. </button>
  176. </div>
  177. <div class="modal-body">
  178. <div class="row">
  179. <!-- Employee No -->
  180. <div class="col-md-4">
  181. <label for="employeenomodel" class="form-label fw-bold">Employee No </label>
  182. <input type="number" id="employeenomodel" class="form-control" readonly>
  183. </div>
  184. <!-- Employee Name -->
  185. <div class="col-md-4">
  186. <label for="employeename" class="form-label fw-bold">Employee Name </label>
  187. <input type="text" id="employeename" class="form-control" readonly>
  188. </div>
  189. <!-- Department -->
  190. <div class="col-md-4">
  191. <label for="department" class="form-label fw-bold">Department </label>
  192. <input type="text" id="department" class="form-control" readonly>
  193. </div>
  194. <!-- Designation -->
  195. <div class="col-md-4">
  196. <label for="designation" class="form-label fw-bold">Designation </label>
  197. <input type="text" id="designation" class="form-control" readonly>
  198. </div>
  199. <div class="col-md-4">
  200. <label for="retirementdate" class="form-label fw-bold">Retirement Date </label>
  201. <input type="date" id="retirementdate" class="form-control" readonly>
  202. </div>
  203. <!-- Class -->
  204. <div class="col-md-4">
  205. <label for="classes" class="form-label fw-bold">Class </label>
  206. <input type="text" id="classes" class="form-control" readonly>
  207. </div>
  208. <!-- Type of Retirement -->
  209. <div class="col-md-4">
  210. <label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label>
  211. <input type="text" id="typeofretirement" class="form-control" readonly>
  212. </div>
  213. <div class="col-md-4">
  214. <label for="pendingDuration" class="form-label fw-bold">
  215. Pending Duration
  216. <span class="text-danger">*</span>
  217. </label>
  218. <div class="d-flex align-items-center">
  219. <div class="form-check" style="padding-right:10px;">
  220. <input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled>
  221. <label for="yes" class="form-check-label">Yes</label>
  222. </div>
  223. <div class="form-check">
  224. <input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled>
  225. <label for="no" class="form-check-label">No</label>
  226. </div>
  227. </div>
  228. <div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;">
  229. <input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly>
  230. </div>
  231. </div>
  232. <!-- Date File Sent to Audit -->
  233. <div class="col-md-4">
  234. <label for="datefile_modal" class="form-label fw-bold">File Forward to Department Date </label>
  235. <input type="date" id="datefile_modal" class="form-control" readonly>
  236. </div>
  237. <!-- Remarks -->
  238. <div class="col-md-12">
  239. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label>
  240. <textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea>
  241. </div>
  242. <!-- new -->
  243. <div class="col-md-12 mt-4">
  244. <h5>File History</h5>
  245. <div id="fileHistoryContainer" class="file-history-list">
  246. <!-- File History will be dynamically loaded here -->
  247. </div>
  248. </div>
  249. </div>
  250. <div class="row mb-2 mt-2">
  251. <div class="col-md-12 d-flex justify-content-center">
  252. <button type="button" class="btn btn-primary mx-2" id="submitbutton">Add Zone/Department Benefits</button>
  253. <button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button>
  254. </div>
  255. </div>
  256. <div style="display :none" id="receivedcard">
  257. <div class="row">
  258. <!-- GPF -->
  259. <div class="col-md-4 mb-2">
  260. <label class="form-label fw-bold">GPF<span class="text-danger">*</span></label>
  261. <div class="d-flex align-items-center gap-5">
  262. <div class="form-check">
  263. <input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes">
  264. <label class="form-check-label" for="gpfYes">Yes</label>
  265. </div>
  266. <div class="form-check">
  267. <input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no">
  268. <label class="form-check-label" for="gpfNo">No</label>
  269. </div>
  270. <div class="form-check">
  271. <input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90">
  272. <label class="form-check-label" for="gpf50">90%</label>
  273. </div>
  274. </div>
  275. <!-- Placeholder for dynamically added input -->
  276. <div id="gpfAmountDiv" class="mt-3" style="display: none;">
  277. <label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label>
  278. <input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)">
  279. </div>
  280. </div>
  281. <!-- Earned Leave & Leave on Private Affairs -->
  282. <div class="col-md-4 mb-2">
  283. <label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label>
  284. <div class="d-flex align-items-center gap-5">
  285. <div class="form-check">
  286. <input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes">
  287. <label class="form-check-label" for="earnedleaveYes">Yes</label>
  288. </div>
  289. <div class="form-check">
  290. <input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no">
  291. <label class="form-check-label" for="earnedleaveNo">No</label>
  292. </div>
  293. </div>
  294. <!-- Placeholder for dynamically added input -->
  295. <div id="earnedleaveAmountDiv" class="mt-3" style="display: none;">
  296. <label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label>
  297. <input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)">
  298. </div>
  299. </div>
  300. <!-- SPFGS -->
  301. <div class="col-md-4 mb-2">
  302. <label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label>
  303. <div class="d-flex align-items-center gap-5">
  304. <div class="form-check">
  305. <input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes">
  306. <label class="form-check-label" for="spfgsYes">Yes</label>
  307. </div>
  308. <div class="form-check">
  309. <input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no">
  310. <label class="form-check-label" for="spfgsNo">No</label>
  311. </div>
  312. </div>
  313. <!-- Placeholder for dynamically added input -->
  314. <div id="spfgsAmountDiv" class="mt-3" style="display: none;">
  315. <label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label>
  316. <input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)">
  317. </div>
  318. </div>
  319. <div class="col-md-4 mb-2">
  320. <label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label>
  321. <input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee">
  322. </div>
  323. <!-- DCRF File is Ready -->
  324. <div class="col-md-4">
  325. <label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label>
  326. <div class="d-flex align-items-center gap-5">
  327. <div class="form-check">
  328. <input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes">
  329. <label class="form-check-label" for="dcrgYes">Yes</label>
  330. </div>
  331. <div class="form-check">
  332. <input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no">
  333. <label class="form-check-label" for="dcrgNo">No</label>
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. <div class="row">
  339. <!-- Date File Forwarded to Pension -->
  340. <div class="col-md-4">
  341. <label for="filedate" class="form-label fw-bold">Date File Forwarded to Pension <span class="text-danger">*</span></label>
  342. <input type="text" id="filedate" class="form-control" readonly>
  343. </div>
  344. <!-- Remarks -->
  345. <div class="col-md-12">
  346. <label for="remarks" class="form-label fw-bold">Remarks<span class="text-danger">*</span></label>
  347. <textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
  348. </div>
  349. </div>
  350. <div class="row mb-2 mt-2">
  351. <div class="col-md-12 d-flex justify-content-center">
  352. <button type="button" class="btn btn-primary" id="sendtopension">Submit</button>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. </div>
  358. </div>
  359. </div>
  360. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  361. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  362. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  363. <!-- Bootstrap 5 JS -->
  364. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  365. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  366. <script>
  367. $(document).ready(function () {
  368. // Initialize DataTable
  369. const table = $('#ReturnRetriedDatatable').DataTable({
  370. dom: 'Bftip',
  371. columnDefs: [
  372. { targets: 'no-sort', orderable: false }
  373. ],
  374. lengthMenu: [
  375. [50, 100, 200, 500, -1],
  376. ['50 rows', '100 rows', '200 rows', 'Show all']
  377. ],
  378. scrollY: '50vh',
  379. buttons: [
  380. { extend: 'pageLength', className: 'btn btn-warning' },
  381. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  382. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  383. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  384. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  385. ],
  386. fixedHeader: true,
  387. autoWidth: true,
  388. responsive: true,
  389. searching: true,
  390. select: false,
  391. processing: false
  392. });
  393. document.getElementById("submitbutton").addEventListener("click", function () {
  394. // Clear the inputs in the receivedcard section
  395. //$('#filedate').val('');
  396. $('#remarks').val('');
  397. // Make the receivedcard section visible
  398. document.getElementById("receivedcard").style.display = "block";
  399. // Scroll the receivedcard section into view
  400. document.getElementById("receivedcard").scrollIntoView({
  401. behavior: "smooth", // Smooth scrolling effect
  402. block: "center" // Aligns the element to the center of the viewport
  403. });
  404. });
  405. // Listen for changes on the GPF radio buttons
  406. document.querySelectorAll('input[name="gpf"]').forEach(radio => {
  407. radio.addEventListener('change', function () {
  408. const gpfAmountDiv = document.getElementById('gpfAmountDiv');
  409. if (this.value === 'yes' || this.value === '50') {
  410. gpfAmountDiv.style.display = 'block'; // Show the input field
  411. } else {
  412. gpfAmountDiv.style.display = 'none'; // Hide the input field
  413. document.getElementById('gpfAmount').value = ''; // Clear the input field
  414. }
  415. });
  416. });
  417. // Listen for changes on the private affaires radio buttons
  418. document.querySelectorAll('input[name="earnedleave"]').forEach(radio => {
  419. radio.addEventListener('change', function () {
  420. const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv');
  421. if (this.value === 'yes') {
  422. earnedleaveAmountDiv.style.display = 'block'; // Show the input field
  423. } else {
  424. earnedleaveAmountDiv.style.display = 'none'; // Hide the input field
  425. document.getElementById('earnedleaveAmount').value = ''; // Clear the input field
  426. }
  427. });
  428. });
  429. // Listen for changes on the spfgs radio buttons
  430. document.querySelectorAll('input[name="spfgs"]').forEach(radio => {
  431. radio.addEventListener('change', function () {
  432. const spfgsAmountDiv = document.getElementById('spfgsAmountDiv');
  433. if (this.value === 'yes') {
  434. spfgsAmountDiv.style.display = 'block'; // Show the input field
  435. } else {
  436. spfgsAmountDiv.style.display = 'none'; // Hide the input field
  437. document.getElementById('spfgsAmount').value = ''; // Clear the input field
  438. }
  439. });
  440. });
  441. });
  442. //model function
  443. function fetchEmployeeDetails(tempId) {
  444. $.ajax({
  445. url: '/gcc/api/department/audit/getzonebenefitsdetails', // API to fetch employee details
  446. type: 'GET',
  447. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  448. success: function (response) {
  449. if (response && response.length > 0) {
  450. let employeeDetails = response[0]; // Access the first object in the array
  451. console.log("response:",response);
  452. // Populate modal fields
  453. $('#employeenomodel').val(employeeDetails.emp_no);
  454. $('#employeename').val(employeeDetails.emp_name);
  455. $('#department').val(employeeDetails.dept_name);
  456. $('#designation').val(employeeDetails.designation);
  457. $('#typeofretirement').val(employeeDetails.type_of_retirement);
  458. $('#classes').val(employeeDetails.retirement_class);
  459. $('#datefile_modal').val(employeeDetails.file_moved_date);
  460. $('#remarks_modal').val(employeeDetails.remarks);
  461. $('#retirementdate').val(employeeDetails.retirement_date);
  462. let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response
  463. let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response
  464. if (pendingDuration === "yes") {
  465. $('#pendingDurationInputContainer').show(); // Show the text box
  466. $('#pendingDurationInput').val(pendingReason); // Populate the input field
  467. } else {
  468. $('#pendingDurationInputContainer').hide(); // Hide the text box
  469. }
  470. // Update radio button selection
  471. if (pendingDuration === "yes") {
  472. $('#yes').prop('checked', true);
  473. } else {
  474. $('#no').prop('checked', true);
  475. }
  476. // Update the modal title with the employee code
  477. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  478. // Show the modal
  479. $('#returnretrieddetailsModal').modal('show');
  480. let status=employeeDetails.file_status;
  481. console.log("status=:"+status);
  482. $('#submitbutton').off('click').on('click', function() {
  483. if (status === 6) {
  484. $('#receivedcard').show();
  485. // GPF
  486. $('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true);
  487. if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "50") {
  488. $('#gpfAmountDiv').show();
  489. $('#gpfAmount').val(employeeDetails.gpf_amount);
  490. } else {
  491. $('#gpfAmountDiv').hide();
  492. }
  493. // Earned Leave & Leave on Private Affairs
  494. $('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true);
  495. if (employeeDetails.private_affairs === "yes") {
  496. $('#earnedleaveAmountDiv').show();
  497. $('#earnedleaveAmount').val(employeeDetails.private_affairs_amount);
  498. } else {
  499. $('#earnedleaveAmountDiv').hide();
  500. }
  501. // SPFGS
  502. $('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true);
  503. if (employeeDetails.spfgs === "yes") {
  504. $('#spfgsAmountDiv').show();
  505. $('#spfgsAmount').val(employeeDetails.spfgs_amount);
  506. } else {
  507. $('#spfgsAmountDiv').hide();
  508. }
  509. // DCRG File
  510. $('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true);
  511. //$('#filedate').val('');
  512. $('#remarks').val('');
  513. }
  514. if (status === 5) {
  515. $('#gpfAmount').val('');
  516. $('#earnedleaveAmount').val('');
  517. $('#spfgsAmount').val('');
  518. $('#recoveryemployeevalue').val('');
  519. //$('#filedate').val('');
  520. $('#remarks').val('');
  521. $('input[name="gpf"]').prop('checked', false);
  522. $('input[name="earnedleave"]').prop('checked', false);
  523. $('input[name="spfgs"]').prop('checked', false);
  524. $('input[name="dcrg"]').prop('checked', false);
  525. $('#gpfAmountDiv').hide();
  526. $('#earnedleaveAmountDiv').hide();
  527. $('#spfgsAmountDiv').hide();
  528. $('#receivedcard').show();
  529. }
  530. });
  531. /* document.getElementById('sendtopension').addEventListener('click', function () {
  532. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  533. // Trigger the save function and pass the value
  534. saveEntryDetails(tempId,employeeNo);
  535. }); */
  536. $('#sendtopension').off('click').on('click', function () {
  537. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  538. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  539. });
  540. } else {
  541. Swal.fire({
  542. icon: 'info',
  543. title: 'No Data',
  544. text: 'No details found for the selected employee.',
  545. confirmButtonText: 'OK',
  546. });
  547. }
  548. },
  549. error: function () {
  550. Swal.fire({
  551. icon: 'error',
  552. title: 'Error',
  553. text: 'Failed to fetch employee details. Please try again.',
  554. confirmButtonText: 'OK',
  555. });
  556. },
  557. });
  558. }
  559. $(document).ready(function () {
  560. $(document).on('click', '.view-btn', function () {
  561. const empCode = $(this).data('id'); // Fetch `data-id` value
  562. console.log("empCode====="+empCode);
  563. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  564. // Hide the receivedcard section before showing the modal
  565. $("#receivedcard").hide();
  566. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  567. loadFileHistory(tempId); // Load the file history for the selected employee
  568. });
  569. // Initialize the modal with static backdrop and disabled keyboard closing
  570. $('#returnretrieddetailsModal').modal({
  571. backdrop: 'static',
  572. keyboard: false,
  573. show: false // Ensure it doesn't auto-show on page load
  574. });
  575. // Handle close button click
  576. $('#back').click(function () {
  577. $('#returnretrieddetailsModal').modal('hide');
  578. });
  579. $('.close').click(function () {
  580. $('#returnretrieddetailsModal').modal('hide');
  581. });
  582. });
  583. function loadFileHistory(tempId) {
  584. $.ajax({
  585. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  586. type: 'GET',
  587. data: { tempId: tempId }, // Pass empCode as a parameter
  588. success: function (response) {
  589. if (response.length > 0) {
  590. let historyHtml = '';
  591. response.forEach(item => {
  592. historyHtml += `
  593. <div class="file-history-item">
  594. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  595. <div class="file-history-content">
  596. <div class="file-history-status">${item.fileStatusHistory}</div>
  597. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  598. </div>
  599. </div>
  600. `;
  601. });
  602. $('#fileHistoryContainer').html(historyHtml);
  603. } else {
  604. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  605. }
  606. },
  607. error: function () {
  608. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  609. }
  610. });
  611. }
  612. // Function to format date and time
  613. function formatDateTime(dateString) {
  614. const options = {
  615. day: '2-digit',
  616. month: '2-digit',
  617. year: 'numeric',
  618. };
  619. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  620. }
  621. function saveEntryDetails(tempId,empCode) {
  622. //console.log("emp_no inside=="+empCode);
  623. // Get the selected GPF value
  624. let selectedGpfValue = $('input[name="gpf"]:checked').val(); // Get the selected radio button value
  625. let gpfAmount = null;
  626. if (selectedGpfValue === 'yes' || selectedGpfValue === '90') {
  627. gpfAmount = $('#gpfAmount').val(); // Retrieve the amount if available, else null
  628. if(!gpfAmount){
  629. Swal.fire({
  630. icon: 'warning',
  631. title: 'Validation Error!',
  632. text: 'GPF amount are required.',
  633. confirmButtonText: 'OK'
  634. });
  635. return;
  636. }
  637. }
  638. let selectedElValue = $('input[name="earnedleave"]:checked').val();
  639. let earnedleaveAmount=null;
  640. if (selectedElValue === 'yes') {
  641. earnedleaveAmount = $('#earnedleaveAmount').val(); // Retrieve the amount if available, else null
  642. if(!earnedleaveAmount){
  643. Swal.fire({
  644. icon: 'warning',
  645. title: 'Validation Error!',
  646. text: 'Earned Leave Amount are required.',
  647. confirmButtonText: 'OK'
  648. });
  649. return;
  650. }
  651. }
  652. let selectedspfgsValue = $('input[name="spfgs"]:checked').val();
  653. let spfgsAmount=null;
  654. if (selectedspfgsValue === 'yes') {
  655. spfgsAmount = $('#spfgsAmount').val(); // Retrieve the amount if available, else null
  656. if(!spfgsAmount){
  657. Swal.fire({
  658. icon: 'warning',
  659. title: 'Validation Error!',
  660. text: 'SPFGS amount are required.',
  661. confirmButtonText: 'OK'
  662. });
  663. return;
  664. }
  665. }
  666. // Check if GPF Amount input is visible and get its value
  667. /* if (selectedGpfValue === 'yes' || selectedGpfValue === '90') {
  668. gpfAmount = $('#gpfAmount').val() || null; // Retrieve the amount if available, else null
  669. }
  670. let selectedElValue = $('input[name="earnedleave"]:checked').val();
  671. let earnedleaveAmount=null;
  672. if (selectedElValue === 'yes') {
  673. earnedleaveAmount = $('#earnedleaveAmount').val() || null; // Retrieve the amount if available, else null
  674. }
  675. let selectedspfgsValue = $('input[name="spfgs"]:checked').val();
  676. let spfgsAmount=null;
  677. if (selectedspfgsValue === 'yes') {
  678. spfgsAmount = $('#spfgsAmount').val() || null; // Retrieve the amount if available, else null
  679. } */
  680. //dcrf
  681. let selecteddcrgValue = $('input[name="dcrg"]:checked').val();
  682. let entryDetails = {
  683. empNo: empCode,
  684. tempId:tempId,
  685. file_moved_date:convertDateFormat($('#filedate').val()?.trim()),
  686. remarks: $('#remarks').val(),
  687. deptId:$('#deptId').text().trim(),
  688. filemovedby:$('#userId').text().trim(),
  689. gpf: selectedGpfValue, // Add GPF value (null if none selected)
  690. gpfAmount: gpfAmount || null, // Include the GPF amount
  691. private_affairs:selectedElValue,
  692. private_affairs_amount:earnedleaveAmount || null,
  693. spfgs:selectedspfgsValue,
  694. spfgs_amount:spfgsAmount || null,
  695. recovery_emp:$('#recoveryemployeevalue').val()|| null,
  696. dcrg:selecteddcrgValue
  697. };
  698. console.log("entryDetails:",entryDetails);
  699. if (!entryDetails.dcrg) {
  700. Swal.fire({
  701. icon: 'warning',
  702. title: 'Validation Error!',
  703. text: 'DCRG are required.',
  704. confirmButtonText: 'OK'
  705. });
  706. return;
  707. }
  708. if (!entryDetails.spfgs) {
  709. Swal.fire({
  710. icon: 'warning',
  711. title: 'Validation Error!',
  712. text: 'SPFGS are required.',
  713. confirmButtonText: 'OK'
  714. });
  715. return;
  716. }
  717. if (!entryDetails.private_affairs) {
  718. Swal.fire({
  719. icon: 'warning',
  720. title: 'Validation Error!',
  721. text: 'Private affairs are required.',
  722. confirmButtonText: 'OK'
  723. });
  724. return;
  725. }
  726. if (!entryDetails.gpf) {
  727. Swal.fire({
  728. icon: 'warning',
  729. title: 'Validation Error!',
  730. text: 'GPF are required.',
  731. confirmButtonText: 'OK'
  732. });
  733. return;
  734. }
  735. if (!entryDetails.remarks) {
  736. Swal.fire({
  737. icon: 'warning',
  738. title: 'Validation Error!',
  739. text: 'Remarks are required.',
  740. confirmButtonText: 'OK'
  741. });
  742. return;
  743. }
  744. // Validate required fields
  745. /* if (!entryDetails.file_moved_date || !entryDetails.gpf || !entryDetails.private_affairs || !entryDetails.spfgs || !entryDetails.dcrg || !entryDetails.remarks) {
  746. Swal.fire({
  747. icon: 'warning',
  748. title: 'Fill All Fields',
  749. text: 'Please fill all mandatory fields.',
  750. confirmButtonText: 'OK'
  751. });
  752. return;
  753. } */
  754. $('#sendtopension').prop('disabled', true).text('Processing...');
  755. $.ajax({
  756. url: '/gcc/api/department/received/updateEmployeeDetails',
  757. type: 'POST',
  758. contentType: 'application/json',
  759. data: JSON.stringify(entryDetails),
  760. success: function (response) {
  761. $('#sendtopension').prop('disabled', false).text('Submit');
  762. Swal.fire({
  763. icon: 'success',
  764. title: 'Success',
  765. text: response,
  766. allowOutsideClick: false,
  767. allowEscapeKey: false,
  768. allowEnterKey: false,
  769. confirmButtonText: 'OK'
  770. }).then((result) => {
  771. if (result.isConfirmed) {
  772. $('#sendtopension').prop('disabled', false).text('Submit');
  773. window.location.href = "/gcc/department/received/pendency";
  774. console.log("Continue clicked");
  775. }
  776. });
  777. },
  778. error: function (xhr, status, error) {
  779. $('#sendtopension').prop('disabled', false).text('Submit');
  780. Swal.fire({
  781. icon: 'error',
  782. title: 'Error',
  783. text: 'Failed to save details. Please try again.',
  784. confirmButtonText: 'OK'
  785. });
  786. console.error('Error:', xhr.responseText);
  787. }
  788. });
  789. }
  790. document.addEventListener("DOMContentLoaded", function() {
  791. // Get today's date
  792. const today = new Date();
  793. // Format the date as DD-MM-YYYY for display
  794. const day = String(today.getDate()).padStart(2, '0');
  795. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  796. const year = today.getFullYear();
  797. // Combine into DD-MM-YYYY format for display
  798. const formattedDateDisplay = `${day}-${month}-${year}`;
  799. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  800. document.getElementById("filedate").value = formattedDateDisplay;
  801. });
  802. function convertDateFormat(dateString) {
  803. if (!dateString) return '';
  804. let [day, month, year] = dateString.split('-');
  805. return `${year}-${month}-${day}`;
  806. }
  807. </script>
  808. </body>
  809. </html>