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.

1295 lines
53 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
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/modules/base/head :: head}"></head>
  4. <style>
  5. .required{
  6. color: red;
  7. }
  8. #modalBody h4 {
  9. font-weight: bold;
  10. margin-top: 15px;
  11. margin-bottom: 10px;
  12. }
  13. #modalBody p {
  14. margin: 5px 0;
  15. }
  16. #modalBody hr {
  17. margin: 15px 0;
  18. }
  19. .comment {
  20. margin-bottom: 20px;
  21. }
  22. .comment p {
  23. margin: 0;
  24. }
  25. hr {
  26. border: 1px solid #ccc;
  27. margin-top: 20px;
  28. margin-bottom: 20px;
  29. }
  30. h5 {
  31. font-size: bold;
  32. }
  33. /* Limit the height of the dropdown menu and make it scrollable */
  34. .dropdown-menu {
  35. max-height: 200px; /* Adjust this value as needed */
  36. overflow-y: auto;
  37. }
  38. .col-4 {
  39. font-weight: bold;
  40. text-align: right;
  41. }
  42. .col-8 {
  43. padding-left: 20px;
  44. }
  45. .comment {
  46. padding: 10px 0;
  47. }
  48. .comment .text-muted {
  49. font-size: 0.9em;
  50. color: #6c757d;
  51. }
  52. .comment hr {
  53. border-top: 1px solid #ccc;
  54. }
  55. .comment .btn-link {
  56. font-size: 0.9em;
  57. text-decoration: underline;
  58. color: #007bff;
  59. }
  60. /* Make the modal body scrollable */
  61. #detailsModal .modal-body {
  62. max-height: 70vh; /* Limit the height to 70% of the viewport */
  63. overflow-y: auto; /* Enable vertical scrolling */
  64. }
  65. .card-box {
  66. border-radius: 20px;
  67. box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px;
  68. }
  69. #followupCard {
  70. transition: transform 0.2s ease; /* Smooth scaling transition */
  71. cursor: pointer; /* Default cursor change */
  72. }
  73. #followupCard:hover {
  74. transform: scale(1.05); /* Slightly scale up on hover */
  75. cursor: pointer; /* Change cursor to hand symbol */
  76. }
  77. .card-block {
  78. padding: 20px;
  79. }
  80. .form-label {
  81. margin-bottom: 0.5rem;
  82. }
  83. input.form-control {
  84. padding: 10px;
  85. }
  86. .form-select {
  87. padding: 10px;
  88. height: 40px;
  89. }
  90. #employeeCard label{
  91. padding-top: 2%;
  92. }
  93. #returnretrieddetailsModal .modal-body{
  94. max-height:80vh;
  95. overflow-y:auto;
  96. }
  97. #returnretrieddetailsModal .col-md-6{
  98. padding-bottom: 10px;
  99. }
  100. .file-history-list {
  101. margin-top: 10px;
  102. padding-left: 0;
  103. }
  104. .file-history-item {
  105. display: flex;
  106. padding: 5px 10px;
  107. font-family: Arial, sans-serif;
  108. align-items: flex-start;
  109. position: relative; /* For vertical line positioning */
  110. margin-bottom: 1px; /* Add space between items */
  111. }
  112. .file-history-item::before {
  113. content: '';
  114. position: absolute;
  115. top: 0;
  116. bottom: 0;
  117. left: 120px; /* Position of the vertical line */
  118. width: 1px;
  119. background-color: #ddd;
  120. }
  121. .file-history-date {
  122. margin-top: 10px;
  123. flex: 0 0 100px;
  124. font-weight: bold;
  125. font-size: 0.8rem;
  126. color: #333;
  127. text-align: center;
  128. white-space: nowrap; /* Prevent wrapping */
  129. }
  130. .file-history-content {
  131. flex: 5;
  132. padding-left: 20px; /* Adds space after the vertical line */
  133. display: flex;
  134. flex-direction: column;
  135. gap: 5px; /* Adds spacing between status and remarks */
  136. white-space: pre-wrap; /* Prevents wrapping */
  137. overflow: visible; /* Prevents content overflow */
  138. text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */
  139. }
  140. .file-history-remarks {
  141. font-size: 0.8rem;
  142. color: #777;
  143. white-space: pre-wrap; /* Prevent wrapping */
  144. overflow: visible;
  145. text-overflow: ellipsis;
  146. }
  147. .form-check {
  148. margin-right: 30px; /* Adjust space between Yes and No */
  149. }
  150. </style>
  151. <body>
  152. <!--[if lt IE 8]>
  153. <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>
  154. <![endif]-->
  155. <div class="wrapper">
  156. <!-- header top menu Start -->
  157. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  158. <!-- header top menu end -->
  159. <div class="page-wrap">
  160. <!--=============== Left Menu side Start ================-->
  161. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  162. <!--=============== Left side End ================-->
  163. <div class="main-content">
  164. <div class="container-fluid">
  165. <div class="page-header mb-2">
  166. <div class="row align-items-end">
  167. <div class="col-lg-8">
  168. <div class="page-header-title">
  169. <i class="fa fa-list-alt bg-blue"></i>
  170. <div class="d-inline">
  171. <h5>File Closing</h5>
  172. <span>Search Employee Number</span>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="col-lg-4">
  177. <nav class="breadcrumb-container" aria-label="breadcrumb">
  178. <ol class="breadcrumb">
  179. <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
  180. <li class="breadcrumb-item" aria-current="page">Retirement File Closing</li>
  181. <li class="breadcrumb-item" aria-current="page">File Closing</li>
  182. <!-- <li class="breadcrumb-item active" aria-current="page">Family Pension</li> -->
  183. </ol>
  184. </nav>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="row mt-4" >
  189. <div class="col-md-12">
  190. <div class="card">
  191. <div class="card-block">
  192. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span>
  193. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> Retirement File Closing</h5>
  194. <span th:text="${userId}" id="userId" style="display:none"></span>
  195. <div class="row mb-4">
  196. <!-- Input Fields for Year Selection -->
  197. <!-- Start Year Dropdown as Button Dropdown -->
  198. <!-- Start Year Dropdown as Button Dropdown -->
  199. <div class="col-md-4" >
  200. <label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label>
  201. <div class="dropdown">
  202. <input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required>
  203. <small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small>
  204. </div>
  205. </div>
  206. <div class="col-md-4 mt-20" >
  207. <button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button>
  208. <!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> -->
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="row mt-4">
  216. <div class="col-md-12">
  217. <div class="card">
  218. <div class="card-block">
  219. <h5 style="font-weight:bold;">Retirement File Closing</h5>
  220. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5>
  221. <span th:text="${userId}" id="userId" style="display:none"></span>
  222. <div id="audittable">
  223. <table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
  224. <thead class="thead-dark">
  225. <tr role="row">
  226. <th class="text-center">S.No</th>
  227. <th class="text-center">Employee Code</th>
  228. <th class="text-center">Name </th>
  229. <th class="text-center">Department</th>
  230. <th class="text-center">Designation</th>
  231. <th class="text-center">File Sent Date</th>
  232. <th class="text-center">File Type</th>
  233. <th class="text-center">View</th>
  234. </tr>
  235. </thead>
  236. <tbody style="text-align:center;">
  237. </tbody>
  238. </table>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. <div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
  247. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  248. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  249. <span class="sr-only">Loading...</span>
  250. </div>
  251. <!-- Add the 'Please wait' text below the spinner -->
  252. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  253. </div>
  254. </div>
  255. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  256. </div>
  257. </div>
  258. <!-- model box -->
  259. <div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  260. <div class="modal-dialog modal-xl" role="document">
  261. <div class="modal-content">
  262. <div class="modal-header">
  263. <h5 class="modal-title" id="detailsModalLabel">
  264. Retirement File Closing - Employee (<span id="modalEmployeeCode"></span>)
  265. </h5>
  266. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  267. <span aria-hidden="true">&times;</span>
  268. </button>
  269. </div>
  270. <div class="modal-body">
  271. <div class="row" id="sec1">
  272. <!-- Employee No -->
  273. <div class="col-md-4">
  274. <label for="employeenomodel" class="form-label fw-bold">Employee No </label>
  275. <input type="number" id="employeenomodel" class="form-control" readonly>
  276. </div>
  277. <!-- Employee Name -->
  278. <div class="col-md-4">
  279. <label for="employeename" class="form-label fw-bold">Employee Name </label>
  280. <input type="text" id="employeename" class="form-control" readonly>
  281. </div>
  282. <!-- Department -->
  283. <div class="col-md-4">
  284. <label for="department" class="form-label fw-bold">Department </label>
  285. <input type="text" id="department" class="form-control" readonly>
  286. </div>
  287. <!-- Designation -->
  288. <div class="col-md-4">
  289. <label for="designation" class="form-label fw-bold">Designation </label>
  290. <input type="text" id="designation" class="form-control" readonly>
  291. </div>
  292. <div class="col-md-4">
  293. <label for="retirementdate" class="form-label fw-bold">Retirement Date </label>
  294. <input type="date" id="retirementdate" class="form-control" readonly>
  295. </div>
  296. <!-- Class -->
  297. <div class="col-md-4">
  298. <label for="classes" class="form-label fw-bold">Class </label>
  299. <input type="text" id="classes" class="form-control" readonly>
  300. </div>
  301. <!-- Type of Retirement -->
  302. <div class="col-md-4">
  303. <label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label>
  304. <input type="text" id="typeofretirement" class="form-control" readonly>
  305. </div>
  306. <!-- Date File Sent to Audit -->
  307. <div class="col-md-4">
  308. <label for="datefile_modal" class="form-label fw-bold">File Updated Date</label>
  309. <input type="date" id="datefile_modal" class="form-control" readonly>
  310. </div>
  311. <!-- Remarks -->
  312. <div class="col-md-12">
  313. <label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label>
  314. <textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea>
  315. </div>
  316. </div>
  317. <hr>
  318. <p style="font-weight: bold;font-size: medium;text-decoration: underline;">Zone Benefits</p>
  319. <div class="row mt-2" id="sec2">
  320. <!-- GPF -->
  321. <div class="col-md-4 mb-2">
  322. <label class="form-label fw-bold">GPF</label>
  323. <div class="d-flex align-items-center gap-5">
  324. <div class="form-check">
  325. <input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes">
  326. <label class="form-check-label" for="gpfYes">Yes</label>
  327. </div>
  328. <div class="form-check">
  329. <input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no">
  330. <label class="form-check-label" for="gpfNo">No</label>
  331. </div>
  332. <div class="form-check">
  333. <input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90">
  334. <label class="form-check-label" for="gpf50">90%</label>
  335. </div>
  336. </div>
  337. <!-- Placeholder for dynamically added input -->
  338. <div id="gpfAmountDiv" class="mt-3" style="display: none;">
  339. <label for="gpfAmount" class="form-label">Enter GPF Amount</label>
  340. <input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)">
  341. </div>
  342. </div>
  343. <!-- Earned Leave & Leave on Private Affairs -->
  344. <div class="col-md-4 mb-2">
  345. <label class="form-label fw-bold">Earned Leave & Leave on Private Affairs</label>
  346. <div class="d-flex align-items-center gap-5">
  347. <div class="form-check">
  348. <input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes">
  349. <label class="form-check-label" for="earnedleaveYes">Yes</label>
  350. </div>
  351. <div class="form-check">
  352. <input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no">
  353. <label class="form-check-label" for="earnedleaveNo">No</label>
  354. </div>
  355. </div>
  356. <!-- Placeholder for dynamically added input -->
  357. <div id="earnedleaveAmountDiv" class="mt-3" style="display: none;">
  358. <label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount</label>
  359. <input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)">
  360. </div>
  361. </div>
  362. <!-- SPFGS -->
  363. <div class="col-md-4 mb-2">
  364. <label class="form-label fw-bold">SPFGS</label>
  365. <div class="d-flex align-items-center gap-5">
  366. <div class="form-check">
  367. <input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes">
  368. <label class="form-check-label" for="spfgsYes">Yes</label>
  369. </div>
  370. <div class="form-check">
  371. <input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no">
  372. <label class="form-check-label" for="spfgsNo">No</label>
  373. </div>
  374. </div>
  375. <!-- Placeholder for dynamically added input -->
  376. <div id="spfgsAmountDiv" class="mt-3" style="display: none;">
  377. <label for="spfgsAmount" class="form-label">Enter SPFGS Amount</label>
  378. <input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)">
  379. </div>
  380. </div>
  381. <div class="col-md-4 mb-2">
  382. <label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label>
  383. <input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee">
  384. </div>
  385. <!-- DCRF File is Ready -->
  386. <div class="col-md-4">
  387. <label class="form-label fw-bold">DCRG File is Ready</label>
  388. <div class="d-flex align-items-center gap-5">
  389. <div class="form-check">
  390. <input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes">
  391. <label class="form-check-label" for="dcrgYes">Yes</label>
  392. </div>
  393. <div class="form-check">
  394. <input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no">
  395. <label class="form-check-label" for="dcrgNo">No</label>
  396. </div>
  397. </div>
  398. </div>
  399. </div>
  400. <hr>
  401. <p style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</p>
  402. <div class="row" id="sec3">
  403. <div class="col-md-4 mt-2 mb-2">
  404. <label for="pensionNumber" class="form-label">Pension Number</label>
  405. <input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" >
  406. </div>
  407. <div class="col-md-4 mt-2 mb-2">
  408. <label for="ledgerNumber" class="form-label">Ledger Number</label>
  409. <input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number">
  410. </div>
  411. </div>
  412. <div class="row mt-2">
  413. <div class="col-md-4 mb-2">
  414. <label class="form-label fw-bold">Sanctions Pensions Benefit-Pension</label>
  415. <div class="d-flex align-items-center gap-5">
  416. <div class="form-check">
  417. <input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes">
  418. <label class="form-check-label" for="bpYes">Yes</label>
  419. </div>
  420. <div class="form-check">
  421. <input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no">
  422. <label class="form-check-label" for="bpNo">No</label>
  423. </div>
  424. </div>
  425. <!-- Placeholder for dynamically added input -->
  426. <div id="PbAmountDiv" class="mt-3" style="display: none;">
  427. <label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount</label>
  428. <input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" min="1" oninput="validatePositiveNumber(this)">
  429. </div>
  430. </div>
  431. <div class="col-md-4 mb-2">
  432. <label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG</label>
  433. <div class="d-flex align-items-center gap-5">
  434. <div class="form-check">
  435. <input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes">
  436. <label class="form-check-label" for="DcrgYes">Yes</label>
  437. </div>
  438. <div class="form-check">
  439. <input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no">
  440. <label class="form-check-label" for="DcrgNo">No</label>
  441. </div>
  442. </div>
  443. <!-- Placeholder for dynamically added input -->
  444. <div id="dcrgAmountDiv" class="mt-3" style="display: none;">
  445. <label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount</label>
  446. <input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" min="1" oninput="validatePositiveNumber(this)">
  447. </div>
  448. </div>
  449. <div class="col-md-4 mb-2">
  450. <label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation</label>
  451. <div class="d-flex align-items-center gap-5">
  452. <div class="form-check">
  453. <input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes">
  454. <label class="form-check-label" for="commutationYes">Yes</label>
  455. </div>
  456. <div class="form-check">
  457. <input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no">
  458. <label class="form-check-label" for="commutationNo">No</label>
  459. </div>
  460. </div>
  461. <!-- Placeholder for dynamically added input -->
  462. <div id="CommutationAmountDiv" class="mt-3" style="display: none;">
  463. <label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount</label>
  464. <input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" min="1" oninput="validatePositiveNumber(this)">
  465. </div>
  466. </div>
  467. </div>
  468. <!-- file history -->
  469. <div class="col-md-12 mt-4">
  470. <h5>File History</h5>
  471. <div id="fileHistoryContainer" class="file-history-list">
  472. <!-- File History will be dynamically loaded here -->
  473. </div>
  474. </div>
  475. <hr>
  476. <div class="row">
  477. <div class="col-md-3">
  478. <label for="datefile" class="form-label fw-bold">Date File Completed <span class="text-danger">*</span></label>
  479. <input type="text" id="datefile" class="form-control" readonly="readonly">
  480. </div>
  481. <div class="col-md-3">
  482. <label for="deathdate" class="form-label fw-bold">Employee Death Date<span class="text-danger">*</span></label>
  483. <input type="date" id="deathdate" class="form-control" onclick="this.showPicker()">
  484. </div>
  485. <div class="col-md-12">
  486. <label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
  487. <textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
  488. </div>
  489. </div>
  490. <div class="row mt-4">
  491. <div class="col-12 d-flex justify-content-center">
  492. <button id="closedbutton" class="btn btn-warning mt-2 mx-2">Mark as Closed</button>
  493. <button id="backbutton" class="btn btn-secondary mt-2" data-dismiss="modal">Back</button>
  494. </div>
  495. </div>
  496. </div>
  497. </div>
  498. </div>
  499. </div>
  500. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  501. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  502. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  503. <!-- Bootstrap 5 JS -->
  504. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  505. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  506. <script>
  507. $(document).ready(function () {
  508. // Initialize DataTable
  509. function initializeDataTable() {
  510. $('#AuditDatatable').DataTable({
  511. dom: 'Bftip',
  512. columnDefs: [{ targets: 'no-sort', orderable: false }],
  513. lengthMenu: [
  514. [50, 100, 200, 500, -1],
  515. ['50 rows', '100 rows', '200 rows', 'Show all']
  516. ],
  517. scrollY: '50vh',
  518. buttons: [
  519. { extend: 'pageLength', className: 'btn btn-warning' },
  520. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  521. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  522. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  523. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  524. ],
  525. fixedHeader: true,
  526. autoWidth: true,
  527. responsive: true,
  528. searching: true,
  529. paging: true,
  530. info: true,
  531. ordering: false
  532. });
  533. }
  534. // Call once on page load
  535. initializeDataTable();
  536. // Trigger search on pressing Enter key
  537. $('#empCode').on('keydown', function (event) {
  538. if (event.key === 'Enter') {
  539. event.preventDefault(); // Prevent default form submission or page reload
  540. const empCode = $('#empCode').val(); // Get the value of empCode
  541. if (!empCode) {
  542. // Show Swal alert if the employee number is missing
  543. Swal.fire({
  544. icon: "warning", // Display a warning icon
  545. title: "Missing Employee Number",
  546. text: "Please enter an employee number to proceed.",
  547. confirmButtonText: "OK",
  548. customClass: {
  549. confirmButton: "btn btn-primary" // Optional styling for the button
  550. }
  551. });
  552. return; // Stop further execution
  553. }
  554. $('#searchButton').click(); // Trigger the click event of the search button
  555. }
  556. });
  557. // Handle Search button click
  558. $('#searchButton').on('click', function () {
  559. const empCode = $('#empCode').val();
  560. const deptId=$('#deptId').text().trim();
  561. if (empCode) {
  562. $('#pageLoader').show();
  563. document.getElementById("audittable").style.display = "block";
  564. }else{
  565. Swal.fire({
  566. icon: "warning", // Display a warning icon
  567. title: "Missing Employee Number",
  568. text: "Please enter an employee number to proceed.",
  569. confirmButtonText: "OK",
  570. customClass: {
  571. confirmButton: "btn btn-primary" // Optional styling for the button
  572. }
  573. });
  574. return;
  575. }
  576. $('#pageLoader').show();
  577. $('#audittable').show();
  578. $.ajax({
  579. url: '/gcc/api/fileclosing/getdetails',
  580. type: 'GET',
  581. data: { empCode: empCode,deptId:deptId },
  582. success: function (response) {
  583. console.log("response==",response);
  584. let employeeDetails=response;
  585. $('#pageLoader').hide();
  586. if (employeeDetails && employeeDetails.length > 0) {
  587. populateDataTable(employeeDetails); // Function to populate DataTable
  588. } else {
  589. Swal.fire({
  590. icon: "warning",
  591. title: "No Data Found",
  592. text: "No details found for this employee number.",
  593. confirmButtonText: "OK",
  594. customClass: {
  595. confirmButton: "btn btn-primary"
  596. }
  597. });
  598. }
  599. },
  600. error: function () {
  601. $('#pageLoader').hide();
  602. Swal.fire({
  603. icon: "error",
  604. title: "Error",
  605. text: "An error occurred while fetching data. Please try again.",
  606. confirmButtonText: "OK"
  607. });
  608. }
  609. });
  610. });
  611. function populateDataTable(data) {
  612. let tbodyHtml = "";
  613. $.each(data, function (index, audit) {
  614. tbodyHtml += `
  615. <tr>
  616. <td class="text-center">${index + 1}</td>
  617. <td class="text-center">${audit.emp_no || 'N/A'}</td>
  618. <td class="text-center">${audit.emp_name || 'N/A'}</td>
  619. <td class="text-center">${audit.dept_name || 'N/A'}</td>
  620. <td class="text-center">${audit.designation || 'N/A'}</td>
  621. <td class="text-center">${audit.file_moved_date ? formatDate(audit.file_moved_date, 'dd-MM-yyyy') : 'N/A'}</td>
  622. <td class="text-center">${audit.file_entry_type || 'N/A'}</td>
  623. <td class="text-center">
  624. <button class="btn btn-primary btn-sm view-btn" data-id="${audit.emp_no}" data-temp-id="${audit.temp_id}">
  625. View
  626. </button>
  627. </td>
  628. </tr>`;
  629. });
  630. // Destroy old DataTable before reinitializing
  631. let table = $('#AuditDatatable').DataTable();
  632. table.clear().destroy();
  633. $('#AuditDatatable tbody').html(tbodyHtml);
  634. // Reinitialize DataTable with updated data
  635. initializeDataTable();
  636. }
  637. function formatDate(dateString, format = 'dd-MM-yyyy') {
  638. if (!dateString) return 'N/A';
  639. // Handle case where date might have time part (e.g., "2024-05-31 00:00:00.0")
  640. let parts = dateString.split(' ')[0].split('-'); // Extract only the date part
  641. if (parts.length !== 3) return 'N/A';
  642. let [year, month, day] = parts; // Assuming date format is "YYYY-MM-DD"
  643. if (format === 'dd-MM-yyyy') {
  644. return `${day}-${month}-${year}`;
  645. } else if (format === 'MM-dd-yyyy') {
  646. return `${month}-${day}-${year}`;
  647. } else {
  648. return dateString; // Default case (return original format)
  649. }
  650. }
  651. });
  652. //model function
  653. function fetchEmployeeDetails(tempId) {
  654. $.ajax({
  655. url: '/gcc/api/fileclosing/getemployeedetails', // API to fetch employee details
  656. type: 'GET',
  657. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  658. success: function (response) {
  659. if (response && response.length > 0) {
  660. let employeeDetails = response[0]; // Access the first object in the array
  661. console.log("response:",response);
  662. //console.log("retirementdate",retirementdate);
  663. // Populate modal fields
  664. $('#employeenomodel').val(employeeDetails.emp_no);
  665. $('#employeename').val(employeeDetails.emp_name);
  666. $('#department').val(employeeDetails.dept_name);
  667. $('#designation').val(employeeDetails.designation);
  668. $('#typeofretirement').val(employeeDetails.type_of_retirement);
  669. $('#classes').val(employeeDetails.retirement_class);
  670. $('#datefile_modal').val(employeeDetails.file_moved_date);
  671. $('#remarks_modal').val(employeeDetails.remarks);
  672. $('#retirementdate').val(employeeDetails.retirement_date);
  673. console.log("retirementdate",retirementdate);
  674. // Update the modal title with the employee code
  675. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  676. // Show the modal
  677. $('#returnretrieddetailsModal').modal('show');
  678. //zone benefits fields
  679. if (employeeDetails.gpf === 'yes') {
  680. $('#gpfYes').prop('checked', true); // Disable radio
  681. $('#gpfNo').prop('disabled', true);
  682. $('#gpf50').prop('disabled', true);
  683. $('#gpfAmountDiv').show();
  684. $('#gpfAmount').val(employeeDetails.gpf_amount).prop('readonly', true); // Make input readonly
  685. } else if (employeeDetails.gpf === 'no') {
  686. $('#gpfNo').prop('checked', true);
  687. $('#gpfYes').prop('disabled', true);
  688. $('#gpf50').prop('disabled', true);
  689. $('#gpfAmountDiv').hide();
  690. } else if (employeeDetails.gpf === '90') {
  691. $('#gpf50').prop('checked', true);
  692. $('#gpfYes').prop('disabled', true);
  693. $('#gpfNo').prop('disabled', true);
  694. $('#gpfAmountDiv').show();
  695. $('#gpfAmount').val(employeeDetails.gpf_amount).prop('readonly', true);
  696. }else {
  697. $('#gpf50').prop('disabled', true);
  698. $('#gpfYes').prop('disabled', true);
  699. $('#gpfNo').prop('disabled', true);
  700. $('#gpfAmountDiv').hide();
  701. }
  702. // Populate Earned Leave & Leave on Private Affairs
  703. if (employeeDetails.private_affairs === 'yes') {
  704. $('#earnedleaveYes').prop('checked', true);
  705. $('#earnedleaveNo').prop('disabled', true);
  706. $('#earnedleaveAmountDiv').show();
  707. $('#earnedleaveAmount').val(employeeDetails.private_affairs_amount).prop('readonly', true);
  708. } else if (employeeDetails.private_affairs === 'no') {
  709. $('#earnedleaveNo').prop('checked', true);
  710. $('#earnedleaveYes').prop('disabled', true);
  711. $('#earnedleaveAmountDiv').hide();
  712. } else {
  713. $('#earnedleaveNo').prop('disabled', true);
  714. $('#earnedleaveYes').prop('disabled', true);
  715. $('#earnedleaveAmountDiv').hide();
  716. }
  717. // Populate SPFGS
  718. if (employeeDetails.spfgs === 'yes') {
  719. $('#spfgsYes').prop('checked', true);
  720. $('#spfgsNo').prop('disabled', true);
  721. $('#spfgsAmountDiv').show();
  722. $('#spfgsAmount').val(employeeDetails.spfgs_amount).prop('readonly', true);
  723. } else if (employeeDetails.spfgs === 'no') {
  724. $('#spfgsNo').prop('checked', true);
  725. $('#spfgsYes').prop('disabled', true);
  726. $('#spfgsAmountDiv').hide();
  727. }else {
  728. $('#spfgsNo').prop('disabled', true);
  729. $('#spfgsYes').prop('disabled', true);
  730. $('#spfgsAmountDiv').hide();
  731. }
  732. // Populate Recovery From Employee
  733. $('#recoveryemployeevalue')
  734. .val(employeeDetails.recovery_emp)
  735. .prop('readonly', true); // Make input readonly
  736. // Populate DCRG
  737. if (employeeDetails.dcrg === 'yes') {
  738. $('#dcrgYes').prop('checked', true);
  739. $('#dcrgNo').prop('disabled', true);
  740. }else if (employeeDetails.dcrg === 'no') {
  741. $('#dcrgNo').prop('checked', true);
  742. $('#dcrgYes').prop('disabled', true);
  743. }else {
  744. $('#dcrgNo').prop('disabled', true);
  745. $('#dcrgYes').prop('disabled', true);
  746. }
  747. $('#pensionNumber').val(employeeDetails.pension_number).prop('readonly',true);
  748. $('#ledgerNumber').val(employeeDetails.ledger_number).prop('readonly',true);
  749. $('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true);
  750. if (employeeDetails.benefit_pension === "yes") {
  751. $('#PbAmountDiv').show();
  752. $('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount).prop('readonly',true);
  753. // bpYes bpNo PbAmountDiv benefit_pension_amount
  754. $('#bpYes').prop('checked', true);
  755. $('#bpNo').prop('disabled', true);
  756. } else if(employeeDetails.benefit_pension === "no"){
  757. $('#PbAmountDiv').hide();
  758. $('#bpNo').prop('checked', true);
  759. $('#bpYes').prop('disabled', true);
  760. }
  761. else{
  762. $('#bpNo').prop('disabled', true);
  763. $('#bpYes').prop('disabled', true);
  764. }
  765. $('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true);
  766. if (employeeDetails.benefit_dcrg === "yes") {
  767. $('#dcrgAmountDiv').show();
  768. $('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount).prop('readonly',true);
  769. // DcrgYes DcrgNo dcrgAmountDiv benefit_dcrg_amount
  770. $('#DcrgYes').prop('checked', true);
  771. $('#DcrgNo').prop('disabled', true);
  772. } else if(employeeDetails.benefit_dcrg === "no"){
  773. $('#dcrgAmountDiv').hide();
  774. $('#DcrgNo').prop('checked', true);
  775. $('#DcrgYes').prop('disabled', true);
  776. }else {
  777. $('#dcrgAmountDiv').hide();
  778. $('#DcrgNo').prop('disabled', true);
  779. $('#DcrgYes').prop('disabled', true);
  780. }
  781. $('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true);
  782. if (employeeDetails.benefit_commutation === "yes") {
  783. $('#CommutationAmountDiv').show();
  784. $('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount).prop('readonly',true);
  785. // commutationYes commutationNo CommutationAmountDiv benefit_commutation_amount
  786. $('#commutationYes').prop('checked', true);
  787. $('#commutationNo').prop('disabled', true);
  788. } else if (employeeDetails.benefit_commutation === "no"){
  789. $('#CommutationAmountDiv').hide();
  790. $('#commutationNo').prop('checked', true);
  791. $('#commutationYes').prop('disabled', true);
  792. }else {
  793. $('#CommutationAmountDiv').hide();
  794. $('#commutationNo').prop('disabled', true);
  795. $('#commutationYes').prop('disabled', true);
  796. }
  797. //$('#datefile').val('');
  798. $('#remarks').val('');
  799. /* document.getElementById('closedbutton').addEventListener('click', function () {
  800. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  801. // Trigger the save function and pass the value
  802. saveEntryDetails(tempId,employeeNo);
  803. }); */
  804. $('#closedbutton').off('click').on('click', function () {
  805. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  806. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  807. });
  808. } else {
  809. Swal.fire({
  810. icon: 'info',
  811. title: 'No Data',
  812. text: 'No details found for the selected employee.',
  813. confirmButtonText: 'OK',
  814. });
  815. }
  816. },
  817. error: function () {
  818. Swal.fire({
  819. icon: 'error',
  820. title: 'Error',
  821. text: 'Failed to fetch employee details. Please try again.',
  822. confirmButtonText: 'OK',
  823. });
  824. },
  825. });
  826. }
  827. $(document).ready(function () {
  828. $(document).on('click', '.view-btn', function () {
  829. const empCode = $(this).data('id'); // Fetch `data-id` value
  830. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  831. console.log("empCode====="+empCode);
  832. console.log("tempId====="+tempId);
  833. // Hide the receivedcard section before showing the modal
  834. $("#receivedcard").hide();
  835. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  836. loadFileHistory(tempId); // Load the file history for the selected employee
  837. });
  838. // Initialize the modal with static backdrop and disabled keyboard closing
  839. $('#returnretrieddetailsModal').modal({
  840. backdrop: 'static',
  841. keyboard: false,
  842. show: false // Ensure it doesn't auto-show on page load
  843. });
  844. // Handle close button click
  845. $('#backbutton').click(function () {
  846. $('#returnretrieddetailsModal').modal('hide');
  847. });
  848. $('.close').click(function () {
  849. $('#returnretrieddetailsModal').modal('hide');
  850. });
  851. // Listen for changes on the GPF radio buttons
  852. document.querySelectorAll('input[name="gpf"]').forEach(radio => {
  853. radio.addEventListener('change', function () {
  854. const gpfAmountDiv = document.getElementById('gpfAmountDiv');
  855. if (this.value === 'yes' || this.value === '90') {
  856. gpfAmountDiv.style.display = 'block'; // Show the input field
  857. } else {
  858. gpfAmountDiv.style.display = 'none'; // Hide the input field
  859. document.getElementById('gpfAmount').value = ''; // Clear the input field
  860. }
  861. });
  862. });
  863. // Listen for changes on the private affaires radio buttons
  864. document.querySelectorAll('input[name="earnedleave"]').forEach(radio => {
  865. radio.addEventListener('change', function () {
  866. const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv');
  867. if (this.value === 'yes') {
  868. earnedleaveAmountDiv.style.display = 'block'; // Show the input field
  869. } else {
  870. earnedleaveAmountDiv.style.display = 'none'; // Hide the input field
  871. document.getElementById('earnedleaveAmount').value = ''; // Clear the input field
  872. }
  873. });
  874. });
  875. // Listen for changes on the spfgs radio buttons
  876. document.querySelectorAll('input[name="spfgs"]').forEach(radio => {
  877. radio.addEventListener('change', function () {
  878. const spfgsAmountDiv = document.getElementById('spfgsAmountDiv');
  879. if (this.value === 'yes') {
  880. spfgsAmountDiv.style.display = 'block'; // Show the input field
  881. } else {
  882. spfgsAmountDiv.style.display = 'none'; // Hide the input field
  883. document.getElementById('spfgsAmount').value = ''; // Clear the input field
  884. }
  885. });
  886. });
  887. document.querySelectorAll('input[name="benefit_pension"]').forEach(radio => {
  888. radio.addEventListener('change', function () {
  889. const PbAmountDiv = document.getElementById('PbAmountDiv');
  890. if (this.value === 'yes') {
  891. PbAmountDiv.style.display = 'block'; // Show the input field
  892. } else {
  893. PbAmountDiv.style.display = 'none'; // Hide the input field
  894. document.getElementById('benefit_pension_amount').value = ''; // Clear the input field
  895. }
  896. });
  897. });
  898. document.querySelectorAll('input[name="benefit_dcrg"]').forEach(radio => {
  899. radio.addEventListener('change', function () {
  900. const dcrgAmountDiv = document.getElementById('dcrgAmountDiv');
  901. if (this.value === 'yes') {
  902. dcrgAmountDiv.style.display = 'block'; // Show the input field
  903. } else {
  904. dcrgAmountDiv.style.display = 'none'; // Hide the input field
  905. document.getElementById('benefit_dcrg_amount').value = ''; // Clear the input field
  906. }
  907. });
  908. });
  909. document.querySelectorAll('input[name="benefit_commutation"]').forEach(radio => {
  910. radio.addEventListener('change', function () {
  911. const CommutationAmountDiv = document.getElementById('CommutationAmountDiv');
  912. if (this.value === 'yes') {
  913. CommutationAmountDiv.style.display = 'block'; // Show the input field
  914. } else {
  915. CommutationAmountDiv.style.display = 'none'; // Hide the input field
  916. document.getElementById('benefit_commutation_amount').value = ''; // Clear the input field
  917. }
  918. });
  919. });
  920. });
  921. function loadFileHistory(tempId) {
  922. $.ajax({
  923. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  924. type: 'GET',
  925. data: { tempId: tempId }, // Pass empCode as a parameter
  926. success: function (response) {
  927. if (response.length > 0) {
  928. let historyHtml = '';
  929. response.forEach(item => {
  930. historyHtml += `
  931. <div class="file-history-item">
  932. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  933. <div class="file-history-content">
  934. <div class="file-history-status">${item.fileStatusHistory}</div>
  935. <div class="file-history-remarks">Remarks: ${item.remarksHistory || 'N/A'}</div>
  936. </div>
  937. </div>
  938. `;
  939. });
  940. $('#fileHistoryContainer').html(historyHtml);
  941. } else {
  942. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  943. }
  944. },
  945. error: function () {
  946. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  947. }
  948. });
  949. }
  950. // Function to format date and time
  951. function formatDateTime(dateString) {
  952. const options = {
  953. day: '2-digit',
  954. month: '2-digit',
  955. year: 'numeric',
  956. };
  957. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  958. }
  959. document.addEventListener("DOMContentLoaded", function() {
  960. // Get today's date
  961. const today = new Date();
  962. // Format the date as DD-MM-YYYY for display
  963. const day = String(today.getDate()).padStart(2, '0');
  964. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  965. const year = today.getFullYear();
  966. // Combine into DD-MM-YYYY format for display
  967. const formattedDateDisplay = `${day}-${month}-${year}`;
  968. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  969. document.getElementById("datefile").value = formattedDateDisplay;
  970. //document.getElementById("datefilereceived").value = formattedDateDisplay;
  971. //document.getElementById("datefileyes").value = formattedDateDisplay;
  972. });
  973. function convertDateFormat(dateString) {
  974. if (!dateString) return '';
  975. let [day, month, year] = dateString.split('-');
  976. return `${year}-${month}-${day}`;
  977. }
  978. function saveEntryDetails(tempId,empNo) {
  979. let entryDetails = {
  980. empNo:empNo,
  981. tempId: tempId, // Pass the stored tempId value
  982. dateToAudit: convertDateFormat($('#datefile').val()?.trim()),
  983. serviceDeath:$('#deathdate').val(),
  984. remarks: $('#remarks').val(),
  985. deptId:$('#deptId').text().trim(),
  986. filemovedby:$('#userId').text().trim(),
  987. };
  988. if (!entryDetails.serviceDeath) {
  989. Swal.fire({
  990. icon: 'warning',
  991. title: 'Validation Error!',
  992. text: 'Employee Death Date is required.',
  993. confirmButtonText: 'OK'
  994. });
  995. return;
  996. }
  997. if (!entryDetails.remarks) {
  998. Swal.fire({
  999. icon: 'warning',
  1000. title: 'Validation Error!',
  1001. text: 'Remarks are required.',
  1002. confirmButtonText: 'OK'
  1003. });
  1004. return;
  1005. }
  1006. console.log("entryDetails:",entryDetails);
  1007. $('#closedbutton').prop('disabled', true).text('Processing...');
  1008. $.ajax({
  1009. url: '/gcc/api/fileclosing/updateDetails',
  1010. type: 'POST',
  1011. contentType: 'application/json',
  1012. data: JSON.stringify(entryDetails),
  1013. success: function (response) {
  1014. $('#closedbutton').prop('disabled', false).text('Mark as Closed');
  1015. Swal.fire({
  1016. icon: 'success',
  1017. title: 'Success',
  1018. text: response,
  1019. allowOutsideClick: false,
  1020. allowEscapeKey: false,
  1021. allowEnterKey: false,
  1022. confirmButtonText: 'OK'
  1023. }).then((result) => {
  1024. if (result.isConfirmed) {
  1025. $('#closedbutton').prop('disabled', false).text('Mark as Closed');
  1026. window.location.href = "/gcc/departmentfileclosing/fileclosing";
  1027. console.log("Continue clicked");
  1028. }
  1029. });
  1030. },
  1031. error: function (xhr, status, error) {
  1032. $('#auditsubmit').prop('disabled', false).text('Mark as Closed');
  1033. Swal.fire({
  1034. icon: 'error',
  1035. title: 'Error',
  1036. text: 'Failed to save details. Please try again.',
  1037. confirmButtonText: 'OK'
  1038. });
  1039. console.error('Error:', xhr.responseText);
  1040. }
  1041. });
  1042. }
  1043. //disable future dates
  1044. document.addEventListener("DOMContentLoaded", function () {
  1045. let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format
  1046. let deathdate = document.getElementById("deathdate");
  1047. // Set max attribute to disable future dates
  1048. deathdate.setAttribute("max", today);
  1049. // Prevent manual future date entry
  1050. deathdate.addEventListener("change", function () {
  1051. if (this.value > today) {
  1052. Swal.fire({
  1053. icon: 'warning',
  1054. title: 'Invalid Date',
  1055. text: 'Future dates are not allowed.',
  1056. confirmButtonText: 'OK'
  1057. });
  1058. this.value = ""; // Clear the invalid input
  1059. }
  1060. });
  1061. });
  1062. </script>
  1063. </body>
  1064. </html>