softDelete features
This commit is contained in:
@@ -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_payment_billing.php?id=${r.id}" title="View payment 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 payments 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_payment_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();
|
||||
|
||||
Reference in New Issue
Block a user