implement JS password scoring, td_stock approve logicc

This commit is contained in:
Thanakorn S
2026-04-30 15:14:42 +07:00
parent db5c47b6ca
commit ac4fd9a5ad
3147 changed files with 1298 additions and 343 deletions
+47 -2
View File
@@ -133,10 +133,16 @@
<td class="py-3">${item['aisle']}</td>
<td class="py-3">${item['rack']}</td>
<td class="py-3">
${(item['status'])?'<span class="badge bg-success">Active</span>':'<span class="badge bg-secondary">Inactive</span>'}
${item['status'] == 1 ? '<span class="badge bg-success">Approved</span>' : '<span class="badge bg-warning text-dark">Draft</span>'}
</td>
<td class="py-3">
<a href="<?php echo $server_url?>ics/manage_stock_in.php?id=${item['id']}&wh=${warehouse}" class=""><i class="ti ti-eye fs-5"></i></a>
${item['status'] == 0
? (auto_approve
? '<button class="btn btn-sm btn-outline-secondary ms-2" disabled title="Auto-approved on save — no manual approval needed"><i class=\"ti ti-check\"></i></button>'
: '<button class="btn btn-sm btn-outline-success ms-2" onclick=\"approve_stock('+item['id']+', '+item['warehouse_id']+', \'in\')\" title="Approve"><i class=\"ti ti-check\"></i></button>'
)
: ''}
<a href="javascript:void(0);" class="link-danger"
onclick="delete_stock_in($(this),${item['id']})">
<i class="ti ti-trash ms-2 fs-5"></i>
@@ -189,13 +195,52 @@
$(async function() {
try {
await load_company_setting();
await retrieve_warehouse();
await retrieve_stock_in();
} catch (e) {
console.log(e);
}
});
</script>
// ── Stock approval ────────────────────────────────────────────────────────
var auto_approve = false; // set from company_setting on load
function load_company_setting() {
return ajax_request({
url: server_url + 'setting/api/engine/company_setting.php',
autoPrepare: true,
checkRequired: 0,
action: 'read',
onSuccess: function(res) {
auto_approve = res.output.default_stock_status == 1;
}
});
}
function approve_stock(id, warehouse_id, type) {
bootbox.confirm({
message: 'Approve this stock record?',
buttons: { confirm: { label: 'Approve', className: 'btn-success' }, cancel: { label: 'Cancel', className: 'btn-secondary' } },
callback: function(result) {
if (!result) return;
ajax_request({
url: server_url + 'ics/api/engine/approve_stock.php',
autoPrepare: true,
checkRequired: 0,
action: 'update',
id: id,
warehouse: warehouse_id,
type: type,
onSuccess: function(res) {
retrieve_stock_list();
}
});
}
});
}
</script>
</body>