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

@@ -122,7 +122,20 @@ main{padding:0 24px 24px}
.col-head small{font-size:13.5px;color:var(--faint)}
.col-head .col-sub{justify-content:space-between;min-height:30px}
.col-head .col-sub small{white-space:nowrap}
.col-head .col-slots{flex-wrap:wrap;gap:5px}
.col-head .slots{flex-direction:column;align-items:stretch;gap:5px;padding-top:2px}
.col-head .slot-row{flex-wrap:wrap;gap:4px 6px;font-size:13px}
.slot-name{flex:1 0 auto;white-space:nowrap;color:var(--tx2);font-weight:600}
.col-head .slot-places{gap:4px;margin-left:auto}
.slot{display:inline-flex;align-items:center;justify-content:center;min-width:46px;height:24px;padding:0 7px;border:0;border-radius:7px;font-family:var(--mono);font-size:12.5px;font-weight:700}
button.slot{cursor:pointer}
button.slot:hover{filter:brightness(1.2)}
button.slot:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.slot.ok{color:var(--ok);background:rgba(111,209,156,.14)}
.slot.info{color:var(--rec);background:rgba(43,182,217,.16)}
.slot.bad{color:var(--bad);background:rgba(244,150,139,.16)}
.slot.muted{color:var(--muted);background:var(--card2);font-family:inherit;font-weight:600}
.slot.free{border:1px dashed var(--line2);color:var(--faint);background:transparent;font-family:inherit;font-weight:500}
.col-head .slot-free{display:block;font-size:12.5px;line-height:1.5;color:var(--muted)}
.col .empty{font-size:13.5px;color:var(--faint);padding:8px 2px}
.card{text-align:left;display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:10px;border:1px solid var(--line2);background:var(--card);width:100%}
.card:hover,.card.open{border-color:var(--line3);background:#1E2226}

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){