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.

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