softDelete features
This commit is contained in:
@@ -188,6 +188,9 @@
|
||||
<?php require '../include_ending.php'; ?>
|
||||
|
||||
<script>
|
||||
|
||||
const can_delete = ['admin', 'owner'].includes(user_role);
|
||||
|
||||
var open_billings = [];
|
||||
var prefill_billing_id = <?php echo $prefill_billing_id; ?>;
|
||||
var formula_map = {};
|
||||
@@ -288,6 +291,7 @@
|
||||
<a href="<?php echo $server_url?>finance/manage_receipt.php?id=${r.id}" title="View receipt">
|
||||
<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_receipt(${r.id})"><i class="ti ti-trash fs-5"></i></a>` : ''}
|
||||
</td>
|
||||
</tr>`;
|
||||
});
|
||||
@@ -482,6 +486,24 @@
|
||||
$(this).removeAttr('data-id');
|
||||
});
|
||||
|
||||
function delete_receipt(id) {
|
||||
bootbox.confirm({
|
||||
message: 'Delete this receipt? The GL entry and invoice allocations will be reversed.',
|
||||
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.php',
|
||||
autoPrepare: false,
|
||||
checkRequired: 0,
|
||||
action: 'delete',
|
||||
data: { id: id },
|
||||
onSuccess: function() { load_receipts(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(async function() {
|
||||
flatpickr('#receipt_date', { dateFormat: 'd/m/Y', allowInput: true });
|
||||
load_departments('department_id');
|
||||
|
||||
Reference in New Issue
Block a user