softDelete features
This commit is contained in:
@@ -160,6 +160,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 = {};
|
||||
@@ -258,6 +261,7 @@
|
||||
<a href="<?php echo $server_url?>finance/manage_payment.php?id=${r.id}" title="View payment">
|
||||
<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_payment(${r.id})"><i class="ti ti-trash fs-5"></i></a>` : ''}
|
||||
</td>
|
||||
</tr>`;
|
||||
});
|
||||
@@ -457,6 +461,24 @@
|
||||
$(this).removeAttr('data-id');
|
||||
});
|
||||
|
||||
function delete_payment(id) {
|
||||
bootbox.confirm({
|
||||
message: 'Delete this payment? 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_payment.php',
|
||||
autoPrepare: false,
|
||||
checkRequired: 0,
|
||||
action: 'delete',
|
||||
data: { id: id },
|
||||
onSuccess: function() { load_payments(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(async function() {
|
||||
flatpickr('#payment_date', { dateFormat: 'd/m/Y', allowInput: true });
|
||||
load_departments('department_id');
|
||||
|
||||
Reference in New Issue
Block a user