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