feat: new layout phase D, the production board and stage times as on the canvas

Roadmap Novo Layout, phase D step 2 (canvas A1, D1): a late card gets
the red border and red time (warn colour for a warn late) instead of the
Atrasados strip, which is no longer shown (renderLatebar kept for later);
machine lanes with name, blocking-alert dot, free places and dashed free
slots; compact Finalizado cards; the phone stage chips fade at the edge.
"Tempo aceitável de cada etapa" is a table (Etapa, Aceitável, Responde
pela etapa) with the same API. Built by Prensa.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-16 10:17:20 -03:00
parent d6c80ff447
commit 2c740da4c1
4 changed files with 61 additions and 21 deletions

View File

@@ -211,7 +211,6 @@ function renderLatebar(){
if(may('manage'))bar.append(button('Editar tempos',()=>stageLimitsDialog(),'btn ghost'));
}
function renderBoard(){
renderLatebar();
renderFilters();
const active=board.orders.filter(o=>['rec','tra','imp'].includes(o.state)&&!o.cancelled_at);
const open=board.orders.filter(o=>o.state!=='fin'&&!o.cancelled_at).length;
@@ -299,10 +298,10 @@ function printingLanes(orders){
if(filtered&&!here.length)continue;
const n=filtered?here.length:Math.max(m.states?.imp||0,here.length);
const lane=node('div',undefined,'lanehead'+(m.id===mine?' mine':''));lane.dataset.machine=m.id;
const load=n>cap?'acima do limite':n>=cap?'cheia':plural(cap-n,'vaga','vagas');
lane.append(svgIcon(IC.printer,'i s'),node('b',m.name));
// The machine's sheet opens here; an alert due shows a warning dot with its text.
const alerts=m.alerts||[];
const load=n>cap?'acima do limite':plural(Math.max(0,cap-n),'vaga','vagas');
lane.append(node('b',m.name));
// The machine's sheet opens here; a blocking alert shows a warning dot with its text.
const alerts=(m.alerts||[]).filter(a=>a.blocking);
if(alerts.length){const mark=node('i',undefined,'lanealert');mark.title=alerts.map(a=>a.text).join(' · ');
mark.setAttribute('aria-hidden','true');lane.append(mark);}
lane.append(node('span',(m.id===mine?'sua máquina · ':'')+load));
@@ -314,7 +313,7 @@ function printingLanes(orders){
out.push(lane,...here.map(o=>{const c=card(o);c.dataset.machine=m.id;return c;}));
if(!filtered&&n<cap){
const slot=node('div',undefined,'freeslot');slot.dataset.machine=m.id;
slot.append(node('i',undefined,'freemark'),cap-n>1?plural(cap-n,'vaga livre','vagas livres')+' na '+m.name:'Vaga livre na '+m.name);out.push(slot);
slot.append(plural(cap-n,'vaga livre','vagas livres')+' na '+m.name);out.push(slot);
}
}
// An order whose machine is gone or off still shows.
@@ -435,14 +434,15 @@ function draggable(c,order){
function card(order,place){
const s=order.snapshot, mine=isMine(order)&&order.state!=='fin'&&!order.cancelled_at;
const [step,tone]=nextStep(order,place);
const c=node('div',undefined,'card'+(mine?' mine':'')+(tone==='live'?' live':'')+(order.id===openOrder?' open':'')+(order.cancelled_at?' off':''));
const late=!!order.late&&!order.cancelled_at;
const c=node('div',undefined,'card'+(mine?' mine':'')+(tone==='live'?' live':'')+(order.id===openOrder?' open':'')+(order.cancelled_at?' off':'')+
(late?' islate':'')+(late&&order.late==='warn'?' islate-warn':''));
c.tabIndex=0;c.setAttribute('role','button');c.dataset.card=order.id;
const who=buyer(s);
c.setAttribute('aria-label','Pedido #'+order.number+', '+who.title+': '+step);
const top=node('span',undefined,'ctop'), info=node('span',undefined,'cinfo');
const row=node('span',undefined,'crow');
const late=!!order.late&&!order.cancelled_at;
const age=node('span',shortAgo(order.state_since||order.updated_at),'age'+(late?' late tip-l'+(order.late==='bad'?' late2':''):''));
const age=node('span',shortAgo(order.state_since||order.updated_at),'age'+(late?' late tip-l'+(order.late==='warn'?' warnlate':''):''));
if(late)age.dataset.tip='Fora do tempo: '+(order.state_hours??'?')+' h nesta etapa · limite '+
(order.limit_hours??'?')+' h · responsável: '+(order.limit_by||'—');
row.append(node('span','#'+order.number,'num'),originTag(order),age);