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.

333 lines
12 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>DropOut</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">DropOut</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">DropOut</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;">DropOut
  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%;">DropOut
  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>
  140. </div>
  141. <div class="d-flex justify-content-center">
  142. <button class="btn"
  143. style="background-color: #414f69; color: white; width: 200px;padding: 10px;margin-bottom: 10px;"
  144. id="createorder">
  145. Create DropOut
  146. </button>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  152. </div>
  153. </div>
  154. <div th:replace="~{fragments/modules/pgr/modal-box :: div}"></div>
  155. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  156. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  157. <script th:replace="~{fragments/modules/pgr/script :: script}"></script>
  158. <script th:inline="javascript">
  159. $(document).ready(function() {
  160. // Function to load order details
  161. function loadOrderDetails() {
  162. $.ajax({
  163. url: '/gcc/api/nulm/getAllOrderDetails', // Updated Endpoint URL
  164. method: 'GET',
  165. dataType: 'json',
  166. success: function(data) {
  167. var $dropdown = $('#orderNumberDropdown');
  168. $dropdown.empty();
  169. $dropdown.append('<option value="">Select Order</option>');
  170. $.each(data, function(index, order) {
  171. $dropdown.append('<option value="' + order.order_id + '">' + order.order_number + '</option>');
  172. });
  173. },
  174. error: function(xhr, status, error) {
  175. console.error('Error fetching order details:', error);
  176. }
  177. });
  178. }
  179. // Load order details when the document is ready
  180. loadOrderDetails();
  181. // Handle order number selection
  182. $('#orderNumberDropdown').change(function() {
  183. var orderId = $(this).val();
  184. var $orderDetails = $('#orderDetails');
  185. var $groupBoxSection = $('#groupboxsection');
  186. if (orderId) {
  187. // Display the order details and group section
  188. $orderDetails.show();
  189. $groupBoxSection.show();
  190. // Fetch group names based on selected order ID
  191. $.ajax({
  192. url: '/gcc/api/nulm/getSchemeGroupNamesByOrderId',
  193. method: 'GET',
  194. data: { orderId: orderId },
  195. dataType: 'json',
  196. success: function(data) {
  197. console.log('Group names data:', data); // Log the response to check if it’s correct
  198. var $groupDropdown = $('#grouplist'); // Ensure you are updating the correct dropdown
  199. $groupDropdown.empty(); // Clear the dropdown before appending new options
  200. $groupDropdown.append('<option value="">Select Scheme Group</option>');
  201. // Check if data is an array and has the expected structure
  202. if (Array.isArray(data) && data.length > 0) {
  203. $.each(data, function(index, group) {
  204. $groupDropdown.append('<option value="' + group.group_id + '">' + group.group_name + '</option>');
  205. });
  206. } else {
  207. console.error('No group names available');
  208. }
  209. },
  210. error: function(xhr, status, error) {
  211. console.error('Error fetching group names:', error);
  212. }
  213. });
  214. // Fetch the enrollment counts based on the selected order ID
  215. $.ajax({
  216. url: '/gcc/api/nulm/dropOutCounts',
  217. method: 'GET',
  218. data: { orderId: orderId },
  219. dataType: 'json',
  220. success: function(counts) {
  221. // Update the values in the cards
  222. $('#total').text(counts.total_count || 0);
  223. $('#pending').text(counts.total_yes || 0);
  224. $('#notappointed').text(counts.total_drop || 0);
  225. },
  226. error: function(xhr, status, error) {
  227. console.error('Error fetching enrollment counts:', error);
  228. }
  229. });
  230. } else {
  231. // Hide the order details and group section if no order is selected
  232. $orderDetails.hide();
  233. $groupBoxSection.hide();
  234. }
  235. });
  236. });
  237. $(document).ready(function() {
  238. $('#createorder').click(function() {
  239. var totalstaff = parseInt($('#total').text(), 10); // Convert total staff to an integer
  240. var selectedEnrollments = [];
  241. var orderId = parseInt($('#orderNumberDropdown').val(), 10); // Ensure orderId is an integer
  242. $('.order-checkbox:checked').each(function() {
  243. selectedEnrollments.push(parseInt($(this).val(), 10)); // Ensure enrollmentIds are integers
  244. });
  245. if (selectedEnrollments.length > totalstaff) {
  246. // Show SweetAlert if the number of selected enrollments exceeds the total staff count
  247. Swal.fire({
  248. icon: 'warning',
  249. title: 'Limit Exceeded',
  250. text: `For this order, only ${totalstaff} staff members are allowed.`
  251. });
  252. } else {
  253. // Proceed with the order creation logic
  254. $.ajax({
  255. url: '/gcc/api/nulm/assignDropout',
  256. method: 'POST',
  257. contentType: 'application/json', // Set the content type to JSON
  258. data: JSON.stringify({
  259. enrollmentIds: selectedEnrollments,
  260. orderId: orderId
  261. }), // Convert the data to JSON string
  262. success: function(response) {
  263. // Show SweetAlert on success
  264. Swal.fire({
  265. icon: 'success',
  266. title: 'Order Dropped',
  267. text: 'The order has been dropped out.',
  268. confirmButtonText: 'OK'
  269. }).then((result) => {
  270. if (result.isConfirmed) {
  271. // Reload the page after SweetAlert is confirmed
  272. location.reload();
  273. }
  274. });
  275. },
  276. error: function(xhr, status, error) {
  277. // Show error message using SweetAlert
  278. Swal.fire({
  279. icon: 'error',
  280. title: 'Error',
  281. text: 'An error occurred while creating the order. Please try again later.'
  282. });
  283. console.error('Error creating order:', error);
  284. }
  285. });
  286. }
  287. });
  288. });
  289. </script>
  290. </body>
  291. </html>