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.

969 lines
40 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
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. #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" 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">Comments/Remarks<span class="text-danger">*</span></label>
  347. <textarea id="remarks" class="form-control" rows="4" ></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 === '90') {
  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. //recover emp
  510. $('#recoveryemployeevalue').val(employeeDetails.recovery_emp);
  511. // DCRG File
  512. $('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true);
  513. //$('#filedate').val('');
  514. //$('#remarks').val('');
  515. }
  516. if (status === 5) {
  517. $('#gpfAmount').val('');
  518. $('#earnedleaveAmount').val('');
  519. $('#spfgsAmount').val('');
  520. $('#recoveryemployeevalue').val('');
  521. //$('#filedate').val('');
  522. //$('#remarks').val('');
  523. $('input[name="gpf"]').prop('checked', false);
  524. $('input[name="earnedleave"]').prop('checked', false);
  525. $('input[name="spfgs"]').prop('checked', false);
  526. $('input[name="dcrg"]').prop('checked', false);
  527. $('#gpfAmountDiv').hide();
  528. $('#earnedleaveAmountDiv').hide();
  529. $('#spfgsAmountDiv').hide();
  530. $('#receivedcard').show();
  531. }
  532. });
  533. /* document.getElementById('sendtopension').addEventListener('click', function () {
  534. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  535. // Trigger the save function and pass the value
  536. saveEntryDetails(tempId,employeeNo);
  537. }); */
  538. $('#sendtopension').off('click').on('click', function () {
  539. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  540. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  541. });
  542. } else {
  543. Swal.fire({
  544. icon: 'info',
  545. title: 'No Data',
  546. text: 'No details found for the selected employee.',
  547. confirmButtonText: 'OK',
  548. });
  549. }
  550. },
  551. error: function () {
  552. Swal.fire({
  553. icon: 'error',
  554. title: 'Error',
  555. text: 'Failed to fetch employee details. Please try again.',
  556. confirmButtonText: 'OK',
  557. });
  558. },
  559. });
  560. }
  561. $(document).ready(function () {
  562. $(document).on('click', '.view-btn', function () {
  563. const empCode = $(this).data('id'); // Fetch `data-id` value
  564. console.log("empCode====="+empCode);
  565. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  566. // Hide the receivedcard section before showing the modal
  567. $("#receivedcard").hide();
  568. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  569. loadFileHistory(tempId); // Load the file history for the selected employee
  570. });
  571. // Initialize the modal with static backdrop and disabled keyboard closing
  572. $('#returnretrieddetailsModal').modal({
  573. backdrop: 'static',
  574. keyboard: false,
  575. show: false // Ensure it doesn't auto-show on page load
  576. });
  577. // Handle close button click
  578. $('#back').click(function () {
  579. $('#returnretrieddetailsModal').modal('hide');
  580. });
  581. $('.close').click(function () {
  582. $('#returnretrieddetailsModal').modal('hide');
  583. });
  584. });
  585. function loadFileHistory(tempId) {
  586. $.ajax({
  587. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  588. type: 'GET',
  589. data: { tempId: tempId }, // Pass empCode as a parameter
  590. success: function (response) {
  591. if (response.length > 0) {
  592. let historyHtml = '';
  593. response.forEach(item => {
  594. historyHtml += `
  595. <div class="file-history-item">
  596. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  597. <div class="file-history-content">
  598. <div class="file-history-status">${item.fileStatusHistory}</div>
  599. <div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
  600. </div>
  601. </div>
  602. `;
  603. });
  604. $('#fileHistoryContainer').html(historyHtml);
  605. } else {
  606. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  607. }
  608. },
  609. error: function () {
  610. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  611. }
  612. });
  613. }
  614. // Function to format date and time
  615. function formatDateTime(dateString) {
  616. const options = {
  617. day: '2-digit',
  618. month: '2-digit',
  619. year: 'numeric',
  620. };
  621. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  622. }
  623. function saveEntryDetails(tempId,empCode) {
  624. //console.log("emp_no inside=="+empCode);
  625. // Get the selected GPF value
  626. let selectedGpfValue = $('input[name="gpf"]:checked').val(); // Get the selected radio button value
  627. let gpfAmount = null;
  628. if (selectedGpfValue === 'yes' || selectedGpfValue === '90') {
  629. gpfAmount = $('#gpfAmount').val(); // Retrieve the amount if available, else null
  630. if(!gpfAmount){
  631. Swal.fire({
  632. icon: 'warning',
  633. title: 'Validation Error!',
  634. text: 'GPF amount are required.',
  635. confirmButtonText: 'OK'
  636. });
  637. return;
  638. }
  639. }
  640. let selectedElValue = $('input[name="earnedleave"]:checked').val();
  641. let earnedleaveAmount=null;
  642. if (selectedElValue === 'yes') {
  643. earnedleaveAmount = $('#earnedleaveAmount').val(); // Retrieve the amount if available, else null
  644. if(!earnedleaveAmount){
  645. Swal.fire({
  646. icon: 'warning',
  647. title: 'Validation Error!',
  648. text: 'Earned Leave Amount are required.',
  649. confirmButtonText: 'OK'
  650. });
  651. return;
  652. }
  653. }
  654. let selectedspfgsValue = $('input[name="spfgs"]:checked').val();
  655. let spfgsAmount=null;
  656. if (selectedspfgsValue === 'yes') {
  657. spfgsAmount = $('#spfgsAmount').val(); // Retrieve the amount if available, else null
  658. if(!spfgsAmount){
  659. Swal.fire({
  660. icon: 'warning',
  661. title: 'Validation Error!',
  662. text: 'SPFGS amount are required.',
  663. confirmButtonText: 'OK'
  664. });
  665. return;
  666. }
  667. }
  668. // Check if GPF Amount input is visible and get its value
  669. /* if (selectedGpfValue === 'yes' || selectedGpfValue === '90') {
  670. gpfAmount = $('#gpfAmount').val() || null; // Retrieve the amount if available, else null
  671. }
  672. let selectedElValue = $('input[name="earnedleave"]:checked').val();
  673. let earnedleaveAmount=null;
  674. if (selectedElValue === 'yes') {
  675. earnedleaveAmount = $('#earnedleaveAmount').val() || null; // Retrieve the amount if available, else null
  676. }
  677. let selectedspfgsValue = $('input[name="spfgs"]:checked').val();
  678. let spfgsAmount=null;
  679. if (selectedspfgsValue === 'yes') {
  680. spfgsAmount = $('#spfgsAmount').val() || null; // Retrieve the amount if available, else null
  681. } */
  682. //dcrf
  683. let selecteddcrgValue = $('input[name="dcrg"]:checked').val();
  684. let entryDetails = {
  685. empNo: empCode,
  686. tempId:tempId,
  687. file_moved_date:convertDateFormat($('#filedate').val()?.trim()),
  688. remarks: $('#remarks').val(),
  689. deptId:$('#deptId').text().trim(),
  690. filemovedby:$('#userId').text().trim(),
  691. gpf: selectedGpfValue, // Add GPF value (null if none selected)
  692. gpfAmount: gpfAmount || null, // Include the GPF amount
  693. private_affairs:selectedElValue,
  694. private_affairs_amount:earnedleaveAmount || null,
  695. spfgs:selectedspfgsValue,
  696. spfgs_amount:spfgsAmount || null,
  697. recovery_emp:$('#recoveryemployeevalue').val()|| null,
  698. dcrg:selecteddcrgValue
  699. };
  700. console.log("entryDetails:",entryDetails);
  701. if (!entryDetails.dcrg) {
  702. Swal.fire({
  703. icon: 'warning',
  704. title: 'Validation Error!',
  705. text: 'DCRG are required.',
  706. confirmButtonText: 'OK'
  707. });
  708. return;
  709. }
  710. if (!entryDetails.spfgs) {
  711. Swal.fire({
  712. icon: 'warning',
  713. title: 'Validation Error!',
  714. text: 'SPFGS are required.',
  715. confirmButtonText: 'OK'
  716. });
  717. return;
  718. }
  719. if (!entryDetails.private_affairs) {
  720. Swal.fire({
  721. icon: 'warning',
  722. title: 'Validation Error!',
  723. text: 'Private affairs are required.',
  724. confirmButtonText: 'OK'
  725. });
  726. return;
  727. }
  728. if (!entryDetails.gpf) {
  729. Swal.fire({
  730. icon: 'warning',
  731. title: 'Validation Error!',
  732. text: 'GPF are required.',
  733. confirmButtonText: 'OK'
  734. });
  735. return;
  736. }
  737. if (!entryDetails.remarks) {
  738. Swal.fire({
  739. icon: 'warning',
  740. title: 'Validation Error!',
  741. text: 'Remarks are required.',
  742. confirmButtonText: 'OK'
  743. });
  744. return;
  745. }
  746. // Validate required fields
  747. /* if (!entryDetails.file_moved_date || !entryDetails.gpf || !entryDetails.private_affairs || !entryDetails.spfgs || !entryDetails.dcrg || !entryDetails.remarks) {
  748. Swal.fire({
  749. icon: 'warning',
  750. title: 'Fill All Fields',
  751. text: 'Please fill all mandatory fields.',
  752. confirmButtonText: 'OK'
  753. });
  754. return;
  755. } */
  756. $('#sendtopension').prop('disabled', true).text('Processing...');
  757. $.ajax({
  758. url: '/gcc/api/department/received/updateEmployeeDetails',
  759. type: 'POST',
  760. contentType: 'application/json',
  761. data: JSON.stringify(entryDetails),
  762. success: function (response) {
  763. $('#sendtopension').prop('disabled', false).text('Submit');
  764. Swal.fire({
  765. icon: 'success',
  766. title: 'Success',
  767. text: response,
  768. allowOutsideClick: false,
  769. allowEscapeKey: false,
  770. allowEnterKey: false,
  771. confirmButtonText: 'OK'
  772. }).then((result) => {
  773. if (result.isConfirmed) {
  774. $('#sendtopension').prop('disabled', false).text('Submit');
  775. window.location.href = "/gcc/department/received/pendency";
  776. console.log("Continue clicked");
  777. }
  778. });
  779. },
  780. error: function (xhr, status, error) {
  781. $('#sendtopension').prop('disabled', false).text('Submit');
  782. Swal.fire({
  783. icon: 'error',
  784. title: 'Error',
  785. text: 'Failed to save details. Please try again.',
  786. confirmButtonText: 'OK'
  787. });
  788. console.error('Error:', xhr.responseText);
  789. }
  790. });
  791. }
  792. document.addEventListener("DOMContentLoaded", function() {
  793. // Get today's date
  794. const today = new Date();
  795. // Format the date as DD-MM-YYYY for display
  796. const day = String(today.getDate()).padStart(2, '0');
  797. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  798. const year = today.getFullYear();
  799. // Combine into DD-MM-YYYY format for display
  800. const formattedDateDisplay = `${day}-${month}-${year}`;
  801. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  802. document.getElementById("filedate").value = formattedDateDisplay;
  803. });
  804. function convertDateFormat(dateString) {
  805. if (!dateString) return '';
  806. let [day, month, year] = dateString.split('-');
  807. return `${year}-${month}-${day}`;
  808. }
  809. </script>
  810. </body>
  811. </html>