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.

581 lines
25 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. <style>
  6. .required{
  7. color: red;
  8. }
  9. .editAgentName {
  10. color: black; /* Default color */
  11. text-decoration: none; /* Remove underline */
  12. transition: color 0.1s ease-in-out; /* Smooth color transition */
  13. }
  14. .editAgentName:hover {
  15. color: blue; /* Change color to blue on hover */
  16. text-decoration: underline; /* Optional: add underline on hover */
  17. }
  18. /* Mobile screens - targeting devices with a max width of 767px */
  19. @media (max-width: 767px)
  20. {
  21. #qaqcRequestForm label{
  22. margin-top: 10px;
  23. }
  24. }
  25. </style>
  26. <body>
  27. <!--[if lt IE 8]>
  28. <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>
  29. <![endif]-->
  30. <div class="wrapper">
  31. <!-- header top menu Start -->
  32. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  33. <!-- header top menu end -->
  34. <div class="page-wrap">
  35. <!--=============== Left Menu side Start ================-->
  36. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  37. <!--=============== Left side End ================-->
  38. <div class="main-content">
  39. <div class="container-fluid">
  40. <div class="page-header mb-2">
  41. <div class="row align-items-end">
  42. <div class="col-lg-8">
  43. <div class="page-header-title">
  44. <i class="fas fa-edit bg-blue"></i>
  45. <div class="d-inline">
  46. <h5>Admin Settings</h5>
  47. <span>1913 Admin Setting for Select Agents inbound or outbound</span>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="col-lg-4">
  52. <nav class="breadcrumb-container" aria-label="breadcrumb">
  53. <ol class="breadcrumb">
  54. <li class="breadcrumb-item"><a href="/gcc/index"><i
  55. class="ik ik-home"></i></a></li>
  56. <li class="breadcrumb-item" aria-current="page">Admin Settings</li>
  57. <li class="breadcrumb-item active" aria-current="page">Admin Settings</li>
  58. </ol>
  59. </nav>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="row mt-4">
  64. <div class="col-md-12">
  65. <div class="card" style="margin-top: 0px;">
  66. <div class="card-header justify-content-between align-items-center">
  67. <h3><b>Admin Settings</b></h3>
  68. </div>
  69. <div class="card-body">
  70. <div class="form-group">
  71. <div class="row">
  72. <div class="col-sm-12 col-md-3">
  73. <label for="productivity_count">Productivity Count Per Agent<span class="required">*</span></label>
  74. <input
  75. type="number"
  76. class="form-control"
  77. id="productivity_count"
  78. th:value="${Counts != null && !Counts.isEmpty() ? Counts[0].productivity_count : 0}"
  79. >
  80. </div>
  81. <div class="col-sm-12 col-md-3">
  82. <label for="total_count">Total Agents</label>
  83. <input
  84. type="number"
  85. class="form-control"
  86. id="total_count"
  87. th:value="${Counts != null && !Counts.isEmpty() ? Counts[0].total_count : 0}"
  88. readonly>
  89. </div>
  90. <div class="col-sm-12 col-md-3">
  91. <label for="assigned">Assigned Agents</label>
  92. <input
  93. type="number"
  94. class="form-control"
  95. id="assigned"
  96. th:value="${Counts != null && !Counts.isEmpty() ? Counts[0].assigned : 0}"
  97. readonly>
  98. </div>
  99. <div class="col-sm-12 col-md-3">
  100. <label for="notassigned">Not Assigned Agents</label>
  101. <input
  102. type="number"
  103. class="form-control"
  104. id="notassigned"
  105. th:value="${Counts != null && !Counts.isEmpty() ? Counts[0].notassigned : 0}"
  106. readonly>
  107. </div>
  108. </div>
  109. <div class="row mt-3">
  110. <div class="col-sm-12 col-md-3">
  111. <label for="inbound_count">Inbound Agents</label>
  112. <input
  113. type="number"
  114. class="form-control"
  115. id="inbound_count"
  116. th:value="${Counts != null && !Counts.isEmpty() ? Counts[0].inbound_count : 0}"
  117. readonly>
  118. </div>
  119. <div class="col-sm-12 col-md-3">
  120. <label for="outbound_count">Outbound Agents</label>
  121. <input
  122. type="number"
  123. class="form-control"
  124. id="outbound_count"
  125. th:value="${Counts != null && !Counts.isEmpty() ? Counts[0].outbound_count : 0}"
  126. readonly>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="form-group text-center">
  131. <button type="submit" class="btn btn-primary" id="requestSubmit">Submit</button>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="col-md-12">
  137. <div class="card">
  138. <div class="card-block">
  139. <div class="page-header-title">
  140. <h5 style="margin: 0; font-weight: bold;">Agent List</h5>
  141. <hr>
  142. </div>
  143. <div>
  144. <table id="QaqcDatatable" class="table table-bordered table-hover dataTable" role="grid">
  145. <thead class="thead-dark">
  146. <tr role="row">
  147. <th class="text-center">S.No</th>
  148. <th class="text-center">Agent ID</th>
  149. <th class="text-center">Username</th>
  150. <th class="text-center">Name</th>
  151. <th class="text-center">Phone No</th>
  152. <th class="text-center ">
  153. <div class="d-inline-flex align-items-center">
  154. <input type="checkbox" id="selectAllInbound" title="Select All InBound" style="margin-right: 5px;">
  155. <span>InBound</span>
  156. </div>
  157. </th>
  158. <th class="text-center">
  159. <div class="d-inline-flex align-items-center">
  160. <input type="checkbox" id="selectAllOutbound" title="Select All OutBound" style="margin-right: 5px;">
  161. <span>OutBound</span>
  162. </div>
  163. </th>
  164. </tr>
  165. </thead>
  166. <tbody>
  167. <!-- Populate the table dynamically using Thymeleaf -->
  168. <tr th:each="agent, iterStat : ${Agents}">
  169. <td th:text="${iterStat.index + 1}" class="text-center"></td>
  170. <td th:text="${agent.agent_id}" class="text-center"></td>
  171. <td th:text="${agent.username}" class="text-center"></td>
  172. <td class="text-center">
  173. <a href="#" th:text="${agent.agent_name}"
  174. th:attr="data-id=${agent.agent_id}, data-name=${agent.agent_name}"
  175. class="editAgentName"
  176. data-toggle="modal" data-target="#editAgentModal"></a>
  177. </td>
  178. <td th:text="${agent.mobile_number}" class="text-center"></td>
  179. <td class="text-center">
  180. <!-- Inbound checkbox, checked if calling_type is INBOUND -->
  181. <input type="checkbox" th:id="'inbound_' + ${agent.agent_id}" th:checked="${'INBOUND'.equals(agent.calling_type)}">
  182. </td>
  183. <td class="text-center">
  184. <!-- Outbound checkbox, checked if calling_type is OUTBOUND -->
  185. <input type="checkbox" th:id="'outbound_' + ${agent.agent_id}" th:checked="${'OUTBOUND'.equals(agent.calling_type)}">
  186. </td>
  187. </tr>
  188. </tbody>
  189. </table>
  190. <!-- Center the Submit button -->
  191. <div class="text-center">
  192. <button type="button" class="btn btn-primary" id="submitBtn">Click to Assign</button>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  202. </div>
  203. </div>
  204. <!-- Edit Agent Modal -->
  205. <div class="modal fade" id="editAgentModal" tabindex="-1" role="dialog" aria-labelledby="editAgentModalLabel" aria-hidden="true">
  206. <div class="modal-dialog" role="document">
  207. <div class="modal-content">
  208. <div class="modal-header">
  209. <h5 class="modal-title" id="editAgentModalLabel">Edit Agent Name</h5>
  210. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  211. <span aria-hidden="true">&times;</span>
  212. </button>
  213. </div>
  214. <div class="modal-body">
  215. <form id="editAgentForm">
  216. <input type="hidden" id="editAgentId"> <!-- Hidden input for agent_id -->
  217. <div class="form-group">
  218. <label for="editAgentName">Agent Name</label>
  219. <input type="text" class="form-control" id="editAgentName" required>
  220. </div>
  221. <button type="submit" class="btn btn-primary">Save Changes</button>
  222. </form>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  228. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  229. <script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
  230. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  231. <script type="text/javascript">
  232. $(document).ready(function () {
  233. // When clicking the agent name
  234. $(".editAgentName").click(function () {
  235. let agentId = $(this).data("id"); // Get agent ID
  236. let agentName = $(this).data("name"); // Get agent name
  237. $("#editAgentId").val(agentId); // Set ID in hidden field
  238. $("#editAgentName").val(agentName); // Set name in input field
  239. });
  240. // Handle Save button inside modal
  241. $("#editAgentForm").submit(function (e) {
  242. e.preventDefault(); // Prevent form from reloading page
  243. let updatedName = $("#editAgentName").val();
  244. let agentId = $("#editAgentId").val();
  245. console.log("Updated Agent ID:", agentId);
  246. console.log("Updated Name:", updatedName);
  247. // Here, you can send the updated name to the server via AJAX
  248. $.ajax({
  249. type: "POST",
  250. url: "/gcc/api/callcenterqaqc/adminsettings/updateagentname",
  251. contentType: "application/json",
  252. data: JSON.stringify({ agent_id: agentId, agent_name: updatedName }),
  253. success: function (response) {
  254. if (response.status === "success") {
  255. Swal.fire({
  256. allowOutsideClick: false,
  257. allowEscapeKey: false,
  258. allowEnterKey: false,
  259. icon: "success",
  260. title: "Success",
  261. text: response.message,
  262. confirmButtonText: "OK"
  263. }).then(() => {
  264. location.reload(); // Reload page after user clicks "OK"
  265. });
  266. } else {
  267. Swal.fire({
  268. icon: "error",
  269. title: "Error",
  270. text: response.message
  271. });
  272. }
  273. },
  274. error: function (xhr) {
  275. let errorMessage = "Error updating agent name!";
  276. if (xhr.responseJSON && xhr.responseJSON.message) {
  277. errorMessage = xhr.responseJSON.message;
  278. }
  279. Swal.fire({
  280. icon: "error",
  281. title: "Error",
  282. text: errorMessage
  283. });
  284. }
  285. });
  286. $("#editAgentModal").modal("hide"); // Close modal after saving
  287. });
  288. });
  289. $(document).ready(function() {
  290. var table = $('#QaqcDatatable').DataTable({
  291. dom: 'Bftip',
  292. columnDefs: [
  293. { targets: 'no-sort', orderable: false }
  294. ],
  295. lengthMenu: [
  296. [200, 500, -1],
  297. [ '200 rows','500 rows', 'Show all']
  298. ],
  299. scrollY: '80vh',
  300. fixedColumns: {
  301. left: 1,
  302. right: 1
  303. },
  304. buttons: [
  305. {
  306. extend: 'pageLength',
  307. className: 'btn btn-warning'
  308. },
  309. {
  310. title: 'Data export',
  311. extend: 'copyHtml5',
  312. text: 'Copy',
  313. className: 'btn btn-secondary',
  314. id: 'copyBtn'
  315. },
  316. {
  317. extend: 'excelHtml5',
  318. text: 'Excel',
  319. className: 'btn btn-secondary',
  320. id: 'excelBtn'
  321. },
  322. {
  323. extend: 'csvHtml5',
  324. text: 'CSV',
  325. className: 'btn btn-secondary',
  326. id: 'csvBtn'
  327. },
  328. {
  329. extend: 'pdfHtml5',
  330. text: 'PDF',
  331. className: 'btn btn-secondary',
  332. id: 'pdfBtn'
  333. }
  334. ],
  335. fixedHeader: true,
  336. autoWidth: true,
  337. responsive: true,
  338. searching: true,
  339. select: false,
  340. processing: false
  341. });
  342. });
  343. $(document).ready(function () {
  344. let lastClickedColumn = null; // Track the last clicked "Select All" checkbox
  345. // Handle "Select All" for InBound
  346. $('#selectAllInbound').on('change', function () {
  347. if (this.checked) {
  348. // Uncheck the "Select All" checkbox in the OutBound column
  349. $('#selectAllOutbound').prop('checked', false);
  350. lastClickedColumn = 'Inbound';
  351. // Check all checkboxes in the InBound column
  352. $('#QaqcDatatable tbody input[id^="inbound_"]').prop('checked', true);
  353. // Uncheck all checkboxes in the OutBound column
  354. $('#QaqcDatatable tbody input[id^="outbound_"]').prop('checked', false);
  355. } else {
  356. // Uncheck all checkboxes in the InBound column
  357. $('#QaqcDatatable tbody input[id^="inbound_"]').prop('checked', false);
  358. }
  359. });
  360. // Handle "Select All" for OutBound
  361. $('#selectAllOutbound').on('change', function () {
  362. if (this.checked) {
  363. // Uncheck the "Select All" checkbox in the InBound column
  364. $('#selectAllInbound').prop('checked', false);
  365. lastClickedColumn = 'Outbound';
  366. // Check all checkboxes in the OutBound column
  367. $('#QaqcDatatable tbody input[id^="outbound_"]').prop('checked', true);
  368. // Uncheck all checkboxes in the InBound column
  369. $('#QaqcDatatable tbody input[id^="inbound_"]').prop('checked', false);
  370. } else {
  371. // Uncheck all checkboxes in the OutBound column
  372. $('#QaqcDatatable tbody input[id^="outbound_"]').prop('checked', false);
  373. }
  374. });
  375. // Ensure individual checkboxes deselect the "Select All" if unchecked
  376. $('#QaqcDatatable').on('change', 'input[id^="inbound_"], input[id^="outbound_"]', function () {
  377. const agentId = $(this).closest('tr').find('td:eq(1)').text().trim();
  378. // Uncheck "Select All" if any checkbox in its column is deselected
  379. if ($(this).attr('id').includes('inbound')) {
  380. if (!this.checked) {
  381. $('#selectAllInbound').prop('checked', false);
  382. }
  383. $('#outbound_' + agentId).prop('checked', false);
  384. } else if ($(this).attr('id').includes('outbound')) {
  385. if (!this.checked) {
  386. $('#selectAllOutbound').prop('checked', false);
  387. }
  388. $('#inbound_' + agentId).prop('checked', false);
  389. }
  390. });
  391. });
  392. $(document).ready(function () {
  393. // Ensure only one checkbox is selected at a time (Inbound or Outbound)
  394. $('#QaqcDatatable').on('change', 'input[type="checkbox"]', function () {
  395. var agentId = $(this).closest('tr').find('td:eq(1)').text().trim(); // Get agent_id from the second column
  396. if ($(this).attr('id').includes('inbound')) {
  397. // If Inbound checkbox is selected, uncheck Outbound
  398. $('#outbound_' + agentId).prop('checked', false);
  399. } else if ($(this).attr('id').includes('outbound')) {
  400. // If Outbound checkbox is selected, uncheck Inbound
  401. $('#inbound_' + agentId).prop('checked', false);
  402. }
  403. });
  404. $('#submitBtn').click(function () {
  405. var selectedAgents = [];
  406. $('#QaqcDatatable tbody tr').each(function () {
  407. var agentId = $(this).find('td:eq(1)').text().trim(); // Get agent_id from the second column
  408. var isInboundChecked = $(this).find('input[id="inbound_' + agentId + '"]').prop('checked');
  409. var isOutboundChecked = $(this).find('input[id="outbound_' + agentId + '"]').prop('checked');
  410. // Set calling_type based on the checked checkboxes
  411. var callingType = null;
  412. if (isInboundChecked) {
  413. callingType = 'INBOUND';
  414. } else if (isOutboundChecked) {
  415. callingType = 'OUTBOUND';
  416. }
  417. // Add agent object to the array with agent_id and calling_type
  418. selectedAgents.push({ agent_id: parseInt(agentId, 10), calling_type: callingType });
  419. });
  420. // Check if no agents were selected and show an alert
  421. if (selectedAgents.length === 0) {
  422. Swal.fire({
  423. icon: 'warning',
  424. title: 'No Selection',
  425. text: 'Please select at least one agent to proceed.',
  426. });
  427. return; // Stop further execution
  428. }
  429. // Send the selected agents and their calling types to the API
  430. $.ajax({
  431. type: "POST",
  432. url: "/gcc/api/callcenterqaqc/adminsettings/updateCallType", // Your API endpoint
  433. data: JSON.stringify(selectedAgents),
  434. contentType: "application/json",
  435. success: function (response) {
  436. // Success: Show success message with Swal
  437. Swal.fire({
  438. icon: 'success',
  439. title: 'Success',
  440. text: response.message || 'Agents Assigned Successfully',
  441. }).then(function () {
  442. // Reload the page after the Swal is closed
  443. location.reload();
  444. });
  445. },
  446. error: function (error) {
  447. // Error: Show error message with Swal
  448. Swal.fire({
  449. icon: 'error',
  450. title: 'Error',
  451. text: error.responseJSON.message || 'Error in Assigning Agents',
  452. });
  453. }
  454. });
  455. });
  456. });
  457. $(document).ready(function () {
  458. $('#requestSubmit').click(function (event) {
  459. event.preventDefault(); // Prevent form submission if it's inside a form
  460. // Get the productivity_count value from the input field
  461. let productivityCount = $('#productivity_count').val();
  462. // Check if the value is null, empty, or NaN
  463. if (!productivityCount || isNaN(parseInt(productivityCount, 10))) {
  464. // Show an error message using Swal
  465. Swal.fire({
  466. icon: 'error',
  467. title: 'Invalid Input',
  468. text: 'Please enter a valid productivity count.',
  469. });
  470. return; // Stop further execution
  471. }
  472. // Parse productivityCount as an integer
  473. productivityCount = parseInt(productivityCount, 10);
  474. // Prepare the data to send
  475. const data = { productivity_count: productivityCount };
  476. // Send the data to the API using AJAX
  477. $.ajax({
  478. type: "POST",
  479. url: "/gcc/api/callcenterqaqc/adminsettings/updateproductivity", // Replace with your API endpoint
  480. data: JSON.stringify(data),
  481. contentType: "application/json",
  482. success: function (response) {
  483. // Show a success message using Swal
  484. Swal.fire({
  485. icon: 'success',
  486. title: 'Success',
  487. text: response.message || 'Productivity updated successfully!',
  488. }).then(function () {
  489. // Reload the page after the Swal is closed
  490. location.reload();
  491. });
  492. },
  493. error: function (error) {
  494. // Show an error message using Swal
  495. Swal.fire({
  496. icon: 'error',
  497. title: 'Error',
  498. text: error.responseJSON?.message || 'Failed to update productivity!',
  499. });
  500. }
  501. });
  502. });
  503. });
  504. </script>
  505. </body>
  506. </html>