feat: Dropstar's answers of 23/10 that need nothing more from them
All checks were successful
Build and deploy / Validate source (push) Successful in 1m6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m5s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m6s

- JPG is refused in every product, at upload and by the server: it has no
  transparency, so the background prints and loose art packs as a box
- a PDF over 150 MB says before payment that the Site cannot check it, as a
  file opened by hand does
- every piece that is not square is tried both ways; the 1 cm rule left
  19,5 x 18,5 cm standing, 2 to a row instead of 3
- a mirrored order (UV only) is flagged on its card and panel, and its print
  file's footer ends in ESPELHADO, in bold
- print files are named DTF-23-item-1, and the order panel copies DTF-23-,
  so the code pasted into the folder's search finds them
- the proof: up to 30 cm, from the thinnest lines, a piece of each different
  artwork, at most three per order, free
- a file opened by hand costs R$ 2,00 more a metre by default, and the Site
  says so

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-26 09:33:22 -03:00
parent c21497d71b
commit a9253d830a
22 changed files with 160 additions and 67 deletions

View File

@@ -177,6 +177,9 @@ function paymentBadge(p){
// What the customer calls the order (the id's first 8 characters, as the
// server's order_code); the # number is the operators'.
const orderCode=id=>String(id).replace(/-/g,'').slice(0,8).toUpperCase();
// The order's files start with this (app/printjobs.py): pasted into the folder's
// search it finds them, and the dash keeps DTF-23 from finding DTF-230.
const fileCode=order=>'DTF-'+order.number+'-';
const sheetSize=p=>p?cm(p.film_width_cm)+' × '+cm(p.height_cm)+' cm':null;
const hoursSince=v=>Math.floor((Date.now()-new Date(v))/3600000);
// The freight's weight: what the package weighs and, when Jadlog charges the
@@ -561,8 +564,12 @@ 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 PROOF_RULE='Até 30 cm, do trecho de traço mais fino, um pedaço de cada arte diferente; no máximo 3 provas por pedido, sem cobrança.';
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;
// Mirrored by the customer (UV only, web/site-pdf.js): the room checks it before printing.
const mirroredItem=item=>!!item.production?.sources?.some(source=>source.mirrored);
const MIRROR_NOTE='O cliente espelhou a arte: confira antes de imprimir';
async function proofOk(order){
await api('/orders/'+order.id+'/proof',{});say('Prova do pedido #'+order.number+' conferida.');await load();
}
@@ -712,11 +719,12 @@ function card(order){
const p=printState(order);
flags.append(badge((p.tone==='ok'?'✓ ':p.tone==='warn'?'! ':'')+p.text,p.tone));
if(s.items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva','warn','O cliente aceitou a ressalva de resolução'));
if(s.items.some(mirroredItem))flags.append(badge('Espelhado','bad',MIRROR_NOTE));
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'));
: badge('Prova','warn',order.snapshot.proof?'O cliente pediu uma prova antes de imprimir':'Pedido acima de 10 m: 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);}
@@ -802,7 +810,11 @@ function renderPanel(order){
const close=node('button',undefined,'close');close.type='button';close.setAttribute('aria-label','Fechar');close.append(icon(['M6 6l12 12M18 6L6 18']));close.onclick=closePanel;
const test=isTest(order)?node('span','TESTE','tag-teste'):null;
if(test)test.title='Pedido de teste: sem pagamento, não vai ao Tiny';
const code=node('span',undefined,'ocode');code.append('Pedido '+orderCode(order.id),copyButton(orderCode(order.id),'Copiar código do pedido'));
// DTF-23 is the room's code, in the file names, the footer and Tiny; the
// customer knows the order by the other one.
const code=node('span',undefined,'ocode');
code.append('Pedido DTF-'+order.number,copyButton(fileCode(order),'Copiar “'+fileCode(order)+'”, o começo do nome dos arquivos deste pedido'));
const theirs=node('span',' · cliente: '+orderCode(order.id),'faint');theirs.title='O código que o cliente vê';code.append(theirs);
code.title='O código que o cliente vê';
row.append(node('span','#'+order.number,'num'),stage,...(test?[test]:[]),code,close);
// What was paid and when, and whether it is stuck: the first things asked of an order.
@@ -904,9 +916,9 @@ function moves(order){
}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.'));
node('span',(order.snapshot.proof
?'O cliente pediu uma prova: imprima, mande a foto pelo WhatsApp e, com o aceite dele, marque Prova OK.'
:'Pedido acima de 10 m: imprima a prova, confira e marque Prova OK antes de rodar o resto.')+' '+PROOF_RULE));
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);
@@ -1107,6 +1119,11 @@ function itemCard(order,item,index){
if(extra)body.append(node('div',extra,'line'));
}
}
if(mirroredItem(item)){
const mirrored=node('div',undefined,'file');
mirrored.append(icon(ICON_WARN),node('span',MIRROR_NOTE,'warn'));
body.append(mirrored);
}
if(['rec','tra','cor'].includes(order.state)){
const done=(order.final_items||[]).includes(index), status=node('div',undefined,'file');
status.append(icon(done?ICON_OK:ICON_WARN),node('span',done?'Arquivo final aprovado':'Falta aprovar o arquivo final',done?'ok':'warn'));