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.

1410 lines
61 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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">Date of Retirement</th>
  243. <th class="text-center">Pending Duration</th>
  244. <th class="text-center">File Status</th>
  245. <th class="text-center">File category</th>
  246. <th class="text-center">File Moved Date</th>
  247. <th class="text-center">Comments/Remarks</th>
  248. </tr>
  249. </thead>
  250. <tbody id="fileDetailsTableBody" style="text-align:center;">
  251. <!-- Data will be inserted dynamically -->
  252. </tbody>
  253. </table>
  254. </div>
  255. <!-- retirement datatable -->
  256. <div style= display:none id="retiretable">
  257. <table id="FileRetirementTable" class="table table-striped table-bordered dataTable">
  258. <thead class="thead-dark">
  259. <tr>
  260. <th class="text-center">S.No</th>
  261. <th class="text-center">Employee Code</th>
  262. <th class="text-center">Name</th>
  263. <th class="text-center">Designation</th>
  264. <th class="text-center">Type of Retirement</th>
  265. <th class="text-center">Date of Retirement</th>
  266. <th class="text-center">File Status</th>
  267. <th class="text-center">File Category</th>
  268. <th class="text-center">File Moved Date</th>
  269. <th class="text-center">Comments/Remarks</th>
  270. </tr>
  271. </thead>
  272. <tbody id="fileRetireTableBody" style="text-align:center;">
  273. <!-- Data will be inserted dynamically -->
  274. </tbody>
  275. </table>
  276. </div>
  277. <!-- Family pension datatable -->
  278. <div style= display:none id="familypensiontable">
  279. <table id="FileFamilyPensionTable" class="table table-striped table-bordered dataTable">
  280. <thead class="thead-dark">
  281. <tr>
  282. <th class="text-center">S.No</th>
  283. <th class="text-center">Employee Code</th>
  284. <th class="text-center">Name</th>
  285. <th class="text-center">Designation</th>
  286. <th class="text-center">Service Death Date</th>
  287. <th class="text-center">Relationship Type</th>
  288. <th class="text-center">Pending Duration</th>
  289. <th class="text-center">File Status</th>
  290. <th class="text-center">File Category</th>
  291. <th class="text-center">File Moved Date</th>
  292. <th class="text-center">Comments/Remarks</th>
  293. </tr>
  294. </thead>
  295. <tbody id="fileFamilyTableBody" style="text-align:center;">
  296. <!-- Data will be inserted dynamically -->
  297. </tbody>
  298. </table>
  299. </div>
  300. <!-- Pendency datatable -->
  301. <div style= display:none id="pendencytable">
  302. <table id="FilePendencyTable" class="table table-striped table-bordered dataTable">
  303. <thead class="thead-dark">
  304. <tr>
  305. <th class="text-center">S.No</th>
  306. <th class="text-center">Employee Code</th>
  307. <th class="text-center">Name</th>
  308. <th class="text-center">Designation</th>
  309. <th class="text-center">Type of Retirement</th>
  310. <th class="text-center">Date of Retirement</th>
  311. <th class="text-center">Pending Duration</th>
  312. <th class="text-center">File Status</th>
  313. <th class="text-center">File Category</th>
  314. <th class="text-center">File Moved Date</th>
  315. <th class="text-center">Comments/Remarks</th>
  316. </tr>
  317. </thead>
  318. <tbody id="filePendencyTableBody" style="text-align:center;">
  319. <!-- Data will be inserted dynamically -->
  320. </tbody>
  321. </table>
  322. </div>
  323. <!-- Gis datatable -->
  324. <div style= display:none id="gistable">
  325. <table id="FileGisTable" class="table table-striped table-bordered dataTable">
  326. <thead class="thead-dark">
  327. <tr>
  328. <th class="text-center">S.No</th>
  329. <th class="text-center">Employee Code</th>
  330. <th class="text-center">Name</th>
  331. <th class="text-center">Designation</th>
  332. <th class="text-center">Service Death Date</th>
  333. <th class="text-center">Sanctioned Amount</th>
  334. <th class="text-center">File Status</th>
  335. <th class="text-center">File category</th>
  336. <th class="text-center">File Moved Date</th>
  337. <th class="text-center">Comments/Remarks</th>
  338. </tr>
  339. </thead>
  340. <tbody id="fileGisTableBody" style="text-align:center;">
  341. <!-- Data will be inserted dynamically -->
  342. </tbody>
  343. </table>
  344. </div>
  345. <!-- provisonal datatable -->
  346. <div style= display:none id="provisionaltable">
  347. <table id="FileProvisionalTable" class="table table-striped table-bordered dataTable">
  348. <thead class="thead-dark">
  349. <tr>
  350. <th class="text-center">S.No</th>
  351. <th class="text-center">Employee Code</th>
  352. <th class="text-center">Name</th>
  353. <th class="text-center">Designation</th>
  354. <th class="text-center">Type of Retirement</th>
  355. <th class="text-center">Date of Retirement</th>
  356. <th class="text-center">File Status</th>
  357. <th class="text-center">File category</th>
  358. <th class="text-center">File Moved Date</th>
  359. <th class="text-center">Comments/Remarks</th>
  360. </tr>
  361. </thead>
  362. <tbody id="fileProvisionalTableBody" style="text-align:center;">
  363. <!-- Data will be inserted dynamically -->
  364. </tbody>
  365. </table>
  366. </div>
  367. </div>
  368. </div>
  369. </div>
  370. </div>
  371. </div>
  372. </div>
  373. <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;">
  374. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  375. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  376. <span class="sr-only">Loading...</span>
  377. </div>
  378. <!-- Add the 'Please wait' text below the spinner -->
  379. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  380. </div>
  381. </div>
  382. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  383. </div>
  384. </div>
  385. <!-- Modal Box -->
  386. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  387. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  388. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  389. <!-- Bootstrap 5 JS -->
  390. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  391. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  392. <script>
  393. $(document).ready(function () {
  394. function loadFileCategories() {
  395. $.ajax({
  396. url: "/gcc/api/report/getFileCategories", // Ensure this is the correct endpoint
  397. type: "GET",
  398. dataType: "json",
  399. success: function (response) {
  400. console.log("File Categories Loaded:", response); // Debugging
  401. if (response.length === 0) {
  402. console.warn("No categories found!");
  403. return;
  404. }
  405. let $categoryDropdown = $("#typeofcategory");
  406. // $categoryDropdown.empty().append('<option value="">-- Select Category --</option>');
  407. response.forEach(category => {
  408. $categoryDropdown.append(`<option value="${category.id}">${category.file_name}</option>`);
  409. });
  410. },
  411. error: function (xhr, status, error) {
  412. console.error("Error fetching categories:", xhr.responseText);
  413. Swal.fire({
  414. icon: "error",
  415. title: "Error Fetching Data",
  416. text: "Failed to load categories. Please try again later.",
  417. });
  418. }
  419. });
  420. }
  421. // Call function to load categories when the page is ready
  422. loadFileCategories();
  423. $('#resetButton').on('click', function () {
  424. window.location.href = "/gcc/department/reports";
  425. });
  426. });
  427. $(document).ready(function () {
  428. // Initialize DataTables
  429. // count datatable
  430. let fileCategoryTable = $("#FileCategoryTable").DataTable({
  431. dom: 'Bftip',
  432. columnDefs: [{ targets: 'no-sort', orderable: false }],
  433. lengthMenu: [
  434. [50, 100, 200, 500, -1],
  435. ['50 rows', '100 rows', '200 rows', 'Show all']
  436. ],
  437. scrollY: '50vh',
  438. fixedColumns: { left: 1, right: 1 },
  439. buttons: [
  440. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  441. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  442. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  443. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  444. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  445. ],
  446. fixedHeader: false,
  447. autoWidth: true,
  448. responsive: true,
  449. searching: true,
  450. select: false,
  451. processing: false,
  452. data: [], // Start with an empty table
  453. columns: [
  454. { title: "S.No", data: "index", className: "text-center" },
  455. { title: "File Category", data: "file_name", className: "text-center" },
  456. { title: "Department Pending", data: "department_pending", className: "text-center" },
  457. { title: "Audit Pending", data: "audit_pending", className: "text-center" },
  458. { title: "Pension Pending", data: "pension_pending", className: "text-center" },
  459. { title: "Completed", data: "completed", className: "text-center" },
  460. { title: "Total Count", data: "total_count", className: "text-center" }
  461. ]
  462. });
  463. //cps datatable
  464. let fileDetailsTable = $("#FileDetailsTable").DataTable({
  465. dom: 'Bftip',
  466. columnDefs: [{ targets: 'no-sort', orderable: false }],
  467. lengthMenu: [
  468. [50, 100, 200, 500, -1],
  469. ['50 rows', '100 rows', '200 rows', 'Show all']
  470. ],
  471. scrollY: '50vh',
  472. fixedColumns: { left: 1, right: 1 },
  473. buttons: [
  474. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  475. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  476. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  477. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  478. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  479. ],
  480. fixedHeader: false,
  481. autoWidth: true,
  482. responsive: true,
  483. searching: true,
  484. select: false,
  485. processing: false,
  486. data: [],
  487. columns: [
  488. { title: "S.No", data: "index", className: "text-center" },
  489. { title: "Employee Code", data: "emp_no", className: "text-center" },
  490. { title: "Name", data: "emp_name", className: "text-center" },
  491. { title: "Designation", data: "designation", className: "text-center" },
  492. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  493. {
  494. title: "Date of Retirement",
  495. data: "retirement_date",
  496. className: "text-center",
  497. render: function(data, type, row) {
  498. if (data) {
  499. let date = new Date(data);
  500. let day = String(date.getDate()).padStart(2, '0');
  501. let month = String(date.getMonth() + 1).padStart(2, '0');
  502. let year = date.getFullYear();
  503. return `${day}-${month}-${year}`;
  504. }
  505. return "";
  506. }
  507. },
  508. { title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
  509. { title: "File Status", data: "fst", className: "text-center" },
  510. { title: "File Category", data: "file_category_name", className: "text-center" },
  511. {
  512. title: "File Moved Date",
  513. data: "created_date",
  514. className: "text-center",
  515. render: function(data, type, row) {
  516. if (data) {
  517. let date = new Date(data);
  518. let day = String(date.getDate()).padStart(2, '0');
  519. let month = String(date.getMonth() + 1).padStart(2, '0');
  520. let year = date.getFullYear();
  521. return `${day}-${month}-${year}`;
  522. }
  523. return "";
  524. }
  525. },
  526. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  527. ]
  528. });
  529. // retirement datatable
  530. /* let fileRetireTable = $("#FileRetirementTable").DataTable({
  531. dom: 'Bftip',
  532. columnDefs: [{ targets: 'no-sort', orderable: false }],
  533. lengthMenu: [
  534. [50, 100, 200, 500, -1],
  535. ['50 rows', '100 rows', '200 rows', 'Show all']
  536. ],
  537. scrollY: '50vh',
  538. fixedColumns: { left: 1, right: 1 },
  539. buttons: [
  540. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  541. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  542. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  543. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  544. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  545. ],
  546. fixedHeader: false,
  547. autoWidth: true,
  548. responsive: true,
  549. searching: true,
  550. select: false,
  551. processing: false,
  552. data: [],
  553. columns: [
  554. { title: "S.No", data: "index", className: "text-center" },
  555. { title: "Employee Code", data: "emp_no", className: "text-center" },
  556. { title: "Name", data: "emp_name", className: "text-center" },
  557. { title: "Designation", data: "designation", className: "text-center" },
  558. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  559. { title: "Date of Retirement", data: "retirement_date", className: "text-center" },
  560. { title: "File Status", data: "fst", className: "text-center" },
  561. { title: "File Category", data: "file_category_name", className: "text-center" },
  562. { title: "File Moved Date", data: "file_moved_date", className: "text-center" },
  563. {
  564. title: "File Moved Date",
  565. data: "file_moved_date",
  566. className: "text-center",
  567. render: function(data, type, row) {
  568. if (data) {
  569. let date = new Date(data);
  570. let day = String(date.getDate()).padStart(2, '0');
  571. let month = String(date.getMonth() + 1).padStart(2, '0');
  572. let year = date.getFullYear();
  573. return `${day}-${month}-${year}`;
  574. }
  575. return "";
  576. }
  577. },
  578. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  579. ]
  580. }); */
  581. let fileRetireTable = $("#FileRetirementTable").DataTable({
  582. dom: 'Bftip',
  583. columnDefs: [{ targets: 'no-sort', orderable: false }],
  584. lengthMenu: [
  585. [50, 100, 200, 500, -1],
  586. ['50 rows', '100 rows', '200 rows', 'Show all']
  587. ],
  588. scrollY: '50vh',
  589. fixedColumns: { left: 1, right: 1 },
  590. buttons: [
  591. { extend: 'pageLength', className: 'btn btn-warning ' },
  592. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' },
  593. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
  594. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
  595. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
  596. ],
  597. fixedHeader: false,
  598. autoWidth: true,
  599. responsive: true,
  600. searching: true,
  601. select: false,
  602. processing: false,
  603. data: [],
  604. columns: [
  605. { title: "S.No", data: "index", className: "text-center" },
  606. { title: "Employee Code", data: "emp_no", className: "text-center" },
  607. { title: "Name", data: "emp_name", className: "text-center" },
  608. { title: "Designation", data: "designation", className: "text-center" },
  609. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  610. {
  611. title: "Date of Retirement",
  612. data: "retirement_date",
  613. className: "text-center",
  614. render: function(data, type, row) {
  615. if (data) {
  616. let date = new Date(data);
  617. let day = String(date.getDate()).padStart(2, '0');
  618. let month = String(date.getMonth() + 1).padStart(2, '0');
  619. let year = date.getFullYear();
  620. return `${day}-${month}-${year}`;
  621. }
  622. return "";
  623. }
  624. },
  625. { title: "File Status", data: "fst", className: "text-center" },
  626. { title: "File Category", data: "file_category_name", className: "text-center" },
  627. {
  628. title: "File Moved Date",
  629. data: "file_moved_date",
  630. className: "text-center",
  631. render: function(data, type, row) {
  632. if (data) {
  633. let date = new Date(data);
  634. let day = String(date.getDate()).padStart(2, '0');
  635. let month = String(date.getMonth() + 1).padStart(2, '0');
  636. let year = date.getFullYear();
  637. return `${day}-${month}-${year}`;
  638. }
  639. return "";
  640. }
  641. },
  642. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  643. ]
  644. });
  645. // family pension datatable
  646. let fileFamilyPensionTable = $("#FileFamilyPensionTable").DataTable({
  647. dom: 'Bftip',
  648. columnDefs: [{ targets: 'no-sort', orderable: false }],
  649. lengthMenu: [
  650. [50, 100, 200, 500, -1],
  651. ['50 rows', '100 rows', '200 rows', 'Show all']
  652. ],
  653. scrollY: '50vh',
  654. fixedColumns: { left: 1, right: 1 },
  655. buttons: [
  656. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  657. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  658. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  659. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  660. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  661. ],
  662. fixedHeader: false,
  663. autoWidth: true,
  664. responsive: true,
  665. searching: true,
  666. select: false,
  667. processing: false,
  668. data: [],
  669. columns: [
  670. { title: "S.No", data: "index", className: "text-center" },
  671. { title: "Employee Code", data: "emp_no", className: "text-center" },
  672. { title: "Name", data: "emp_name", className: "text-center" },
  673. { title: "Designation", data: "designation", className: "text-center" },
  674. {
  675. title: "Service Death Date",
  676. data: "service_death",
  677. className: "text-center",
  678. render: function(data, type, row) {
  679. if (data) {
  680. let date = new Date(data);
  681. let day = String(date.getDate()).padStart(2, '0');
  682. let month = String(date.getMonth() + 1).padStart(2, '0');
  683. let year = date.getFullYear();
  684. return `${day}-${month}-${year}`;
  685. }
  686. return "";
  687. }
  688. },
  689. { title: "Relationship Type", data: "relationship_deceased", className: "text-center" },
  690. { title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
  691. { title: "File Status", data: "fst", className: "text-center" },
  692. { title: "File Category", data: "file_category_name", className: "text-center" },
  693. {
  694. title: "File Moved Date",
  695. data: "file_moved_date",
  696. className: "text-center",
  697. render: function(data, type, row) {
  698. if (data) {
  699. let date = new Date(data);
  700. let day = String(date.getDate()).padStart(2, '0');
  701. let month = String(date.getMonth() + 1).padStart(2, '0');
  702. let year = date.getFullYear();
  703. return `${day}-${month}-${year}`;
  704. }
  705. return "";
  706. }
  707. },
  708. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  709. ]
  710. });
  711. // pendency datatable
  712. let filePendencyTable = $("#FilePendencyTable").DataTable({
  713. dom: 'Bftip',
  714. columnDefs: [{ targets: 'no-sort', orderable: false }],
  715. lengthMenu: [
  716. [50, 100, 200, 500, -1],
  717. ['50 rows', '100 rows', '200 rows', 'Show all']
  718. ],
  719. scrollY: '50vh',
  720. fixedColumns: { left: 1, right: 1 },
  721. buttons: [
  722. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  723. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  724. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  725. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  726. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  727. ],
  728. fixedHeader: false,
  729. autoWidth: true,
  730. responsive: true,
  731. searching: true,
  732. select: false,
  733. processing: false,
  734. data: [],
  735. columns: [
  736. { title: "S.No", data: "index", className: "text-center" },
  737. { title: "Employee Code", data: "emp_no", className: "text-center" },
  738. { title: "Name", data: "emp_name", className: "text-center" },
  739. { title: "Designation", data: "designation", className: "text-center" },
  740. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  741. {
  742. title: "Date of Retirement",
  743. data: "retirement_date",
  744. className: "text-center",
  745. render: function(data, type, row) {
  746. if (data) {
  747. let date = new Date(data);
  748. let day = String(date.getDate()).padStart(2, '0');
  749. let month = String(date.getMonth() + 1).padStart(2, '0');
  750. let year = date.getFullYear();
  751. return `${day}-${month}-${year}`;
  752. }
  753. return "";
  754. }
  755. },
  756. { title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
  757. { title: "File Status", data: "fst", className: "text-center" },
  758. { title: "File Category", data: "file_category_name", className: "text-center" },
  759. {
  760. title: "File Moved Date",
  761. data: "file_moved_date",
  762. className: "text-center",
  763. render: function(data, type, row) {
  764. if (data) {
  765. let date = new Date(data);
  766. let day = String(date.getDate()).padStart(2, '0');
  767. let month = String(date.getMonth() + 1).padStart(2, '0');
  768. let year = date.getFullYear();
  769. return `${day}-${month}-${year}`;
  770. }
  771. return "";
  772. }
  773. },
  774. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  775. ]
  776. });
  777. // Gis datatable
  778. let fileGisTable = $("#FileGisTable").DataTable({
  779. dom: 'Bftip',
  780. columnDefs: [{ targets: 'no-sort', orderable: false }],
  781. lengthMenu: [
  782. [50, 100, 200, 500, -1],
  783. ['50 rows', '100 rows', '200 rows', 'Show all']
  784. ],
  785. scrollY: '50vh',
  786. fixedColumns: { left: 1, right: 1 },
  787. buttons: [
  788. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  789. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  790. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  791. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  792. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  793. ],
  794. fixedHeader: false,
  795. autoWidth: true,
  796. responsive: true,
  797. searching: true,
  798. select: false,
  799. processing: false,
  800. data: [],
  801. columns: [
  802. { title: "S.No", data: "index", className: "text-center" },
  803. { title: "Employee Code", data: "emp_no", className: "text-center" },
  804. { title: "Name", data: "emp_name", className: "text-center" },
  805. { title: "Designation", data: "designation", className: "text-center" },
  806. {
  807. title: "Service Death Date",
  808. data: "service_death",
  809. className: "text-center",
  810. render: function(data, type, row) {
  811. if (data) {
  812. let date = new Date(data);
  813. let day = String(date.getDate()).padStart(2, '0');
  814. let month = String(date.getMonth() + 1).padStart(2, '0');
  815. let year = date.getFullYear();
  816. return `${day}-${month}-${year}`;
  817. }
  818. return "";
  819. }
  820. },
  821. { title: "Sanctioned Amount", data: "sanctional_gis_amount", className: "text-center" },
  822. { title: "File Status", data: "fst", className: "text-center" },
  823. { title: "File Category", data: "file_category_name", className: "text-center" },
  824. {
  825. title: "File Moved Date",
  826. data: "file_moved_date",
  827. className: "text-center",
  828. render: function(data, type, row) {
  829. if (data) {
  830. let date = new Date(data);
  831. let day = String(date.getDate()).padStart(2, '0');
  832. let month = String(date.getMonth() + 1).padStart(2, '0');
  833. let year = date.getFullYear();
  834. return `${day}-${month}-${year}`;
  835. }
  836. return "";
  837. }
  838. },
  839. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  840. ]
  841. });
  842. // provisional datatable
  843. let fileProvisionalTable = $("#FileProvisionalTable").DataTable({
  844. dom: 'Bftip',
  845. columnDefs: [{ targets: 'no-sort', orderable: false }],
  846. lengthMenu: [
  847. [50, 100, 200, 500, -1],
  848. ['50 rows', '100 rows', '200 rows', 'Show all']
  849. ],
  850. scrollY: '50vh',
  851. fixedColumns: { left: 1, right: 1 },
  852. buttons: [
  853. { extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
  854. { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
  855. { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
  856. { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
  857. { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } // GIS-style
  858. ],
  859. fixedHeader: false,
  860. autoWidth: true,
  861. responsive: true,
  862. searching: true,
  863. select: false,
  864. processing: false,
  865. data: [],
  866. columns: [
  867. { title: "S.No", data: "index", className: "text-center" },
  868. { title: "Employee Code", data: "emp_no", className: "text-center" },
  869. { title: "Name", data: "emp_name", className: "text-center" },
  870. { title: "Designation", data: "designation", className: "text-center" },
  871. { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
  872. {
  873. title: "Date of Retirement",
  874. data: "retirement_date",
  875. className: "text-center",
  876. render: function(data, type, row) {
  877. if (data) {
  878. let date = new Date(data);
  879. let day = String(date.getDate()).padStart(2, '0');
  880. let month = String(date.getMonth() + 1).padStart(2, '0');
  881. let year = date.getFullYear();
  882. return `${day}-${month}-${year}`;
  883. }
  884. return "";
  885. }
  886. },
  887. { title: "File Category", data: "file_category_name", className: "text-center" },
  888. { title: "File Status", data: "fst", className: "text-center" },
  889. {
  890. title: "File Moved Date",
  891. data: "file_moved_date",
  892. className: "text-center",
  893. render: function(data, type, row) {
  894. if (data) {
  895. let date = new Date(data);
  896. let day = String(date.getDate()).padStart(2, '0');
  897. let month = String(date.getMonth() + 1).padStart(2, '0');
  898. let year = date.getFullYear();
  899. return `${day}-${month}-${year}`;
  900. }
  901. return "";
  902. }
  903. },
  904. { title: "Comments/Remarks", data: "remarks", className: "text-center" },
  905. ]
  906. });
  907. // Listen for changes in the Type of Report dropdown
  908. $("#typeofreport").change(function () {
  909. let selectedValue = $(this).val();
  910. if (selectedValue === "Detailed") {
  911. $("#categoryDiv").show();
  912. } else {
  913. $("#categoryDiv").hide();
  914. $("#typeofcategory").val(""); // Reset category value
  915. $("#statusDiv").hide();
  916. $("#statusDropdown").val("");
  917. }
  918. });
  919. $("#typeofcategory").change(function () {
  920. let selectedCatValue = $(this).val();
  921. let statusDropdown = $("#statusDropdown");
  922. if(selectedCatValue==""){
  923. $("#statusDiv").hide();
  924. $("#statusDropdown").val("");
  925. }
  926. else{
  927. $("#statusDiv").show();
  928. }
  929. // Backup of all options (only once)
  930. if (!statusDropdown.data("original-options")) {
  931. statusDropdown.data("original-options", statusDropdown.html());
  932. }
  933. if (selectedCatValue === "1") {
  934. // Restore all options
  935. statusDropdown.html(statusDropdown.data("original-options"));
  936. } else {
  937. // Remove the last two options ("File Completed" and "File Closed")
  938. statusDropdown.html(statusDropdown.data("original-options"));
  939. statusDropdown.find("option[value='[12]']").remove();
  940. }
  941. });
  942. /* $('#statusDropdown').on('change', function () {
  943. let selectedValue = $(this).val();
  944. let statusArray = selectedValue ? JSON.parse(selectedValue) : []; // Convert string to array
  945. console.log(statusArray); // Output: [1,3] or [2,5,6,9] etc.
  946. }); */
  947. // Handle Search Button click
  948. $("#searchButton").click(function () {
  949. let startDate = $("#startdate").val();
  950. let endDate = $("#enddate").val();
  951. let deptId = $('#deptId').text().trim();
  952. let typeOfReport = $("#typeofreport").val();
  953. let typeOfCategory = $("#typeofcategory").val();
  954. let selectedStatus = $("#statusDropdown").val();
  955. let statusArray = selectedStatus ? JSON.parse(selectedStatus) : [];
  956. console.log("statusArray", statusArray);
  957. if (!startDate || !endDate) {
  958. Swal.fire({
  959. icon: "warning",
  960. title: "Validation Error",
  961. text: "Please select Both Date before searching.",
  962. confirmButtonText: "OK"
  963. });
  964. return;
  965. }
  966. // Validation
  967. if (!typeOfReport) {
  968. Swal.fire({
  969. icon: "warning",
  970. title: "Validation Error",
  971. text: "Please select a Type of Report before searching.",
  972. confirmButtonText: "OK"
  973. });
  974. return; // Stop execution if validation fails
  975. }
  976. // Handle Detailed Report or Summary Report based on selection
  977. if (typeOfReport === "Detailed" && !typeOfCategory) {
  978. Swal.fire({
  979. icon: "warning",
  980. title: "Validation Error",
  981. text: "Please select a Category for Detailed report.",
  982. confirmButtonText: "OK"
  983. });
  984. return;
  985. }
  986. // Perform AJAX for FileCategory (Summary) or FileDetails (Detailed)
  987. let url, data;
  988. if (typeOfReport === "Detailed") {
  989. url = "/gcc/api/report/getReportDetails";
  990. data = { startDate: startDate, endDate: endDate, deptId: deptId, fileCatId: typeOfCategory , fileStatus:statusArray};
  991. } else {
  992. url = "/gcc/api/report/getReportData";
  993. data = { startDate: startDate, endDate: endDate, deptId: deptId };
  994. }
  995. $('#pageLoader').show();
  996. // Make AJAX request based on selected report type
  997. $.ajax({
  998. url: url,
  999. type: "GET",
  1000. data: data,
  1001. traditional: true,
  1002. dataType: "json",
  1003. success: function (response) {
  1004. $('#pageLoader').hide();
  1005. if (response.length === 0) {
  1006. $('#FileCategoryTable').DataTable().clear().draw();
  1007. $('#FileDetailsTable').DataTable().clear().draw();
  1008. $('#FileRetirementTable').DataTable().clear().draw();
  1009. $('#FileFamilyPensionTable').DataTable().clear().draw();
  1010. $('#FilePendencyTable').DataTable().clear().draw();
  1011. $('#FileGisTable').DataTable().clear().draw();
  1012. $('#FileProvisionalTable').DataTable().clear().draw();
  1013. Swal.fire({
  1014. icon: "info",
  1015. title: "No Data Found",
  1016. text: "No records match your selection.",
  1017. confirmButtonText: "OK"
  1018. });
  1019. } else {
  1020. $('#pageLoader').hide();
  1021. // Format and add data to the correct table based on the report type
  1022. if (typeOfReport === "Detailed" && typeOfCategory=='6' ) {
  1023. $("#cpstable").css("display", "block").css("height", "auto");
  1024. $("#audittable").css("display", "none").css("height", "auto");
  1025. $("#retiretable").css("display", "none").css("height", "auto");
  1026. $("#familypensiontable").css("display", "none").css("height", "auto");
  1027. $("#pendencytable").css("display", "none").css("height", "auto");
  1028. $("#gistable").css("display", "none").css("height", "auto");
  1029. $("#provisionaltable").css("display", "none").css("height", "auto");
  1030. let formattedData = response.map((row, index) => ({
  1031. index: index + 1,
  1032. emp_no: row.emp_no,
  1033. emp_name: row.emp_name,
  1034. designation: row.designation,
  1035. type_of_retirement: row.type_of_retirement,
  1036. retirement_date: row.retirement_date,
  1037. reason_for_pending: row.reason_for_pending,
  1038. fst: row.fst,
  1039. file_category_name:row.file_category_name,
  1040. remarks: row.remarks,
  1041. created_date: row.created_date,
  1042. }));
  1043. fileDetailsTable.clear().rows.add(formattedData).draw();
  1044. console.log("retirement data",formattedData);
  1045. }
  1046. if (typeOfReport === "Detailed" && typeOfCategory=='1' ) {
  1047. $("#cpstable").css("display", "none").css("height", "auto");
  1048. $("#audittable").css("display", "none").css("height", "auto");
  1049. $("#retiretable").css("display", "block").css("height", "auto");
  1050. $("#familypensiontable").css("display", "none").css("height", "auto");
  1051. $("#pendencytable").css("display", "none").css("height", "auto");
  1052. $("#gistable").css("display", "none").css("height", "auto");
  1053. $("#provisionaltable").css("display", "none").css("height", "auto");
  1054. let formattedData = response.map((row, index) => ({
  1055. index: index + 1,
  1056. emp_no: row.emp_no,
  1057. emp_name: row.emp_name,
  1058. designation: row.designation,
  1059. type_of_retirement: row.type_of_retirement,
  1060. retirement_date: row.retirement_date,
  1061. fst: row.fst,
  1062. file_category_name:row.file_category_name,
  1063. remarks: row.remarks,
  1064. file_moved_date: row.file_moved_date,
  1065. }));
  1066. fileRetireTable.clear().rows.add(formattedData).draw();
  1067. }
  1068. if (typeOfReport === "Detailed" && typeOfCategory=='2' ) {
  1069. $("#cpstable").css("display", "none").css("height", "auto");
  1070. $("#audittable").css("display", "none").css("height", "auto");
  1071. $("#retiretable").css("display", "none").css("height", "auto");
  1072. $("#familypensiontable").css("display", "block").css("height", "auto");
  1073. $("#pendencytable").css("display", "none").css("height", "auto");
  1074. $("#gistable").css("display", "none").css("height", "auto");
  1075. $("#provisionaltable").css("display", "none").css("height", "auto");
  1076. let formattedData = response.map((row, index) => ({
  1077. index: index + 1,
  1078. emp_no: row.emp_no,
  1079. emp_name: row.emp_name,
  1080. designation: row.designation,
  1081. service_death:row.service_death,
  1082. relationship_deceased: row.relationship_deceased,
  1083. reason_for_pending: row.reason_for_pending,
  1084. fst: row.fst,
  1085. file_category_name:row.file_category_name,
  1086. remarks: row.remarks,
  1087. file_moved_date: row.file_moved_date,
  1088. }));
  1089. fileFamilyPensionTable.clear().rows.add(formattedData).draw();
  1090. }
  1091. if (typeOfReport === "Detailed" && typeOfCategory=='3' ) {
  1092. $("#cpstable").css("display", "none").css("height", "auto");
  1093. $("#audittable").css("display", "none").css("height", "auto");
  1094. $("#retiretable").css("display", "none").css("height", "auto");
  1095. $("#familypensiontable").css("display", "none").css("height", "auto");
  1096. $("#pendencytable").css("display", "block").css("height", "auto");
  1097. $("#gistable").css("display", "none").css("height", "auto");
  1098. $("#provisionaltable").css("display", "none").css("height", "auto");
  1099. let formattedData = response.map((row, index) => ({
  1100. index: index + 1,
  1101. emp_no: row.emp_no,
  1102. emp_name: row.emp_name,
  1103. designation: row.designation,
  1104. type_of_retirement: row.type_of_retirement,
  1105. retirement_date: row.retirement_date,
  1106. reason_for_pending:row.reason_for_pending,
  1107. fst: row.fst,
  1108. file_category_name:row.file_category_name,
  1109. remarks: row.remarks,
  1110. file_moved_date: row.file_moved_date,
  1111. }));
  1112. filePendencyTable.clear().rows.add(formattedData).draw();
  1113. }
  1114. if (typeOfReport === "Detailed" && typeOfCategory=='4' ) {
  1115. $("#cpstable").css("display", "none").css("height", "auto");
  1116. $("#audittable").css("display", "none").css("height", "auto");
  1117. $("#retiretable").css("display", "none").css("height", "auto");
  1118. $("#familypensiontable").css("display", "none").css("height", "auto");
  1119. $("#pendencytable").css("display", "none").css("height", "auto");
  1120. $("#gistable").css("display", "block").css("height", "auto");
  1121. $("#provisionaltable").css("display", "none").css("height", "auto");
  1122. let formattedData = response.map((row, index) => ({
  1123. index: index + 1,
  1124. emp_no: row.emp_no,
  1125. emp_name: row.emp_name,
  1126. designation: row.designation,
  1127. service_death: row.service_death,
  1128. sanctional_gis_amount: row.sanctional_gis_amount,
  1129. fst: row.fst,
  1130. file_category_name:row.file_category_name,
  1131. remarks: row.remarks,
  1132. file_moved_date: row.file_moved_date,
  1133. }));
  1134. fileGisTable.clear().rows.add(formattedData).draw();
  1135. }
  1136. if (typeOfReport === "Detailed" && typeOfCategory=='5' ) {
  1137. $("#cpstable").css("display", "none").css("height", "auto");
  1138. $("#audittable").css("display", "none").css("height", "auto");
  1139. $("#retiretable").css("display", "none").css("height", "auto");
  1140. $("#familypensiontable").css("display", "none").css("height", "auto");
  1141. $("#pendencytable").css("display", "none").css("height", "auto");
  1142. $("#gistable").css("display", "none").css("height", "auto");
  1143. $("#provisionaltable").css("display", "block").css("height", "auto");
  1144. let formattedData = response.map((row, index) => ({
  1145. index: index + 1,
  1146. emp_no: row.emp_no,
  1147. emp_name: row.emp_name,
  1148. designation: row.designation,
  1149. type_of_retirement: row.type_of_retirement,
  1150. retirement_date: row.retirement_date,
  1151. fst: row.fst,
  1152. file_category_name:row.file_category_name,
  1153. remarks: row.remarks,
  1154. file_moved_date: row.file_moved_date,
  1155. }));
  1156. fileProvisionalTable.clear().rows.add(formattedData).draw();
  1157. }
  1158. if(typeOfReport === "Abstract"){
  1159. $("#cpstable").css("display", "none").css("height", "auto");
  1160. $("#audittable").css("display", "block").css("height", "auto");
  1161. $("#retiretable").css("display", "none").css("height", "auto");
  1162. $("#familypensiontable").css("display", "none").css("height", "auto");
  1163. $("#pendencytable").css("display", "none").css("height", "auto");
  1164. $("#gistable").css("display", "none").css("height", "auto");
  1165. $("#provisionaltable").css("display", "none").css("height", "auto");
  1166. let formattedData = response.map((row, index) => ({
  1167. index: index + 1,
  1168. file_name: row.file_name,
  1169. department_pending: row.department_pending,
  1170. audit_pending: row.audit_pending,
  1171. pension_pending: row.pension_pending,
  1172. completed: row.completed,
  1173. total_count: row.total_files
  1174. }));
  1175. fileCategoryTable.clear().rows.add(formattedData).draw();
  1176. }
  1177. }
  1178. },
  1179. error: function (xhr, status, error) {
  1180. $('#pageLoader').hide();
  1181. Swal.fire({
  1182. icon: "error",
  1183. title: "Error",
  1184. text: "Failed to load data. Please try again.",
  1185. confirmButtonText: "OK"
  1186. });
  1187. }
  1188. });
  1189. });
  1190. });
  1191. $('#startdate').on('change', function () {
  1192. const fromDate = $(this).val();
  1193. $('#enddate').attr('min', fromDate); // Update min attribute for To Date
  1194. // If To Date is earlier than the new From Date, adjust it
  1195. const toDate = $('#enddate').val();
  1196. if (new Date(toDate) < new Date(fromDate)) {
  1197. $('#enddate').val(fromDate);
  1198. }
  1199. });
  1200. // Update From Date's max attribute when To Date changes
  1201. $('#enddate').on('change', function () {
  1202. const toDate = $(this).val();
  1203. $('#startdate').attr('max', toDate); // Update max attribute for From Date
  1204. // If From Date is later than the new To Date, adjust it
  1205. const fromDate = $('#startdate').val();
  1206. if (new Date(fromDate) > new Date(toDate)) {
  1207. $('#startdate').val(toDate);
  1208. }
  1209. });
  1210. //disable future dates
  1211. document.addEventListener("DOMContentLoaded", function () {
  1212. let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format
  1213. let startdateInput = document.getElementById("startdate");
  1214. let enddateInput = document.getElementById("enddate");
  1215. // Set max attribute to disable future dates
  1216. startdateInput.setAttribute("max", today);
  1217. enddateInput.setAttribute("max", today);
  1218. // Prevent manual future date entry
  1219. startdateInput.addEventListener("change", function () {
  1220. if (this.value > today) {
  1221. Swal.fire({
  1222. icon: 'warning',
  1223. title: 'Invalid Date',
  1224. text: 'Future dates are not allowed.',
  1225. confirmButtonText: 'OK'
  1226. });
  1227. this.value = ""; // Clear the invalid input
  1228. }
  1229. });
  1230. });
  1231. </script>
  1232. </body>
  1233. </html>