feat: the print proof: Prova OK before Finalizado, and a proof the customer can ask for
Some checks failed
Some checks failed
Dropstar's items 15 and 16 (2026-10-21). - an order above 10 m prints 20 cm of proof first; the room checks it and marks "Prova OK", without stopping the order, and without that mark the order cannot reach Finalizado - at checkout, "Quero aprovar uma prova antes de imprimir", for any length: the paid order arrives marked "Aguardando contato" with what to do, and waits for the customer's word on the photo sent by WhatsApp - the card shows Prova / Prova OK, the panel gives the next step, and "Prova a conferir" is a board filter; the designer cannot mark it - the proof is not billed, as Dropstar leans; rounds and which part of the sheet wait for their answer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -558,6 +558,14 @@ const stalled=order=>['rec','tra','fil','imp'].includes(order.state)&&Date.now()
|
||||
// A mark on the card, not a stage; a finished order no longer needs it.
|
||||
const waitingContact=order=>!!order.contact_since&&!order.cancelled_at&&order.state!=='fin';
|
||||
const contactWho=order=>(order.contact_by||'')+' em '+when(order.contact_since);
|
||||
// The print proof (app/proof.py): asked for at checkout, or an order above 10 m.
|
||||
// The room marks "Prova OK" once it is checked; without it, no Finalizado.
|
||||
const PROOF_ABOVE_METRES=10;
|
||||
const needsProof=order=>!!order.snapshot.proof||order.snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0)>PROOF_ABOVE_METRES;
|
||||
const proofPending=order=>needsProof(order)&&!order.proof_ok_at&&order.state!=='fin'&&!order.cancelled_at;
|
||||
async function proofOk(order){
|
||||
await api('/orders/'+order.id+'/proof',{});say('Prova do pedido #'+order.number+' conferida.');await load();
|
||||
}
|
||||
// The board's filters: one choice per kind, and the kinds combine (Têxtil on
|
||||
// máquina2, waiting for contact). An empty choice is "all".
|
||||
const FILTER_TESTS={
|
||||
@@ -567,6 +575,7 @@ const FILTER_TESTS={
|
||||
retirada:o=>!o.snapshot.destination,
|
||||
parados:stalled,
|
||||
contato:waitingContact,
|
||||
prova:proofPending,
|
||||
manual:o=>['rec','tra'].includes(o.state)&&!finalDone(o)&&(o.print_files||[]).some(r=>
|
||||
(r.status==='manual'||r.status==='failed')&&!(o.corrections||[]).some(f=>f.item_index===r.item_index)),
|
||||
};
|
||||
@@ -584,7 +593,7 @@ function filterKinds(){
|
||||
{key:'product',label:'Produto',all:'Todos',options:[['textil','Têxtil'],['uv','UV']]},
|
||||
{key:'delivery',label:'Envio',all:'Entrega e retirada',options:[['entrega','Entrega'],['retirada','Retirada']]},
|
||||
{key:'status',label:'Situação',all:'Todos',options:[['parados','Parados há mais de '+LATE_HOURS+' h','Parados'],
|
||||
['contato','Aguardando contato'],['manual','Preparar à mão'],['cancelados','Cancelados']]}];
|
||||
['contato','Aguardando contato'],['prova','Prova a conferir'],['manual','Preparar à mão'],['cancelados','Cancelados']]}];
|
||||
// A machine, when there is more than one to tell apart.
|
||||
const machines=(board.machines||[]).filter(m=>m.active||m.open_orders);
|
||||
if(machines.length>1)kinds.splice(1,0,{key:'machine',label:'Máquina',all:'Todas',options:machines.map(m=>
|
||||
@@ -705,6 +714,9 @@ function card(order){
|
||||
if(s.items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva','warn','O cliente aceitou a ressalva de resolução'));
|
||||
if(stalled(order))flags.append(badge('⏱ Parado '+hoursSince(order.updated_at)+' h','bad','Sem mudar de etapa desde '+when(order.updated_at)));
|
||||
if(waitingContact(order))flags.append(badge('☎ Aguardando contato','warn',order.contact_note+' · '+contactWho(order)));
|
||||
if(needsProof(order))flags.append(order.proof_ok_at
|
||||
? badge('✓ Prova OK','ok','Conferida por '+order.proof_ok_by+' em '+when(order.proof_ok_at))
|
||||
: badge('Prova','warn',order.snapshot.proof?'O cliente pediu uma prova antes de imprimir':'Pedido acima de 10 m: 20 cm de prova antes do resto'));
|
||||
}
|
||||
c.append(artBox(s.items,'card-art'),top,buyerBlock(s,'cust'),meta,place(s.destination));
|
||||
if(order.machine&&order.state!=='fin'){const m=node('div',undefined,'place machine');m.append(icon(ICON_PRINTER),order.machine.name);c.append(m);}
|
||||
@@ -889,6 +901,15 @@ function moves(order){
|
||||
upload.append(cancel);sync=()=>{actions.hidden=!upload.hidden;};
|
||||
text.append(actions,upload);
|
||||
step=node('div',undefined,'nextstep lead');step.append(node('span','!','nextmark'),text);
|
||||
}else if(next==='fin'&&proofPending(order)){
|
||||
// Finalizado waits for the proof: printing it and checking it is the next step.
|
||||
const text=node('div');text.append(node('b','Próximo passo: conferir a prova'),
|
||||
node('span',order.snapshot.proof
|
||||
?'O cliente pediu uma prova: mande a foto pelo WhatsApp e, com o aceite dele, marque Prova OK.'
|
||||
:'Pedido acima de 10 m: imprima 20 cm, confira e marque Prova OK antes de rodar o resto.'));
|
||||
if(may('print')){const actions=node('div',undefined,'stepactions');
|
||||
const b=button('Prova OK',()=>proofOk(order),'btn primary');b.dataset.proof='';actions.append(b);text.append(actions);}
|
||||
step=node('div',undefined,'nextstep lead');step.append(node('span','!','nextmark'),text);
|
||||
}else if(mayMove(order.state,next)){
|
||||
const b=button('Mover para '+board.states[next],()=>move(order,next),'btn primary');b.dataset.move=next;row.append(b);
|
||||
}
|
||||
@@ -906,6 +927,10 @@ function moves(order){
|
||||
backForm.append(why,go);
|
||||
backForm.onsubmit=async e=>{e.preventDefault();go.disabled=true;try{await move(order,previous,why.value.trim());}catch(error){say(error.message,true);go.disabled=false;}};
|
||||
}
|
||||
// The proof may be checked before Imprimindo, while the order waits in the queue.
|
||||
if(order.state==='fil'&&proofPending(order)&&may('print')){
|
||||
const b=button('✓ Prova OK',()=>proofOk(order),'linkbtn');b.title='A prova foi impressa e conferida';sub.append(b);
|
||||
}
|
||||
// Waiting for a word with the customer: shown on top with "Contato feito";
|
||||
// otherwise marked from here, with what has to be agreed.
|
||||
const contactForm=node('form',undefined,'reason');contactForm.hidden=true;forms.push(contactForm);
|
||||
|
||||
Reference in New Issue
Block a user