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.

125 lines
5.0 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!-- jQuery (required for DataTables plugin) -->
  2. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  3. <!-- DataTables Plugins -->
  4. <script src="js/plugins/datatables/jquery.dataTables.min.js"></script>
  5. <script src="js/plugins/datatables-bs5/js/dataTables.bootstrap5.min.js"></script>
  6. <script src="js/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
  7. <script src="js/plugins/datatables-responsive-bs5/js/responsive.bootstrap5.min.js"></script>
  8. <script src="js/plugins/datatables-buttons/dataTables.buttons.min.js"></script>
  9. <script src="js/plugins/datatables-buttons-bs5/js/buttons.bootstrap5.min.js"></script>
  10. <script src="js/plugins/datatables-buttons-jszip/jszip.min.js"></script>
  11. <script src="js/plugins/datatables-buttons-pdfmake/pdfmake.min.js"></script>
  12. <script src="js/plugins/datatables-buttons-pdfmake/vfs_fonts.js"></script>
  13. <script src="js/plugins/datatables-buttons/buttons.print.min.js"></script>
  14. <script src="js/plugins/datatables-buttons/buttons.html5.min.js"></script>
  15. <!-- Other Plugins -->
  16. <script src="js/plugins/sweetalert2/sweetalert2.min.js"></script>
  17. <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
  18. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  19. <!--<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>-->
  20. <!--<script src="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.js"></script>-->
  21. <link rel="stylesheet" type="text/css" href="..\files\assets\css\swiper-bundle.min.css">
  22. <!-- Your Custom Script -->
  23. <script src="js/dashmix.app.min.js"></script>
  24. <!-- Bootstrap and Multiselect -->
  25. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
  26. <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js"></script>
  27. <script>
  28. $(document).ready(function () {
  29. // Get the current URL
  30. var currentUrl = window.location.href;
  31. // Loop through each navigation item
  32. $('.nav-main-item').each(function () {
  33. // Get the link for this item
  34. var link = $(this).find('.nav-main-link').attr('href');
  35. //console.log(link + " == " + currentUrl + " == " + currentUrl.indexOf(link));
  36. // Check if the link matches the current URL
  37. if (currentUrl.indexOf(link) !== -1) {
  38. // Add the active class to this item
  39. $(this).find('.nav-main-link').addClass('active');
  40. // Add the open class to the parent item
  41. $(this).parents('.nav-main-item').addClass('open');
  42. }
  43. });
  44. });
  45. function resetPassword() {
  46. $('#resetpinForm').modal('show');
  47. }
  48. function resetpinsave() {
  49. let resetpinmobilenumber = $("#resetpinmobilenumber").val();
  50. let oldpin = $("#oldpin").val();
  51. let newpin = $("#newpin").val();
  52. // Validate that all fields are filled
  53. if (!resetpinmobilenumber || !oldpin || !newpin) {
  54. Swal.fire('Error', 'Please fill all the fields.', 'error');
  55. return false; // Prevent form submission
  56. }
  57. $.ajax({
  58. type: "GET",
  59. url: '/communityhall/careTaker/api/resetPIN',
  60. data: {
  61. 'oldpin': oldpin,
  62. 'newpin': newpin,
  63. 'resetpinmobilenumber': resetpinmobilenumber
  64. },
  65. dataType: 'text',
  66. success: function(bodyMessage) {
  67. if (bodyMessage.trim() === "Success") {
  68. Swal.fire(
  69. 'PIN Registration!',
  70. 'Your New PIN Successfully Saved!<br>Now login with your new PIN.',
  71. 'success'
  72. ).then(() => {
  73. window.location.href = '/communityhall/admin/logout';
  74. });
  75. } else if (bodyMessage.trim() === "error") {
  76. Swal.fire(
  77. 'Error',
  78. 'Old PIN is not matched with your PIN',
  79. 'error'
  80. )
  81. }
  82. },
  83. error: function() {
  84. Swal.fire(
  85. 'Error',
  86. 'An error occurred while processing your request. Please try again later.',
  87. 'error'
  88. );
  89. }
  90. });
  91. return false; // Prevent form submission as the form is handled by AJAX
  92. }
  93. document.addEventListener('DOMContentLoaded', function () {
  94. function clearModalFields(modalId) {
  95. const modal = document.getElementById(modalId);
  96. if (modal) {
  97. // Clear text inputs and select elements
  98. modal.querySelectorAll('input[type="password"], select').forEach(input => {
  99. if (input.tagName === 'SELECT') {
  100. input.selectedIndex = 0; // Reset to default option
  101. } else {
  102. input.value = ''; // Clear text inputs
  103. }
  104. });
  105. }
  106. }
  107. // Clear fields when the saveModal is hidden
  108. document.getElementById('resetpinForm').addEventListener('hidden.bs.modal', function () {
  109. clearModalFields('resetpinForm');
  110. });
  111. });
  112. </script>