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.

648 lines
24 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/modules/base/head :: head}">
  4. </head>
  5. <style>
  6. </style>
  7. <body>
  8. <div class="wrapper">
  9. <!-- header top menu Start -->
  10. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  11. <!-- header top menu end -->
  12. <div class="page-wrap">
  13. <!--=============== Left Menu side Start ================-->
  14. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  15. <!--=============== Left side End ================-->
  16. <div class="main-content">
  17. <div class="container-fluid">
  18. <div class="page-header mb-2">
  19. <div class="row align-items-end">
  20. <div class="col-lg-8">
  21. <div class="page-header-title">
  22. <i class="fa fa-list-alt bg-blue"></i>
  23. <div class="d-inline">
  24. <h5>QAQC Unattended List</h5>
  25. <span>1913 QAQC Unattended List</span>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="col-lg-4">
  30. <nav class="breadcrumb-container" aria-label="breadcrumb">
  31. <ol class="breadcrumb">
  32. <li class="breadcrumb-item"><a href="/gcc/index"><i
  33. class="ik ik-home"></i></a></li>
  34. <li class="breadcrumb-item" aria-current="page">1913 QAQC</li>
  35. <li class="breadcrumb-item active" aria-current="page">Admin QAQC</li>
  36. <li class="breadcrumb-item active" aria-current="page">Unattended</li>
  37. </ol>
  38. </nav>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="row mt-4">
  43. <div class="col-12">
  44. <div class="card">
  45. <div class="card-header">
  46. <span th:text="${userId}" style="display:none;" id="userIdSpan"></span>
  47. <span style="font-size: medium;font-weight: bold;">Closing Unattended Complaints&nbsp;(<span class="text-danger">You can receive and close only 100 complaints at a time</span>):</span>
  48. </div>
  49. <div class="card-body">
  50. <span class="text-danger" style="font-size: medium;font-weight: bold;">Use after 7.00 pm</span><br>
  51. <div class="row">
  52. <!-- <div class="col-sm-2 mb-2">
  53. <label for="startDate" style="font-size: medium;">From Date:</label>
  54. <input type="date" id="startDate" class="form-control">
  55. </div>
  56. <div class="col-sm-2 mb-2">
  57. <label for="endDate" style="font-size: medium;">To Date:</label>
  58. <input type="date" id="endDate" class="form-control">
  59. </div> -->
  60. <div class="col-sm-3 mb-2">
  61. <label for="unattended_count" style="font-size: medium;">Enter Minimum no of unattended counts:</label>
  62. <input type="number" id="unattended_count" class="form-control" >
  63. <!-- <select id="stsdropdown" class="form-control">
  64. <option value="total">Select</option>
  65. <option value="processing">Processing</option>
  66. <option value="reopened">Reopened</option>
  67. <option value="redressed">Action Taken 1</option>
  68. <option value="closed">Action Taken 2</option>
  69. <option value="completed">Final Closure</option>
  70. </select> -->
  71. </div>
  72. <!-- <div class="col-sm-2 mb-2">
  73. <label for="dropdown4" style="font-size: medium;">Group:</label>
  74. <select id="dropdown4" class="form-control">
  75. <option value="">Select</option>
  76. <option value="">general</option>
  77. Add options here
  78. </select>
  79. </div> -->
  80. <!-- <div class="col-sm-2 mb-2">
  81. <label for="dropdown1" style="font-size: medium;">Type:</label>
  82. <select id="dropdown1" class="form-control">
  83. <option value="">Select</option>
  84. <option value="Cleanliness in Parks">Cleanliness in Parks</option>
  85. </select>
  86. </div> -->
  87. <!-- <div class="col-sm-2 mb-2">
  88. <label for="dropdown3" style="font-size: medium;">Mode:</label>
  89. <select id="dropdown3" class="form-control">
  90. <option value="">Select</option>
  91. <option value="">INTERNET</option>
  92. </select>
  93. </div> -->
  94. </div>
  95. <!-- <div class="row mt-2">
  96. <div class="col-sm-2 mb-2">
  97. <label for="dropdown2" style="font-size: medium;">Zone:</label>
  98. <select id="dropdown2" class="form-control">
  99. <option value="">Select</option>
  100. <option value="N01">N01</option>
  101. <option value="ALL">ALL</option>
  102. </select>
  103. </div>
  104. </div> -->
  105. <div class="row mt-4">
  106. <div class="col-12 d-flex justify-content-center">
  107. <button type="submit" id="searchBtn"
  108. class="btn btn-primary mx-2">Search</button>
  109. <button class="btn btn-danger mx-2" id="resetBtn"
  110. name="reset" type="reset">Reset</button>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="row mt-4">
  118. <div class="col-md-12">
  119. <div class="card">
  120. <div class="card-header">
  121. <span style="font-size: medium;font-weight: bold;">Unattended List</span>
  122. </div>
  123. <div class="card-body">
  124. <div class="table-responsive">
  125. <table id="ReportDatatable"
  126. class="table table-striped table-bordered table-hover dataTable"
  127. role="grid">
  128. <thead class="thead-dark">
  129. <tr role="row">
  130. <th class="text-center no-sort">S.No</th>
  131. <th class="text-center">Reg Date</th>
  132. <th class="text-center no-sort">Complaint No</th>
  133. <th class="text-center">ComplaintGroup</th>
  134. <th class="text-center">ComplaintType</th>
  135. <th class="text-center">Mode</th>
  136. <th class="text-center no-sort">Public Name</th>
  137. <th class="text-center">Public Mobile no</th>
  138. </tr>
  139. </thead>
  140. <tbody>
  141. </tbody>
  142. </table>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. <div id="submitcard" style="display: none;">
  149. <div class="card pl-4 pr-4">
  150. <div class="row mt-4">
  151. <div class="col-md-12">
  152. <label for="remarks" class="form-label fw-bold">Remarks<span class="text-danger">*</span></label>
  153. <textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
  154. </div>
  155. </div>
  156. <div class="row mb-2 mt-3">
  157. <div class="col-md-12 d-flex justify-content-center">
  158. <button type="button" class="btn btn-primary" id="closebutton">Mark as Completed</button>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. <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;">
  166. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  167. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  168. <span class="sr-only">Loading...</span>
  169. </div>
  170. <!-- Add the 'Please wait' text below the spinner -->
  171. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  172. </div>
  173. </div>
  174. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  175. </div>
  176. </div>
  177. <!-- in the code use to show the download different type microsoft -->
  178. <!-- Include jQuery and Bootstrap JavaScript -->
  179. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  180. <script
  181. src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  182. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  183. <!-- sweet alert -->
  184. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  185. <script type="text/javascript">
  186. /* document.addEventListener("DOMContentLoaded", function () {
  187. const complaintTypeDropdown = document.getElementById('dropdown1');
  188. const complaintGroupDropdown = document.getElementById('dropdown4');
  189. const complaintModeDropdown = document.getElementById('dropdown3');
  190. // const complaintZoneDropdown = document.getElementById('dropdown2');
  191. // Load Complaint Groups
  192. fetch('/gcc/api/callcenterqaqc/getComplaintGroup')
  193. .then(response => response.json())
  194. .then(data => {
  195. // Clear existing options
  196. complaintGroupDropdown.innerHTML = `<option value="">Select</option>`;
  197. // Add options from the API response
  198. data.forEach(complaintGroupName => {
  199. complaintGroupDropdown.innerHTML += `<option value="${complaintGroupName}">${complaintGroupName}</option>`;
  200. });
  201. })
  202. .catch(error => {
  203. console.error('Error fetching complaint groups:', error);
  204. });
  205. // Event Listener for Complaint Group Change
  206. complaintGroupDropdown.addEventListener('change', function () {
  207. const selectedGroup = complaintGroupDropdown.value;
  208. if (selectedGroup) {
  209. // Fetch Complaint Types based on selected group
  210. fetch(`/gcc/api/callcenterqaqc/getComplaintTypesByGroup?group=${encodeURIComponent(selectedGroup)}`)
  211. .then(response => response.json())
  212. .then(data => {
  213. // Clear existing options
  214. complaintTypeDropdown.innerHTML = `<option value="">Select</option>`;
  215. // Add options from the API response
  216. data.forEach(complaintTypeName => {
  217. complaintTypeDropdown.innerHTML += `<option value="${complaintTypeName}">${complaintTypeName}</option>`;
  218. });
  219. })
  220. .catch(error => {
  221. console.error('Error fetching complaint types:', error);
  222. });
  223. } else {
  224. // Clear complaint type dropdown if no group is selected
  225. complaintTypeDropdown.innerHTML = `<option value="">Select</option>`;
  226. }
  227. });
  228. // Load all Modes
  229. fetch('/gcc/api/callcenterqaqc/getModes')
  230. .then(response => response.json())
  231. .then(data => {
  232. // Clear existing options
  233. complaintModeDropdown.innerHTML = `<option value="">Select</option>`;
  234. // Add options from the API response
  235. data.forEach(complaintMode => {
  236. complaintModeDropdown.innerHTML += `<option value="${complaintMode}">${complaintMode}</option>`;
  237. });
  238. })
  239. .catch(error => {
  240. console.error('Error fetching complaint groups:', error);
  241. });
  242. // Load all zones
  243. fetch('/gcc/api/callcenterqaqc/getZones')
  244. .then(response => response.json())
  245. .then(data => {
  246. // Clear existing options
  247. complaintZoneDropdown.innerHTML = `<option value="">Select</option>`;
  248. // Add options from the API response
  249. data.forEach(complaintZone => {
  250. complaintZoneDropdown.innerHTML += `<option value="${complaintZone}">${complaintZone}</option>`;
  251. });
  252. })
  253. .catch(error => {
  254. console.error('Error fetching complaint groups:', error);
  255. });
  256. }); */
  257. $(document).ready(function() {
  258. var table = $('#ReportDatatable').DataTable({
  259. dom: 'Bftip',
  260. columnDefs: [
  261. { targets: 'no-sort', orderable: false }
  262. ],
  263. lengthMenu: [
  264. [50, 100, 200, 500, -1],
  265. ['50 rows', '100 rows', '200 rows', 'Show all']
  266. ],
  267. scrollY: '50vh',
  268. fixedColumns: {
  269. left: 1,
  270. right: 1
  271. },
  272. buttons: [
  273. {
  274. extend: 'pageLength',
  275. className: 'btn btn-warning'
  276. },
  277. {
  278. title: 'Data export',
  279. extend: 'copyHtml5',
  280. text: 'Copy',
  281. className: 'btn btn-secondary',
  282. id: 'copyBtn'
  283. },
  284. {
  285. extend: 'excelHtml5',
  286. text: 'Excel',
  287. className: 'btn btn-secondary',
  288. id: 'excelBtn'
  289. },
  290. {
  291. extend: 'csvHtml5',
  292. text: 'CSV',
  293. className: 'btn btn-secondary',
  294. id: 'csvBtn'
  295. },
  296. {
  297. extend: 'pdfHtml5',
  298. text: 'PDF',
  299. className: 'btn btn-secondary',
  300. id: 'pdfBtn'
  301. }
  302. ],
  303. fixedHeader: true,
  304. autoWidth: true,
  305. responsive: true,
  306. searching: true,
  307. select: false,
  308. processing: false
  309. });
  310. document.getElementById('resetBtn').addEventListener('click', function () {
  311. event.preventDefault();
  312. window.location.href="/gcc/callcenterqaqc/admin/unattendedcomplaints";
  313. });
  314. document.getElementById('searchBtn').addEventListener('click', function (e) {
  315. let ucount = document.getElementById('unattended_count').value;
  316. console.log("ucount: ",ucount);
  317. if (ucount=="") {
  318. Swal.fire({
  319. icon: 'info',
  320. title: 'Info',
  321. text: 'Enter Unattended Count',
  322. showConfirmButton: true,
  323. timer: 3000
  324. });
  325. e.preventDefault(); // Prevent the default action
  326. return; // Stop further execution
  327. }
  328. if (ucount=="0") {
  329. Swal.fire({
  330. icon: 'info',
  331. title: 'Info',
  332. text: 'You Entered 0 Count',
  333. showConfirmButton: true,
  334. timer: 3000
  335. });
  336. e.preventDefault(); // Prevent the default action
  337. return; // Stop further execution
  338. }
  339. let entryDetails = {
  340. ucount:ucount
  341. };
  342. console.log("entryDetails:",entryDetails);
  343. $('#pageLoader').show();
  344. $.ajax({
  345. type: "GET",
  346. url: `/gcc/api/callcenterqaqc/getunattendedcount?ucount=${ucount}`,
  347. success: function (response) {
  348. //console.log("API Response:", response);
  349. $('#pageLoader').hide();
  350. if (response.status === "success") {
  351. $("#submitcard").show();
  352. console.log("Details Array:", response.details);
  353. // Ensure details is an array and has at least one entry
  354. if (Array.isArray(response.details) && response.details.length > 0) {
  355. let table = $('#ReportDatatable').DataTable({
  356. destroy: true,
  357. searching: true,
  358. autoWidth: true,
  359. responsive: true,
  360. paging: true,
  361. info: true,
  362. data: response.details,
  363. columns: [
  364. {
  365. data: null,
  366. render: (data, type, row, meta) => meta.row + 1,
  367. className: 'text-center'
  368. },
  369. { data: 'complaint_date', defaultContent: '-', className: 'text-center' },
  370. { data: 'complaint_number', defaultContent: '-', className: 'text-center' },
  371. { data: 'complaint_group', defaultContent: '-', className: 'text-center' },
  372. { data: 'complaint_type', defaultContent: '-', className: 'text-center' },
  373. { data: 'complaint_mode', defaultContent: '-', className: 'text-center' },
  374. { data: 'complaint_person_name', defaultContent: '-', className: 'text-center' },
  375. { data: 'complaint_mobilenumber', defaultContent: '-', className: 'text-center' },
  376. ],
  377. dom: 'Bfrtip',
  378. buttons: [
  379. {
  380. extend: 'pageLength',
  381. className: 'btn btn-warning'
  382. },
  383. {
  384. title: 'Data export',
  385. extend: 'copyHtml5',
  386. text: 'Copy',
  387. className: 'btn btn-secondary',
  388. id: 'copyBtn'
  389. },
  390. {
  391. extend: 'excelHtml5',
  392. text: 'Excel',
  393. className: 'btn btn-secondary',
  394. id: 'excelBtn'
  395. },
  396. {
  397. extend: 'csvHtml5',
  398. text: 'CSV',
  399. className: 'btn btn-secondary',
  400. id: 'csvBtn'
  401. },
  402. {
  403. extend: 'pdfHtml5',
  404. text: 'PDF',
  405. className: 'btn btn-secondary',
  406. id: 'pdfBtn'
  407. }
  408. ],
  409. columnDefs: [
  410. { targets: 'no-sort', orderable: false }
  411. ],
  412. lengthMenu: [
  413. [50, 100, 200, 500, -1],
  414. ['50 rows', '100 rows', '200 rows', 'Show all']
  415. ],
  416. scrollY: '50vh',
  417. fixedColumns: {
  418. left: 1,
  419. right: 1
  420. }
  421. });
  422. }
  423. }
  424. else if (response.status === "nodata") {
  425. $("#submitcard").hide();
  426. Swal.fire({
  427. icon: 'warning',
  428. title: 'No Data',
  429. text: 'No data available for the count.'
  430. });
  431. }
  432. else {
  433. $("#submitcard").hide();
  434. Swal.fire({
  435. icon: 'error',
  436. title: 'Error',
  437. text: response.message
  438. });
  439. }
  440. },
  441. error: function (error) {
  442. $("#submitcard").hide();
  443. Swal.fire({
  444. icon: 'error',
  445. title: 'Error',
  446. text: error.responseJSON?.message
  447. });
  448. }
  449. });
  450. });
  451. document.getElementById('closebutton').addEventListener('click', function (e) {
  452. let userId = document.getElementById('userIdSpan').textContent;
  453. console.log("userId=" + userId);
  454. let remarks = $('#remarks').val().trim();
  455. // Get all complaint numbers from the DataTable
  456. let table = $('#ReportDatatable').DataTable();
  457. let complaintNumbers = table
  458. .column(2) // Assuming 'complaint_number' is in the 3rd column (index 2)
  459. .data()
  460. .toArray(); // Convert to an array
  461. let compDetails = {
  462. remarks:remarks,
  463. userId:userId,
  464. complaintNumbers: complaintNumbers // Add the list of complaint numbers
  465. };
  466. console.log("compDetails:",compDetails);
  467. // Regular expression to allow only letters, numbers, and spaces (No special characters)
  468. let regex = /^[a-zA-Z0-9\s]+$/;
  469. if (!compDetails.remarks || compDetails.remarks === '') {
  470. Swal.fire({
  471. icon: 'info',
  472. title: 'Info',
  473. text: 'Remarks are required to complete complaints.',
  474. confirmButtonText: 'OK'
  475. });
  476. return; // Stop execution
  477. }
  478. if (!regex.test(compDetails.remarks)) {
  479. Swal.fire({
  480. icon: 'error',
  481. title: 'Invalid Input',
  482. text: 'Remarks should not contain special characters.',
  483. confirmButtonText: 'OK'
  484. });
  485. return; // Stop execution
  486. }
  487. $('#closebutton').prop('disabled', true).text('Processing...');
  488. $('#pageLoader').show();
  489. $.ajax({
  490. url: '/gcc/api/callcenterqaqc/closingunattendedcomplaints',
  491. type: 'POST',
  492. contentType: 'application/json',
  493. data: JSON.stringify(compDetails),
  494. success: function (response) {
  495. $('#pageLoader').hide();
  496. $('#closebutton').prop('disabled', false).text('Mark as Completed');
  497. if (response.status === "success") {
  498. Swal.fire({
  499. icon: 'success',
  500. title: 'Success',
  501. text: response.message,
  502. allowOutsideClick: false,
  503. allowEscapeKey: false,
  504. allowEnterKey: false,
  505. confirmButtonText: 'OK'
  506. }).then((result) => {
  507. if (result.isConfirmed) {
  508. window.location.href = "/gcc/callcenterqaqc/admin/unattendedcomplaints";
  509. }
  510. });
  511. } else if (response.status === "partial_success") {
  512. Swal.fire({
  513. icon: 'warning',
  514. title: 'Partial Success',
  515. text: response.message + " Completed: " + response.completedCount + ", Failed: " + response.failedCount,
  516. allowOutsideClick: false,
  517. allowEscapeKey: false,
  518. allowEnterKey: false,
  519. confirmButtonText: 'OK'
  520. });
  521. } else {
  522. Swal.fire({
  523. icon: 'error',
  524. title: 'Error',
  525. text: response.message,
  526. confirmButtonText: 'OK'
  527. });
  528. }
  529. },
  530. error: function (xhr) {
  531. $('#pageLoader').hide();
  532. $('#closebutton').prop('disabled', false).text('Mark as Completed');
  533. let errorMessage = "An unknown error occurred.";
  534. if (xhr.responseJSON && xhr.responseJSON.message) {
  535. errorMessage = xhr.responseJSON.message;
  536. }
  537. Swal.fire({
  538. icon: 'error',
  539. title: 'Error',
  540. text: errorMessage,
  541. confirmButtonText: 'OK'
  542. });
  543. console.error('Error:', xhr.responseText);
  544. }
  545. });
  546. });
  547. });
  548. </script>
  549. </body>
  550. </html>