softDelete features

This commit is contained in:
Thanakorn S
2026-05-22 14:07:22 +07:00
parent f04554793e
commit 2410f7bade
59 changed files with 1783 additions and 16 deletions
+22
View File
@@ -162,6 +162,8 @@
<script>
const can_delete = ['admin', 'owner'].includes(user_role);
// ── Status helpers ────────────────────────────────────────────────────────
function order_status_badge(status) {
status = parseInt(status);
@@ -268,6 +270,7 @@
onclick="cancel_order(${o.id})">
<i class="ti ti-x fs-5"></i>
</a>` : ''}
${can_delete ? `<a href="javascript:void(0);" class="link-danger ms-2" title="Delete" onclick="delete_order(${o.id})"><i class="ti ti-trash fs-5"></i></a>` : ''}
</td>
</tr>`;
});
@@ -301,6 +304,25 @@
}
function delete_order(id) {
bootbox.confirm({
message: 'Delete this order? Unconfirmed stock-out rows will also be removed.',
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?>order/api/engine/delete_order.php',
autoPrepare: false,
checkRequired: 0,
action: 'delete',
data: { id: id },
onSuccess: function() { retrieve_orders(); }
});
}
});
}
// ── Boot ─────────────────────────────────────────────────────────────────
$(async function() {
await load_dept_cache();