softDelete features

This commit is contained in:
Thanakorn S
2026-05-22 14:07:22 +07:00
parent 738f600fe8
commit 648efee991
59 changed files with 1783 additions and 16 deletions
+22
View File
@@ -138,6 +138,9 @@
<?php require '../include_ending.php'; ?>
<script>
const can_delete = ['admin', 'owner'].includes(user_role);
var billable_documents = [];
function show_billing_form() {
@@ -207,6 +210,7 @@
<a href="<?php echo $server_url?>finance/manage_receipt_billing.php?id=${r.id}" title="View receipt billing">
<i class="ti ti-eye fs-5"></i>
</a>
${can_delete ? `<a href="javascript:void(0);" class="link-danger ms-2" title="Delete" onclick="delete_billing(${r.id})"><i class="ti ti-trash fs-5"></i></a>` : ''}
</td>
</tr>`;
});
@@ -347,6 +351,24 @@
$(this).removeAttr('data-id');
});
function delete_billing(id) {
bootbox.confirm({
message: 'Delete this billing? All linked receipts must be deleted first.',
buttons: { confirm: { label: 'Delete', className: 'btn-danger' }, cancel: { label: 'Back', className: 'btn-secondary' } },
callback: function(result) {
if (!result) return;
ajax_request({
url: '<?php echo $server_url?>finance/api/engine/delete_receipt_billing.php',
autoPrepare: false,
checkRequired: 0,
action: 'delete',
data: { id: id },
onSuccess: function() { load_billings(); }
});
}
});
}
$(function() {
flatpickr('#billing_date', { dateFormat: 'd/m/Y', allowInput: true });
load_billings();