From c08136d87bed2f407bde52ac8cc8e9b86dc11d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 30 Oct 2026 10:08:59 -0300 Subject: [PATCH] feat: the Imprimindo column shows each machine's two places, not a row of counters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- web/kanban.css | 15 ++++++++++++++- web/kanban.js | 33 ++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/web/kanban.css b/web/kanban.css index 1c8fdba..651ec58 100644 --- a/web/kanban.css +++ b/web/kanban.css @@ -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} diff --git a/web/kanban.js b/web/kanban.js index 607f0c0..63d2bea 100644 --- a/web/kanban.js +++ b/web/kanban.js @@ -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=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