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.

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