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.

1307 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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. <div id="showZoneBenefit">
  318. <hr>
  319. <p style="font-weight: bold;font-size: medium;text-decoration: underline;">Zone Benefits</p>
  320. <div class="row mt-2" id="sec2">
  321. <!-- GPF -->
  322. <div class="col-md-4 mb-2">
  323. <label class="form-label fw-bold">GPF</label>
  324. <div class="d-flex align-items-center gap-5">
  325. <div class="form-check">
  326. <input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes">
  327. <label class="form-check-label" for="gpfYes">Yes</label>
  328. </div>
  329. <div class="form-check">
  330. <input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no">
  331. <label class="form-check-label" for="gpfNo">No</label>
  332. </div>
  333. <div class="form-check">
  334. <input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90">
  335. <label class="form-check-label" for="gpf50">90%</label>
  336. </div>
  337. </div>
  338. <!-- Placeholder for dynamically added input -->
  339. <div id="gpfAmountDiv" class="mt-3" style="display: none;">
  340. <label for="gpfAmount" class="form-label">Enter GPF Amount</label>
  341. <input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)">
  342. </div>
  343. </div>
  344. <!-- Earned Leave & Leave on Private Affairs -->
  345. <div class="col-md-4 mb-2">
  346. <label class="form-label fw-bold">Earned Leave & Leave on Private Affairs</label>
  347. <div class="d-flex align-items-center gap-5">
  348. <div class="form-check">
  349. <input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes">
  350. <label class="form-check-label" for="earnedleaveYes">Yes</label>
  351. </div>
  352. <div class="form-check">
  353. <input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no">
  354. <label class="form-check-label" for="earnedleaveNo">No</label>
  355. </div>
  356. </div>
  357. <!-- Placeholder for dynamically added input -->
  358. <div id="earnedleaveAmountDiv" class="mt-3" style="display: none;">
  359. <label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount</label>
  360. <input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)">
  361. </div>
  362. </div>
  363. <!-- SPFGS -->
  364. <div class="col-md-4 mb-2">
  365. <label class="form-label fw-bold">SPFGS</label>
  366. <div class="d-flex align-items-center gap-5">
  367. <div class="form-check">
  368. <input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes">
  369. <label class="form-check-label" for="spfgsYes">Yes</label>
  370. </div>
  371. <div class="form-check">
  372. <input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no">
  373. <label class="form-check-label" for="spfgsNo">No</label>
  374. </div>
  375. </div>
  376. <!-- Placeholder for dynamically added input -->
  377. <div id="spfgsAmountDiv" class="mt-3" style="display: none;">
  378. <label for="spfgsAmount" class="form-label">Enter SPFGS Amount</label>
  379. <input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)">
  380. </div>
  381. </div>
  382. <div class="col-md-4 mb-2">
  383. <label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label>
  384. <input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee">
  385. </div>
  386. <!-- DCRF File is Ready -->
  387. <div class="col-md-4">
  388. <label class="form-label fw-bold">DCRG File is Ready</label>
  389. <div class="d-flex align-items-center gap-5">
  390. <div class="form-check">
  391. <input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes">
  392. <label class="form-check-label" for="dcrgYes">Yes</label>
  393. </div>
  394. <div class="form-check">
  395. <input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no">
  396. <label class="form-check-label" for="dcrgNo">No</label>
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. </div>
  402. <!-- <p style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</p> -->
  403. <!-- <div class="row" id="sec3">
  404. <div class="col-md-4 mt-2 mb-2">
  405. <label for="pensionNumber" class="form-label">Pension Number</label>
  406. <input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" >
  407. </div>
  408. <div class="col-md-4 mt-2 mb-2">
  409. <label for="ledgerNumber" class="form-label">Ledger Number</label>
  410. <input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number">
  411. </div>
  412. </div> -->
  413. <!-- <div class="row mt-2">
  414. <div class="col-md-4 mb-2">
  415. <label class="form-label fw-bold">Sanctions Pensions Benefit-Pension</label>
  416. <div class="d-flex align-items-center gap-5">
  417. <div class="form-check">
  418. <input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes">
  419. <label class="form-check-label" for="bpYes">Yes</label>
  420. </div>
  421. <div class="form-check">
  422. <input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no">
  423. <label class="form-check-label" for="bpNo">No</label>
  424. </div>
  425. </div>
  426. Placeholder for dynamically added input
  427. <div id="PbAmountDiv" class="mt-3" style="display: none;">
  428. <label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount</label>
  429. <input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" min="1" oninput="validatePositiveNumber(this)">
  430. </div>
  431. </div>
  432. <div class="col-md-4 mb-2">
  433. <label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG</label>
  434. <div class="d-flex align-items-center gap-5">
  435. <div class="form-check">
  436. <input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes">
  437. <label class="form-check-label" for="DcrgYes">Yes</label>
  438. </div>
  439. <div class="form-check">
  440. <input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no">
  441. <label class="form-check-label" for="DcrgNo">No</label>
  442. </div>
  443. </div>
  444. Placeholder for dynamically added input
  445. <div id="dcrgAmountDiv" class="mt-3" style="display: none;">
  446. <label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount</label>
  447. <input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" min="1" oninput="validatePositiveNumber(this)">
  448. </div>
  449. </div>
  450. <div class="col-md-4 mb-2">
  451. <label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation</label>
  452. <div class="d-flex align-items-center gap-5">
  453. <div class="form-check">
  454. <input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes">
  455. <label class="form-check-label" for="commutationYes">Yes</label>
  456. </div>
  457. <div class="form-check">
  458. <input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no">
  459. <label class="form-check-label" for="commutationNo">No</label>
  460. </div>
  461. </div>
  462. Placeholder for dynamically added input
  463. <div id="CommutationAmountDiv" class="mt-3" style="display: none;">
  464. <label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount</label>
  465. <input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" min="1" oninput="validatePositiveNumber(this)">
  466. </div>
  467. </div>
  468. </div> -->
  469. <!-- file history -->
  470. <div class="col-md-12 mt-4">
  471. <h5>File History</h5>
  472. <div id="fileHistoryContainer" class="file-history-list">
  473. <!-- File History will be dynamically loaded here -->
  474. </div>
  475. </div>
  476. <hr>
  477. <div class="row">
  478. <div class="col-md-3">
  479. <label for="datefile" class="form-label fw-bold">Date File Completed <span class="text-danger">*</span></label>
  480. <input type="text" id="datefile" class="form-control" readonly="readonly">
  481. </div>
  482. <div class="col-md-3">
  483. <label for="deathdate" class="form-label fw-bold">Employee Death Date<span class="text-danger">*</span></label>
  484. <input type="date" id="deathdate" class="form-control" onclick="this.showPicker()">
  485. </div>
  486. <div class="col-md-12">
  487. <label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
  488. <textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
  489. </div>
  490. </div>
  491. <div class="row mt-4">
  492. <div class="col-12 d-flex justify-content-center">
  493. <button id="closedbutton" class="btn btn-warning mt-2 mx-2">Mark as Closed</button>
  494. <button id="backbutton" class="btn btn-secondary mt-2" data-dismiss="modal">Back</button>
  495. </div>
  496. </div>
  497. </div>
  498. </div>
  499. </div>
  500. </div>
  501. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  502. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  503. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  504. <!-- Bootstrap 5 JS -->
  505. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  506. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  507. <script>
  508. $(document).ready(function () {
  509. // Initialize DataTable
  510. function initializeDataTable() {
  511. $('#AuditDatatable').DataTable({
  512. dom: 'Bftip',
  513. columnDefs: [{ targets: 'no-sort', orderable: false }],
  514. lengthMenu: [
  515. [50, 100, 200, 500, -1],
  516. ['50 rows', '100 rows', '200 rows', 'Show all']
  517. ],
  518. scrollY: '50vh',
  519. buttons: [
  520. { extend: 'pageLength', className: 'btn btn-warning' },
  521. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
  522. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  523. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  524. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  525. ],
  526. fixedHeader: true,
  527. autoWidth: true,
  528. responsive: true,
  529. searching: true,
  530. paging: true,
  531. info: true,
  532. ordering: false
  533. });
  534. }
  535. // Call once on page load
  536. initializeDataTable();
  537. // Trigger search on pressing Enter key
  538. $('#empCode').on('keydown', function (event) {
  539. if (event.key === 'Enter') {
  540. event.preventDefault(); // Prevent default form submission or page reload
  541. const empCode = $('#empCode').val(); // Get the value of empCode
  542. if (!empCode) {
  543. // Show Swal alert if the employee number is missing
  544. Swal.fire({
  545. icon: "warning", // Display a warning icon
  546. title: "Missing Employee Number",
  547. text: "Please enter an employee number to proceed.",
  548. confirmButtonText: "OK",
  549. customClass: {
  550. confirmButton: "btn btn-primary" // Optional styling for the button
  551. }
  552. });
  553. return; // Stop further execution
  554. }
  555. $('#searchButton').click(); // Trigger the click event of the search button
  556. }
  557. });
  558. // Handle Search button click
  559. $('#searchButton').on('click', function () {
  560. const empCode = $('#empCode').val();
  561. const deptId=$('#deptId').text().trim();
  562. if (empCode) {
  563. $('#pageLoader').show();
  564. document.getElementById("audittable").style.display = "block";
  565. }else{
  566. Swal.fire({
  567. icon: "warning", // Display a warning icon
  568. title: "Missing Employee Number",
  569. text: "Please enter an employee number to proceed.",
  570. confirmButtonText: "OK",
  571. customClass: {
  572. confirmButton: "btn btn-primary" // Optional styling for the button
  573. }
  574. });
  575. return;
  576. }
  577. $('#pageLoader').show();
  578. $('#audittable').show();
  579. $.ajax({
  580. url: '/gcc/api/fileclosing/getdetails',
  581. type: 'GET',
  582. data: { empCode: empCode,deptId:deptId },
  583. success: function (response) {
  584. console.log("response==",response);
  585. let employeeDetails=response;
  586. $('#pageLoader').hide();
  587. if (employeeDetails && employeeDetails.length > 0) {
  588. populateDataTable(employeeDetails); // Function to populate DataTable
  589. } else {
  590. Swal.fire({
  591. icon: "warning",
  592. title: "No Data Found",
  593. text: "No details found for this employee number.",
  594. confirmButtonText: "OK",
  595. customClass: {
  596. confirmButton: "btn btn-primary"
  597. }
  598. });
  599. }
  600. },
  601. error: function () {
  602. $('#pageLoader').hide();
  603. Swal.fire({
  604. icon: "error",
  605. title: "Error",
  606. text: "An error occurred while fetching data. Please try again.",
  607. confirmButtonText: "OK"
  608. });
  609. }
  610. });
  611. });
  612. function populateDataTable(data) {
  613. let tbodyHtml = "";
  614. $.each(data, function (index, audit) {
  615. tbodyHtml += `
  616. <tr>
  617. <td class="text-center">${index + 1}</td>
  618. <td class="text-center">${audit.emp_no || 'N/A'}</td>
  619. <td class="text-center">${audit.emp_name || 'N/A'}</td>
  620. <td class="text-center">${audit.dept_name || 'N/A'}</td>
  621. <td class="text-center">${audit.designation || 'N/A'}</td>
  622. <td class="text-center">${audit.file_moved_date ? formatDate(audit.file_moved_date, 'dd-MM-yyyy') : 'N/A'}</td>
  623. <td class="text-center">${audit.file_entry_type || 'N/A'}</td>
  624. <td class="text-center">
  625. <button class="btn btn-primary btn-sm view-btn" data-id="${audit.emp_no}" data-temp-id="${audit.temp_id}">
  626. View
  627. </button>
  628. </td>
  629. </tr>`;
  630. });
  631. // Destroy old DataTable before reinitializing
  632. let table = $('#AuditDatatable').DataTable();
  633. table.clear().destroy();
  634. $('#AuditDatatable tbody').html(tbodyHtml);
  635. // Reinitialize DataTable with updated data
  636. initializeDataTable();
  637. }
  638. function formatDate(dateString, format = 'dd-MM-yyyy') {
  639. if (!dateString) return 'N/A';
  640. // Handle case where date might have time part (e.g., "2024-05-31 00:00:00.0")
  641. let parts = dateString.split(' ')[0].split('-'); // Extract only the date part
  642. if (parts.length !== 3) return 'N/A';
  643. let [year, month, day] = parts; // Assuming date format is "YYYY-MM-DD"
  644. if (format === 'dd-MM-yyyy') {
  645. return `${day}-${month}-${year}`;
  646. } else if (format === 'MM-dd-yyyy') {
  647. return `${month}-${day}-${year}`;
  648. } else {
  649. return dateString; // Default case (return original format)
  650. }
  651. }
  652. });
  653. //model function
  654. function fetchEmployeeDetails(tempId) {
  655. $.ajax({
  656. url: '/gcc/api/fileclosing/getemployeedetails', // API to fetch employee details
  657. type: 'GET',
  658. data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
  659. success: function (response) {
  660. if (response && response.length > 0) {
  661. let employeeDetails = response[0]; // Access the first object in the array
  662. console.log("response:",response);
  663. //console.log("retirementdate",retirementdate);
  664. // Populate modal fields
  665. $('#employeenomodel').val(employeeDetails.emp_no);
  666. $('#employeename').val(employeeDetails.emp_name);
  667. $('#department').val(employeeDetails.dept_name);
  668. $('#designation').val(employeeDetails.designation);
  669. $('#typeofretirement').val(employeeDetails.type_of_retirement);
  670. $('#classes').val(employeeDetails.retirement_class);
  671. $('#datefile_modal').val(employeeDetails.file_moved_date);
  672. $('#remarks_modal').val(employeeDetails.remarks);
  673. $('#retirementdate').val(employeeDetails.retirement_date);
  674. console.log("retirementdate",retirementdate);
  675. let status=employeeDetails.file_status;
  676. console.log("status=:"+status);
  677. // Update the modal title with the employee code
  678. $('#modalEmployeeCode').text(employeeDetails.emp_no);
  679. // Show the modal
  680. $('#returnretrieddetailsModal').modal('show');
  681. //zone benefits fields
  682. if (status >= 6 && status <= 8) {
  683. $('#showZoneBenefit').show();
  684. if (employeeDetails.gpf === 'yes') {
  685. $('#gpfYes').prop('checked', true); // Disable radio
  686. $('#gpfNo').prop('disabled', true);
  687. $('#gpf50').prop('disabled', true);
  688. $('#gpfAmountDiv').show();
  689. $('#gpfAmount').val(employeeDetails.gpf_amount).prop('readonly', true); // Make input readonly
  690. } else if (employeeDetails.gpf === 'no') {
  691. $('#gpfNo').prop('checked', true);
  692. $('#gpfYes').prop('disabled', true);
  693. $('#gpf50').prop('disabled', true);
  694. $('#gpfAmountDiv').hide();
  695. } else if (employeeDetails.gpf === '90') {
  696. $('#gpf50').prop('checked', true);
  697. $('#gpfYes').prop('disabled', true);
  698. $('#gpfNo').prop('disabled', true);
  699. $('#gpfAmountDiv').show();
  700. $('#gpfAmount').val(employeeDetails.gpf_amount).prop('readonly', true);
  701. }else {
  702. $('#gpf50').prop('disabled', true);
  703. $('#gpfYes').prop('disabled', true);
  704. $('#gpfNo').prop('disabled', true);
  705. $('#gpfAmountDiv').hide();
  706. }
  707. // Populate Earned Leave & Leave on Private Affairs
  708. if (employeeDetails.private_affairs === 'yes') {
  709. $('#earnedleaveYes').prop('checked', true);
  710. $('#earnedleaveNo').prop('disabled', true);
  711. $('#earnedleaveAmountDiv').show();
  712. $('#earnedleaveAmount').val(employeeDetails.private_affairs_amount).prop('readonly', true);
  713. } else if (employeeDetails.private_affairs === 'no') {
  714. $('#earnedleaveNo').prop('checked', true);
  715. $('#earnedleaveYes').prop('disabled', true);
  716. $('#earnedleaveAmountDiv').hide();
  717. } else {
  718. $('#earnedleaveNo').prop('disabled', true);
  719. $('#earnedleaveYes').prop('disabled', true);
  720. $('#earnedleaveAmountDiv').hide();
  721. }
  722. // Populate SPFGS
  723. if (employeeDetails.spfgs === 'yes') {
  724. $('#spfgsYes').prop('checked', true);
  725. $('#spfgsNo').prop('disabled', true);
  726. $('#spfgsAmountDiv').show();
  727. $('#spfgsAmount').val(employeeDetails.spfgs_amount).prop('readonly', true);
  728. } else if (employeeDetails.spfgs === 'no') {
  729. $('#spfgsNo').prop('checked', true);
  730. $('#spfgsYes').prop('disabled', true);
  731. $('#spfgsAmountDiv').hide();
  732. }else {
  733. $('#spfgsNo').prop('disabled', true);
  734. $('#spfgsYes').prop('disabled', true);
  735. $('#spfgsAmountDiv').hide();
  736. }
  737. // Populate Recovery From Employee
  738. $('#recoveryemployeevalue')
  739. .val(employeeDetails.recovery_emp)
  740. .prop('readonly', true); // Make input readonly
  741. // Populate DCRG
  742. if (employeeDetails.dcrg === 'yes') {
  743. $('#dcrgYes').prop('checked', true);
  744. $('#dcrgNo').prop('disabled', true);
  745. }else if (employeeDetails.dcrg === 'no') {
  746. $('#dcrgNo').prop('checked', true);
  747. $('#dcrgYes').prop('disabled', true);
  748. }else {
  749. $('#dcrgNo').prop('disabled', true);
  750. $('#dcrgYes').prop('disabled', true);
  751. }
  752. }
  753. else if(status <=5)
  754. {
  755. $('#showZoneBenefit').hide();
  756. }
  757. /* $('#pensionNumber').val(employeeDetails.pension_number).prop('readonly',true);
  758. $('#ledgerNumber').val(employeeDetails.ledger_number).prop('readonly',true);
  759. $('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true);
  760. if (employeeDetails.benefit_pension === "yes") {
  761. $('#PbAmountDiv').show();
  762. $('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount).prop('readonly',true);
  763. // bpYes bpNo PbAmountDiv benefit_pension_amount
  764. $('#bpYes').prop('checked', true);
  765. $('#bpNo').prop('disabled', true);
  766. } else if(employeeDetails.benefit_pension === "no"){
  767. $('#PbAmountDiv').hide();
  768. $('#bpNo').prop('checked', true);
  769. $('#bpYes').prop('disabled', true);
  770. }
  771. else{
  772. $('#bpNo').prop('disabled', true);
  773. $('#bpYes').prop('disabled', true);
  774. }
  775. $('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true);
  776. if (employeeDetails.benefit_dcrg === "yes") {
  777. $('#dcrgAmountDiv').show();
  778. $('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount).prop('readonly',true);
  779. // DcrgYes DcrgNo dcrgAmountDiv benefit_dcrg_amount
  780. $('#DcrgYes').prop('checked', true);
  781. $('#DcrgNo').prop('disabled', true);
  782. } else if(employeeDetails.benefit_dcrg === "no"){
  783. $('#dcrgAmountDiv').hide();
  784. $('#DcrgNo').prop('checked', true);
  785. $('#DcrgYes').prop('disabled', true);
  786. }else {
  787. $('#dcrgAmountDiv').hide();
  788. $('#DcrgNo').prop('disabled', true);
  789. $('#DcrgYes').prop('disabled', true);
  790. }
  791. $('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true);
  792. if (employeeDetails.benefit_commutation === "yes") {
  793. $('#CommutationAmountDiv').show();
  794. $('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount).prop('readonly',true);
  795. // commutationYes commutationNo CommutationAmountDiv benefit_commutation_amount
  796. $('#commutationYes').prop('checked', true);
  797. $('#commutationNo').prop('disabled', true);
  798. } else if (employeeDetails.benefit_commutation === "no"){
  799. $('#CommutationAmountDiv').hide();
  800. $('#commutationNo').prop('checked', true);
  801. $('#commutationYes').prop('disabled', true);
  802. }else {
  803. $('#CommutationAmountDiv').hide();
  804. $('#commutationNo').prop('disabled', true);
  805. $('#commutationYes').prop('disabled', true);
  806. } */
  807. //$('#datefile').val('');
  808. $('#remarks').val('');
  809. /* document.getElementById('closedbutton').addEventListener('click', function () {
  810. let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
  811. // Trigger the save function and pass the value
  812. saveEntryDetails(tempId,employeeNo);
  813. }); */
  814. $('#closedbutton').off('click').on('click', function () {
  815. let employeeNo = $('#employeenomodel').val(); // Get the employee number
  816. saveEntryDetails(tempId, employeeNo); // Call function with parameters
  817. });
  818. } else {
  819. Swal.fire({
  820. icon: 'info',
  821. title: 'No Data',
  822. text: 'No details found for the selected employee.',
  823. confirmButtonText: 'OK',
  824. });
  825. }
  826. },
  827. error: function () {
  828. Swal.fire({
  829. icon: 'error',
  830. title: 'Error',
  831. text: 'Failed to fetch employee details. Please try again.',
  832. confirmButtonText: 'OK',
  833. });
  834. },
  835. });
  836. }
  837. $(document).ready(function () {
  838. $(document).on('click', '.view-btn', function () {
  839. const empCode = $(this).data('id'); // Fetch `data-id` value
  840. const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
  841. console.log("empCode====="+empCode);
  842. console.log("tempId====="+tempId);
  843. // Hide the receivedcard section before showing the modal
  844. $("#receivedcard").hide();
  845. fetchEmployeeDetails(tempId); // Call the function to fetch employee details
  846. loadFileHistory(tempId); // Load the file history for the selected employee
  847. });
  848. // Initialize the modal with static backdrop and disabled keyboard closing
  849. $('#returnretrieddetailsModal').modal({
  850. backdrop: 'static',
  851. keyboard: false,
  852. show: false // Ensure it doesn't auto-show on page load
  853. });
  854. // Handle close button click
  855. $('#backbutton').click(function () {
  856. $('#returnretrieddetailsModal').modal('hide');
  857. });
  858. $('.close').click(function () {
  859. $('#returnretrieddetailsModal').modal('hide');
  860. });
  861. // Listen for changes on the GPF radio buttons
  862. document.querySelectorAll('input[name="gpf"]').forEach(radio => {
  863. radio.addEventListener('change', function () {
  864. const gpfAmountDiv = document.getElementById('gpfAmountDiv');
  865. if (this.value === 'yes' || this.value === '90') {
  866. gpfAmountDiv.style.display = 'block'; // Show the input field
  867. } else {
  868. gpfAmountDiv.style.display = 'none'; // Hide the input field
  869. document.getElementById('gpfAmount').value = ''; // Clear the input field
  870. }
  871. });
  872. });
  873. // Listen for changes on the private affaires radio buttons
  874. document.querySelectorAll('input[name="earnedleave"]').forEach(radio => {
  875. radio.addEventListener('change', function () {
  876. const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv');
  877. if (this.value === 'yes') {
  878. earnedleaveAmountDiv.style.display = 'block'; // Show the input field
  879. } else {
  880. earnedleaveAmountDiv.style.display = 'none'; // Hide the input field
  881. document.getElementById('earnedleaveAmount').value = ''; // Clear the input field
  882. }
  883. });
  884. });
  885. // Listen for changes on the spfgs radio buttons
  886. document.querySelectorAll('input[name="spfgs"]').forEach(radio => {
  887. radio.addEventListener('change', function () {
  888. const spfgsAmountDiv = document.getElementById('spfgsAmountDiv');
  889. if (this.value === 'yes') {
  890. spfgsAmountDiv.style.display = 'block'; // Show the input field
  891. } else {
  892. spfgsAmountDiv.style.display = 'none'; // Hide the input field
  893. document.getElementById('spfgsAmount').value = ''; // Clear the input field
  894. }
  895. });
  896. });
  897. /* document.querySelectorAll('input[name="benefit_pension"]').forEach(radio => {
  898. radio.addEventListener('change', function () {
  899. const PbAmountDiv = document.getElementById('PbAmountDiv');
  900. if (this.value === 'yes') {
  901. PbAmountDiv.style.display = 'block'; // Show the input field
  902. } else {
  903. PbAmountDiv.style.display = 'none'; // Hide the input field
  904. document.getElementById('benefit_pension_amount').value = ''; // Clear the input field
  905. }
  906. });
  907. });
  908. document.querySelectorAll('input[name="benefit_dcrg"]').forEach(radio => {
  909. radio.addEventListener('change', function () {
  910. const dcrgAmountDiv = document.getElementById('dcrgAmountDiv');
  911. if (this.value === 'yes') {
  912. dcrgAmountDiv.style.display = 'block'; // Show the input field
  913. } else {
  914. dcrgAmountDiv.style.display = 'none'; // Hide the input field
  915. document.getElementById('benefit_dcrg_amount').value = ''; // Clear the input field
  916. }
  917. });
  918. });
  919. document.querySelectorAll('input[name="benefit_commutation"]').forEach(radio => {
  920. radio.addEventListener('change', function () {
  921. const CommutationAmountDiv = document.getElementById('CommutationAmountDiv');
  922. if (this.value === 'yes') {
  923. CommutationAmountDiv.style.display = 'block'; // Show the input field
  924. } else {
  925. CommutationAmountDiv.style.display = 'none'; // Hide the input field
  926. document.getElementById('benefit_commutation_amount').value = ''; // Clear the input field
  927. }
  928. });
  929. }); */
  930. });
  931. function loadFileHistory(tempId) {
  932. $.ajax({
  933. url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
  934. type: 'GET',
  935. data: { tempId: tempId }, // Pass empCode as a parameter
  936. success: function (response) {
  937. if (response.length > 0) {
  938. let historyHtml = '';
  939. response.forEach(item => {
  940. historyHtml += `
  941. <div class="file-history-item">
  942. <div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
  943. <div class="file-history-content">
  944. <div class="file-history-status">${item.fileStatusHistory}</div>
  945. <div class="file-history-remarks">Remarks: ${item.remarksHistory || 'N/A'}</div>
  946. </div>
  947. </div>
  948. `;
  949. });
  950. $('#fileHistoryContainer').html(historyHtml);
  951. } else {
  952. $('#fileHistoryContainer').html('<p>No file history available.</p>');
  953. }
  954. },
  955. error: function () {
  956. $('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
  957. }
  958. });
  959. }
  960. // Function to format date and time
  961. function formatDateTime(dateString) {
  962. const options = {
  963. day: '2-digit',
  964. month: '2-digit',
  965. year: 'numeric',
  966. };
  967. return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
  968. }
  969. document.addEventListener("DOMContentLoaded", function() {
  970. // Get today's date
  971. const today = new Date();
  972. // Format the date as DD-MM-YYYY for display
  973. const day = String(today.getDate()).padStart(2, '0');
  974. const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
  975. const year = today.getFullYear();
  976. // Combine into DD-MM-YYYY format for display
  977. const formattedDateDisplay = `${day}-${month}-${year}`;
  978. // Set the value of the input field to the current date (in DD-MM-YYYY format for display)
  979. document.getElementById("datefile").value = formattedDateDisplay;
  980. //document.getElementById("datefilereceived").value = formattedDateDisplay;
  981. //document.getElementById("datefileyes").value = formattedDateDisplay;
  982. });
  983. function convertDateFormat(dateString) {
  984. if (!dateString) return '';
  985. let [day, month, year] = dateString.split('-');
  986. return `${year}-${month}-${day}`;
  987. }
  988. function saveEntryDetails(tempId,empNo) {
  989. let entryDetails = {
  990. empNo:empNo,
  991. tempId: tempId, // Pass the stored tempId value
  992. dateToAudit: convertDateFormat($('#datefile').val()?.trim()),
  993. serviceDeath:$('#deathdate').val(),
  994. remarks: $('#remarks').val(),
  995. deptId:$('#deptId').text().trim(),
  996. filemovedby:$('#userId').text().trim(),
  997. };
  998. if (!entryDetails.serviceDeath) {
  999. Swal.fire({
  1000. icon: 'warning',
  1001. title: 'Validation Error!',
  1002. text: 'Employee Death Date is required.',
  1003. confirmButtonText: 'OK'
  1004. });
  1005. return;
  1006. }
  1007. if (!entryDetails.remarks) {
  1008. Swal.fire({
  1009. icon: 'warning',
  1010. title: 'Validation Error!',
  1011. text: 'Remarks are required.',
  1012. confirmButtonText: 'OK'
  1013. });
  1014. return;
  1015. }
  1016. console.log("entryDetails:",entryDetails);
  1017. $('#closedbutton').prop('disabled', true).text('Processing...');
  1018. $.ajax({
  1019. url: '/gcc/api/fileclosing/updateDetails',
  1020. type: 'POST',
  1021. contentType: 'application/json',
  1022. data: JSON.stringify(entryDetails),
  1023. success: function (response) {
  1024. $('#closedbutton').prop('disabled', false).text('Mark as Closed');
  1025. Swal.fire({
  1026. icon: 'success',
  1027. title: 'Success',
  1028. text: response,
  1029. allowOutsideClick: false,
  1030. allowEscapeKey: false,
  1031. allowEnterKey: false,
  1032. confirmButtonText: 'OK'
  1033. }).then((result) => {
  1034. if (result.isConfirmed) {
  1035. $('#closedbutton').prop('disabled', false).text('Mark as Closed');
  1036. window.location.href = "/gcc/departmentfileclosing/fileclosing";
  1037. console.log("Continue clicked");
  1038. }
  1039. });
  1040. },
  1041. error: function (xhr, status, error) {
  1042. $('#auditsubmit').prop('disabled', false).text('Mark as Closed');
  1043. Swal.fire({
  1044. icon: 'error',
  1045. title: 'Error',
  1046. text: 'Failed to save details. Please try again.',
  1047. confirmButtonText: 'OK'
  1048. });
  1049. console.error('Error:', xhr.responseText);
  1050. }
  1051. });
  1052. }
  1053. //disable future dates
  1054. document.addEventListener("DOMContentLoaded", function () {
  1055. let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format
  1056. let deathdate = document.getElementById("deathdate");
  1057. // Set max attribute to disable future dates
  1058. deathdate.setAttribute("max", today);
  1059. // Prevent manual future date entry
  1060. deathdate.addEventListener("change", function () {
  1061. if (this.value > today) {
  1062. Swal.fire({
  1063. icon: 'warning',
  1064. title: 'Invalid Date',
  1065. text: 'Future dates are not allowed.',
  1066. confirmButtonText: 'OK'
  1067. });
  1068. this.value = ""; // Clear the invalid input
  1069. }
  1070. });
  1071. });
  1072. </script>
  1073. </body>
  1074. </html>