fixed otp email settings
This commit is contained in:
@@ -8,7 +8,8 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
|
||||
|
||||
// Generic AJAX handler for standard forms (Shortcodes & Payments)
|
||||
$(document).on('submit', '#shortcodeForm, #paymentForm, #noteForm', function(e) {
|
||||
// $(document).on('submit', '#shortcodeForm, #paymentForm, #noteForm', function(e) {
|
||||
$(document).on('submit', '#shortcodeForm, #paymentForm, #noteForm, #editNoteForm, #editShortcodeForm, #editPaymentForm', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
let $form = $(this);
|
||||
@@ -378,5 +379,100 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Confirm and Delete Note
|
||||
$(document).on('click', '.delete-note-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
if(confirm("Are you sure you want to delete this note? This action cannot be undone.")) {
|
||||
// Send AJAX DELETE request using the meta tag for CSRF
|
||||
$.ajax({
|
||||
url: `/notes/${id}`,
|
||||
type: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(res) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Confirm and Delete Short Code
|
||||
$(document).on('click', '.delete-shortcode-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
if(confirm("Are you sure you want to delete this short code?")) {
|
||||
$.ajax({
|
||||
url: `/shortcodes/${id}`,
|
||||
type: 'DELETE',
|
||||
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
|
||||
success: function(res) { location.reload(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Confirm and Delete Payment
|
||||
$(document).on('click', '.delete-payment-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
if(confirm("Are you sure you want to delete this payment record?")) {
|
||||
$.ajax({
|
||||
url: `/payments/${id}`,
|
||||
type: 'DELETE',
|
||||
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
|
||||
success: function(res) { location.reload(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// --- POPULATE NOTE EDIT MODAL ---
|
||||
$(document).on('click', '.edit-note-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
let body = $(this).closest('.list-group-item').find('p').text();
|
||||
|
||||
$('#edit_note_id').val(id);
|
||||
$('#edit_note_body').val(body);
|
||||
|
||||
$('#editNoteForm').attr('action', `/notes/${id}`);
|
||||
|
||||
// Replaced vanilla JS with jQuery modal show
|
||||
$('#editNoteModal').modal('show');
|
||||
});
|
||||
|
||||
// --- POPULATE SHORT CODE EDIT MODAL ---
|
||||
$(document).on('click', '.edit-shortcode-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
|
||||
$('#edit_shortcode_id').val(id);
|
||||
$('#edit_sc_type').val($(this).data('type'));
|
||||
$('#edit_sc_code').val($(this).data('code'));
|
||||
$('#edit_sc_network').val($(this).data('network'));
|
||||
$('#edit_sc_status').val($(this).data('status'));
|
||||
$('#edit_sc_expiry').val($(this).data('expiry'));
|
||||
$('#edit_sc_remarks').val($(this).data('remarks'));
|
||||
|
||||
$('#editShortcodeForm').attr('action', `/shortcodes/${id}`);
|
||||
|
||||
// Replaced vanilla JS with jQuery modal show
|
||||
$('#editShortcodeModal').modal('show');
|
||||
});
|
||||
|
||||
// --- POPULATE PAYMENT EDIT MODAL ---
|
||||
$(document).on('click', '.edit-payment-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
|
||||
$('#edit_payment_id').val(id);
|
||||
$('#edit_pay_invoice').val($(this).data('invoice'));
|
||||
$('#edit_pay_amount').val($(this).data('amount'));
|
||||
$('#edit_pay_date').val($(this).data('date'));
|
||||
$('#edit_pay_status').val($(this).data('status'));
|
||||
|
||||
$('#editPaymentForm').attr('action', `/payments/${id}`);
|
||||
|
||||
// Replaced vanilla JS with jQuery modal show
|
||||
$('#editPaymentModal').modal('show');
|
||||
});
|
||||
|
||||
}); // <-- End of the main $(document).ready
|
||||
});
|
||||
Reference in New Issue
Block a user