fixed otp email settings and added edit/delete to show tabs

This commit is contained in:
Kwesi Banson Jnr
2026-08-27 12:51:35 +00:00
parent 3ab91468a8
commit e4926ea726
3 changed files with 71 additions and 27 deletions

View File

@@ -386,16 +386,11 @@ document.addEventListener("DOMContentLoaded", function() {
$(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}`,
url: base_url + `/client-notes/${id}`,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(res) {
location.reload();
}
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
success: function(res) { location.reload(); }
});
}
});
@@ -405,7 +400,7 @@ document.addEventListener("DOMContentLoaded", function() {
let id = $(this).data('id');
if(confirm("Are you sure you want to delete this short code?")) {
$.ajax({
url: `/shortcodes/${id}`,
url: base_url + `/shortcodes/${id}`,
type: 'DELETE',
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
success: function(res) { location.reload(); }
@@ -418,7 +413,7 @@ document.addEventListener("DOMContentLoaded", function() {
let id = $(this).data('id');
if(confirm("Are you sure you want to delete this payment record?")) {
$.ajax({
url: `/payments/${id}`,
url: base_url + `/client-payments/${id}`,
type: 'DELETE',
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
success: function(res) { location.reload(); }
@@ -426,7 +421,9 @@ document.addEventListener("DOMContentLoaded", function() {
}
});
// --- POPULATE NOTE EDIT MODAL ---
// --- POPULATE EDIT MODALS ---
// 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();
@@ -434,13 +431,12 @@ document.addEventListener("DOMContentLoaded", function() {
$('#edit_note_id').val(id);
$('#edit_note_body').val(body);
$('#editNoteForm').attr('action', `/notes/${id}`);
// Replaced vanilla JS with jQuery modal show
// Fixed URL
$('#editNoteForm').attr('action', base_url + `/client-notes/${id}`);
$('#editNoteModal').modal('show');
});
// --- POPULATE SHORT CODE EDIT MODAL ---
// Populate Short Code Edit Modal
$(document).on('click', '.edit-shortcode-btn', function() {
let id = $(this).data('id');
@@ -452,13 +448,12 @@ document.addEventListener("DOMContentLoaded", function() {
$('#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
// Fixed URL
$('#editShortcodeForm').attr('action', base_url + `/shortcodes/${id}`);
$('#editShortcodeModal').modal('show');
});
// --- POPULATE PAYMENT EDIT MODAL ---
// Populate Payment Edit Modal
$(document).on('click', '.edit-payment-btn', function() {
let id = $(this).data('id');
@@ -468,9 +463,8 @@ document.addEventListener("DOMContentLoaded", function() {
$('#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
// Fixed URL
$('#editPaymentForm').attr('action', base_url + `/client-payments/${id}`);
$('#editPaymentModal').modal('show');
});