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
@@ -148,6 +148,9 @@
<?php require '../include_ending.php'; ?>
<script>
const can_delete = ['admin', 'owner'].includes(user_role);
function return_status_badge(status) {
const map = {
'-1': '<span class="badge bg-secondary">Cancelled</span>',
@@ -238,6 +241,7 @@
onclick="show_stock_rows('supplier_return', ${r.id}, '${escape_html(r.return_number || '')}')">
<i class="ti ti-packages fs-5"></i>
</a>
${can_delete ? `<a href="javascript:void(0);" class="link-danger ms-2" title="Delete" onclick="delete_supplier_return(${r.id})"><i class="ti ti-trash fs-5"></i></a>` : ''}
</td>
</tr>`;
});
@@ -245,6 +249,24 @@
$('table#return_list tbody').html(body);
}
function delete_supplier_return(id) {
bootbox.confirm({
message: 'Delete this return? Unconfirmed stock rows will 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?>po/api/engine/delete_supplier_return.php',
autoPrepare: false,
checkRequired: 0,
action: 'delete',
data: { id: id },
onSuccess: function() { retrieve_returns(); }
});
}
});
}
$(async function() {
await load_dept_cache();
populate_dept_filter('filter_dept');