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.

1392 lines
60 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" dir="">
  3. <html xmlns:th="http://www.thymeleaf.org">
  4. <head th:replace="~{fragments/modules/base/head :: head}"></head>
  5. <style>
  6. .required{
  7. color: red;
  8. }
  9. #modalBody h4 {
  10. font-weight: bold;
  11. margin-top: 15px;
  12. margin-bottom: 10px;
  13. }
  14. #modalBody p {
  15. margin: 5px 0;
  16. }
  17. #modalBody hr {
  18. margin: 15px 0;
  19. }
  20. .comment {
  21. margin-bottom: 20px;
  22. }
  23. .comment p {
  24. margin: 0;
  25. }
  26. hr {
  27. border: 1px solid #ccc;
  28. margin-top: 20px;
  29. margin-bottom: 20px;
  30. }
  31. h5 {
  32. font-size: bold;
  33. }
  34. /* Limit the height of the dropdown menu and make it scrollable */
  35. .col-4 {
  36. font-weight: bold;
  37. text-align: right;
  38. }
  39. .col-8 {
  40. padding-left: 20px;
  41. }
  42. .comment {
  43. padding: 10px 0;
  44. }
  45. .comment .text-muted {
  46. font-size: 0.9em;
  47. color: #6c757d;
  48. }
  49. .comment hr {
  50. border-top: 1px solid #ccc;
  51. }
  52. .comment .btn-link {
  53. font-size: 0.9em;
  54. text-decoration: underline;
  55. color: #007bff;
  56. }
  57. /* Make the modal body scrollable */
  58. #detailsModal .modal-body {
  59. max-height: 70vh; /* Limit the height to 70% of the viewport */
  60. overflow-y: auto; /* Enable vertical scrolling */
  61. }
  62. .card-box {
  63. border-radius: 20px;
  64. box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px;
  65. }
  66. #followupCard {
  67. transition: transform 0.2s ease; /* Smooth scaling transition */
  68. cursor: pointer; /* Default cursor change */
  69. }
  70. #followupCard:hover {
  71. transform: scale(1.05); /* Slightly scale up on hover */
  72. cursor: pointer; /* Change cursor to hand symbol */
  73. }
  74. #returnretrieddetailsModal .modal-body{
  75. max-height:80vh;
  76. overflow-y:auto;
  77. }
  78. #returnretrieddreportetailsModals .modal-body{
  79. max-height:80vh;
  80. overflow-y:auto;
  81. }
  82. /* Ensure consistent table borders */
  83. .table {
  84. border-collapse: collapse !important;
  85. }
  86. .table thead th {
  87. background-color: #343a40; /* Dark header background */
  88. color: #ffffff; /* White text */
  89. text-align: center;
  90. }
  91. .table-bordered td, .table-bordered th {
  92. border: 1px solid #dee2e6 !important; /* Ensure borders are visible */
  93. }
  94. /* Ensure proper column width */
  95. #SecondFollowupDatatables, #FollowupDatatable, #reportFollowupDatatables {
  96. table-layout: fixed;
  97. width: 100%;
  98. }
  99. #SecondFollowupDatatables th,
  100. #FollowupDatatable th,
  101. #reportFollowupDatatables th {
  102. white-space: nowrap;
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. }
  106. /* Add padding for better readability */
  107. td, th {
  108. padding: 10px;
  109. text-align: center;
  110. }
  111. .col-md-3 label{
  112. padding-top: 2%;
  113. }
  114. </style>
  115. <body>
  116. <!--[if lt IE 8]>
  117. <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>
  118. <![endif]-->
  119. <div class="wrapper">
  120. <!-- header top menu Start -->
  121. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  122. <!-- header top menu end -->
  123. <div class="page-wrap">
  124. <!--=============== Left Menu side Start ================-->
  125. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  126. <!--=============== Left side End ================-->
  127. <div class="main-content">
  128. <div class="container-fluid">
  129. <div class="page-header mb-2">
  130. <div class="row align-items-end">
  131. <div class="col-lg-8">
  132. <div class="page-header-title">
  133. <i class="fa fa-list-alt bg-blue"></i>
  134. <div class="d-inline">
  135. <h5>Report</h5>
  136. <span>Department Entries</span>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="col-lg-4">
  141. <nav class="breadcrumb-container" aria-label="breadcrumb">
  142. <ol class="breadcrumb">
  143. <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
  144. <li class="breadcrumb-item" aria-current="page">Department Entries</li>
  145. <li class="breadcrumb-item" aria-current="page">Reports</li>
  146. </ol>
  147. </nav>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="row mt-4">
  152. <div class="col-md-12">
  153. <div class="card">
  154. <div class="card-block">
  155. <h5 style="font-weight:bold;">Department-Report</h5>
  156. <h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span>
  157. <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> </h5>
  158. <div class="row mb-4">
  159. <!-- Input Fields for Year Selection -->
  160. <!-- Start Year Dropdown as Button Dropdown -->
  161. <!-- Start Year Dropdown as Button Dropdown -->
  162. <div class="col-md-3">
  163. <label for="startdate" class="form-label fw-bold">Start Date<span class="text-danger">*</span></label>
  164. <input type="date" id="startdate" class="form-control" onclick="this.showPicker()" >
  165. </div>
  166. <div class="col-md-3">
  167. <label for="enddate" class="form-label fw-bold">End Date<span class="text-danger">*</span></label>
  168. <input type="date" id="enddate" class="form-control" onclick="this.showPicker()" >
  169. </div>
  170. <div class="col-md-3">
  171. <label for="typeofreport" class="form-label fw-bold">Type of Report<span class="text-danger">*</span></label>
  172. <select id="typeofreport" class="form-control" style="width: 100%;" required>
  173. <option value="" selected>-- Select Option --</option>
  174. <option value="Abstract">Abstract</option>
  175. <option value="Detailed">Detailed</option>
  176. </select>
  177. </div>
  178. <!-- Type of Category (Initially Hidden) -->
  179. <!-- <div class="col-md-3" id="categoryDiv" style="display: none;">
  180. <label for="typeofcategory" class="form-label fw-bold">Type of Category<span class="text-danger">*</span></label>
  181. <select id="typeofcategory" class="form-control" style="width: 100%;">
  182. <option value="" selected>-- Select Category --</option>
  183. <option value="1">Retirement</option>
  184. <option value="2">Family Pension</option>
  185. <option value="3">Pendency</option>
  186. <option value="4">GIS</option>
  187. <option value="5">Provisional Retirement</option>
  188. <option value="6">Contributory Pension Scheme</option>
  189. </select>
  190. </div> -->
  191. <div class="col-md-3" id="categoryDiv" style="display: none;">
  192. <label for="typeofcategory" class="form-label fw-bold">Type of Category<span class="text-danger">*</span></label>
  193. <select id="typeofcategory" class="form-control" style="width: 100%;">
  194. <option value="" selected>-- Select Category --</option>
  195. </select>
  196. </div>
  197. <div class="col-md-3" id="statusDiv" style="display: none;">
  198. <label for="statusDropdown" class="form-label fw-bold">File Status</label>
  199. <select id="statusDropdown" class="form-control" style="width: 100%;">
  200. <option value="" selected>-- Select Status --</option>
  201. <option value="[1,3]">Audit Pending</option>
  202. <option value="[2,5,6,9]">Department Pending</option>
  203. <option value="[4,7,8,10]">Pension Pending</option>
  204. <option value="[11]">File Completed</option>
  205. <option value="[12]">File Closed</option>
  206. </select>
  207. </div>
  208. <div class="col-md-4 mt-20">
  209. <button id="searchButton" class="btn btn-primary mt-2 mx-2">Search</button>
  210. <button id="resetButton" class="btn btn-secondary mt-2">Reset</button>
  211. </div>
  212. </div>
  213. <div class="page-header-title"></div>
  214. <div style= display:none id="audittable">
  215. <!-- <div style="visibility: hidden; height: 0; overflow: hidden;" id="audittable"> -->
  216. <table id="FileCategoryTable" class="table table-striped table-bordered dataTable">
  217. <thead class="thead-dark">
  218. <tr>
  219. <th class="text-center">S.No</th>
  220. <th class="text-center">File Category</th>
  221. <th class="text-center">Department Pending</th>
  222. <th class="text-center">Audit Pending</th>
  223. <th class="text-center">Pension Pending</th>
  224. <th class="text-center">Completed</th>
  225. <th class="text-center">Total count</th>
  226. </tr>
  227. </thead>
  228. <tbody id="fileCategoryTableBody" style="text-align:center;">
  229. <!-- Data will be inserted dynamically -->
  230. </tbody>
  231. </table>
  232. </div>
  233. <div style= display:none id="cpstable">
  234. <table id="FileDetailsTable" class="table table-striped table-bordered dataTable">
  235. <thead class="thead-dark">
  236. <tr>
  237. <th class="text-center">S.No</th>
  238. <th class="text-center">Employee Code</th>
  239. <th class="text-center">Name</th>
  240. <th class="text-center">Designation</th>
  241. <th class="text-center">Type of Retirement</th>
  242. <th class="text-center">Pending Duration</th>
  243. <th class="text-center">File Status</th>
  244. <th class="text-center">File category</th>
  245. <th class="text-center">File Moved Date</th>
  246. <th class="text-center">Comments/Remarks</th>
  247. </tr>
  248. </thead>
  249. <tbody id="fileDetailsTableBody" style="text-align:center;">
  250. <!-- Data will be inserted dynamically -->
  251. </tbody>
  252. </table>
  253. </div>
  254. <!-- retirement datatable -->
  255. <div style= display:none id="retiretable">
  256. <table id="FileRetirementTable" class="table table-striped table-bordered dataTable">
  257. <thead class="thead-dark">
  258. <tr>
  259. <th class="text-center">S.No</th>
  260. <th class="text-center">Employee Code</th>
  261. <th class="text-center">Name</th>
  262. <th class="text-center">Designation</th>
  263. <th class="text-center">Type of Retirement</th>
  264. <th class="text-center">Date of Retirement</th>
  265. <th class="text-center">File Status</th>
  266. <th class="text-center">File Category</th>
  267. <th class="text-center">File Moved Date</th>
  268. <th class="text-center">Comments/Remarks</th>
  269. </tr>
  270. </thead>
  271. <tbody id="fileRetireTableBody" style="text-align:center;">
  272. <!-- Data will be inserted dynamically -->
  273. </tbody>
  274. </table>
  275. </div>
  276. <!-- Family pension datatable -->
  277. <div style= display:none id="familypensiontable">
  278. <table id="FileFamilyPensionTable" class="table table-striped table-bordered dataTable">
  279. <thead class="thead-dark">
  280. <tr>
  281. <th class="text-center">S.No</th>
  282. <th class="text-center">Employee Code</th>
  283. <th class="text-center">Name</th>
  284. <th class="text-center">Designation</th>
  285. <th class="text-center">Service Death Date</th>
  286. <th class="text-center">Relationship Type</th>
  287. <th class="text-center">Pending Duration</th>
  288. <th class="text-center">File Status</th>
  289. <th class="text-center">File Category</th>
  290. <th class="text-center">File Moved Date</th>
  291. <th class="text-center">Comments/Remarks</th>
  292. </tr>
  293. </thead>
  294. <tbody id="fileFamilyTableBody" style="text-align:center;">
  295. <!-- Data will be inserted dynamically -->
  296. </tbody>
  297. </table>
  298. </div>
  299. <!-- Pendency datatable -->
  300. <div style= display:none id="pendencytable">
  301. <table id="FilePendencyTable" class="table table-striped table-bordered dataTable">
  302. <thead class="thead-dark">
  303. <tr>
  304. <th class="text-center">S.No</th>
  305. <th class="text-center">Employee Code</th>
  306. <th class="text-center">Name</th>
  307. <th class="text-center">Designation</th>
  308. <th class="text-center">Type of Retirement</th>
  309. <th class="text-center">Date of Retirement</th>
  310. <th class="text-center">Pending Duration</th>
  311. <th class="text-center">File Status</th>
  312. <th class="text-center">File Category</th>
  313. <th class="text-center">File Moved Date</th>
  314. <th class="text-center">Comments/Remarks</th>
  315. </tr>
  316. </thead>
  317. <tbody id="filePendencyTableBody" style="text-align:center;">
  318. <!-- Data will be inserted dynamically -->
  319. </tbody>
  320. </table>
  321. </div>
  322. <!-- Gis datatable -->
  323. <div style= display:none id="gistable">
  324. <table id="FileGisTable" class="table table-striped table-bordered dataTable">
  325. <thead class="thead-dark">
  326. <tr>
  327. <th class="text-center">S.No</th>
  328. <th class="text-center">Employee Code</th>
  329. <th class="text-center">Name</th>
  330. <th class="text-center">Designation</th>
  331. <th class="text-center">Service Death Date</th>
  332. <th class="text-center">Sanctioned Amount</th>
  333. <th class="text-center">File Status</th>
  334. <th class="text-center">File category</th>
  335. <th class="text-center">File Moved Date</th>
  336. <th class="text-center">Comments/Remarks</th>
  337. </tr>
  338. </thead>
  339. <tbody id="fileGisTableBody" style="text-align:center;">
  340. <!-- Data will be inserted dynamically -->
  341. </tbody>
  342. </table>
  343. </div>
  344. <!-- provisonal datatable -->
  345. <div style= display:none id="provisionaltable">
  346. <table id="FileProvisionalTable" class="table table-striped table-bordered dataTable">
  347. <thead class="thead-dark">
  348. <tr>
  349. <th class="text-center">S.No</th>
  350. <th class="text-center">Employee Code</th>
  351. <th class="text-center">Name</th>
  352. <th class="text-center">Designation</th>
  353. <th class="text-center">Type of Retirement</th>
  354. <th class="text-center">Date of Retirement</th>
  355. <th class="text-center">File Status</th>
  356. <th class="text-center">File category</th>
  357. <th class="text-center">File Moved Date</th>
  358. <th class="text-center">Comments/Remarks</th>
  359. </tr>
  360. </thead>
  361. <tbody id="fileProvisionalTableBody" style="text-align:center;">
  362. <!-- Data will be inserted dynamically -->
  363. </tbody>
  364. </table>
  365. </div>
  366. </div>
  367. </div>
  368. </div>
  369. </div>
  370. </div>
  371. </div>
  372. <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;">
  373. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  374. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  375. <span class="sr-only">Loading...</span>
  376. </div>
  377. <!-- Add the 'Please wait' text below the spinner -->
  378. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  379. </div>
  380. </div>
  381. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  382. </div>
  383. </div>
  384. <!-- Modal Box -->
  385. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  386. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  387. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  388. <!-- Bootstrap 5 JS -->
  389. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  390. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  391. <script>
  392. $(document).ready(function () {
  393. function loadFileCategories() {
  394. $.ajax({
  395. url: "/getFileCategories", // Ensure this is the correct endpoint
  396. type: "GET",
  397. dataType: "json",
  398. success: function (response) {
  399. console.log("File Categories Loaded:", response); // Debugging
  400. if (response.length === 0) {
  401. console.warn("No categories found!");
  402. return;
  403. }
  404. let $categoryDropdown = $("#typeofcategory");
  405. // $categoryDropdown.empty().append('<option value="">-- Select Category --</option>');
  406. response.forEach(category => {
  407. $categoryDropdown.append(`<option value="${category.id}">${category.file_name}</option>`);
  408. });
  409. },
  410. error: function (xhr, status, error) {
  411. console.error("Error fetching categories:", xhr.responseText);
  412. Swal.fire({
  413. icon: "error",
  414. title: "Error Fetching Data",
  415. text: "Failed to load categories. Please try again later.",
  416. });
  417. }
  418. });
  419. }
  420. // Call function to load categories when the page is ready
  421. loadFileCategories();
  422. $('#resetButton').on('click', function () {
  423. window.location.href = "/gcc/department/reports";
  424. });
  425. });
  426. $(document).ready(function () {
  427. // Initialize DataTables
  428. // count datatable
  429. let fileCategoryTable = $("#FileCategoryTable").DataTable({
  430. dom: 'Bftip',
  431. columnDefs: [{ targets: 'no-sort', orderable: false }],
  432. lengthMenu: [
  433. [50, 100, 200, 500, -1],
  434. ['50 rows', '100 rows', '200 rows', 'Show all']
  435. ],
  436. scrollY: '50vh',
  437. fixedColumns: { left: 1, right: 1 },
  438. buttons: [
  439. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  440. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  441. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  442. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  443. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  444. ],
  445. fixedHeader: false,
  446. autoWidth: true,
  447. responsive: true,
  448. searching: true,
  449. select: false,
  450. processing: false,
  451. data: [], // Start with an empty table
  452. columns: [
  453. { title: "S.No", data: "index", className: "text-center" },
  454. { title: "File Category", data: "file_name", className: "text-center" },
  455. { title: "Department Pending", data: "department_pending", className: "text-center" },
  456. { title: "Audit Pending", data: "audit_pending", className: "text-center" },
  457. { title: "Pension Pending", data: "pension_pending", className: "text-center" },
  458. { title: "Completed", data: "completed", className: "text-center" },
  459. { title: "Total Count", data: "total_count", className: "text-center" }
  460. ]
  461. });
  462. //cps datatable
  463. let fileDetailsTable = $("#FileDetailsTable").DataTable({
  464. dom: 'Bftip',
  465. columnDefs: [{ targets: 'no-sort', orderable: false }],
  466. lengthMenu: [
  467. [50, 100, 200, 500, -1],
  468. ['50 rows', '100 rows', '200 rows', 'Show all']
  469. ],
  470. scrollY: '50vh',
  471. fixedColumns: { left: 1, right: 1 },
  472. buttons: [
  473. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  474. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  475. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  476. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  477. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  478. ],
  479. fixedHeader: false,
  480. autoWidth: true,
  481. responsive: true,
  482. searching: true,
  483. select: false,
  484. processing: false,
  485. data: [],
  486. columns: [
  487. { title: "S.No", data: "index", className: "text-center" },
  488. { title: "Employee Code", data: "emp_no", className: "text-center" },
  489. { title: "Name", data: "emp_name", className: "text-center" },
  490. { title: "Designation", data: "designation", className: "text-center" },
  491. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  492. { title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
  493. { title: "File Status", data: "fst", className: "text-center" },
  494. { title: "File Category", data: "file_category_name", className: "text-center" },
  495. {
  496. title: "File Moved Date",
  497. data: "created_date",
  498. className: "text-center",
  499. render: function(data, type, row) {
  500. if (data) {
  501. let date = new Date(data);
  502. let day = String(date.getDate()).padStart(2, '0');
  503. let month = String(date.getMonth() + 1).padStart(2, '0');
  504. let year = date.getFullYear();
  505. return `${day}-${month}-${year}`;
  506. }
  507. return "";
  508. }
  509. },
  510. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  511. ]
  512. });
  513. // retirement datatable
  514. /* let fileRetireTable = $("#FileRetirementTable").DataTable({
  515. dom: 'Bftip',
  516. columnDefs: [{ targets: 'no-sort', orderable: false }],
  517. lengthMenu: [
  518. [50, 100, 200, 500, -1],
  519. ['50 rows', '100 rows', '200 rows', 'Show all']
  520. ],
  521. scrollY: '50vh',
  522. fixedColumns: { left: 1, right: 1 },
  523. buttons: [
  524. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  525. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  526. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  527. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  528. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  529. ],
  530. fixedHeader: false,
  531. autoWidth: true,
  532. responsive: true,
  533. searching: true,
  534. select: false,
  535. processing: false,
  536. data: [],
  537. columns: [
  538. { title: "S.No", data: "index", className: "text-center" },
  539. { title: "Employee Code", data: "emp_no", className: "text-center" },
  540. { title: "Name", data: "emp_name", className: "text-center" },
  541. { title: "Designation", data: "designation", className: "text-center" },
  542. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  543. { title: "Date of Retirement", data: "retirement_date", className: "text-center" },
  544. { title: "File Status", data: "fst", className: "text-center" },
  545. { title: "File Category", data: "file_category_name", className: "text-center" },
  546. { title: "File Moved Date", data: "file_moved_date", className: "text-center" },
  547. {
  548. title: "File Moved Date",
  549. data: "file_moved_date",
  550. className: "text-center",
  551. render: function(data, type, row) {
  552. if (data) {
  553. let date = new Date(data);
  554. let day = String(date.getDate()).padStart(2, '0');
  555. let month = String(date.getMonth() + 1).padStart(2, '0');
  556. let year = date.getFullYear();
  557. return `${day}-${month}-${year}`;
  558. }
  559. return "";
  560. }
  561. },
  562. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  563. ]
  564. }); */
  565. let fileRetireTable = $("#FileRetirementTable").DataTable({
  566. dom: 'Bftip',
  567. columnDefs: [{ targets: 'no-sort', orderable: false }],
  568. lengthMenu: [
  569. [50, 100, 200, 500, -1],
  570. ['50 rows', '100 rows', '200 rows', 'Show all']
  571. ],
  572. scrollY: '50vh',
  573. fixedColumns: { left: 1, right: 1 },
  574. buttons: [
  575. { extend: 'pageLength', className: 'btn btn-warning ' },
  576. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' },
  577. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  578. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  579. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  580. ],
  581. fixedHeader: false,
  582. autoWidth: true,
  583. responsive: true,
  584. searching: true,
  585. select: false,
  586. processing: false,
  587. data: [],
  588. columns: [
  589. { title: "S.No", data: "index", className: "text-center" },
  590. { title: "Employee Code", data: "emp_no", className: "text-center" },
  591. { title: "Name", data: "emp_name", className: "text-center" },
  592. { title: "Designation", data: "designation", className: "text-center" },
  593. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  594. {
  595. title: "Date of Retirement",
  596. data: "retirement_date",
  597. className: "text-center",
  598. render: function(data, type, row) {
  599. if (data) {
  600. let date = new Date(data);
  601. let day = String(date.getDate()).padStart(2, '0');
  602. let month = String(date.getMonth() + 1).padStart(2, '0');
  603. let year = date.getFullYear();
  604. return `${day}-${month}-${year}`;
  605. }
  606. return "";
  607. }
  608. },
  609. { title: "File Status", data: "fst", className: "text-center" },
  610. { title: "File Category", data: "file_category_name", className: "text-center" },
  611. {
  612. title: "File Moved Date",
  613. data: "file_moved_date",
  614. className: "text-center",
  615. render: function(data, type, row) {
  616. if (data) {
  617. let date = new Date(data);
  618. let day = String(date.getDate()).padStart(2, '0');
  619. let month = String(date.getMonth() + 1).padStart(2, '0');
  620. let year = date.getFullYear();
  621. return `${day}-${month}-${year}`;
  622. }
  623. return "";
  624. }
  625. },
  626. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  627. ]
  628. });
  629. // family pension datatable
  630. let fileFamilyPensionTable = $("#FileFamilyPensionTable").DataTable({
  631. dom: 'Bftip',
  632. columnDefs: [{ targets: 'no-sort', orderable: false }],
  633. lengthMenu: [
  634. [50, 100, 200, 500, -1],
  635. ['50 rows', '100 rows', '200 rows', 'Show all']
  636. ],
  637. scrollY: '50vh',
  638. fixedColumns: { left: 1, right: 1 },
  639. buttons: [
  640. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  641. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  642. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  643. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  644. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  645. ],
  646. fixedHeader: false,
  647. autoWidth: true,
  648. responsive: true,
  649. searching: true,
  650. select: false,
  651. processing: false,
  652. data: [],
  653. columns: [
  654. { title: "S.No", data: "index", className: "text-center" },
  655. { title: "Employee Code", data: "emp_no", className: "text-center" },
  656. { title: "Name", data: "emp_name", className: "text-center" },
  657. { title: "Designation", data: "designation", className: "text-center" },
  658. {
  659. title: "Service Death Date",
  660. data: "service_death",
  661. className: "text-center",
  662. render: function(data, type, row) {
  663. if (data) {
  664. let date = new Date(data);
  665. let day = String(date.getDate()).padStart(2, '0');
  666. let month = String(date.getMonth() + 1).padStart(2, '0');
  667. let year = date.getFullYear();
  668. return `${day}-${month}-${year}`;
  669. }
  670. return "";
  671. }
  672. },
  673. { title: "Relationship Type", data: "relationship_deceased", className: "text-center" },
  674. { title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
  675. { title: "File Status", data: "fst", className: "text-center" },
  676. { title: "File Category", data: "file_category_name", className: "text-center" },
  677. {
  678. title: "File Moved Date",
  679. data: "file_moved_date",
  680. className: "text-center",
  681. render: function(data, type, row) {
  682. if (data) {
  683. let date = new Date(data);
  684. let day = String(date.getDate()).padStart(2, '0');
  685. let month = String(date.getMonth() + 1).padStart(2, '0');
  686. let year = date.getFullYear();
  687. return `${day}-${month}-${year}`;
  688. }
  689. return "";
  690. }
  691. },
  692. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  693. ]
  694. });
  695. // pendency datatable
  696. let filePendencyTable = $("#FilePendencyTable").DataTable({
  697. dom: 'Bftip',
  698. columnDefs: [{ targets: 'no-sort', orderable: false }],
  699. lengthMenu: [
  700. [50, 100, 200, 500, -1],
  701. ['50 rows', '100 rows', '200 rows', 'Show all']
  702. ],
  703. scrollY: '50vh',
  704. fixedColumns: { left: 1, right: 1 },
  705. buttons: [
  706. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  707. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  708. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  709. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  710. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  711. ],
  712. fixedHeader: false,
  713. autoWidth: true,
  714. responsive: true,
  715. searching: true,
  716. select: false,
  717. processing: false,
  718. data: [],
  719. columns: [
  720. { title: "S.No", data: "index", className: "text-center" },
  721. { title: "Employee Code", data: "emp_no", className: "text-center" },
  722. { title: "Name", data: "emp_name", className: "text-center" },
  723. { title: "Designation", data: "designation", className: "text-center" },
  724. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  725. {
  726. title: "Date of Retirement",
  727. data: "retirement_date",
  728. className: "text-center",
  729. render: function(data, type, row) {
  730. if (data) {
  731. let date = new Date(data);
  732. let day = String(date.getDate()).padStart(2, '0');
  733. let month = String(date.getMonth() + 1).padStart(2, '0');
  734. let year = date.getFullYear();
  735. return `${day}-${month}-${year}`;
  736. }
  737. return "";
  738. }
  739. },
  740. { title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
  741. { title: "File Status", data: "fst", className: "text-center" },
  742. { title: "File Category", data: "file_category_name", className: "text-center" },
  743. {
  744. title: "File Moved Date",
  745. data: "file_moved_date",
  746. className: "text-center",
  747. render: function(data, type, row) {
  748. if (data) {
  749. let date = new Date(data);
  750. let day = String(date.getDate()).padStart(2, '0');
  751. let month = String(date.getMonth() + 1).padStart(2, '0');
  752. let year = date.getFullYear();
  753. return `${day}-${month}-${year}`;
  754. }
  755. return "";
  756. }
  757. },
  758. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  759. ]
  760. });
  761. // Gis datatable
  762. let fileGisTable = $("#FileGisTable").DataTable({
  763. dom: 'Bftip',
  764. columnDefs: [{ targets: 'no-sort', orderable: false }],
  765. lengthMenu: [
  766. [50, 100, 200, 500, -1],
  767. ['50 rows', '100 rows', '200 rows', 'Show all']
  768. ],
  769. scrollY: '50vh',
  770. fixedColumns: { left: 1, right: 1 },
  771. buttons: [
  772. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  773. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  774. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  775. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  776. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  777. ],
  778. fixedHeader: false,
  779. autoWidth: true,
  780. responsive: true,
  781. searching: true,
  782. select: false,
  783. processing: false,
  784. data: [],
  785. columns: [
  786. { title: "S.No", data: "index", className: "text-center" },
  787. { title: "Employee Code", data: "emp_no", className: "text-center" },
  788. { title: "Name", data: "emp_name", className: "text-center" },
  789. { title: "Designation", data: "designation", className: "text-center" },
  790. {
  791. title: "Service Death Date",
  792. data: "service_death",
  793. className: "text-center",
  794. render: function(data, type, row) {
  795. if (data) {
  796. let date = new Date(data);
  797. let day = String(date.getDate()).padStart(2, '0');
  798. let month = String(date.getMonth() + 1).padStart(2, '0');
  799. let year = date.getFullYear();
  800. return `${day}-${month}-${year}`;
  801. }
  802. return "";
  803. }
  804. },
  805. { title: "Sanctioned Amount", data: "sanctional_gis_amount", className: "text-center" },
  806. { title: "File Status", data: "fst", className: "text-center" },
  807. { title: "File Category", data: "file_category_name", className: "text-center" },
  808. {
  809. title: "File Moved Date",
  810. data: "file_moved_date",
  811. className: "text-center",
  812. render: function(data, type, row) {
  813. if (data) {
  814. let date = new Date(data);
  815. let day = String(date.getDate()).padStart(2, '0');
  816. let month = String(date.getMonth() + 1).padStart(2, '0');
  817. let year = date.getFullYear();
  818. return `${day}-${month}-${year}`;
  819. }
  820. return "";
  821. }
  822. },
  823. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  824. ]
  825. });
  826. // provisional datatable
  827. let fileProvisionalTable = $("#FileProvisionalTable").DataTable({
  828. dom: 'Bftip',
  829. columnDefs: [{ targets: 'no-sort', orderable: false }],
  830. lengthMenu: [
  831. [50, 100, 200, 500, -1],
  832. ['50 rows', '100 rows', '200 rows', 'Show all']
  833. ],
  834. scrollY: '50vh',
  835. fixedColumns: { left: 1, right: 1 },
  836. buttons: [
  837. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  838. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  839. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  840. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  841. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  842. ],
  843. fixedHeader: false,
  844. autoWidth: true,
  845. responsive: true,
  846. searching: true,
  847. select: false,
  848. processing: false,
  849. data: [],
  850. columns: [
  851. { title: "S.No", data: "index", className: "text-center" },
  852. { title: "Employee Code", data: "emp_no", className: "text-center" },
  853. { title: "Name", data: "emp_name", className: "text-center" },
  854. { title: "Designation", data: "designation", className: "text-center" },
  855. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  856. {
  857. title: "Date of Retirement",
  858. data: "retirement_date",
  859. className: "text-center",
  860. render: function(data, type, row) {
  861. if (data) {
  862. let date = new Date(data);
  863. let day = String(date.getDate()).padStart(2, '0');
  864. let month = String(date.getMonth() + 1).padStart(2, '0');
  865. let year = date.getFullYear();
  866. return `${day}-${month}-${year}`;
  867. }
  868. return "";
  869. }
  870. },
  871. { title: "File Category", data: "file_category_name", className: "text-center" },
  872. { title: "File Status", data: "fst", className: "text-center" },
  873. {
  874. title: "File Moved Date",
  875. data: "file_moved_date",
  876. className: "text-center",
  877. render: function(data, type, row) {
  878. if (data) {
  879. let date = new Date(data);
  880. let day = String(date.getDate()).padStart(2, '0');
  881. let month = String(date.getMonth() + 1).padStart(2, '0');
  882. let year = date.getFullYear();
  883. return `${day}-${month}-${year}`;
  884. }
  885. return "";
  886. }
  887. },
  888. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  889. ]
  890. });
  891. // Listen for changes in the Type of Report dropdown
  892. $("#typeofreport").change(function () {
  893. let selectedValue = $(this).val();
  894. if (selectedValue === "Detailed") {
  895. $("#categoryDiv").show();
  896. } else {
  897. $("#categoryDiv").hide();
  898. $("#typeofcategory").val(""); // Reset category value
  899. $("#statusDiv").hide();
  900. $("#statusDropdown").val("");
  901. }
  902. });
  903. $("#typeofcategory").change(function () {
  904. let selectedCatValue = $(this).val();
  905. let statusDropdown = $("#statusDropdown");
  906. if(selectedCatValue==""){
  907. $("#statusDiv").hide();
  908. $("#statusDropdown").val("");
  909. }
  910. else{
  911. $("#statusDiv").show();
  912. }
  913. // Backup of all options (only once)
  914. if (!statusDropdown.data("original-options")) {
  915. statusDropdown.data("original-options", statusDropdown.html());
  916. }
  917. if (selectedCatValue === "1") {
  918. // Restore all options
  919. statusDropdown.html(statusDropdown.data("original-options"));
  920. } else {
  921. // Remove the last two options ("File Completed" and "File Closed")
  922. statusDropdown.html(statusDropdown.data("original-options"));
  923. statusDropdown.find("option[value='[12]']").remove();
  924. }
  925. });
  926. /* $('#statusDropdown').on('change', function () {
  927. let selectedValue = $(this).val();
  928. let statusArray = selectedValue ? JSON.parse(selectedValue) : []; // Convert string to array
  929. console.log(statusArray); // Output: [1,3] or [2,5,6,9] etc.
  930. }); */
  931. // Handle Search Button click
  932. $("#searchButton").click(function () {
  933. let startDate = $("#startdate").val();
  934. let endDate = $("#enddate").val();
  935. let deptId = $('#deptId').text().trim();
  936. let typeOfReport = $("#typeofreport").val();
  937. let typeOfCategory = $("#typeofcategory").val();
  938. let selectedStatus = $("#statusDropdown").val();
  939. let statusArray = selectedStatus ? JSON.parse(selectedStatus) : [];
  940. console.log("statusArray", statusArray);
  941. if (!startDate || !endDate) {
  942. Swal.fire({
  943. icon: "warning",
  944. title: "Validation Error",
  945. text: "Please select Both Date before searching.",
  946. confirmButtonText: "OK"
  947. });
  948. return;
  949. }
  950. // Validation
  951. if (!typeOfReport) {
  952. Swal.fire({
  953. icon: "warning",
  954. title: "Validation Error",
  955. text: "Please select a Type of Report before searching.",
  956. confirmButtonText: "OK"
  957. });
  958. return; // Stop execution if validation fails
  959. }
  960. // Handle Detailed Report or Summary Report based on selection
  961. if (typeOfReport === "Detailed" && !typeOfCategory) {
  962. Swal.fire({
  963. icon: "warning",
  964. title: "Validation Error",
  965. text: "Please select a Category for Detailed report.",
  966. confirmButtonText: "OK"
  967. });
  968. return;
  969. }
  970. // Perform AJAX for FileCategory (Summary) or FileDetails (Detailed)
  971. let url, data;
  972. if (typeOfReport === "Detailed") {
  973. url = "/getReportDetails";
  974. data = { startDate: startDate, endDate: endDate, deptId: deptId, fileCatId: typeOfCategory , fileStatus:statusArray};
  975. } else {
  976. url = "/getReportData";
  977. data = { startDate: startDate, endDate: endDate, deptId: deptId };
  978. }
  979. $('#pageLoader').show();
  980. // Make AJAX request based on selected report type
  981. $.ajax({
  982. url: url,
  983. type: "GET",
  984. data: data,
  985. traditional: true,
  986. dataType: "json",
  987. success: function (response) {
  988. $('#pageLoader').hide();
  989. if (response.length === 0) {
  990. $('#FileCategoryTable').DataTable().clear().draw();
  991. $('#FileDetailsTable').DataTable().clear().draw();
  992. $('#FileRetirementTable').DataTable().clear().draw();
  993. $('#FileFamilyPensionTable').DataTable().clear().draw();
  994. $('#FilePendencyTable').DataTable().clear().draw();
  995. $('#FileGisTable').DataTable().clear().draw();
  996. $('#FileProvisionalTable').DataTable().clear().draw();
  997. Swal.fire({
  998. icon: "info",
  999. title: "No Data Found",
  1000. text: "No records match your selection.",
  1001. confirmButtonText: "OK"
  1002. });
  1003. } else {
  1004. $('#pageLoader').hide();
  1005. // Format and add data to the correct table based on the report type
  1006. if (typeOfReport === "Detailed" && typeOfCategory=='6' ) {
  1007. $("#cpstable").css("display", "block").css("height", "auto");
  1008. $("#audittable").css("display", "none").css("height", "auto");
  1009. $("#retiretable").css("display", "none").css("height", "auto");
  1010. $("#familypensiontable").css("display", "none").css("height", "auto");
  1011. $("#pendencytable").css("display", "none").css("height", "auto");
  1012. $("#gistable").css("display", "none").css("height", "auto");
  1013. $("#provisionaltable").css("display", "none").css("height", "auto");
  1014. let formattedData = response.map((row, index) => ({
  1015. index: index + 1,
  1016. emp_no: row.emp_no,
  1017. emp_name: row.emp_name,
  1018. designation: row.designation,
  1019. type_of_retirement: row.type_of_retirement,
  1020. reason_for_pending: row.reason_for_pending,
  1021. fst: row.fst,
  1022. file_category_name:row.file_category_name,
  1023. remarks: row.remarks,
  1024. created_date: row.created_date,
  1025. }));
  1026. fileDetailsTable.clear().rows.add(formattedData).draw();
  1027. }
  1028. if (typeOfReport === "Detailed" && typeOfCategory=='1' ) {
  1029. $("#cpstable").css("display", "none").css("height", "auto");
  1030. $("#audittable").css("display", "none").css("height", "auto");
  1031. $("#retiretable").css("display", "block").css("height", "auto");
  1032. $("#familypensiontable").css("display", "none").css("height", "auto");
  1033. $("#pendencytable").css("display", "none").css("height", "auto");
  1034. $("#gistable").css("display", "none").css("height", "auto");
  1035. $("#provisionaltable").css("display", "none").css("height", "auto");
  1036. let formattedData = response.map((row, index) => ({
  1037. index: index + 1,
  1038. emp_no: row.emp_no,
  1039. emp_name: row.emp_name,
  1040. designation: row.designation,
  1041. type_of_retirement: row.type_of_retirement,
  1042. retirement_date: row.retirement_date,
  1043. fst: row.fst,
  1044. file_category_name:row.file_category_name,
  1045. remarks: row.remarks,
  1046. file_moved_date: row.file_moved_date,
  1047. }));
  1048. fileRetireTable.clear().rows.add(formattedData).draw();
  1049. }
  1050. if (typeOfReport === "Detailed" && typeOfCategory=='2' ) {
  1051. $("#cpstable").css("display", "none").css("height", "auto");
  1052. $("#audittable").css("display", "none").css("height", "auto");
  1053. $("#retiretable").css("display", "none").css("height", "auto");
  1054. $("#familypensiontable").css("display", "block").css("height", "auto");
  1055. $("#pendencytable").css("display", "none").css("height", "auto");
  1056. $("#gistable").css("display", "none").css("height", "auto");
  1057. $("#provisionaltable").css("display", "none").css("height", "auto");
  1058. let formattedData = response.map((row, index) => ({
  1059. index: index + 1,
  1060. emp_no: row.emp_no,
  1061. emp_name: row.emp_name,
  1062. designation: row.designation,
  1063. service_death:row.service_death,
  1064. relationship_deceased: row.relationship_deceased,
  1065. reason_for_pending: row.reason_for_pending,
  1066. fst: row.fst,
  1067. file_category_name:row.file_category_name,
  1068. remarks: row.remarks,
  1069. file_moved_date: row.file_moved_date,
  1070. }));
  1071. fileFamilyPensionTable.clear().rows.add(formattedData).draw();
  1072. }
  1073. if (typeOfReport === "Detailed" && typeOfCategory=='3' ) {
  1074. $("#cpstable").css("display", "none").css("height", "auto");
  1075. $("#audittable").css("display", "none").css("height", "auto");
  1076. $("#retiretable").css("display", "none").css("height", "auto");
  1077. $("#familypensiontable").css("display", "none").css("height", "auto");
  1078. $("#pendencytable").css("display", "block").css("height", "auto");
  1079. $("#gistable").css("display", "none").css("height", "auto");
  1080. $("#provisionaltable").css("display", "none").css("height", "auto");
  1081. let formattedData = response.map((row, index) => ({
  1082. index: index + 1,
  1083. emp_no: row.emp_no,
  1084. emp_name: row.emp_name,
  1085. designation: row.designation,
  1086. type_of_retirement: row.type_of_retirement,
  1087. retirement_date: row.retirement_date,
  1088. reason_for_pending:row.reason_for_pending,
  1089. fst: row.fst,
  1090. file_category_name:row.file_category_name,
  1091. remarks: row.remarks,
  1092. file_moved_date: row.file_moved_date,
  1093. }));
  1094. filePendencyTable.clear().rows.add(formattedData).draw();
  1095. }
  1096. if (typeOfReport === "Detailed" && typeOfCategory=='4' ) {
  1097. $("#cpstable").css("display", "none").css("height", "auto");
  1098. $("#audittable").css("display", "none").css("height", "auto");
  1099. $("#retiretable").css("display", "none").css("height", "auto");
  1100. $("#familypensiontable").css("display", "none").css("height", "auto");
  1101. $("#pendencytable").css("display", "none").css("height", "auto");
  1102. $("#gistable").css("display", "block").css("height", "auto");
  1103. $("#provisionaltable").css("display", "none").css("height", "auto");
  1104. let formattedData = response.map((row, index) => ({
  1105. index: index + 1,
  1106. emp_no: row.emp_no,
  1107. emp_name: row.emp_name,
  1108. designation: row.designation,
  1109. service_death: row.service_death,
  1110. sanctional_gis_amount: row.sanctional_gis_amount,
  1111. fst: row.fst,
  1112. file_category_name:row.file_category_name,
  1113. remarks: row.remarks,
  1114. file_moved_date: row.file_moved_date,
  1115. }));
  1116. fileGisTable.clear().rows.add(formattedData).draw();
  1117. }
  1118. if (typeOfReport === "Detailed" && typeOfCategory=='5' ) {
  1119. $("#cpstable").css("display", "none").css("height", "auto");
  1120. $("#audittable").css("display", "none").css("height", "auto");
  1121. $("#retiretable").css("display", "none").css("height", "auto");
  1122. $("#familypensiontable").css("display", "none").css("height", "auto");
  1123. $("#pendencytable").css("display", "none").css("height", "auto");
  1124. $("#gistable").css("display", "none").css("height", "auto");
  1125. $("#provisionaltable").css("display", "block").css("height", "auto");
  1126. let formattedData = response.map((row, index) => ({
  1127. index: index + 1,
  1128. emp_no: row.emp_no,
  1129. emp_name: row.emp_name,
  1130. designation: row.designation,
  1131. type_of_retirement: row.type_of_retirement,
  1132. retirement_date: row.retirement_date,
  1133. fst: row.fst,
  1134. file_category_name:row.file_category_name,
  1135. remarks: row.remarks,
  1136. file_moved_date: row.file_moved_date,
  1137. }));
  1138. fileProvisionalTable.clear().rows.add(formattedData).draw();
  1139. }
  1140. if(typeOfReport === "Abstract"){
  1141. $("#cpstable").css("display", "none").css("height", "auto");
  1142. $("#audittable").css("display", "block").css("height", "auto");
  1143. $("#retiretable").css("display", "none").css("height", "auto");
  1144. $("#familypensiontable").css("display", "none").css("height", "auto");
  1145. $("#pendencytable").css("display", "none").css("height", "auto");
  1146. $("#gistable").css("display", "none").css("height", "auto");
  1147. $("#provisionaltable").css("display", "none").css("height", "auto");
  1148. let formattedData = response.map((row, index) => ({
  1149. index: index + 1,
  1150. file_name: row.file_name,
  1151. department_pending: row.department_pending,
  1152. audit_pending: row.audit_pending,
  1153. pension_pending: row.pension_pending,
  1154. completed: row.completed,
  1155. total_count: row.total_files
  1156. }));
  1157. fileCategoryTable.clear().rows.add(formattedData).draw();
  1158. }
  1159. }
  1160. },
  1161. error: function (xhr, status, error) {
  1162. $('#pageLoader').hide();
  1163. Swal.fire({
  1164. icon: "error",
  1165. title: "Error",
  1166. text: "Failed to load data. Please try again.",
  1167. confirmButtonText: "OK"
  1168. });
  1169. }
  1170. });
  1171. });
  1172. });
  1173. $('#startdate').on('change', function () {
  1174. const fromDate = $(this).val();
  1175. $('#enddate').attr('min', fromDate); // Update min attribute for To Date
  1176. // If To Date is earlier than the new From Date, adjust it
  1177. const toDate = $('#enddate').val();
  1178. if (new Date(toDate) < new Date(fromDate)) {
  1179. $('#enddate').val(fromDate);
  1180. }
  1181. });
  1182. // Update From Date's max attribute when To Date changes
  1183. $('#enddate').on('change', function () {
  1184. const toDate = $(this).val();
  1185. $('#startdate').attr('max', toDate); // Update max attribute for From Date
  1186. // If From Date is later than the new To Date, adjust it
  1187. const fromDate = $('#startdate').val();
  1188. if (new Date(fromDate) > new Date(toDate)) {
  1189. $('#startdate').val(toDate);
  1190. }
  1191. });
  1192. //disable future dates
  1193. document.addEventListener("DOMContentLoaded", function () {
  1194. let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format
  1195. let startdateInput = document.getElementById("startdate");
  1196. let enddateInput = document.getElementById("enddate");
  1197. // Set max attribute to disable future dates
  1198. startdateInput.setAttribute("max", today);
  1199. enddateInput.setAttribute("max", today);
  1200. // Prevent manual future date entry
  1201. startdateInput.addEventListener("change", function () {
  1202. if (this.value > today) {
  1203. Swal.fire({
  1204. icon: 'warning',
  1205. title: 'Invalid Date',
  1206. text: 'Future dates are not allowed.',
  1207. confirmButtonText: 'OK'
  1208. });
  1209. this.value = ""; // Clear the invalid input
  1210. }
  1211. });
  1212. });
  1213. </script>
  1214. </body>
  1215. </html>