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.

484 lines
18 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}">
  5. </head>
  6. <body>
  7. <!--[if lt IE 8]>
  8. <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>
  9. <![endif]-->
  10. <div class="wrapper">
  11. <!-- header top menu Start -->
  12. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  13. <!-- header top menu end -->
  14. <div class="page-wrap">
  15. <!--=============== Left Menu side Start ================-->
  16. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  17. <!--=============== Left side End ================-->
  18. <div class="main-content">
  19. <div class="container-fluid">
  20. <div class="page-header">
  21. <div class="row align-items-end">
  22. <div class="col-lg-6">
  23. <div class="page-header-title">
  24. <i class="ik ik-thumbs-up bg-blue"></i>
  25. <div class="d-inline">
  26. <h5>NULM STAFF</h5>
  27. <span>Appointment</span>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="col-lg-6">
  32. <nav class="breadcrumb-container" aria-label="breadcrumb">
  33. <ol class="breadcrumb">
  34. <li class="breadcrumb-item">
  35. <a href="/index"><i class="ik ik-home"></i></a>
  36. </li>
  37. <li class="breadcrumb-item active" aria-current="page">Appointment</li>
  38. </ol>
  39. </nav>
  40. </div>
  41. </div>
  42. </div>
  43. <hr>
  44. <div class="row align-items-center justify-content-center"
  45. style="color: white;background-color:#414f69 ;padding: 10px;">
  46. <h3 class="title resizable-content">Appoinment</h3>
  47. </div>
  48. <!-- Card Section -->
  49. <div class="card mt-5 p-3 resizable-content" style="margin-bottom: 8px;color: #414f69;">
  50. <!-- Add the resizable-content class to the card sections -->
  51. <div class="card mb-3 resizable-content">
  52. <div class="card-body">
  53. <div class="row">
  54. <div class="col-md-6 d-flex justify-content-between align-items-center">
  55. <label
  56. style="font-size: large; font-weight: 700; color: #414f69;">Order:</label>
  57. <select id="orderNumberDropdown" class="form-control"
  58. style="font-size: large; width: 70%;">
  59. <option value="">Select Order</option>
  60. </select>
  61. </div>
  62. </div>
  63. <div class="mt-3" id="orderDetails" style="display: none;">
  64. <div class="card-block" style="text-align:center;">
  65. <div id="chart" class="row">
  66. <div class="col-sm-12 col-lg-4">
  67. <div class="card" style="height: 100px;">
  68. <div class="card-body">
  69. <h5 class="card-title" style="font-size:14px;">Total Staff</h5>
  70. <p class="card-text" id="total"
  71. style="font-size:large; font-weight: bold;">0</p>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="col-sm-12 col-lg-4">
  76. <div class="card" style="height: 100px;">
  77. <div class="card-body">
  78. <h5 class="card-title" style="font-size:14px;">Appointed</h5>
  79. <p class="card-text" id="pending"
  80. style="font-size: large;font-weight: bold;">0</p>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="col-sm-12 col-lg-4">
  85. <div class="card" style="height: 100px;">
  86. <div class="card-body">
  87. <h5 class="card-title" style="font-size:14px;">Available
  88. </h5>
  89. <p class="card-text" id="notappointed"
  90. style="font-size: large;font-weight: bold;">0</p>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <br>
  98. <div class="row" id="groupboxsection" style="display:none">
  99. <div class="col-md-6 d-flex justify-content-between align-items-center">
  100. <label
  101. style="font-size: large; font-weight: 700; color: #414f69;">Self Help Group:</label>
  102. <select id="grouplist" class="form-control"
  103. style="font-size: large; width: 70%;">
  104. <option value="">Select Group</option>
  105. </select>
  106. </div>
  107. </div>
  108. <!-- Appointment Date Section (Initially Hidden) -->
  109. <div class="row mt-3" id="appointmentSection" style="display: none;">
  110. <div class="col-md-6 d-flex align-items-center">
  111. <label
  112. style="font-size: large; font-weight: 700; color: #414f69; width: 30%;">Appointment
  113. Date:</label>
  114. <input type="date" id="appointmentDate" class="form-control"
  115. style="font-size: large; width: 70%;">
  116. </div>
  117. </div>
  118. <!-- Orders Table Section (Initially Hidden) -->
  119. <div class="row mt-3" id="ordersTableSection" style="display: none;">
  120. <div class="col-md-12">
  121. <table class="table table-bordered">
  122. <thead>
  123. <tr>
  124. <th style="width: 10%;">
  125. <input type="checkbox" id="selectAll">
  126. </th>
  127. <th style="width: 30%;">Name</th>
  128. <th style="width: 30%;">Phone Number</th>
  129. <th style="width: 30%;">Address</th>
  130. <th style="width: 30%;">Education Qualification</th>
  131. </tr>
  132. </thead>
  133. <tbody id="ordersTableBody">
  134. <!-- Table rows will be populated here -->
  135. </tbody>
  136. </table>
  137. </div>
  138. </div>
  139. <div class="row mt-3" id="inchargemobilenosection" style="display: none;">
  140. <div class="col-md-6 d-flex align-items-center">
  141. <label style="font-size: large; font-weight: 700; color: #414f69; width: 30%;">Designation:</label>
  142. <select id="designation" class="form-control"
  143. style="font-size: large; width: 70%;">
  144. <option value="">Select Designation</option>
  145. <option>CI</option>
  146. <option>Software Developer</option>
  147. </select>
  148. </div>
  149. <div class="col-md-6 d-flex align-items-center">
  150. <label
  151. style="font-size: large; font-weight: 700; color: #414f69; width: 30%;">Incharge
  152. Mobileno:</label>
  153. <input type="text" id="inchargemobileno" class="form-control"
  154. style="font-size: large; width: 70%;">
  155. </div>
  156. <div class="col-md-6 d-flex align-items-center">
  157. <label
  158. style="font-size: large; font-weight: 700; color: #414f69; width: 30%;">Incharge
  159. Name:</label>
  160. <input type="text" id="inchargeName" class="form-control"
  161. style="font-size: large; width: 70%;">
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. <div class="d-flex justify-content-center">
  167. <button class="btn"
  168. style="background-color: #414f69; color: white; width: 200px;padding: 10px;margin-bottom: 10px;"
  169. id="createorder">
  170. Create Appointment
  171. </button>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  177. </div>
  178. </div>
  179. <div th:replace="~{fragments/modules/pgr/modal-box :: div}"></div>
  180. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  181. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  182. <script th:replace="~{fragments/modules/pgr/script :: script}"></script>
  183. <script th:inline="javascript">
  184. $(document).ready(function () {
  185. // Function to load scheme group names
  186. function loadSchemeGroupNames() {
  187. $.ajax({
  188. url: '/gcc/api/nulm/getAllSchemeGroupNames', // Endpoint URL
  189. method: 'GET',
  190. dataType: 'json',
  191. success: function (data) {
  192. // Get the dropdown element
  193. var $dropdown = $('#schemeGroupDropdown');
  194. // Clear existing options
  195. $dropdown.empty();
  196. // Add the default option
  197. $dropdown.append('<option value="">Select Scheme Group</option>');
  198. // Populate the dropdown with scheme group names
  199. $.each(data, function (index, value) {
  200. $dropdown.append('<option value="' + value + '">' + value + '</option>');
  201. });
  202. },
  203. error: function (xhr, status, error) {
  204. console.error('Error fetching scheme group names:', error);
  205. }
  206. });
  207. }
  208. // Load the scheme group names when the document is ready
  209. loadSchemeGroupNames();
  210. });
  211. $(document).ready(function () {
  212. // Function to load scheme group names
  213. function loadNotappointed() {
  214. $.ajax({
  215. url: '/gcc/api/nulm/getAllSchemeGroupNames', // Endpoint URL
  216. method: 'GET',
  217. dataType: 'json',
  218. success: function (data) {
  219. var $dropdown = $('#grouplist');
  220. $dropdown.empty();
  221. $dropdown.append('<option value="">Select Group</option>');
  222. $.each(data, function (index, group) {
  223. $dropdown.append('<option value="' + group.group_id + '">' + group.group_name + '</option>');
  224. });
  225. },
  226. error: function (xhr, status, error) {
  227. console.error('Error fetching scheme group names:', error);
  228. }
  229. });
  230. }
  231. // Load the scheme group names when the document is ready
  232. loadNotappointed();
  233. $('#grouplist').change(function () {
  234. var groupId = $(this).val();
  235. if (groupId) {
  236. $.ajax({
  237. url: '/gcc/api/nulm/enrollmentCountsbygroupId',
  238. method: 'GET',
  239. data: { groupId: groupId },
  240. dataType: 'json',
  241. success: function (data) {
  242. console.log("data==", data);
  243. function getTodayDate() {
  244. return new Date().toISOString().split('T')[0];
  245. }
  246. var $ordersTableBody = $('#ordersTableBody');
  247. $ordersTableBody.empty();
  248. $('#appointmentSection').show();
  249. $('#inchargemobilenosection').show();
  250. $('#appointmentDate').val(getTodayDate());
  251. if (data.length > 0) {
  252. $.each(data, function (index, enrollment) {
  253. var row = '<tr>' +
  254. '<td><input type="checkbox" class="form-check-input order-checkbox" name="selectRow" value="' + enrollment.enrollment_id + '" style="margin-left:0px"></td>' +
  255. '<td>' + enrollment.name + '</td>' +
  256. '<td>' + enrollment.phone_number + '</td>' +
  257. '<td>' + enrollment.address + '</td>' +
  258. '<td>' + enrollment.education_qualification + '</td>' +
  259. '</tr>';
  260. $ordersTableBody.append(row);
  261. });
  262. $('#ordersTableSection').show();
  263. } else {
  264. $ordersTableBody.append('<tr><td colspan="5">No enrollments found.</td></tr>');
  265. $('#ordersTableSection').show();
  266. }
  267. },
  268. error: function (xhr, status, error) {
  269. console.error('Error fetching enrollment counts:', error);
  270. }
  271. });
  272. } else {
  273. $('#ordersTableSection').hide(); // Hide the table if no group is selected
  274. $('#appointmentSection').hide();
  275. $('#inchargemobilenosection').hide();
  276. }
  277. $('#selectAll').click(function () {
  278. var isChecked = $(this).is(':checked');
  279. $('.order-checkbox').prop('checked', isChecked);
  280. });
  281. // Optionally, if you want to uncheck the "Select All" checkbox when any individual checkbox is unchecked
  282. $(document).on('click', '.order-checkbox', function () {
  283. if (!$(this).is(':checked')) {
  284. $('#selectAll').prop('checked', false);
  285. } else if ($('.order-checkbox:checked').length === $('.order-checkbox').length) {
  286. $('#selectAll').prop('checked', true);
  287. }
  288. });
  289. });
  290. });
  291. $(document).ready(function() {
  292. // Function to load order details
  293. function loadOrderDetails() {
  294. $.ajax({
  295. url: '/gcc/api/nulm/getAllOrderDetails', // Updated Endpoint URL
  296. method: 'GET',
  297. dataType: 'json',
  298. success: function(data) {
  299. var $dropdown = $('#orderNumberDropdown');
  300. $dropdown.empty();
  301. $dropdown.append('<option value="">Select Order</option>');
  302. $.each(data, function(index, order) {
  303. $dropdown.append('<option value="' + order.order_id + '">' + order.order_number + '</option>');
  304. });
  305. },
  306. error: function(xhr, status, error) {
  307. console.error('Error fetching order details:', error);
  308. }
  309. });
  310. }
  311. // Load order details when the document is ready
  312. loadOrderDetails();
  313. // Handle order number selection
  314. $('#orderNumberDropdown').change(function() {
  315. var orderId = $(this).val();
  316. var $orderDetails = $('#orderDetails');
  317. var $groupBoxSection = $('#groupboxsection');
  318. if (orderId) {
  319. // Display the order details and group section
  320. $orderDetails.show();
  321. $groupBoxSection.show();
  322. // Fetch the enrollment counts based on the selected order ID
  323. $.ajax({
  324. url: '/gcc/api/nulm/enrollmentCountsbyorderId',
  325. method: 'GET',
  326. data: { orderId: orderId },
  327. dataType: 'json',
  328. success: function(counts) {
  329. // Update the values in the cards
  330. $('#total').text(counts.total_count || 0);
  331. $('#pending').text(counts.total_yes || 0);
  332. $('#notappointed').text(counts.output_value || 0);
  333. },
  334. error: function(xhr, status, error) {
  335. console.error('Error fetching enrollment counts:', error);
  336. }
  337. });
  338. } else {
  339. // Hide the order details and group section if no order is selected
  340. $orderDetails.hide();
  341. $groupBoxSection.hide();
  342. }
  343. });
  344. });
  345. $(document).ready(function () {
  346. // Function to load scheme group names
  347. function loadStaffName() {
  348. $.ajax({
  349. url: '/gcc/api/nulm/getAllStaffNames', // Endpoint URL
  350. method: 'GET',
  351. dataType: 'json',
  352. success: function (data) {
  353. // Get the dropdown element
  354. var $dropdown = $('#staffNameDropdown');
  355. // Clear existing options
  356. $dropdown.empty();
  357. // Add the default option
  358. $dropdown.append('<option value="">Select Staff Name</option>');
  359. // Populate the dropdown with scheme group names
  360. $.each(data, function (index, value) {
  361. $dropdown.append('<option value="' + value + '">' + value + '</option>');
  362. });
  363. },
  364. error: function (xhr, status, error) {
  365. console.error('Error fetching scheme group names:', error);
  366. }
  367. });
  368. }
  369. // Load the scheme group names when the document is ready
  370. loadStaffName();
  371. });
  372. $(document).ready(function () {
  373. $('#createorder').click(function () {
  374. var totalstaff = parseInt($('#total').text(), 10); // Convert total staff to an integer
  375. var selectedEnrollments = [];
  376. var orderId = parseInt($('#orderNumberDropdown').val(), 10); // Ensure orderId is an integer
  377. var inchargePhoneno = $('#inchargemobileno').val(); // Get the in-charge mobile number
  378. var designation = $('#designation').val(); // Get the designation
  379. $('.order-checkbox:checked').each(function () {
  380. selectedEnrollments.push(parseInt($(this).val(), 10)); // Ensure enrollmentIds are integers
  381. });
  382. if (selectedEnrollments.length > totalstaff) {
  383. // Show SweetAlert if the number of selected enrollments exceeds the total staff count
  384. Swal.fire({
  385. icon: 'warning',
  386. title: 'Limit Exceeded',
  387. text: `For this order, only ${totalstaff} staff members are allowed.`
  388. });
  389. } else {
  390. // Proceed with the order creation logic
  391. $.ajax({
  392. url: '/gcc/api/nulm/assignAppointment',
  393. method: 'POST',
  394. contentType: 'application/json', // Set the content type to JSON
  395. data: JSON.stringify({
  396. enrollmentIds: selectedEnrollments,
  397. orderId: orderId,
  398. incharge_phoneno: inchargePhoneno, // Include the in-charge mobile number
  399. designation: designation // Include the designation
  400. }), // Convert the data to JSON string
  401. success: function(response) {
  402. // Show SweetAlert on success
  403. Swal.fire({
  404. icon: 'success',
  405. title: 'Order Created',
  406. text: 'The order has been successfully created.',
  407. confirmButtonText: 'OK'
  408. }).then((result) => {
  409. if (result.isConfirmed) {
  410. // Reload the page after SweetAlert is confirmed
  411. location.reload();
  412. }
  413. });
  414. },
  415. error: function(xhr, status, error) {
  416. // Show error message using SweetAlert
  417. Swal.fire({
  418. icon: 'error',
  419. title: 'Error',
  420. text: 'An error occurred while creating the order. Please try again later.'
  421. });
  422. console.error('Error creating order:', error);
  423. }
  424. });
  425. }
  426. });
  427. });
  428. </script>
  429. </body>
  430. </html>