implement JS password scoring, td_stock approve logicc
This commit is contained in:
@@ -129,10 +129,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_transfer.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']+', \'transfer\')\" title="Approve"><i class=\"ti ti-check\"></i></button>'
|
||||
)
|
||||
: ''}
|
||||
<a href="javascript:void(0);" class="link-danger"
|
||||
onclick="delete_stock_transfer($(this),${item['id']})">
|
||||
<i class="ti ti-trash ms-2 fs-5"></i>
|
||||
@@ -187,13 +193,52 @@
|
||||
|
||||
$(async function() {
|
||||
try {
|
||||
await load_company_setting();
|
||||
await retrieve_warehouse();
|
||||
await retrieve_stock_transfer();
|
||||
} 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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user