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.

686 lines
20 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <html xmlns:th="http://www.thymeleaf.org">
  4. <head th:replace="~{fragments/modules/base/head :: head}"></head>
  5. <style>
  6. body {
  7. background-color: #f8f9fa;
  8. /* font-family: Arial, sans-serif;*/
  9. }
  10. .header {
  11. font-size: 22px;
  12. font-weight: bold;
  13. margin-bottom: 20px;
  14. }
  15. .table {
  16. border: 1px solid #dee2e6;
  17. }
  18. .table th,
  19. .table td {
  20. border: 1px solid #dee2e6;
  21. padding: 10px;
  22. }
  23. .section-title {
  24. font-size: 18px;
  25. font-weight: bold;
  26. margin-top: 20px;
  27. border-bottom: 2px solid #007bff;
  28. padding-bottom: 5px;
  29. }
  30. .form-group {
  31. margin-top: 15px;
  32. }
  33. .radio-group {
  34. display: flex;
  35. gap: 20px;
  36. margin-top: 10px;
  37. }
  38. .info-table {
  39. width: 100%;
  40. border-collapse: collapse;
  41. margin-top: 10px;
  42. }
  43. .info-table td,
  44. .info-table th {
  45. border: 1px solid #ddd;
  46. padding: 10px;
  47. vertical-align: middle;
  48. }
  49. .info-table td:first-child {
  50. font-weight: bold;
  51. width: 50%;
  52. }
  53. .info-table td:last-child {
  54. color: #555;
  55. }
  56. .btn-gap {
  57. margin-left: 1rem;
  58. /* or any value you like */
  59. }
  60. .student-data-wrapper {
  61. padding: 0px;
  62. margin-top: -58px;
  63. margin-left: -186px;
  64. width: 120%;
  65. }
  66. @media (max-width: 768px) {
  67. .student-data-wrapper {
  68. margin-left: 0;
  69. width: 100%;
  70. padding: 0 15px; /* Optional horizontal spacing */
  71. }
  72. }
  73. </style>
  74. <body>
  75. <div class="wrapper">
  76. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  77. <div class="page-wrap">
  78. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  79. <div class="card">
  80. <div class="main-content" style="background-color: white;">
  81. <!-- <div class="container">
  82. <div>
  83. <div style="padding: 0px;margin-top:-58px;margin-left: -233px;width:120%;">
  84. <div class="row" style=" padding: 15px;">
  85. <div class="col-md-6 form-group">
  86. <label>Total No of Students <span class="text-danger">*</span></label>
  87. <input type="text" class="form-control" placeholder="Enter the value"
  88. id="total_students" required />
  89. </div>
  90. </div>
  91. <div class="row" style=" padding: 15px;">
  92. <div class="col-md-4 form-group">
  93. <label>No of Boys <span class="text-danger">*</span></label>
  94. <input type="text" class="form-control" placeholder="Enter the value"
  95. id="total_boys" required />
  96. </div>
  97. <div class="col-md-4 form-group">
  98. <label>No of Girls <span class="text-danger">*</span></label>
  99. <input type="text" class="form-control" placeholder="Enter the value"
  100. id="total_girls" required />
  101. </div>
  102. <div class="col-md-4 form-group">
  103. <label>Others <span class="text-danger">*</span></label>
  104. <input type="text" class="form-control" placeholder="Enter the value"
  105. id="others" required />
  106. </div>
  107. </div>
  108. <div class="card-footer text-center" >
  109. <button type="submit" class="btn btn-primary" id="StudentSubmitBtn"><i
  110. class="ik ik-save"></i>Submit
  111. </button>
  112. <button type="reset" class="btn btn-secondary mr-2" id="StudentresetButton"><i
  113. class="ik ik-refresh-cw"></i>Reset
  114. </button>
  115. </div>
  116. </div>-->
  117. <div class="student-data-wrapper">
  118. <div class="card-header d-flex justify-content-between align-items-center">
  119. <b>Student Details</b>
  120. </div>
  121. <!-- Read-only View -->
  122. <div id="studentReadOnlyView" style="display: none;">
  123. <table class="info-table">
  124. <tr>
  125. <td>Total No of Students</td>
  126. <td id="readonly_total_students">-</td>
  127. </tr>
  128. <tr>
  129. <td>No of Boys</td>
  130. <td id="readonly_total_boys">-</td>
  131. </tr>
  132. <tr>
  133. <td>No of Girls</td>
  134. <td id="readonly_total_girls">-</td>
  135. </tr>
  136. <tr>
  137. <td>Transgender</td>
  138. <td id="readonly_others">-</td>
  139. </tr>
  140. </table>
  141. <br>
  142. <div class=" text-center">
  143. <button type="button" class="btn btn-primary" id="processupdate"
  144. style="display:none;">Update</button>
  145. </div>
  146. </div>
  147. <!-- Editable Form -->
  148. <div id="studentEntryForm" style="display: none;">
  149. <div class="row p-3">
  150. <div class="col-md-6 form-group">
  151. <label>Total No of Student <span class="text-danger">*</span></label>
  152. <input type="text" class="form-control" id="total_students" required />
  153. </div>
  154. </div>
  155. <div class="row p-3">
  156. <div class="col-md-4 form-group">
  157. <label>No of Boys <span class="text-danger">*</span></label>
  158. <input type="text" class="form-control" id="total_boys" required />
  159. </div>
  160. <div class="col-md-4 form-group">
  161. <label>No of Girls <span class="text-danger">*</span></label>
  162. <input type="text" class="form-control" id="total_girls" required />
  163. </div>
  164. <div class="col-md-4 form-group">
  165. <label>Transgender <span class="text-danger">*</span></label>
  166. <input type="text" class="form-control" id="others" required />
  167. </div>
  168. </div>
  169. <div class="card-footer text-center">
  170. <button type="submit" class="btn btn-primary" id="StudentSubmitBtn"><i
  171. class="ik ik-save"></i> Submit</button>
  172. <button type="reset" class="btn btn-secondary" id="StudentresetButton"><i
  173. class="ik ik-refresh-cw"></i> Reset</button>
  174. </div>
  175. </div>
  176. <!-- Modal for Update -->
  177. <div class="modal fade" id="studentUpdateModal" tabindex="-1">
  178. <div class="modal-dialog">
  179. <div class="modal-content">
  180. <div class="modal-header">
  181. <h5 class="modal-title">Update Student Details</h5>
  182. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  183. <span aria-hidden="true">&times;</span>
  184. </button>
  185. </div>
  186. <div class="modal-body">
  187. <div class="form-group"><label>Total Students *</label><input
  188. id="modal_total_students" class="form-control"></div>
  189. <div class="form-group"><label>No of Boys *</label><input id="modal_total_boys"
  190. class="form-control"></div>
  191. <div class="form-group"><label>No of Girls *</label><input
  192. id="modal_total_girls" class="form-control"></div>
  193. <div class="form-group"><label>Transgender *</label><input id="modal_others"
  194. class="form-control"></div>
  195. </div>
  196. <div class="modal-footer">
  197. <button type="button" class="btn btn-primary" id="saveModalUpdate">Save
  198. Changes</button>
  199. <button type="button" class="btn btn-secondary"
  200. data-bs-dismiss="modal">Close</button>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. <div id="pageLoader"
  207. style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
  208. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  209. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  210. <span class="sr-only">Loading...</span>
  211. </div>
  212. <!-- Add the 'Please wait' text below the spinner -->
  213. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  221. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
  222. <script type="text/javascript">
  223. $(document).ready(function () {
  224. const urlParams = new URLSearchParams(window.location.search);
  225. const schoolId = urlParams.get("schoolId");
  226. document.getElementById('total_students').addEventListener('input', function () {
  227. this.value = this.value.replace(/[^0-9]/g, '');
  228. if (parseInt(this.value) < 0) {
  229. this.value = '';
  230. }
  231. });
  232. document.getElementById('total_boys').addEventListener('input', function () {
  233. this.value = this.value.replace(/[^0-9]/g, '');
  234. if (parseInt(this.value) < 0) {
  235. this.value = '';
  236. }
  237. });
  238. document.getElementById('total_girls').addEventListener('input', function () {
  239. this.value = this.value.replace(/[^0-9]/g, '');
  240. if (parseInt(this.value) < 0) {
  241. this.value = '';
  242. }
  243. });
  244. document.getElementById('others').addEventListener('input', function () {
  245. this.value = this.value.replace(/[^0-9]/g, '');
  246. if (parseInt(this.value) < 0) {
  247. this.value = '';
  248. }
  249. });
  250. document.getElementById('modal_total_students').addEventListener('input', function () {
  251. this.value = this.value.replace(/[^0-9]/g, '');
  252. if (parseInt(this.value) < 0) {
  253. this.value = '';
  254. }
  255. });
  256. document.getElementById('modal_total_boys').addEventListener('input', function () {
  257. this.value = this.value.replace(/[^0-9]/g, '');
  258. if (parseInt(this.value) < 0) {
  259. this.value = '';
  260. }
  261. });
  262. document.getElementById('modal_total_girls').addEventListener('input', function () {
  263. this.value = this.value.replace(/[^0-9]/g, '');
  264. if (parseInt(this.value) < 0) {
  265. this.value = '';
  266. }
  267. });
  268. document.getElementById('modal_others').addEventListener('input', function () {
  269. this.value = this.value.replace(/[^0-9]/g, '');
  270. if (parseInt(this.value) < 0) {
  271. this.value = '';
  272. }
  273. });
  274. /* $.ajax({
  275. url: '/gcc/api/gccschool/buildingasset/getStudentStrengthBySchoolId',
  276. type: 'GET',
  277. data: {schoolId},
  278. success: function (response) {
  279. console.log(response);
  280. if (response.status === 'OK') {
  281. if(response.studentStrength.length > 0){
  282. const data = response.studentStrength[0]; // Get the first object from the array
  283. // Show the update button (assuming it's an ID, use #)
  284. $('#processupdate').show();
  285. //$('.card-footer').hide();
  286. $('#StudentSubmitBtn').hide();
  287. $('#StudentresetButton').hide();
  288. $('#refreshButton').show();
  289. // Populate values into the respective HTML elements
  290. $('#total_students').val(data.total_students || 0);
  291. $('#total_boys').val(data.total_boys || 0);
  292. $('#total_girls').val(data.total_girls || 0);
  293. $('#others').val(data.others || 0);
  294. }else
  295. {
  296. // Optional: handle the case where studentStrength is empty
  297. $('#total_students').text('');
  298. $('#total_boys').text('');
  299. $('#total_girls').text('');
  300. $('#others').text('');
  301. $('#processupdate').hide(); // hide update button if no data
  302. }
  303. }
  304. else if(response.status==='NEW'){
  305. $('#processupdate').hide();
  306. $('#refreshButton').hide();
  307. $('.card-footer').show();
  308. }
  309. }
  310. });*/
  311. $.ajax({
  312. url: '/gcc/api/gccschool/buildingasset/getStudentStrengthBySchoolId',
  313. type: 'GET',
  314. data: {schoolId},
  315. success: function (response) {
  316. if (response.status === 'OK' && response.studentStrength.length > 0) {
  317. const data = response.studentStrength[0];
  318. $('#readonly_total_students').text(data.total_students || 0);
  319. $('#readonly_total_boys').text(data.total_boys || 0);
  320. $('#readonly_total_girls').text(data.total_girls || 0);
  321. $('#readonly_others').text(data.others || 0);
  322. $('#studentReadOnlyView').show();
  323. $('#studentEntryForm').hide();
  324. $('#processupdate').show();
  325. $('#refreshButton').show();
  326. } else {
  327. $('#studentReadOnlyView').hide();
  328. $('#studentEntryForm').show();
  329. $('.card-footer').show();
  330. $('#processupdate').hide();
  331. $('#refreshButton').hide();
  332. }
  333. }
  334. });
  335. $('#processupdate').on('click', function () {
  336. $('#modal_total_students').val($('#readonly_total_students').text());
  337. $('#modal_total_boys').val($('#readonly_total_boys').text());
  338. $('#modal_total_girls').val($('#readonly_total_girls').text());
  339. $('#modal_others').val($('#readonly_others').text());
  340. $('#studentUpdateModal').modal('show');
  341. });
  342. $('#saveModalUpdate').on('click', function () {
  343. let requestData = {
  344. total_students: parseInt($('#modal_total_students').val()) || 0,
  345. total_boys: parseInt($('#modal_total_boys').val()) || 0,
  346. total_girls: parseInt($('#modal_total_girls').val()) || 0,
  347. others: parseInt($('#modal_others').val()) || 0,
  348. school_id: schoolId
  349. };
  350. if (!$('#modal_total_students').val().trim()) {
  351. Swal.fire({
  352. icon: 'warning',
  353. title: 'Validation Error',
  354. text: 'Please enter Total No of Students.',
  355. allowOutsideClick: false,
  356. allowEscapeKey: false,
  357. allowEnterKey: false,
  358. showConfirmButton: true
  359. });
  360. return;
  361. }
  362. if (!$('#modal_total_boys').val().trim()) {
  363. Swal.fire({
  364. icon: 'warning',
  365. title: 'Validation Error',
  366. text: 'Please enter No of Boys.',
  367. allowOutsideClick: false,
  368. allowEscapeKey: false,
  369. allowEnterKey: false,
  370. showConfirmButton: true
  371. });
  372. return;
  373. }
  374. if (!$('#modal_total_girls').val().trim()) {
  375. Swal.fire({
  376. icon: 'warning',
  377. title: 'Validation Error',
  378. text: 'Please enter No of Girls.',
  379. allowOutsideClick: false,
  380. allowEscapeKey: false,
  381. allowEnterKey: false,
  382. showConfirmButton: true
  383. });
  384. return;
  385. }
  386. if (!$('#modal_others').val().trim()) {
  387. Swal.fire({
  388. icon: 'warning',
  389. title: 'Validation Error',
  390. text: 'Please enter No of Transgender.',
  391. allowOutsideClick: false,
  392. allowEscapeKey: false,
  393. allowEnterKey: false,
  394. showConfirmButton: true
  395. });
  396. return;
  397. }
  398. if (requestData.total_students !== (requestData.total_boys + requestData.total_girls + requestData.others)) {
  399. Swal.fire('Validation Error', 'Total should equal Boys + Girls + Transgender.', 'warning');
  400. return;
  401. }
  402. $('#pageLoader').show();
  403. $.ajax({
  404. url: '/gcc/api/gccschool/schoolproperty/updateStudentDetails',
  405. type: 'POST',
  406. contentType: 'application/x-www-form-urlencoded', // important
  407. data: $.param(requestData), // flatten the object correctly
  408. success: function (res) {
  409. console.log("res:" + res);
  410. $('#pageLoader').hide();
  411. $('#studentUpdateModal').modal('hide');
  412. // Swal.fire('Updated!', res, 'success').then(() => location.reload());
  413. Swal.fire({
  414. title: 'Updated!',
  415. text: 'Student strength details updated successfully!',
  416. icon: 'success',
  417. allowOutsideClick: false,
  418. allowEscapeKey: false,
  419. allowEnterKey: false,
  420. showConfirmButton: true
  421. }).then(() => location.reload());
  422. },
  423. error: function (err) {
  424. $('#pageLoader').hide();
  425. Swal.fire({
  426. title: 'Error',
  427. text: err.responseText,
  428. icon: 'error',
  429. allowOutsideClick: false,
  430. allowEscapeKey: false,
  431. allowEnterKey: false,
  432. showConfirmButton: true
  433. });
  434. // Swal.fire('Error', err.responseText, 'error');
  435. }
  436. });
  437. });
  438. $(document).on('click', '#StudentSubmitBtn', function () {
  439. //parseInt($('#tot_staff').val()) || 0;
  440. let total_students = parseInt($('#total_students').val()) || 0;
  441. let total_boys = parseInt($('#total_boys').val()) || 0;
  442. let total_girls = parseInt($('#total_girls').val()) || 0;
  443. let others = parseInt($('#others').val()) || 0;
  444. //let school_id = 1;
  445. console.log("total_students=", total_students);
  446. console.log("total_boys=", total_boys);
  447. console.log("total_girls=", total_girls);
  448. console.log("others=", others);
  449. console.log("school_id=", schoolId);
  450. if (!$('#total_students').val().trim()) {
  451. Swal.fire({
  452. icon: 'warning',
  453. title: 'Validation Error',
  454. text: 'Please enter Total No of Students.',
  455. allowOutsideClick: false,
  456. allowEscapeKey: false,
  457. allowEnterKey: false,
  458. showConfirmButton: true
  459. });
  460. return;
  461. }
  462. if (!$('#total_boys').val().trim()) {
  463. Swal.fire({
  464. icon: 'warning',
  465. title: 'Validation Error',
  466. text: 'Please enter No of Boys.',
  467. allowOutsideClick: false,
  468. allowEscapeKey: false,
  469. allowEnterKey: false,
  470. showConfirmButton: true
  471. });
  472. return;
  473. }
  474. if (!$('#total_girls').val().trim()) {
  475. Swal.fire({
  476. icon: 'warning',
  477. title: 'Validation Error',
  478. text: 'Please enter No of Girls.',
  479. allowOutsideClick: false,
  480. allowEscapeKey: false,
  481. allowEnterKey: false,
  482. showConfirmButton: true
  483. });
  484. return;
  485. }
  486. if (!$('#others').val().trim()) {
  487. Swal.fire({
  488. icon: 'warning',
  489. title: 'Validation Error',
  490. text: 'Please enter No of Transgender.',
  491. allowOutsideClick: false,
  492. allowEscapeKey: false,
  493. allowEnterKey: false,
  494. showConfirmButton: true
  495. });
  496. return;
  497. }
  498. // Validate inputs
  499. let fields = {
  500. "Total No of Students": total_students,
  501. "No of Boys": total_boys,
  502. "No of Girls": total_girls,
  503. "Others": others,
  504. };
  505. /*for (let key in fields) {
  506. if (!fields[key] || isNaN(fields[key])) {
  507. Swal.fire({
  508. icon: 'info',
  509. title: 'Validation Error',
  510. text: `Please enter ${key}` + " , IF No means Enter 0",
  511. confirmButtonText: 'OK'
  512. });
  513. return; // Stop execution if validation fails
  514. }
  515. }*/
  516. if (total_students !== (total_boys + total_girls + others)) {
  517. Swal.fire({
  518. icon: 'warning',
  519. title: 'Validation Error',
  520. text: 'Total Students must be equal to the sum of No of Boys, No of Girls, and Transgender.',
  521. allowOutsideClick: false, // Disable clicking outside the modal to close it
  522. allowEscapeKey: false, // Disable escape key to close the modal
  523. allowEnterKey: false, // Disable enter key to close the modal
  524. showConfirmButton: true
  525. });
  526. return;
  527. }
  528. // Prepare Data for AJAX
  529. let requestData = {
  530. total_students: total_students,
  531. total_boys: total_boys,
  532. total_girls: total_girls,
  533. school_id: schoolId,
  534. others: others
  535. };
  536. $('#StudentSubmitBtn').prop('disabled', true).text('Processing...');
  537. $('#pageLoader').show();
  538. $.ajax({
  539. url: '/gcc/api/gccschool/schoolproperty/saveStudentStrength',
  540. type: 'POST',
  541. contentType: 'application/x-www-form-urlencoded',
  542. data: $.param(requestData),
  543. success: function (response) {
  544. $('#pageLoader').hide();
  545. $('#StudentSubmitBtn').prop('disabled', false).text('Submit');
  546. Swal.fire({
  547. icon: 'success',
  548. title: 'Success',
  549. text: response,
  550. allowOutsideClick: false,
  551. allowEscapeKey: false,
  552. allowEnterKey: false,
  553. confirmButtonText: 'OK'
  554. }).then((result) => {
  555. if (result.isConfirmed) {
  556. $('#StudentSubmitBtn').prop('disabled', false).text('Submit');
  557. location.reload();
  558. }
  559. });
  560. },
  561. error: function (xhr, status, error) {
  562. $('#pageLoader').hide();
  563. $('#StudentSubmitBtn').prop('disabled', false).text('Submit');
  564. let errorMessage = xhr.responseText;
  565. Swal.fire({
  566. icon: 'error',
  567. title: 'Error',
  568. text: errorMessage,
  569. confirmButtonText: 'OK'
  570. });
  571. console.error('Error:', xhr.responseText);
  572. }
  573. });
  574. });
  575. function resetStudentFields() {
  576. console.log("Reset button clicked");
  577. $('#total_students, #total_boys, #total_girls, #others').val('');
  578. }
  579. // Event Listener for Reset Button
  580. $(document).on('click', '#StudentresetButton', function (event) {
  581. event.preventDefault();
  582. resetStudentFields();
  583. });
  584. $('#refreshButton').on('click', function (e) {
  585. e.preventDefault(); // prevent default reset behavior, optional
  586. location.reload();
  587. });
  588. });
  589. </script>
  590. </body>
  591. </html>