feat: every order is born with its origin, shown, filtered and counted (Dropstar's rules D-21 and D-35)
All checks were successful
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Successful in 3m21s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m1s

Orders carry site, dropflow or atendimento, required and with no default,
limited to the three. The Site's orders are marked site where they are
created; older orders became site. The Kanban shows the origin on each card
and in the order panel, filters by it, and Numeros has a Por origem table:
orders, metres, money and time from payment to Finalizado per way in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-27 11:39:08 -03:00
parent bba55a83f3
commit 0319039328
13 changed files with 98 additions and 19 deletions

View File

@@ -129,6 +129,7 @@ main{padding:0 24px 24px}
.card .num{font-size:14.5px;font-weight:800}
.card .age{margin-left:auto;font-size:13.5px;color:var(--faint)}
.card .cust{font-size:14px;font-weight:600;color:var(--tx);width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.origin{font-size:12px;font-weight:700;padding:1px 7px;border-radius:6px;border:1px solid var(--line3);color:var(--muted)}
.tag-teste{font-size:12.5px;font-weight:800;letter-spacing:.04em;padding:2px 7px;border-radius:6px;background:var(--warn);color:#1a1300}
.late{font-size:13.5px;color:#F06A5B;font-weight:600}

View File

@@ -94,6 +94,9 @@
Metros por hora: sobre o tempo em Imprimindo; pedidos imprimindo juntos na mesma máquina contam esse tempo uma vez.</p>
<table class="log"><thead><tr><th scope="col">Máquina</th><th scope="col">Impresso</th><th scope="col">Metros por hora</th><th scope="col">Último finalizado</th><th scope="col">Agora</th></tr></thead><tbody id="stats-machines"></tbody></table>
</section>
<section class="statbox"><h2>Por origem</h2>
<p class="faint stats-hint">Por onde o pedido entrou: o Site, os lotes do Dropflow ou a equipe, em Atendimento. O tempo vai do pagamento ao Finalizado, sem o tempo em Aguardando contato.</p>
<table class="log"><thead><tr><th scope="col">Origem</th><th scope="col">Pedidos</th><th scope="col">Metros</th><th scope="col">Recebido</th><th scope="col">Do pagamento ao Finalizado</th></tr></thead><tbody id="stats-origins"></tbody></table></section>
<section class="statbox"><h2>Artes tratadas</h2>
<p class="faint stats-hint">Pedidos do período em que o arquivo final aprovado não é a arte do cliente: alguém da equipe preparou. Por quem aprovou o arquivo.</p>
<table class="log"><thead><tr><th scope="col">Quem aprovou</th><th scope="col">Pedidos</th></tr></thead><tbody id="stats-treated"></tbody></table></section>

View File

@@ -33,7 +33,7 @@ function outcomeText(outcome){
let board=null;
let tab='board', openOrder=null, openToken=0;
const boardFilter={product:'',machine:'',delivery:'',status:''};
const boardFilter={product:'',machine:'',delivery:'',origin:'',status:''};
// Layout versions the server takes (app/core/models.py PRODUCTION_VERSIONS).
const LAYOUT_VERSIONS=[2,3];
let quoteKind='pending', pickedQuote=null;
@@ -598,7 +598,14 @@ async function proofOk(order){
}
// The board's filters: one choice per kind, and the kinds combine (Têxtil on
// máquina2, waiting for contact). An empty choice is "all".
// Where an order came from (Dropstar's rule D-21): every card says it.
const ORIGINS={site:'Site',dropflow:'Dropflow',atendimento:'Atendimento'};
const ORIGIN_NOTE='Origem do pedido';
const originTag=order=>{const t=node('span',ORIGINS[order.origin]||order.origin,'origin');t.title=ORIGIN_NOTE;return t;};
const FILTER_TESTS={
site:o=>o.origin==='site',
dropflow:o=>o.origin==='dropflow',
atendimento:o=>o.origin==='atendimento',
textil:o=>o.snapshot.items.some(i=>i.mode==='file'||i.mode==='avulsa'),
uv:o=>o.snapshot.items.some(i=>i.mode==='uvfile'||i.mode==='uv'),
entrega:o=>!!o.snapshot.destination,
@@ -622,6 +629,7 @@ function filterKinds(){
const kinds=[
{key:'product',label:'Produto',all:'Todos',options:[['textil','Têxtil'],['uv','UV']]},
{key:'delivery',label:'Envio',all:'Entrega e retirada',options:[['entrega','Entrega'],['retirada','Retirada']]},
{key:'origin',label:'Origem',all:'Todas',options:Object.entries(ORIGINS)},
{key:'status',label:'Situação',all:'Todos',options:[['parados','Parados há mais de '+LATE_HOURS+' h','Parados'],
['contato','Aguardando contato'],['prova','Prova a conferir'],['manual','Preparar à mão'],['cancelados','Cancelados']]}];
// A machine, when there is more than one to tell apart.
@@ -732,7 +740,7 @@ function card(order){
if(order.id===openOrder)c.classList.add('open');
const s=order.snapshot;
const top=node('div',undefined,'row');
top.append(node('span','#'+order.number,'num'),...(isTest(order)?[node('span','TESTE','tag-teste')]:[]),node('span',ago(order.updated_at),'age'));
top.append(node('span','#'+order.number,'num'),originTag(order),...(isTest(order)?[node('span','TESTE','tag-teste')]:[]),node('span',ago(order.updated_at),'age'));
const meta=node('div',undefined,'meta');
meta.append(gradePill(lowestGrade(s.items)),productBadge(s.items),
node('b',metres(s.items.reduce((t,i)=>t+Number(i.billed_metres),0)),'mtr'));
@@ -844,7 +852,7 @@ function renderPanel(order){
code.append('Pedido DTF-'+order.number,copyButton(fileCode(order),'Copiar “'+fileCode(order)+'”, o começo do nome dos arquivos deste pedido'));
const theirs=node('span',' · cliente: '+orderCode(order.id),'faint');theirs.title='O código que o cliente vê';code.append(theirs);
code.title='O código que o cliente vê';
row.append(node('span','#'+order.number,'num'),stage,...(test?[test]:[]),code,close);
row.append(node('span','#'+order.number,'num'),stage,originTag(order),...(test?[test]:[]),code,close);
// What was paid and when, and whether it is stuck: the first things asked of an order.
const paid=node('div',undefined,'paidline');
paid.append(node('b',money(order.snapshot.total_cents)),isTest(order)?' sem pagamento · '+when(order.created_at):' pago em '+when(order.created_at));
@@ -1424,6 +1432,11 @@ async function loadStats(){
tr.append(node('td',t.who),node('td',t.orders+(t.orders>1?' pedidos':' pedido')));return tr;});
if(!treatedRows.length){const tr=node('tr');const td=node('td','Nenhuma arte tratada no período.','faint');td.colSpan=2;tr.append(td);treatedRows.push(tr);}
$('stats-treated').replaceChildren(...treatedRows);
// Each way in apart (D-21): its orders, metres, money and time to Finalizado.
$('stats-origins').replaceChildren(...data.origins.map(o=>{const tr=node('tr');
tr.append(node('td',ORIGINS[o.origin]),node('td',String(o.orders)),node('td',metres(o.metres)),node('td',money(o.cents)),
node('td',o.finished?duration(o.median_hours)+' · '+o.finished+(o.finished>1?' finalizados':' finalizado'):'—'));
if(!o.orders)tr.classList.add('off');return tr;}));
const rows=['rec','tra','imp','cor','rev'].map(state=>{
const tr=node('tr'),name=node('td'),sw=node('span',undefined,'swatch');sw.style.setProperty('--c',STAGE_COLORS[state]);
name.append(sw,board.states[state]);