70 lines
2.6 KiB
JavaScript
70 lines
2.6 KiB
JavaScript
|
|
$(function(){
|
||
|
|
$.ajaxSetup({
|
||
|
|
headers: {
|
||
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
var update_notification_status_url = $('#update_notification_status_url').val();
|
||
|
|
|
||
|
|
$(document).on('click', '.noti-checkbox', function(){
|
||
|
|
|
||
|
|
var noti_key = $(this).attr('data-noti-key');
|
||
|
|
$('.noti-checkbox').prop('disabled', true);
|
||
|
|
$.ajax({
|
||
|
|
url: update_notification_status_url.replace(':notification', noti_key),
|
||
|
|
type: 'get',
|
||
|
|
dataType:'json',
|
||
|
|
success:function(response) {
|
||
|
|
console.log('response', response);
|
||
|
|
$('.noti-checkbox').prop('disabled', false);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
$(document).on('submit', '#update_password_form', function(e){
|
||
|
|
e.preventDefault();
|
||
|
|
$.ajax({
|
||
|
|
url: $(this).attr('action'),
|
||
|
|
type: 'post',
|
||
|
|
data: $(this).serialize(),
|
||
|
|
dataType:'json',
|
||
|
|
success:function(reponse) {
|
||
|
|
if (reponse.success) {
|
||
|
|
$('#update_password_form').find('input').val('');
|
||
|
|
$('#update_password_response').html(`<div class="alert alert-success" role="alert">${reponse.message}</div>`);
|
||
|
|
} else {
|
||
|
|
$('#update_password_response').html(`<div class="alert alert-danger" role="alert">${reponse.message}</div>`);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
error:function(err) {
|
||
|
|
var error = err.responseJSON;
|
||
|
|
$('#update_password_response').html(`<div class="alert alert-danger" role="alert">${error.message}</div>`);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
$(document).on('submit', '#submit_enquiry_form', function(e){
|
||
|
|
e.preventDefault();
|
||
|
|
$.ajax({
|
||
|
|
url: $(this).attr('action'),
|
||
|
|
type: 'post',
|
||
|
|
data: $(this).serialize(),
|
||
|
|
dataType:'json',
|
||
|
|
success:function(reponse) {
|
||
|
|
if (reponse.success) {
|
||
|
|
$('#submit_enquiry_form').find('input').val('');
|
||
|
|
$('#submit_enquiry_form').find('textarea').val('');
|
||
|
|
$('#enquiry-response-con').html(`<div class="alert alert-success" role="alert">${reponse.message}</div>`);
|
||
|
|
} else {
|
||
|
|
$('#enquiry-response-con').html(`<div class="alert alert-danger" role="alert">${reponse.message}</div>`);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
error:function(err) {
|
||
|
|
var error = err.responseJSON;
|
||
|
|
$('#enquiry-response-con').html(`<div class="alert alert-danger" role="alert">${error.message}</div>`);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|