fix: an item without a contraction class says so from the queue on, and the class can be chosen while printing (#237)

A CDR the Site could not measure, prepared by hand, reached Imprimindo
without a class; the hot folder writes no file without one (the class is
the C1/C2/C3 folder), so its parts waited unseen, and the card only showed
"Sem classe" there. The next step now warns "Sem contração" with the choice
in Mandar para a fila, Puxar para a máquina and Imprimindo, and the
contraction is editable while printing; the server already takes it until
the item's files go into the hot folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 16:30:54 -03:00
parent f23b64bebf
commit 1c32730ee7
2 changed files with 18 additions and 1 deletions

View File

@@ -195,11 +195,19 @@ const CLASS_NOTE={C1:'traço até 4 px',C2:'traço de 5 a 19 px',C3:'traço de 2
// A mixed sheet (item 16) where the customer chose to protect the solid areas starts at C3.
const measuredClass=item=>item.stroke_choice==='client_c3'?'C3':item.stroke_class||null;
const contractionOf=(order,index)=>order.contraction?.[index]?.class||measuredClass(order.snapshot.items[index]);
// Items whose files cannot go into the machine's hot folder yet: no class and
// not premium, which has its own folder (app/hotfolder.py folder_class). A
// CDR the Site could not measure, prepared by hand, reached Imprimindo like
// this and waited unseen (#237, 2026-12-02).
const withoutClass=order=>order.snapshot.items.map((item,index)=>index)
.filter(index=>order.snapshot.items[index].mode!=='premium'&&!contractionOf(order,index));
function contractionControl(order,index){
const item=order.snapshot.items[index], now=contractionOf(order,index), chosen=order.contraction?.[index];
const measured=(item.stroke_class?'medido '+item.stroke_class+', '+item.stroke_px+' px':'sem medida do navegador')+
(item.stroke_choice==='client_c3'?'; o cliente escolheu proteger as áreas chapadas (C3)':'');
const editable=may('produce')&&!order.cancelled_at&&['rec','tra','cor'].includes(order.state);
// Printing too, until the item's files go into the hot folder (the server
// says so after that: app/api/operator/orders.py choose_contraction).
const editable=may('produce')&&!order.cancelled_at&&['rec','tra','cor','imp'].includes(order.state);
if(!editable){const t=node('span',now?now+' ('+(chosen?'escolhida':measured)+')':'Sem classe');return t;}
const select=node('select',undefined,'inp sm');select.setAttribute('aria-label','Contração do item '+(index+1));
for(const [value,text] of [['','Escolha'],['C1','C1, '+CLASS_NOTE.C1],['C2','C2, '+CLASS_NOTE.C2],['C3','C3, '+CLASS_NOTE.C3]]){
@@ -253,6 +261,11 @@ function nextBox(order){
let title='';const body=[],main=[],more=[];
const note=text=>body.push(node('p',text,'nnote'));
const can=to=>mayMove(st,to)&&mayAct(order);
// Without a class the file never reaches the machine's folder: said, with
// the choice, from the queue on.
const askClass=text=>{const missing=withoutClass(order);if(!missing.length||!['rec','tra','imp'].includes(st))return;
const which=order.snapshot.items.length>1?' (item '+missing.map(i=>i+1).join(', ')+')':'';
body.push(node('p','Sem contração'+which+': '+text,'nnote warn'));body.push(contractionList(order));};
const moveBtn=(to,label,className='btn pri lg')=>{
// Pulling to a machine goes through the sheet's alerts first (front 1a).
const fn=to==='imp'?()=>pullTo(order,order.machine?.id||myMachine()?.id||null):()=>move(order,to);
@@ -399,6 +412,7 @@ function nextBox(order){
}else if(st==='rec'){
title='Mandar para a fila';
note('O arquivo final está aprovado. Na fila, o operador puxa para a máquina.');
askClass('escolha a classe antes da fila, ou o arquivo não vai para a pasta da máquina.');
if(can('tra'))main.push(moveBtn('tra'));else cannot();
// Approved already, the art can still be treated while in Arte recebida.
if(may('produce')){const t=button('Tratar a arte',async()=>treatDialog(order),'btn lg');t.dataset.treat='';more.push(t);}
@@ -415,12 +429,14 @@ function nextBox(order){
}else if(st==='tra'){
title='Puxar para a máquina';
note(order.machine?'Vai para a '+order.machine.name+'. O arquivo final já está aprovado.':'O arquivo final já está aprovado.');
askClass('escolha a classe, ou o arquivo não vai para a pasta da máquina.');
if(can('imp'))main.push(moveBtn('imp'));else cannot();
const p=proofBtn();if(p)more.push(p);
fixBtn();
}else if(st==='imp'){
title=order.printing==='ripando'?'Ripando enquanto o anterior roda':order.printing==='aguardando'?'Na vez: espera os da frente':'Terminou de imprimir?';
note('A folha segue para o Revisor conferir.');
askClass('o arquivo está esperando e não foi para a pasta da máquina. Escolha a classe para ele ir.');
if(can('rev'))main.push(moveBtn('rev'));else cannot();
const p=proofBtn();if(p)more.push(p);
fixBtn();

View File

@@ -438,6 +438,7 @@ main{padding:0}
.nextbox h3{margin:0;font-size:18px;font-weight:650;letter-spacing:-.01em}
.nnote{margin:0;color:var(--tx2);font-size:13.5px}
.nnote b{color:var(--tx);font-weight:600}
.nnote.warn{color:var(--warn);font-weight:600}
.files{display:flex;flex-direction:column;gap:8px}
.file{display:flex;align-items:center;gap:12px;padding:10px 10px 10px 12px;border-radius:9px;background:var(--sf2);border:1px solid var(--ln)}
.fico{width:32px;height:38px;border-radius:4px;background:var(--sf);border:1px solid var(--ln2);display:flex;align-items:flex-end;justify-content:center;padding-bottom:5px;font-size:8.5px;font-weight:700;letter-spacing:.04em;color:var(--tx2);flex:none;position:relative}