This portal only for GCC Officers. Based on there roles and Group ID they can view there module`s Like PGR, QR Public Asset Feedback, Makkalai Thedi Mayor,etc...
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.

646 lines
28 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. <body>
  6. <!--[if lt IE 8]>
  7. <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>
  8. <![endif]-->
  9. <div class="wrapper">
  10. <!-- header top menu Start -->
  11. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  12. <!-- header top menu end -->
  13. <div class="page-wrap">
  14. <!--=============== Left Menu side Start ================-->
  15. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  16. <!--=============== Left side End ================-->
  17. <div class="main-content">
  18. <div class="container-fluid">
  19. <div class="page-header">
  20. <div class="row align-items-end">
  21. <div class="col-lg-6">
  22. <div class="page-header-title">
  23. <i class="ik ik-map-pin bg-blue"></i>
  24. <div class="d-inline">
  25. <h5>Zone Wise Without Reopen Report</h5>
  26. <span>Public Grievance Redressal Reports</span>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="col-lg-6">
  31. <nav class="breadcrumb-container" aria-label="breadcrumb">
  32. <ol class="breadcrumb">
  33. <li class="breadcrumb-item">
  34. <a href="/index"><i class="ik ik-home"></i></a>
  35. </li>
  36. <li class="breadcrumb-item" aria-current="page">Zone Wise Report</li>
  37. <li class="breadcrumb-item active" aria-current="page">Without Reopen</li>
  38. </ol>
  39. </nav>
  40. </div>
  41. </div>
  42. </div>
  43. <hr>
  44. <div class="row">
  45. <div class="col-md-12">
  46. <div class="card">
  47. <div class="card-block">
  48. <div th:replace="~{fragments/modules/pgr/search_form :: div}"></div>
  49. <div id="tableLoading"></div>
  50. <div id="tableBody"></div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  58. </div>
  59. </div>
  60. <div th:replace="~{fragments/modules/pgr/modal-box :: div}"></div>
  61. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  62. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  63. <script th:replace="~{fragments/modules/pgr/script :: script}"></script>
  64. <script th:inline="javascript">
  65. var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
  66. // Loading Div id
  67. const loading = $("#tableLoading");
  68. // DataTables buttons configuration
  69. var buttons = [
  70. {
  71. extend: 'pageLength',
  72. className: 'btn btn-warning'
  73. },
  74. {
  75. title: 'Data export',
  76. extend: 'copyHtml5',
  77. text: 'Copy',
  78. className: 'btn btn-secondary',
  79. id: 'copyBtn'
  80. },
  81. {
  82. extend: 'excelHtml5',
  83. text: 'Excel',
  84. className: 'btn btn-secondary',
  85. id: 'excelBtn',
  86. title: 'Petition List'
  87. },
  88. {
  89. extend: 'csvHtml5',
  90. text: 'CSV',
  91. className: 'btn btn-secondary',
  92. id: 'csvBtn',
  93. title: 'Petition List'
  94. },
  95. {
  96. extend: 'pdfHtml5',
  97. text: 'PDF',
  98. className: 'btn btn-secondary',
  99. id: 'pdfBtn',
  100. title: 'Petition List'
  101. },
  102. {
  103. extend: 'print',
  104. text: 'Print',
  105. className: 'btn btn-secondary',
  106. id: 'printBtn',
  107. title: 'Petition List'
  108. }
  109. ];
  110. // Complaint Config Array (See script page)
  111. var complaintIds = complaintTypeId();
  112. ///////////////////////////// End ///////////////////////////
  113. function call_loading(){
  114. loading_text_msg = getLoadingMessage();
  115. $("#filter_reset_btn").prop("disabled", true);
  116. $("#filter_search_btn").prop("disabled", true);
  117. loading.html(searchinfo("<b>"+loading_text_msg+"</b>"));
  118. }
  119. function remove_loading(){
  120. $("#filter_reset_btn").prop("disabled", false);
  121. $("#filter_search_btn").prop("disabled", false);
  122. loading.html("");
  123. }
  124. /* Get Department Data */
  125. function get_department_data(){
  126. get_department_list().then(function(departments) {
  127. // Handle the department list
  128. departmentlist = departments;
  129. // Iterate through the department list and add options to the select element
  130. $.each(departmentlist, function(index, department) {
  131. // Create an option element
  132. var option = $('<option>', {
  133. value: department.ID_DEPT, // case-sensitive as per object
  134. text: department.DEPT_NAME
  135. });
  136. // Append the option to the select element
  137. $('#search_department_id').append(option);
  138. });
  139. }).catch(function(error) {
  140. // Handle errors
  141. console.error('Error fetching department list:', error);
  142. });
  143. }
  144. /* Get Data of Main Page 1 */
  145. function get_table_data(){
  146. var apiUrl = '/gcc/api/pgr/getZoneWiseWithoutReopenComplaintList';
  147. // Return a Promise
  148. return new Promise(function(resolve, reject) {
  149. $.ajax({
  150. url: apiUrl,
  151. type: 'GET',
  152. dataType: 'json',
  153. success: function(jsonResponse) {
  154. // Resolve the Promise with the department list
  155. console.log('Response list:', jsonResponse);
  156. resolve(jsonResponse);
  157. },
  158. error: function(xhr, status, error) {
  159. // Reject the Promise with the error message
  160. reject(error);
  161. }
  162. });
  163. });
  164. }
  165. /* Get Complaints List */
  166. function get_table_list(){
  167. get_table_data().then(function(complaintList) {
  168. $('#tableBody').html(getPageTableBody()); // Call Table Html
  169. // Handle the department list
  170. generate_table(complaintList);
  171. }).catch(function(error) {
  172. // Handle errors
  173. console.error('Error fetching department list:', error);
  174. });
  175. }
  176. /* Call DataTable function */
  177. function generate_table(data){
  178. // Check for mobile
  179. var isMobile = window.innerWidth <= 768; // Adjust the breakpoint as needed
  180. var table = $('#complaintDatatable').DataTable( {
  181. dom: 'Bftip',
  182. columnDefs: [
  183. { targets: 'no-sort', orderable: false }
  184. ],
  185. lengthMenu: [
  186. [ 50, 100, 200, 500, -1 ],
  187. [ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
  188. ],
  189. scrollY: '50vh',
  190. scrollX: '50vh',
  191. fixedColumns: {
  192. left: 0,
  193. right: 0
  194. },
  195. buttons: [buttons],
  196. responsive: isMobile, // Set responsive option based on device width
  197. searching: false,
  198. select: false,
  199. processing: false,
  200. } );
  201. // Clearn Table data
  202. table.clear().draw();
  203. // Add rows to DataTable
  204. var rowNum = 1;
  205. $.each(data, function(index, row) {
  206. table.row.add([
  207. rowNum++,
  208. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", 'all','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['DEPT_NAME']+"</a>",
  209. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["NonBURSTLT"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['NonBURSTLT']+"</a>",
  210. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["REOFGAR"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['REOFGAR']+"</a>",
  211. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["ROAD"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['ROAD']+"</a>",
  212. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["MOSQUITE"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['MOSQUITE']+"</a>",
  213. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["WATER"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['WATER']+"</a>",
  214. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["REOFDEB"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['REOFDEB']+"</a>",
  215. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["TREE"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['TREE']+"</a>",
  216. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["DOGS"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['DOGS']+"</a>",
  217. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["ENCMTN"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['ENCMTN']+"</a>",
  218. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["POT"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['POT']+"</a>",
  219. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["PTAX"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['PTAX']+"</a>",
  220. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", '"+complaintIds["OTHERS"]+"','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['OTHERS']+"</a>",
  221. "<a href=\"#\" onclick=\"return viewZoneWiseOfficerComplaintCountList("+row['DEPTID']+", 'all','"+row["DEPT_NAME"]+"')\" class=\"link\">"+row['TOTAL']+"</a>",
  222. row['DAYS_90_PEN'],
  223. row['DAYS_61_90_PEN'],
  224. row['DAYS_31_60_PEN'],
  225. row['DAYS_16_30_PEN'],
  226. row['DAYS_0_15_PEN']
  227. ]).draw(false);
  228. });
  229. // Now call for Filter
  230. get_department_data();
  231. remove_loading(); // remove Loading
  232. }
  233. $(document).ready(function() {
  234. call_loading();
  235. get_table_list();
  236. });
  237. function getPageTableBody(){
  238. var tableBodyHTML = "";
  239. tableBodyHTML = `<table id="complaintDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="100%">
  240. <thead class="thead-dark">
  241. <tr class="table-bordered">
  242. <th class="text-center no-sort">S.No</th>
  243. <th class="text-center">Zone Name</th>
  244. <th class="text-center">Street Light not burning</th>
  245. <th class="text-center">Removal of Garbage</th>
  246. <th class="text-center">Road Damaged</th>
  247. <th class="text-center">Mosquito Nuisance</th>
  248. <th class="text-center">Water Stagnation</th>
  249. <th class="text-center">Removal of Debries</th>
  250. <th class="text-center">Tree Fallen</th>
  251. <th class="text-center">Dog Menace</th>
  252. <th class="text-center">Encroachment</th>
  253. <th class="text-center">Potshole</th>
  254. <th class="text-center">Property Tax</th>
  255. <th class="text-center">Others</th>
  256. <th class="text-center">Total</th>
  257. <th class="text-center">&gt; 90 Days</th>
  258. <th class="text-center">61 - 90 Days</th>
  259. <th class="text-center">31-60 days</th>
  260. <th class="text-center">16-30 days</th>
  261. <th class="text-center">0-15 days</th>
  262. </tr>
  263. </thead>
  264. <tbody>
  265. </tbody>
  266. <tfoot class="thead-dark">
  267. <tr>
  268. <th class="text-center no-sort">S.No</th>
  269. <th class="text-center">Zone Name</th>
  270. <th class="text-center">Street Light not burning</th>
  271. <th class="text-center">Removal of Garbage</th>
  272. <th class="text-center">Road Damaged</th>
  273. <th class="text-center">Mosquito Nuisance</th>
  274. <th class="text-center">Water Stagnation</th>
  275. <th class="text-center">Removal of Debries</th>
  276. <th class="text-center">Tree Fallen</th>
  277. <th class="text-center">Dog Menace</th>
  278. <th class="text-center">Encroachment</th>
  279. <th class="text-center">Potshole</th>
  280. <th class="text-center">Property Tax</th>
  281. <th class="text-center">Others</th>
  282. <th class="text-center">Total</th>
  283. <th class="text-center">&gt; 90 Days</th>
  284. <th class="text-center">61 - 90 Days</th>
  285. <th class="text-center">31-60 days</th>
  286. <th class="text-center">16-30 days</th>
  287. <th class="text-center">0-15 days</th>
  288. </tr>
  289. </tfoot>
  290. </table>`;
  291. return tableBodyHTML;
  292. }
  293. /////////////////////////////////////// Modal Box -1 ///////////////////////////////////////
  294. var model_box_1 = "#pgrModalBox";
  295. function viewZoneWiseOfficerComplaintCountList(deptid, complainttype, dept_name)
  296. {
  297. get_table_list_modal_box_1(deptid, complainttype);
  298. var dept_name_txt = dept_name.split("-");
  299. if(dept_name_txt.length<=1){
  300. dept_name_txt[0] = "-";
  301. }
  302. dept_name_txt[1] = dept_name_txt[1].charAt(0).toUpperCase() + dept_name_txt[1].slice(1).toLowerCase();
  303. $('#modalTitle').html("Officer`s Pending Report Of "+dept_name_txt[1]+" Zone ("+dept_name_txt[0]+")"); // Box title
  304. loading_text_msg = getLoadingMessage(); // get Loading random text
  305. $('#modalBody').html(searchinfo("<b>"+loading_text_msg+"</b>")); // Box content (Body)
  306. $(model_box_1).modal({
  307. backdrop: 'static',
  308. keyboard: false
  309. }); // Show Modal Box
  310. //$(model_box_1).modal('show'); // Show Modal Box
  311. return false;
  312. }
  313. /* Get Data of Main Page 1 */
  314. function get_modal_box_1_table_data(deptid, complainttype){
  315. var apiUrl = '/gcc/api/pgr/getZoneWiseOfficerWithoutReopenComplaintCountList';
  316. // Return a Promise
  317. return new Promise(function(resolve, reject) {
  318. $.ajax({
  319. url: apiUrl,
  320. type: 'GET',
  321. data: {
  322. 'deptid': deptid,
  323. 'complainttype': complainttype,
  324. },
  325. dataType: 'json',
  326. success: function(jsonResponse) {
  327. // Resolve the Promise with the department list
  328. //console.log('Response list:', jsonResponse);
  329. resolve(jsonResponse);
  330. },
  331. error: function(xhr, status, error) {
  332. // Reject the Promise with the error message
  333. reject(error);
  334. }
  335. });
  336. });
  337. }
  338. /* Get Complaints List */
  339. function get_table_list_modal_box_1(deptid, complainttype){
  340. get_modal_box_1_table_data(deptid, complainttype).then(function(complaintList) {
  341. // Handle the data list
  342. //console.log('Response list:', complaintList);
  343. $('#modalBody').html(get_modal_box_1_table_html()); // Box content (Body)
  344. generate_table_modal_box_1(complaintList,complainttype);
  345. $(model_box_1).modal('show'); // Show Modal Box
  346. }).catch(function(error) {
  347. // Handle errors
  348. console.error('Error fetching department list:', error);
  349. });
  350. }
  351. /* Call DataTable function */
  352. function generate_table_modal_box_1(data,complainttype){
  353. // Check for mobile
  354. var isMobile = window.innerWidth <= 768; // Adjust the breakpoint as needed
  355. var table = $('#modal_1_ComplaintDatatable').DataTable( {
  356. dom: 'Bftip',
  357. columnDefs: [
  358. { targets: 'no-sort', orderable: false }
  359. ],
  360. lengthMenu: [
  361. [ 50, 100, 200, 500, -1 ],
  362. [ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
  363. ],
  364. scrollY: '50vh',
  365. scrollX: '50vh',
  366. fixedColumns: {
  367. left: 0,
  368. right: 0
  369. },
  370. buttons: [buttons],
  371. responsive: isMobile, // Set responsive option based on device width
  372. searching: false,
  373. select: false,
  374. processing: false,
  375. } );
  376. // Clearn Table data
  377. table.clear().draw();
  378. // Add rows to DataTable
  379. var rowNum = 1;
  380. $.each(data, function(index, row) {
  381. table.row.add([
  382. rowNum++,
  383. row['DEPT_NAME'],
  384. row['USER_NAME'],
  385. row['MOBILENO'],
  386. "<a href=\"#\" onclick=\"return viewOfficerBasedPendidngComplaintList("+row['DEPTID']+", '"+complainttype+"','"+row["IDUSER"]+"')\" class=\"link\">"+row['NOS']+"</a>"
  387. ]).draw(false);
  388. });
  389. }
  390. function get_modal_box_1_table_html(){
  391. var modal_box_1_html=`<table id="modal_1_ComplaintDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="100%">
  392. <thead class="thead-dark">
  393. <tr class="table-bordered">
  394. <th class="text-center no-sort">S.No</th>
  395. <th class="text-center">Department</th>
  396. <th class="text-center">Officer ID</th>
  397. <th class="text-center">Mobile Number</th>
  398. <th class="text-center">No\`s</th>
  399. </tr>
  400. </thead>
  401. <tbody>
  402. </tbody>
  403. <tfoot class="thead-dark">
  404. <tr>
  405. <th class="text-center no-sort">S.No</th>
  406. <th class="text-center">Department</th>
  407. <th class="text-center">Officer ID</th>
  408. <th class="text-center">Mobile Number</th>
  409. <th class="text-center">No\`s</th>
  410. </tr>
  411. </tfoot>
  412. </table>`;
  413. return modal_box_1_html
  414. }
  415. /////////////////////////////////////// Modal Box - 2 ///////////////////////////////////////
  416. var model_box_2 = "#pgrModalBox_2";
  417. function viewOfficerBasedPendidngComplaintList(deptid, complainttype, iduser)
  418. {
  419. get_table_list_modal_box_2(deptid, complainttype, iduser);
  420. /*
  421. var dept_name_txt = dept_name.split("-");
  422. if(dept_name_txt.length<=1){
  423. dept_name_txt[0] = "-";
  424. }
  425. dept_name_txt[1] = dept_name_txt[1].charAt(0).toUpperCase() + dept_name_txt[1].slice(1).toLowerCase();
  426. $('#modalTitle_2').html("Officer`s Pending Report Of "+dept_name_txt[1]+" Zone ("+dept_name_txt[0]+")"); // Box title
  427. */
  428. loading_text_msg = getLoadingMessage(); // get Loading random text
  429. $('#modalBody_2').html(searchinfo("<b>"+loading_text_msg+"</b>")); // Box content (Body)
  430. $(model_box_2).modal({
  431. backdrop: 'static',
  432. keyboard: false
  433. }); // Show Modal Box
  434. //$(model_box_2).modal('show'); // Show Modal Box
  435. return false;
  436. }
  437. /* Get Data of Main Page 1 */
  438. function get_modal_box_2_table_data(deptid, complainttype, iduser){
  439. var apiUrl = '/gcc/api/pgr/getZoneWiseOfficerWithoutReopenComplaintList';
  440. // Return a Promise
  441. return new Promise(function(resolve, reject) {
  442. $.ajax({
  443. url: apiUrl,
  444. type: 'GET',
  445. data: {
  446. 'deptid': deptid,
  447. 'complainttype': complainttype,
  448. 'iduser': iduser,
  449. },
  450. dataType: 'json',
  451. success: function(jsonResponse) {
  452. // Resolve the Promise with the department list
  453. //console.log('Response list:', jsonResponse);
  454. resolve(jsonResponse);
  455. },
  456. error: function(xhr, status, error) {
  457. // Reject the Promise with the error message
  458. reject(error);
  459. }
  460. });
  461. });
  462. }
  463. /* Get Complaints List */
  464. function get_table_list_modal_box_2(deptid, complainttype, iduser){
  465. get_modal_box_2_table_data(deptid, complainttype, iduser).then(function(complaintList) {
  466. // Handle the data list
  467. //console.log('Response list:', complaintList);
  468. $('#modalBody_2').html(get_modal_box_2_table_html()); // Box content (Body)
  469. generate_table_modal_box_2(complaintList);
  470. //$(model_box_2).modal('show'); // Show Modal Box
  471. }).catch(function(error) {
  472. // Handle errors
  473. console.error('Error fetching department list:', error);
  474. });
  475. }
  476. /* Call DataTable function */
  477. function generate_table_modal_box_2(data){
  478. // Check for mobile
  479. var isMobile = window.innerWidth <= 768; // Adjust the breakpoint as needed
  480. var table = $('#modal_2_ComplaintDatatable').DataTable( {
  481. dom: 'Bftip',
  482. columnDefs: [
  483. { targets: 'no-sort', orderable: false }
  484. ],
  485. lengthMenu: [
  486. [ 50, 100, 200, 500, -1 ],
  487. [ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
  488. ],
  489. scrollY: '50vh',
  490. scrollX: '50vh',
  491. fixedColumns: {
  492. left: 0,
  493. right: 0
  494. },
  495. buttons: [buttons],
  496. responsive: isMobile, // Set responsive option based on device width
  497. searching: false,
  498. select: false,
  499. processing: false,
  500. } );
  501. // Clearn Table data
  502. table.clear().draw();
  503. // Add rows to DataTable
  504. var rowNum = 1;
  505. $.each(data, function(index, row) {
  506. table.row.add([
  507. rowNum++,
  508. "<a href=\"#\" onclick=\"return viewComplaintDetails('"+row['COMPLAINTNUMBER']+"')\" class=\"link\">"+row['COMPLAINTNUMBER']+"</a>",
  509. row['DEPT_NAME'],
  510. row['COMPLAINTTYPENAME'],
  511. row['COMPDATE'],
  512. row['COMPLAINTDETAILS'],
  513. row['COMPLAINANTFIRSTNAME'],
  514. row['USER_NAME']
  515. ]).draw(false);
  516. });
  517. }
  518. function get_modal_box_2_table_html(){
  519. var modal_box_2_html=`<table id="modal_2_ComplaintDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="100%">
  520. <thead class="thead-dark">
  521. <tr class="table-bordered">
  522. <th class="text-center no-sort">S.No</th>
  523. <th class="text-center">Complaint No.</th>
  524. <th class="text-center">Department</th>
  525. <th class="text-center">Complaint Type</th>
  526. <th class="text-center">Complaint Date</th>
  527. <th class="text-center">Complaint Details</th>
  528. <th class="text-center">Person Name</th>
  529. <th class="text-center">Officer ID</th>
  530. </tr>
  531. </thead>
  532. <tbody>
  533. </tbody>
  534. <tfoot class="thead-dark">
  535. <tr>
  536. <th class="text-center no-sort">S.No</th>
  537. <th class="text-center">Complaint No.</th>
  538. <th class="text-center">Department</th>
  539. <th class="text-center">Complaint Type</th>
  540. <th class="text-center">Complaint Date</th>
  541. <th class="text-center">Complaint Details</th>
  542. <th class="text-center">Person Name</th>
  543. <th class="text-center">Officer ID</th>
  544. </tr>
  545. </tfoot>
  546. </table>`;
  547. return modal_box_2_html
  548. }
  549. /////////////////////////////////////// Modal Box - 3 ///////////////////////////////////////
  550. <!-- See Common Script page -->
  551. </script>
  552. </body>
  553. </html>