feat: the Imprimindo column shows each machine's two places, not a row of counters
All checks were successful
Build and deploy / Validate source (push) Successful in 1m28s
Build and deploy / Integration suite on a real stack (push) Successful in 4m20s
Build and deploy / Secret scan and release gate (push) Successful in 15s
Build and deploy / Publish images (push) Successful in 1m38s

Each machine with something printing is one line: its name, the order
printing (green, as the card's Imprimindo label) and the one ripping
(blue, as Ripando), each opening its order, or a dashed "livre" place;
above the limit, the extra order shows in red. The machines with nothing
printing share one line, "Livres: máquina3 · máquina4", so an empty
column takes one line instead of a grid of "0/2" chips. In a narrow
column the places go under the machine's name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-30 10:08:59 -03:00
parent d962865944
commit c08136d87b
2 changed files with 40 additions and 8 deletions

View File

@@ -617,17 +617,36 @@ const residueBadge=item=>badge('! Resíduo aceito','warn','O cliente aceitou imp
// in is printing, the next is being ripped meanwhile.
const PRINTING={imprimindo:['Imprimindo','ok','Já ripou, está rodando'],
ripando:['Ripando','info','O Flexi está ripando enquanto o anterior roda']};
// "máquina5 · 2/2" for each machine that prints, or has an order printing.
// An operator who works on some machines sees those.
// Each machine's two places in Imprimindo (app/machines.py): the order
// printing and the one ripping, each opening its order, or a free place. The
// machines with nothing printing share one line. An operator who works on
// some machines sees those.
function printingRoom(){
const cap=board.printing_cap, mine=ME?.role==='operador'&&ME.machines?.length?ME.machines:null;
const list=(board.machines||[]).filter(m=>(m.active||m.states.imp)&&(!mine||mine.includes(m.id)));
if(!list.length)return null;
const room=node('div',undefined,'col-slots');
room.append(...list.map(m=>{const n=m.states.imp||0;
const chip=node('span',m.name+' · '+n+'/'+cap,'pill '+(n>cap?'bad':n===cap?'warn':'muted'));
chip.title=n>=cap?m.name+' está cheia: abre vaga quando um pedido sair de Imprimindo':m.name+' tem '+(cap-n)+' vaga'+(cap-n===1?'':'s');
return chip;}));
const room=node('div',undefined,'slots'), free=[];
for(const m of list){
const here=board.orders.filter(o=>o.state==='imp'&&!o.cancelled_at&&o.machine?.id===m.id)
.sort((a,b)=>(a.printing==='imprimindo'?0:1)-(b.printing==='imprimindo'?0:1));
const n=Math.max(m.states.imp||0,here.length);
if(!n){free.push(m.name);continue;}
const row=node('div',undefined,'slot-row');
row.title=m.name+' · '+n+' de '+cap+(n>=cap?' · cheia: abre vaga quando um pedido sair de Imprimindo':' · '+(cap-n)+' vaga');
// The places go under the name when the column is too narrow for both.
const places=node('div',undefined,'slot-places');
for(let i=0;i<Math.max(cap,n);i++){
const o=here[i];
if(o){
const b=node('button','#'+o.number,'slot '+(i>=cap?'bad':o.printing==='ripando'?'info':'ok'));b.type='button';
b.title=(i>=cap?'Acima do limite':PRINTING[o.printing]?.[0]||'Imprimindo')+' · pedido #'+o.number;
b.onclick=()=>openPanel(o.id);places.append(b);
}else places.append(node('span',i<n?'ocupada':'livre','slot '+(i<n?'muted':'free')));
}
row.append(node('span',m.name,'slot-name'),places);
room.append(row);
}
if(free.length){const line=node('div',undefined,'slot-free');line.append(node('span','Livres: ','faint'),free.join(' · '));room.append(line);}
return room;
}
async function proofOk(order){