function stageOrder(id){var csrf=document.querySelector("meta[name=csrf-token]").content;fetch("index.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"system_action=modify&entity=order_fulfillment&id="+id+"&data[status]=processing&_csrf="+csrf}).then(r=>r.json()).then(d=>{if(d.success)location.reload();else alert(d.error);});}
function scanOrder(ref){fetch("api/search.php?scope=orders&q="+ref).then(r=>r.json()).then(d=>{if(d.success&&d.data.length)stageOrder(d.data[0].id);else alert("Order not found");});}
