feat: Dropstar's corrections of 21/10 that need no answer from them
All checks were successful
Build and deploy / Validate source (push) Successful in 1m30s
Build and deploy / Integration suite on a real stack (push) Successful in 4m2s
Build and deploy / Secret scan and release gate (push) Successful in 14s
Build and deploy / Publish images (push) Successful in 1m48s

- the home example priced as the ready sheet it shows (nota 92, R$ 14,90)
- opening hours 7h to 18h, and art sent at any time
- uploads up to 1 GB, every file scanned
- a Designer profile: artwork and corrections on every order, moving only
  among Arte recebida, Arte conferida and Correção
- Números by date range, per machine, and orders apart from passages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-22 10:09:15 -03:00
parent a2382f4834
commit d4494a0654
21 changed files with 279 additions and 89 deletions

View File

@@ -735,9 +735,9 @@ h2 em{font-style:normal;color:var(--laranja)}
<i style="left:75%;top:63%;width:22%;height:26%;background:#E9C23A"></i>
</div>
<div class="hf-num">
<div><span>Metragem</span><b>0,60 m</b></div>
<div><span>Metragem</span><b>1,20 m</b></div>
<div><span>Nota da arte</span><b class="verde">92</b></div>
<div><span>Preço do metro</span><b class="laranja">R$ 24,90</b></div>
<div><span>Preço do metro</span><b class="laranja">R$ 14,90</b></div>
</div>
</div>
</div>
@@ -839,7 +839,7 @@ h2 em{font-style:normal;color:var(--laranja)}
<div class="zona" id="zona" tabindex="0" role="button">
<div class="ico"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/></svg></div>
<b id="zTit">Arraste aqui</b><span id="zSub"></span>
<span id="zLimite">Até 5 GB por arquivo.</span>
<span id="zLimite">Até 1 GB por arquivo.</span>
<span class="bt">ou escolher no computador</span>
<span class="zOutra"><b id="zOutra">Adicionar outra folha</b> ou arraste aqui</span>
<span class="zManual" id="zManual">Tem <b>CDR, AI, PSD ou TIFF</b>? Pode mandar também.
@@ -1036,7 +1036,7 @@ h2 em{font-style:normal;color:var(--laranja)}
<div>
<b><svg class="ic" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M20 10c0 4.99-5.54 10.19-7.4 11.8a1 1 0 0 1-1.2 0C9.54 20.19 4 14.99 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/></svg>Retirar em Franca</b>
<span>Av. Major Elias Motta, 1281 · Jardim São Luís<br>
Segunda a sexta, das 7h às 17h</span>
Segunda a sexta, das 7h às 18h</span>
</div>
<em>Grátis</em>
</button>
@@ -1157,7 +1157,8 @@ h2 em{font-style:normal;color:var(--laranja)}
<a href="https://wa.me/message/NJ76CLIOUGXLB1" target="_blank" rel="noopener">16 99428-0056</a>
· arquivos 16 99230-2546<br>
<a href="mailto:atendimentodropstar@gmail.com">atendimentodropstar@gmail.com</a><br>
Segunda a sexta, 07h às 17h
Mande sua arte em qualquer horário.<br>
Retirada em Franca, de segunda a sexta, das 7h às 18h
</div>
</div>
<div class="fbase">

View File

@@ -230,6 +230,10 @@ main{padding:0 24px 24px}
.pagehead{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.statchips{display:flex;gap:8px;margin-left:auto}
.stats-note{margin:-12px 0 0;font-size:13.5px}
.stats-hint{margin:-4px 0 10px;font-size:13px}
.daterange{display:flex;align-items:center;gap:6px}
.daterange input[type=date]{height:34px;padding:0 8px;border-radius:8px;border:1px solid var(--line2);background:var(--bg);color:var(--tx);font:inherit;font-size:13.5px;color-scheme:dark}
.statchips{flex-wrap:wrap}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.kpi{display:flex;flex-direction:column;gap:4px;padding:14px 16px;border:1px solid var(--line2);border-radius:12px;background:var(--card)}
.kpi span{font-size:13.5px;color:var(--muted)}
@@ -461,7 +465,7 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
#tab-users .pagehead .btn{margin-left:auto}
#tab-users td.actions{text-align:right;white-space:nowrap}
#tab-users td.actions .btn+.btn{margin-left:6px}
#tab-users tr.off td{opacity:.55}
#tab-users tr.off td,#tab-stats tr.off td{opacity:.55}
.faint.block{display:block;font-size:13px}
.danger-text{color:var(--bad)}
.machine-select{height:36px;padding:0 10px;border-radius:8px;border:1px solid var(--line3);background:var(--bg);color:var(--tx);font:inherit;font-size:14px}

View File

@@ -78,9 +78,13 @@
</section>
<section id="tab-stats" class="page" hidden>
<div class="pagehead"><h1>Números</h1><div class="statchips" id="stats-period"></div></div>
<p class="faint stats-note">Pedidos pagos no período. Pedidos de teste e cancelados ficam de fora.</p>
<p class="faint stats-note" id="stats-note">Pedidos pagos no período. Pedidos de teste e cancelados ficam de fora.</p>
<div class="kpis" id="stats-kpis"></div>
<section class="statbox"><h2>Metros por dia</h2><div class="chart" id="stats-chart"></div></section>
<section class="statbox"><h2>Por máquina</h2>
<p class="faint stats-hint">Pedidos que chegaram a Finalizado no período, na máquina em que estavam. Metros por hora: o tempo que ficaram em Imprimindo.</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>Tempo em cada etapa</h2>
<table class="log"><thead><tr><th scope="col">Etapa</th><th scope="col">Tempo mediano</th><th scope="col">Pedidos que passaram</th><th scope="col">Agora</th></tr></thead><tbody id="stats-stages"></tbody></table>
</section>
@@ -88,7 +92,8 @@
<section id="tab-users" class="page" hidden>
<div class="pagehead"><h1>Usuários</h1><button class="btn primary" id="new-user" type="button">Novo usuário</button></div>
<p class="faint stats-note">Quem entra no Kanban e o que cada perfil pode fazer. Administrador: tudo, inclusive esta página.
Gestão: tudo, menos usuários. Operador: move pedidos e aprova arquivos. Vendedor: só consulta.</p>
Gestão: tudo, menos usuários. Designer: aprova arquivos e pede correção, em Arte recebida, Arte conferida e Correção.
Operador: move pedidos e aprova arquivos. Vendedor: só consulta.</p>
<section class="statbox"><table class="log"><thead><tr><th scope="col">Nome</th><th scope="col">Perfil</th><th scope="col">Máquinas</th><th scope="col">Último acesso</th><th scope="col"></th></tr></thead><tbody id="users-list"></tbody></table></section>
<div class="pagehead"><h2>Máquinas</h2><button class="btn" id="new-machine" type="button">Nova máquina</button></div>
<p class="faint stats-note">Cada pedido vai para a máquina do produto com menos metros em aberto, dentro do limite. No pedido dá para trocar.</p>

View File

@@ -36,10 +36,13 @@ let quoteQuery='', quoteProduct='', quoteLayout='', quoteFlag='', quoteTimer=nul
// The signed-in operator and what their profile allows (app/core/auth.py).
let ME=null;
const may=cap=>!!ME?.can?.includes(cap);
const ROLE_NAMES={superadmin:'Superadmin',admin:'Administrador',gestao:'Gestão',operador:'Operador',vendedor:'Vendedor'};
const ROLE_NAMES={superadmin:'Superadmin',admin:'Administrador',gestao:'Gestão',designer:'Designer',operador:'Operador',vendedor:'Vendedor'};
// The designer moves cards only among the artwork stages; the queue onwards is the print room's (app/core/auth.py).
const DESIGNER_STATES=['rec','tra','cor'];
const mayMove=(from,to)=>may('produce')&&(ME?.role!=='designer'||DESIGNER_STATES.includes(from)&&DESIGNER_STATES.includes(to));
// Which tabs each capability opens.
const TAB_NEEDS={quotes:o=>may('manage')||ME?.role==='vendedor',payments:()=>may('manage'),
stats:()=>may('manage')||ME?.role==='vendedor',integrations:()=>may('manage')||may('produce'),users:()=>may('users')};
stats:()=>may('manage')||ME?.role==='vendedor',integrations:()=>may('manage')||may('print'),users:()=>may('users')};
function applyRole(){
for(const b of document.querySelectorAll('[data-tab]')){const need=TAB_NEEDS[b.dataset.tab];b.hidden=!!need&&!need();}
if(TAB_NEEDS[tab]&&!TAB_NEEDS[tab]())showTab('board');
@@ -300,7 +303,7 @@ function folderCount(){
// The folder's row and the tab's warning sign, which shows the folder needs a click.
function paintFolder(){
$('folder-card')?.replaceWith(folderCard());
const attention=may('produce')&&(FOLDER.mode==='folder'&&!!FOLDER.handle&&!FOLDER.granted||folderActive()&&!!FOLDER.error);
const attention=may('print')&&(FOLDER.mode==='folder'&&!!FOLDER.handle&&!FOLDER.granted||folderActive()&&!!FOLDER.error);
$('badge-integrations').textContent=attention?'!':'';
}
async function chooseFolder(){
@@ -373,7 +376,7 @@ async function moveToQueue(rec){
// board load it asks only when something it follows changed; the folder's
// own timer always asks, since another computer may have moved the order.
async function syncFolder(force=false){
if(!folderActive()||FOLDER.busy||!board||!may('produce'))return;
if(!folderActive()||FOLDER.busy||!board||!may('print'))return;
const follows=early()?['rec','tra','cor','fil']:['fil'];
const sig=FOLDER.when+'|'+board.orders.filter(o=>follows.includes(o.state)||o.cancelled_at)
.map(o=>o.id+':'+o.version+':'+o.state+(o.cancelled_at?':x':'')).join(',');
@@ -600,7 +603,7 @@ function renderBoard(){
const count=state==='fin'&&board.finished_total>orders.length?orders.length+' de '+board.finished_total:String(orders.length);
line.append(swatch,node('h2',title),node('span',count,'n'));
// The print queue's tools need the room: there it says only the metres.
const tools=state==='fil'&&may('produce');
const tools=state==='fil'&&may('print');
const sub=node('div',undefined,'col-sub');sub.append(node('small',orders.length?metres(total)+(tools?'':' no total'):'vazio'));
// The print queue's files, all at once, to import into FlexiPRINT.
if(tools){
@@ -615,7 +618,7 @@ function renderBoard(){
// Dragging only goes forward to the next stage. Going back or asking for a
// correction needs a reason, so those happen in the order panel.
column.ondragover=e=>{
if(dragging?.state===state&&state!=='fin'){e.preventDefault();markDrop(column,e.clientY);return;}
if(dragging?.state===state&&state!=='fin'&&mayMove(state,state)){e.preventDefault();markDrop(column,e.clientY);return;}
if(!column.classList.contains('allowed'))return;e.preventDefault();column.classList.add('target');};
column.ondragleave=e=>{if(!column.contains(e.relatedTarget)){column.classList.remove('target');clearDrop();}};
column.ondrop=async e=>{e.preventDefault();column.classList.remove('target');
@@ -632,7 +635,7 @@ function renderBoard(){
// An operator's test order: no payment, no Tiny.
const isTest=order=>order.payment?.provider==='teste';
function card(order){
const c=node('button',undefined,'card');c.type='button';c.dataset.card=order.id;c.draggable=!order.cancelled_at&&may('produce');
const c=node('button',undefined,'card');c.type='button';c.dataset.card=order.id;c.draggable=!order.cancelled_at&&mayMove(order.state,order.state);
if(order.id===openOrder)c.classList.add('open');
const s=order.snapshot;
const top=node('div',undefined,'row');
@@ -657,7 +660,7 @@ function card(order){
c.ondragstart=e=>{
dragging=order;
e.dataTransfer.setData('text/plain',order.id);
const forward=board.transitions[order.state].filter(s=>s!=='cor');
const forward=board.transitions[order.state].filter(s=>s!=='cor'&&mayMove(order.state,s));
for(const col of document.querySelectorAll('.col[data-state]'))col.classList.toggle('allowed',forward.includes(col.dataset.state));
say((forward.length?'Mover para '+forward.map(s=>board.states[s]).join(' ou ')+', ou ':'')+'arraste para cima ou para baixo para mudar a prioridade',false,60000);
};
@@ -806,6 +809,7 @@ function moves(order){
let step=null;
for(const next of board.transitions[order.state]){
if(next==='cor'){
if(!mayMove(order.state,next))continue;
const b=node('button','Pedir correção','btn danger');b.type='button';b.dataset.move='cor';
b.onclick=()=>toggle(reason);row.append(b);
}else if(next==='fil'&&!finalDone(order)){
@@ -832,13 +836,13 @@ function moves(order){
upload.append(cancel);sync=()=>{actions.hidden=!upload.hidden;};
text.append(actions,upload);
step=node('div',undefined,'nextstep lead');step.append(node('span','!','nextmark'),text);
}else{
}else if(mayMove(order.state,next)){
const b=button('Mover para '+board.states[next],()=>move(order,next),'btn primary');b.dataset.move=next;row.append(b);
}
}
if(!row.children.length)row.append(node('span','Pedido concluído.','muted'));
if(!row.children.length)row.append(node('span',order.state==='fin'?'Pedido concluído.':'Daqui em diante, com a produção.','muted'));
// Undo a mistaken move: one stage back, internal reason, no customer message.
const previous=board.back?.[order.state];
const previous=mayMove(order.state,board.back?.[order.state])?board.back?.[order.state]:null;
const sub=node('div',undefined,'subactions');
const backForm=node('form',undefined,'reason');backForm.hidden=true;forms.push(backForm);
if(previous){
@@ -949,7 +953,7 @@ async function approveReady(order,ready){
ready.map((r,i)=>(many?'Item '+(i+1)+': ':'')+r.label).join('\n')))return;
const note='Aprovado como está: '+[...new Set(ready.map(r=>FINAL_SOURCE[r.source]))].join(', ');
await api('/orders/'+order.id+'/final-files',{version:order.version,files:ready.map((r,i)=>({item_index:i,upload_id:r.upload_id})),note});
await load();say('Arquivo final aprovado. Agora é só mover para a fila.');
await load();say(mayMove(order.state,'fil')?'Arquivo final aprovado. Agora é só mover para a fila.':'Arquivo final aprovado. A produção coloca na fila.');
}
// The form for a file the operator prepared, or to pick per item; ready
// files come ticked.
@@ -1078,7 +1082,7 @@ function historySection(order,rows,section){
function machineCard(order){
const box=node('div',undefined,'fcard');box.append(node('p','Máquina','eyebrow'));
const current=order.machine;
if(!may('produce')||!board.machines?.length){
if(!may('print')||!board.machines?.length){
box.append(node('b',current?current.name:'Nenhuma máquina cadastrada'));return box;
}
const select=node('select',undefined,'machine-select');select.setAttribute('aria-label','Máquina do pedido');
@@ -1174,7 +1178,7 @@ function userForm(u){
const name=node('input');name.required=true;name.maxLength=80;name.value=u?.name||'';
const email=node('input');email.type='email';email.required=true;email.value=u?.email||'';
const role=node('select');
const roles=u?.role==='superadmin'?['superadmin']:['admin','gestao','operador','vendedor'];
const roles=u?.role==='superadmin'?['superadmin']:['admin','gestao','designer','operador','vendedor'];
for(const r of roles){const o=node('option',ROLE_NAMES[r]);o.value=r;role.append(o);}
role.value=u?.role||'operador';role.disabled=u?.role==='superadmin'||u?.email===ME.email;
const pass=node('input');pass.type='password';pass.minLength=8;pass.maxLength=128;pass.autocomplete='new-password';
@@ -1228,18 +1232,36 @@ $('new-machine').onclick=()=>machineForm(null);
// ---- Numbers -------------------------------------------------------------
let statsDays=30;
// The period: the last 7, 30 or 90 days, or two dates the person picks.
let statsDays=30, statsRange=null;
function duration(hours){
if(hours===null||hours===undefined)return '—';
if(hours<1)return Math.max(1,Math.round(hours*60))+' min';
if(hours<48)return (hours<10?hours.toFixed(1):Math.round(hours).toString()).replace('.',',')+' h';
return Math.round(hours/24)+' dias';
}
const dayLabel=iso=>new Date(iso+'T12:00:00').toLocaleDateString('pt-BR',{day:'2-digit',month:'2-digit',year:'numeric'});
function statsPeriod(){
const box=$('stats-period');
const chips=[[7,'7 dias'],[30,'30 dias'],[90,'90 dias']].map(([days,label])=>{
const b=node('button',label,'chip');b.type='button';b.setAttribute('aria-pressed',String(!statsRange&&days===statsDays));
b.onclick=()=>{statsDays=days;statsRange=null;loadStats().catch(e=>say(e.message,true));};return b;});
const from=node('input');from.type='date';from.setAttribute('aria-label','De');
const to=node('input');to.type='date';to.setAttribute('aria-label','Até');
const today=new Date(Date.now()-3*3600e3).toISOString().slice(0,10);
from.max=to.max=today;
if(statsRange){from.value=statsRange.start;to.value=statsRange.end;}
const apply=button('Ver',()=>{
if(!from.value||!to.value)return say('Escolha a data inicial e a final.',true);
if(from.value>to.value)return say('A data inicial é depois da final.',true);
statsRange={start:from.value,end:to.value};loadStats().catch(e=>say(e.message,true));},'btn small');
const range=node('div',undefined,'daterange');range.append(from,node('span','até','faint'),to,apply);
box.replaceChildren(...chips,range);
}
async function loadStats(){
const data=await api('/stats?days='+statsDays);
$('stats-period').replaceChildren(...[[7,'7 dias'],[30,'30 dias'],[90,'90 dias']].map(([days,label])=>{
const b=node('button',label,'chip');b.type='button';b.setAttribute('aria-pressed',String(days===statsDays));
b.onclick=()=>{statsDays=days;loadStats().catch(e=>say(e.message,true));};return b;}));
const data=await api('/stats?'+(statsRange?'start='+statsRange.start+'&end='+statsRange.end:'days='+statsDays));
statsPeriod();
$('stats-note').textContent='Pedidos pagos de '+dayLabel(data.start)+' a '+dayLabel(data.end)+'. Pedidos de teste e cancelados ficam de fora.';
const kpi=(label,value,note)=>{const k=node('div',undefined,'kpi');k.append(node('span',label),node('b',value));if(note)k.append(node('small',note));return k;};
const pct=data.orders?Math.round(100*data.corrected/data.orders):0;
$('stats-kpis').replaceChildren(
@@ -1250,11 +1272,24 @@ async function loadStats(){
kpi('Pedidos com correção',String(data.corrected),data.orders?pct+'% dos pedidos':null),
kpi('Do pagamento ao Finalizado',duration(data.lead.median_hours),data.lead.orders?'mediana de '+data.lead.orders+' pedidos':'nenhum finalizado'));
statsChart($('stats-chart'),data.daily);
const machineRows=data.machines.map(m=>{
const tr=node('tr');if(!m.active)tr.classList.add('off');
const now=[m.now.imp?m.now.imp+' imprimindo':'',m.now.fil?m.now.fil+' na fila':''].filter(Boolean).join(' · ');
tr.append(node('td',m.name+(m.active?'':' · desativada')),
node('td',m.orders?metres(m.metres)+' · '+m.orders+(m.orders>1?' pedidos':' pedido'):'nada'),
node('td',m.metres_per_hour!=null?String(m.metres_per_hour).replace('.',',')+' m/h':'—'),
node('td',m.last_finished?when(m.last_finished):'nunca','faint'),
node('td',m.id?now||'nada na fila':'—'));
return tr;});
if(!machineRows.length){const tr=node('tr');const td=node('td','Nenhuma máquina cadastrada.','faint');td.colSpan=5;tr.append(td);machineRows.push(tr);}
$('stats-machines').replaceChildren(...machineRows);
const rows=['rec','tra','fil','imp','cor'].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]);
const st=data.stages[state], now=data.waiting[state];
tr.append(name,node('td',st?duration(st.median_hours):'—'),node('td',st?String(st.orders):'0'),
// Orders; when some came back to the stage, how many times it was entered.
const passed=st?String(st.orders)+(st.passages>st.orders?' · '+st.passages+' passagens':''):'0';
tr.append(name,node('td',st?duration(st.median_hours):'—'),node('td',passed),
node('td',now?now.orders+(now.orders>1?' pedidos':' pedido')+' · o mais antigo há '+duration(now.oldest_hours):'nenhum'));
return tr;});
$('stats-stages').replaceChildren(...rows);
@@ -1267,7 +1302,7 @@ function statsChart(box,daily){
const step=max<=0?1:(()=>{const raw=max/4, p=10**Math.floor(Math.log10(raw)), f=raw/p;return (f<=1?1:f<=2?2:f<=5?5:10)*p;})();
const ceiling=step*Math.max(1,Math.ceil(max/step));
const svg=document.createElementNS(ns,'svg');svg.setAttribute('viewBox','0 0 '+w+' '+h);svg.setAttribute('role','img');
svg.setAttribute('aria-label','Metros vendidos por dia nos últimos '+daily.length+' dias');
svg.setAttribute('aria-label','Metros vendidos por dia, '+daily.length+' dias');
const el=(tag,attrs)=>{const e=document.createElementNS(ns,tag);for(const [k,v] of Object.entries(attrs))e.setAttribute(k,v);return e;};
const y=v=>top+(h-top-bottom)*(1-v/ceiling);
for(let v=0;v<=ceiling+1e-9;v+=step){
@@ -1673,7 +1708,7 @@ const eventsIfAllowed=async()=>{if(may('integrations'))await loadEvents();};
const integRow=o=>may('integrations')?integration(o):integration({name:o.name,state:o.state,tone:o.tone,summary:o.summary});
let mpCheck=null;
function renderIntegrations(){
const t=board.tiny||{};const rows=may('produce')?[folderCard()]:[];
const t=board.tiny||{};const rows=may('print')?[folderCard()]:[];
$('event-log').hidden=!may('integrations');
if(!may('manage')){$('integrations').replaceChildren(...rows);return;}
const act=(text,fn)=>button(text,fn,'btn small');

View File

@@ -208,7 +208,8 @@
<a href="https://wa.me/message/NJ76CLIOUGXLB1" target="_blank" rel="noopener">16 99428-0056</a>
· arquivos 16 99230-2546<br>
<a href="mailto:atendimentodropstar@gmail.com">atendimentodropstar@gmail.com</a><br>
Segunda a sexta, 07h às 17h
Mande sua arte em qualquer horário.<br>
Retirada em Franca, de segunda a sexta, das 7h às 18h
</div>
</div>
<div class="fbase">

View File

@@ -37,7 +37,7 @@ function sel(fs){
const fora = fs.filter(f=>!regra.test(f.name));
fs = fs.filter(f=>regra.test(f.name));
recusa(fora);
const max=window.dtfUploadMaxBytes||5*1073741824;
const max=window.dtfUploadMaxBytes||1073741824;
const grandes=fs.filter(f=>f.size>max);
if(grandes.length){
const el=$('recusa');