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.
 
 
 
 
 

126 lines
5.0 KiB

<!-- jQuery (required for DataTables plugin) -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- DataTables Plugins -->
<script src="js/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="js/plugins/datatables-bs5/js/dataTables.bootstrap5.min.js"></script>
<script src="js/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="js/plugins/datatables-responsive-bs5/js/responsive.bootstrap5.min.js"></script>
<script src="js/plugins/datatables-buttons/dataTables.buttons.min.js"></script>
<script src="js/plugins/datatables-buttons-bs5/js/buttons.bootstrap5.min.js"></script>
<script src="js/plugins/datatables-buttons-jszip/jszip.min.js"></script>
<script src="js/plugins/datatables-buttons-pdfmake/pdfmake.min.js"></script>
<script src="js/plugins/datatables-buttons-pdfmake/vfs_fonts.js"></script>
<script src="js/plugins/datatables-buttons/buttons.print.min.js"></script>
<script src="js/plugins/datatables-buttons/buttons.html5.min.js"></script>
<!-- Other Plugins -->
<script src="js/plugins/sweetalert2/sweetalert2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!--<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>-->
<!--<script src="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.js"></script>-->
<link rel="stylesheet" type="text/css" href="..\files\assets\css\swiper-bundle.min.css">
<!-- Your Custom Script -->
<script src="js/dashmix.app.min.js"></script>
<!-- Bootstrap and Multiselect -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js"></script>
<script>
$(document).ready(function () {
// Get the current URL
var currentUrl = window.location.href;
// Loop through each navigation item
$('.nav-main-item').each(function () {
// Get the link for this item
var link = $(this).find('.nav-main-link').attr('href');
//console.log(link + " == " + currentUrl + " == " + currentUrl.indexOf(link));
// Check if the link matches the current URL
if (currentUrl.indexOf(link) !== -1) {
// Add the active class to this item
$(this).find('.nav-main-link').addClass('active');
// Add the open class to the parent item
$(this).parents('.nav-main-item').addClass('open');
}
});
});
function resetPassword() {
$('#resetpinForm').modal('show');
}
function resetpinsave() {
let resetpinmobilenumber = $("#resetpinmobilenumber").val();
let oldpin = $("#oldpin").val();
let newpin = $("#newpin").val();
// Validate that all fields are filled
if (!resetpinmobilenumber || !oldpin || !newpin) {
Swal.fire('Error', 'Please fill all the fields.', 'error');
return false; // Prevent form submission
}
$.ajax({
type: "GET",
url: '/communityhall/careTaker/api/resetPIN',
data: {
'oldpin': oldpin,
'newpin': newpin,
'resetpinmobilenumber': resetpinmobilenumber
},
dataType: 'text',
success: function(bodyMessage) {
if (bodyMessage.trim() === "Success") {
Swal.fire(
'PIN Registration!',
'Your New PIN Successfully Saved!<br>Now login with your new PIN.',
'success'
).then(() => {
window.location.href = '/communityhall/admin/logout';
});
} else if (bodyMessage.trim() === "error") {
Swal.fire(
'Error',
'Old PIN is not matched with your PIN',
'error'
)
}
},
error: function() {
Swal.fire(
'Error',
'An error occurred while processing your request. Please try again later.',
'error'
);
}
});
return false; // Prevent form submission as the form is handled by AJAX
}
document.addEventListener('DOMContentLoaded', function () {
function clearModalFields(modalId) {
const modal = document.getElementById(modalId);
if (modal) {
// Clear text inputs and select elements
modal.querySelectorAll('input[type="password"], select').forEach(input => {
if (input.tagName === 'SELECT') {
input.selectedIndex = 0; // Reset to default option
} else {
input.value = ''; // Clear text inputs
}
});
}
}
// Clear fields when the saveModal is hidden
document.getElementById('resetpinForm').addEventListener('hidden.bs.modal', function () {
clearModalFields('resetpinForm');
});
});
</script>