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.

311 lines
13 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>Salary Details</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">Salary Details</li>
  38. </ol>
  39. </nav>
  40. </div>
  41. </div>
  42. </div>
  43. <hr>
  44. <div class="row">
  45. <div class="col-sm-3">
  46. <label for="month">Month:</label>
  47. <select id="month" class="form-control" required>
  48. <option value="">Select</option>
  49. <option value="January">January</option>
  50. <option value="February">February</option>
  51. <option value="March">March</option>
  52. <option value="April">April</option>
  53. <option value="May">May</option>
  54. <option value="June">June</option>
  55. <option value="July">July</option>
  56. <option value="August">August</option>
  57. <option value="September">September</option>
  58. <option value="October">October</option>
  59. <option value="November">November</option>
  60. <option value="December">December</option>
  61. </select>
  62. </div>
  63. <div class="col-sm-3">
  64. <label for="year">Year:</label>
  65. <input type="number" id="year" class="form-control" min="2000" max="2100" required>
  66. </div>
  67. <div class="col-sm-3">
  68. <button class="btn btn-primary mt-4" onclick="fetchSalaryDetails()">Get Salary Info</button>
  69. </div>
  70. </div>
  71. <div class="card-block mt-3">
  72. <div>
  73. <table id="salaryDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="99.5%">
  74. <thead class="thead-dark">
  75. <tr role="row">
  76. <th>S.No</th>
  77. <th>Employee Name</th>
  78. <th>Total Number of days</th>
  79. <th>Number of days present</th>
  80. <th>Number of days Absent</th>
  81. <th>OD</th>
  82. <th>Total Days for the Salary</th>
  83. <th>Month</th>
  84. <th>Year</th>
  85. <th>Salary Amount</th>
  86. <th><input type="checkbox" id="selectAll"> Action</th>
  87. </tr>
  88. </thead>
  89. <tbody>
  90. <tr th:each="salaryCounts, i : ${salaryCounts}">
  91. <td th:text="${i.count}">0</td>
  92. <td th:text="${salaryCounts.name}"></td>
  93. <td th:text="${salaryCounts.total_days}"></td>
  94. <td th:text="${salaryCounts.total_days_present}"></td>
  95. <td th:text="${salaryCounts.total_days_absent}"></td>
  96. <td th:text="${salaryCounts.total_days_od}"></td>
  97. <td th:text="${salaryCounts.total_days_salary}"></td>
  98. <td th:text="${salaryCounts.month}"></td>
  99. <td th:text="${salaryCounts.year}"></td>
  100. <td th:text="${salaryCounts.total_salary}"></td>
  101. <td>
  102. <!-- Show "Approved" badge if salary_status is 'Approved' -->
  103. <span th:if="${salaryCounts.salary_status == 'Approved'}" class="badge badge-primary">Approved</span>
  104. <!-- Show "Initiated" badge if salary_status is 'Initiated' -->
  105. <span th:if="${salaryCounts.salary_status == 'Initiated'}" class="badge badge-success">Initiated</span>
  106. <!-- Show checkbox if salary_status is neither 'Approved' nor 'Initiated' -->
  107. <input type="checkbox" th:unless="${salaryCounts.salary_status == 'Approved' || salaryCounts.salary_status == 'Initiated'}"
  108. class="initiate-checkbox"
  109. th:data-enrollment-id="${salaryCounts.enrollment_id}"
  110. th:data-total-days-present="${salaryCounts.total_days_present}"
  111. th:data-total-days-od="${salaryCounts.total_days_od}"
  112. th:data-total-days="${salaryCounts.total_days}"
  113. th:data-total-days-absent="${salaryCounts.total_days_absent}"
  114. th:data-month="${salaryCounts.month}"
  115. th:data-year="${salaryCounts.year}"
  116. th:data-salary-amount="${salaryCounts.total_salary}"
  117. th:data-salary-status="${salaryCounts.salary_status}"
  118. th:data-group-id="${salaryCounts.group_id}"
  119. th:data-wage-id="${salaryCounts.wage_id}">
  120. </td>
  121. </tr>
  122. </tbody>
  123. <tfoot class="thead-dark">
  124. <tr role="row">
  125. <th>S.No</th>
  126. <th>Employee Name</th>
  127. <th>Total Number of days</th>
  128. <th>Number of days present</th>
  129. <th>Number of days Absent</th>
  130. <th>OD</th>
  131. <th>Total Days for the Salary</th>
  132. <th>Month</th>
  133. <th>Year</th>
  134. <th>Salary Amount</th>
  135. <th>Action</th>
  136. </tr>
  137. </tfoot>
  138. </table>
  139. <button id="initiateButton" class="btn btn-success">Initiate</button>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  145. </div>
  146. </div>
  147. <div th:replace="~{fragments/modules/pgr/modal-box :: div}"></div>
  148. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  149. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  150. <script th:replace="~{fragments/modules/pgr/script :: script}"></script>
  151. <script th:inline="javascript">
  152. function fetchSalaryDetails() {
  153. const month = document.getElementById('month').value;
  154. const year = document.getElementById('year').value;
  155. if (month && year) {
  156. window.location.href = `/gcc/nulm/salaryDetails?month=${month}&year=${year}`;
  157. } else {
  158. alert("Please select both month and year.");
  159. }
  160. }
  161. $(document).ready(function () {
  162. // Initialize DataTable
  163. var table = $('#salaryDatatable').DataTable({
  164. dom: 'Bftip',
  165. columnDefs: [
  166. { targets: 'no-sort', orderable: false }
  167. ],
  168. lengthMenu: [
  169. [50, 100, 200, 500, -1],
  170. ['50 rows', '100 rows', '200 rows', 'Show all']
  171. ],
  172. scrollY: '50vh',
  173. fixedColumns: {
  174. left: 1,
  175. right: 1
  176. },
  177. buttons: [
  178. {
  179. extend: 'pageLength',
  180. className: 'btn btn-warning'
  181. },
  182. {
  183. title: 'Data export',
  184. extend: 'copyHtml5',
  185. text: 'Copy',
  186. className: 'btn btn-secondary',
  187. id: 'copyBtn'
  188. },
  189. {
  190. extend: 'pdfHtml5',
  191. text: 'PDF',
  192. className: 'btn btn-secondary',
  193. id: 'pdfBtn'
  194. }
  195. ],
  196. fixedHeader: true,
  197. autoWidth: true,
  198. responsive: true,
  199. searching: true,
  200. select: false,
  201. processing: false
  202. });
  203. // Handle "Select All" checkbox change event
  204. $("#selectAll").on('change', function () {
  205. $(".initiate-checkbox").prop('checked', this.checked);
  206. });
  207. // Handle individual checkboxes change event to update the "Select All" checkbox
  208. $(".initiate-checkbox").on('change', function () {
  209. if ($('.initiate-checkbox:checked').length === $('.initiate-checkbox').length) {
  210. $('#selectAll').prop('checked', true);
  211. } else {
  212. $('#selectAll').prop('checked', false);
  213. }
  214. });
  215. // Approve button click event
  216. $("#initiateButton").click(function (event){
  217. event.preventDefault();
  218. // Collect selected row data
  219. let selectedRows = [];
  220. $(".initiate-checkbox:checked").each(function () {
  221. const enrollmentId = $(this).data("enrollment-id");
  222. const totalDaysPresent = $(this).data("total-days-present");
  223. const totalDaysOd = $(this).data("total-days-od");
  224. const totalDays = $(this).data("total-days");
  225. const totalDaysAbsent = $(this).data("total-days-absent");
  226. const month = $(this).data("month");
  227. const year = $(this).data("year");
  228. const salaryAmount = $(this).data("salary-amount");
  229. const salaryStatus = $(this).data("salary-status");
  230. const groupId = $(this).data("group-id");
  231. const wageId = $(this).data("wage-id");
  232. selectedRows.push({
  233. enrollment_id: parseInt(enrollmentId),
  234. total_days_present: parseInt(totalDaysPresent),
  235. total_days_od: parseInt(totalDaysOd),
  236. total_days: parseInt(totalDays),
  237. total_days_absent: parseInt(totalDaysAbsent),
  238. month: month,
  239. year: parseInt(year),
  240. salary_amount: parseInt(salaryAmount),
  241. salary_status: salaryStatus,
  242. group_id: parseInt(groupId),
  243. wage_id: parseInt(wageId)
  244. });
  245. });
  246. // If no rows are selected, show an alert
  247. if (selectedRows.length === 0) {
  248. alert("Please select at least one row to approve.");
  249. return;
  250. }
  251. // Send AJAX POST request using jQuery
  252. $.ajax({
  253. url: "/gcc/api/nulm/salaryDetailUpdate",
  254. type: "POST",
  255. contentType: "application/json",
  256. data: JSON.stringify(selectedRows), // Send array of objects
  257. success: function (response) {
  258. Swal.fire({
  259. title: 'Success!',
  260. text: 'Selected Staffs for Salary has been Initited successfully!',
  261. icon: 'success',
  262. confirmButtonText: 'OK'
  263. }).then((result) => {
  264. if (result.isConfirmed) {
  265. // Optionally, you could refresh the page or update the UI to reflect the changes
  266. location.reload(); // This will reload the page to fetch the latest data
  267. }
  268. });
  269. },
  270. error: function (xhr, status, error) {
  271. console.error("Error:", error);
  272. alert("An error occurred while approving salary details.");
  273. }
  274. });
  275. });
  276. })
  277. </script>
  278. </body>
  279. </html>