feat: Dropstar's new flow: Arte conferida is the queue, Revisão and the Revisor
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 3m36s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m24s
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 3m36s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m24s
The board Dropstar drew on 2026-10-23: Arte recebida, Arte conferida, Imprimindo, Correção, Revisão, Finalizado. - Fila de impressão leaves the board: Arte conferida is the queue. It takes an order only with every item's final approved, keeps the finals as approved, orders its cards for printing and has the room's "Baixar" and the automatic folder. Orders that were in the queue move there once, with a line in their history - Revisão checks the printed sheet, and the new Revisor profile is the only one that sends an order to Finalizado (the superadmin too, for support) - who moves what, from the server (MOVES): the designer the artwork, asking for corrections and bringing the new art back; the operator Arte conferida to Imprimindo to Revisão; admin and gestão everything else, Correção included; a step back belongs to whoever makes the move it undoes - Tiny: Arte conferida is "Preparando envio" and Finalizado "Pronto para envio", for delivery orders too - Prova OK still comes before Finalizado; the customer's portal shows the new steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
--line:#262A2F;--line2:#2A2F35;--line3:#3A4047;
|
||||
--tx:#ECE9E4;--tx2:#D5D2CC;--muted:#A3A9B0;--faint:#8B929A;
|
||||
--accent:#FF8B2B;--accent-tx:#FFB575;--ok:#6FD19C;--warn:#F2B33D;--bad:#F4968B;--bad-line:#5A3530;
|
||||
--rec:#2BB6D9;--tra:#E0508F;--fil:#E9C23A;--imp:#D9D6D0;--cor:#F06A5B;--fin:#3FB97A;
|
||||
--rec:#2BB6D9;--tra:#E0508F;--fil:#E9C23A;--imp:#D9D6D0;--cor:#F06A5B;--rev:#8E6BDE;--fin:#3FB97A;
|
||||
--mono:Manrope,system-ui,sans-serif;
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
@@ -513,6 +513,6 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
.mload{display:flex;justify-content:space-between;gap:8px;font-size:13.5px;color:var(--tx2)}
|
||||
.mload.over{color:var(--bad);font-weight:600}
|
||||
.mtile-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:4px}
|
||||
/* Fila de impressão's tools: Baixar. */
|
||||
/* The queue's tools (Arte conferida): Baixar. */
|
||||
.coltools{display:flex;gap:6px;flex-shrink:0}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<button type="button" data-tab="quotes" aria-selected="false">Cotações <span class="badge" id="badge-quotes"></span></button>
|
||||
<button type="button" data-tab="payments" aria-selected="false">Pagamentos <span class="badge warn" id="badge-payments"></span></button>
|
||||
<button type="button" data-tab="stats" aria-selected="false">Números</button>
|
||||
<button type="button" data-tab="integrations" aria-selected="false">Integrações <span class="badge warn" id="badge-integrations" title="A pasta da Fila de impressão precisa de atenção"></span></button>
|
||||
<button type="button" data-tab="integrations" aria-selected="false">Integrações <span class="badge warn" id="badge-integrations" title="A pasta da fila precisa de atenção"></span></button>
|
||||
<button type="button" data-tab="users" aria-selected="false" hidden>Usuários</button>
|
||||
</nav>
|
||||
<div class="searchbox">
|
||||
@@ -102,8 +102,9 @@
|
||||
<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. 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>
|
||||
Gestão: tudo, menos usuários; manda o pedido para Correção e traz de volta. Designer: vê todos os pedidos, aprova e recusa o arquivo final, pede correção.
|
||||
Operador: ligado a uma máquina, vê só os pedidos dela; imprime e passa para a Revisão. Revisor: confere a folha impressa e libera; é o único que manda para Finalizado.
|
||||
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>
|
||||
|
||||
106
web/kanban.js
106
web/kanban.js
@@ -5,8 +5,12 @@ const $ = id=>document.getElementById(id);
|
||||
// Remove credentials saved by older local builds. Only HttpOnly sessions now.
|
||||
sessionStorage.removeItem('dtf-operator');
|
||||
|
||||
const STAGE_COLORS={rec:'var(--rec)',tra:'var(--tra)',fil:'var(--fil)',imp:'var(--imp)',cor:'var(--cor)',fin:'var(--fin)'};
|
||||
const FLOW=['rec','tra','fil','imp','fin'];
|
||||
// Dropstar's flow (2026-10-23): Arte conferida is the print queue and Revisão
|
||||
// checks the printed sheet. 'fil' (Fila de impressão) is only in older history.
|
||||
const STAGE_COLORS={rec:'var(--rec)',tra:'var(--tra)',fil:'var(--fil)',imp:'var(--imp)',cor:'var(--cor)',rev:'var(--rev)',fin:'var(--fin)'};
|
||||
const FLOW=['rec','tra','imp','rev','fin'];
|
||||
const FORMER_STATES={fil:'Fila de impressão'};
|
||||
const stateName=s=>board.states[s]||FORMER_STATES[s]||s;
|
||||
const PRODUCT={file:'DTF Têxtil · folha montada',avulsa:'DTF Têxtil · artes avulsas',uvfile:'DTF UV · folha montada',uv:'DTF UV · artes avulsas'};
|
||||
const SHORT={file:'Têxtil folha',avulsa:'Têxtil avulsa',uvfile:'UV folha',uv:'UV avulsa'};
|
||||
const EVENTS={payment_approved:'Pagamento aprovado',production_started:'Produção iniciada',correction_needed:'Correção necessária',ready:'Pedido pronto',cancelled:'Pedido cancelado'};
|
||||
@@ -39,10 +43,11 @@ 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',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));
|
||||
const ROLE_NAMES={superadmin:'Superadmin',admin:'Administrador',gestao:'Gestão',designer:'Designer',operador:'Operador',revisor:'Revisor',vendedor:'Vendedor'};
|
||||
// Which moves this profile makes, and which columns' order it sets: the
|
||||
// server's own list (app/core/auth.py MOVES), never worked out here.
|
||||
const mayMove=(from,to)=>!!ME?.moves?.some(([a,b])=>a===from&&b===to);
|
||||
const mayReorder=state=>!!ME?.reorder?.includes(state);
|
||||
// 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('print'),users:()=>may('users')};
|
||||
@@ -202,8 +207,8 @@ function download(uid){return async()=>{
|
||||
const link=node('a');link.href=result.url;link.referrerPolicy='no-referrer';link.download=result.name;link.click();
|
||||
};}
|
||||
// ---- Automatic folder ------------------------------------------------------
|
||||
// The print queue's files, saved by this browser as orders enter Fila de
|
||||
// impressão, while the Kanban is open. It is switched on in Integrações, on
|
||||
// The print queue's files, saved by this browser as orders enter Arte
|
||||
// conferida (the queue since 2026-10-23), while the Kanban is open. It is switched on in Integrações, on
|
||||
// the print room's computer: the folder belongs to that browser, not to the
|
||||
// account. Chrome and Edge write into a folder the operator chose
|
||||
// (FlexiPRINT's, or the internal server's share), remembered, with one click
|
||||
@@ -219,8 +224,9 @@ const kv=(()=>{let opened;const open=()=>opened||(opened=new Promise((ok,fail)=>
|
||||
const BRAVE_FLAG='brave://flags/#file-system-access-api';
|
||||
// `when`: download as soon as the order arrives in Arte recebida ('rec', the
|
||||
// default), into a "Recebidos" folder inside the chosen one; the file moves up
|
||||
// when the order enters the queue; or only at the queue ('fil'). Only a chosen folder can do that: Firefox
|
||||
// downloads cannot be moved or removed afterwards.
|
||||
// when the order enters the queue; or only at the queue ('tra'; computers set
|
||||
// before 2026-10-23 kept 'fil', read the same). Only a chosen folder can do
|
||||
// that: Firefox downloads cannot be moved or removed afterwards.
|
||||
const FOLDER={mode:'showDirectoryPicker' in window?'folder':/Firefox\//.test(navigator.userAgent)?'downloads':'none',
|
||||
brave:!!navigator.brave,handle:null,granted:false,downloads:false,when:'rec',
|
||||
saved:new Map(),busy:false,status:'',error:'',last:null,lastSig:null};
|
||||
@@ -242,7 +248,7 @@ async function restoreFolder(){
|
||||
return;
|
||||
}
|
||||
if(FOLDER.mode!=='folder')return;
|
||||
try{FOLDER.when=await kv.get('folder-when')==='fil'?'fil':'rec';
|
||||
try{FOLDER.when=['tra','fil'].includes(await kv.get('folder-when'))?'tra':'rec';
|
||||
FOLDER.handle=await kv.get('folder')||null;
|
||||
if(FOLDER.handle){FOLDER.granted=(await FOLDER.handle.queryPermission({mode:'readwrite'}))==='granted';
|
||||
FOLDER.saved=await loadSaved();
|
||||
@@ -253,7 +259,7 @@ async function restoreFolder(){
|
||||
// row says what is happening; the how-to and the secondary buttons are under
|
||||
// "Detalhes".
|
||||
function folderCard(){
|
||||
const name='Pasta da Fila de impressão', h=FOLDER.handle;
|
||||
const name='Pasta da fila (Arte conferida)', h=FOLDER.handle;
|
||||
const act=(text,fn)=>button(text,fn,'btn small');
|
||||
const ghost=(text,fn)=>button(text,fn,'btn ghost small');
|
||||
const steps=(...lines)=>{const ol=node('ol',undefined,'integ-steps');for(const l of lines)ol.append(l instanceof Node?l:node('li',l));return ol;};
|
||||
@@ -286,7 +292,7 @@ function folderCard(){
|
||||
actions:[act('Liberar pasta',releaseFolder)],extra:[ghost('Trocar pasta',chooseFolder),ghost('Desligar',forgetFolder)]});
|
||||
}else{
|
||||
const when=node('select',undefined,'machine-select');when.setAttribute('aria-label','Quando baixar');
|
||||
for(const [value,text] of [['rec','Baixar em Arte recebida'],['fil','Baixar na Fila de impressão']]){
|
||||
for(const [value,text] of [['rec','Baixar em Arte recebida'],['tra','Baixar em Arte conferida']]){
|
||||
const o=node('option',text);o.value=value;o.selected=FOLDER.when===value;when.append(o);}
|
||||
when.onchange=()=>setWhen(when.value);
|
||||
row=integration({name,state:FOLDER.error?'Verificar':'Ligada',tone:FOLDER.error?'warn':'ok',
|
||||
@@ -294,8 +300,8 @@ function folderCard(){
|
||||
details:[['Pasta','“'+h.name+'”'],['Arquivos salvos',String(FOLDER.saved.size)],
|
||||
['Último',FOLDER.last?FOLDER.last.toLocaleTimeString('pt-BR',{hour:'2-digit',minute:'2-digit'}):'—'],
|
||||
node('p',FOLDER.when==='rec'
|
||||
?'Em Arte recebida: o arquivo do pedido é baixado em “'+h.name+'/'+RECEIVED+'” assim que o pedido chega, e passa para “'+h.name+'” quando entra na Fila de impressão.'
|
||||
:'Na Fila de impressão: o arquivo é baixado em “'+h.name+'” quando o pedido entra na Fila de impressão.'),
|
||||
?'Em Arte recebida: o arquivo do pedido é baixado em “'+h.name+'/'+RECEIVED+'” assim que o pedido chega, e passa para “'+h.name+'” quando entra em Arte conferida, a fila.'
|
||||
:'Em Arte conferida: o arquivo é baixado em “'+h.name+'” quando o pedido entra em Arte conferida, a fila.'),
|
||||
node('p','Pedido cancelado, excluído ou devolvido para correção: o arquivo sai da pasta. Arquivo trocado: a versão antiga sai. '+
|
||||
'Deixe o Kanban aberto neste computador. Um arquivo que o FlexiPRINT tirar da pasta não é baixado de novo.')],
|
||||
extra:[ghost('Trocar pasta',chooseFolder),ghost('Desligar',forgetFolder)]});
|
||||
@@ -340,7 +346,7 @@ async function setDownloads(on){
|
||||
async function setWhen(when){
|
||||
FOLDER.when=when;FOLDER.lastSig=null;
|
||||
await kv.set('folder-when',when).catch(()=>{});
|
||||
paintFolder();say(when==='rec'?'Os arquivos vão ser baixados assim que o pedido chegar, em “'+RECEIVED+'”.':'Os arquivos vão ser baixados quando o pedido entrar na Fila.');
|
||||
paintFolder();say(when==='rec'?'Os arquivos vão ser baixados assim que o pedido chegar, em “'+RECEIVED+'”.':'Os arquivos vão ser baixados quando o pedido entrar em Arte conferida.');
|
||||
syncFolder(true);
|
||||
}
|
||||
|
||||
@@ -384,7 +390,7 @@ async function moveToQueue(rec){
|
||||
// own timer always asks, since another computer may have moved the order.
|
||||
async function syncFolder(force=false){
|
||||
if(!folderActive()||FOLDER.busy||!board||!may('print'))return;
|
||||
const follows=early()?['rec','tra','cor','fil']:['fil'];
|
||||
const follows=early()?['rec','tra','cor']:['tra'];
|
||||
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(',');
|
||||
if(!force&&sig===FOLDER.lastSig)return;
|
||||
@@ -399,13 +405,13 @@ async function syncFolder(force=false){
|
||||
if(tidy)for(const [uid,rec] of [...FOLDER.saved]){
|
||||
if(!rec.order||rec.place==='done')continue;
|
||||
const state=states[rec.order];
|
||||
if(state==='imp'||state==='fin'){rec.place='done';continue;}
|
||||
if(state==='imp'||state==='rev'||state==='fin'){rec.place='done';continue;}
|
||||
const now=wanted.get(rec.order+':'+rec.item);
|
||||
const expected=state==='fil'||early()&&(state==='rec'||state==='tra');
|
||||
const expected=state==='tra'||early()&&state==='rec';
|
||||
if(state&&state!=='cancelled'&&state!=='cor'&&!(expected&&(!now||now.upload_id!==uid)))continue;
|
||||
await removeSaved(rec);FOLDER.saved.delete(uid);removed++;await keepSaved();
|
||||
}
|
||||
const pending=files.filter(f=>{const r=FOLDER.saved.get(f.upload_id);return !r||r.place==='early'&&f.state==='fil';});
|
||||
const pending=files.filter(f=>{const r=FOLDER.saved.get(f.upload_id);return !r||r.place==='early'&&f.state==='tra';});
|
||||
for(const [i,file] of pending.entries()){
|
||||
const rec=FOLDER.saved.get(file.upload_id);
|
||||
const up=!!rec&&await moveToQueue(rec);
|
||||
@@ -419,11 +425,11 @@ async function syncFolder(force=false){
|
||||
}else{
|
||||
const r=await fetch(file.url,{referrerPolicy:'no-referrer'});
|
||||
if(!r.ok||!r.body)throw new Error('não foi possível baixar '+file.name+' (erro '+r.status+').');
|
||||
await writeWhole(file.state==='fil'?FOLDER.handle:await received(),file.name,r.body);
|
||||
await writeWhole(file.state==='tra'?FOLDER.handle:await received(),file.name,r.body);
|
||||
}
|
||||
}
|
||||
FOLDER.saved.set(file.upload_id,{order:file.order,item:file.item,name:file.name,
|
||||
place:file.state==='fil'||FOLDER.mode!=='folder'?'queue':'early'});
|
||||
place:file.state==='tra'||FOLDER.mode!=='folder'?'queue':'early'});
|
||||
FOLDER.last=new Date();await keepSaved();
|
||||
}
|
||||
FOLDER.lastSig=sig;FOLDER.error='';
|
||||
@@ -544,7 +550,7 @@ function render(){
|
||||
// ---- Production board ----------------------------------------------------
|
||||
|
||||
function printState(order){
|
||||
if(order.state==='fil'||order.state==='imp')return {text:'Final aprovado',tone:'ok'};
|
||||
if(order.state==='imp'||order.state==='rev')return {text:'Final aprovado',tone:'ok'};
|
||||
if(order.state==='fin')return {text:'Concluído',tone:'ok'};
|
||||
if(order.state==='cor')return {text:'Aguardando o cliente',tone:''};
|
||||
if(finalDone(order))return {text:'Final aprovado',tone:'ok'};
|
||||
@@ -557,7 +563,7 @@ function printState(order){
|
||||
return {text:items>1&&ready?ready+' de '+items+' pronto':'Preparar à mão',tone:'warn'};
|
||||
return {text:'Sem arquivo gerado',tone:'warn'};
|
||||
}
|
||||
const stalled=order=>['rec','tra','fil','imp'].includes(order.state)&&Date.now()-new Date(order.updated_at)>LATE_HOURS*3600000;
|
||||
const stalled=order=>['rec','tra','imp','rev'].includes(order.state)&&Date.now()-new Date(order.updated_at)>LATE_HOURS*3600000;
|
||||
// "Aguardando contato": a word with the customer is needed before printing.
|
||||
// A mark on the card, not a stage; a finished order no longer needs it.
|
||||
const waitingContact=order=>!!order.contact_since&&!order.cancelled_at&&order.state!=='fin';
|
||||
@@ -658,7 +664,7 @@ function renderFilters(){
|
||||
}
|
||||
function renderBoard(){
|
||||
renderFilters();
|
||||
const active=board.orders.filter(o=>['rec','tra','fil','imp'].includes(o.state));
|
||||
const active=board.orders.filter(o=>['rec','tra','imp'].includes(o.state));
|
||||
const queued=active.reduce((s,o)=>s+o.snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0),0);
|
||||
$('board-summary').textContent=metres(queued)+' em produção';
|
||||
$('kan').replaceChildren(...Object.entries(board.states).map(([state,title])=>{
|
||||
@@ -672,8 +678,8 @@ function renderBoard(){
|
||||
// Finished orders are a recent window, not the whole history: say so.
|
||||
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('print');
|
||||
// The print queue (Arte conferida) has the room's tools: there it says only the metres.
|
||||
const tools=state==='tra'&&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){
|
||||
@@ -688,7 +694,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'&&mayMove(state,state)){e.preventDefault();markDrop(column,e.clientY);return;}
|
||||
if(dragging?.state===state&&state!=='fin'&&mayReorder(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');
|
||||
@@ -705,7 +711,8 @@ 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&&mayMove(order.state,order.state);
|
||||
const c=node('button',undefined,'card');c.type='button';c.dataset.card=order.id;
|
||||
c.draggable=!order.cancelled_at&&(mayReorder(order.state)||board.transitions[order.state].some(s=>s!=='cor'&&mayMove(order.state,s)));
|
||||
if(order.id===openOrder)c.classList.add('open');
|
||||
const s=order.snapshot;
|
||||
const top=node('div',undefined,'row');
|
||||
@@ -736,7 +743,9 @@ function card(order){
|
||||
e.dataTransfer.setData('text/plain',order.id);
|
||||
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);
|
||||
const moves=forward.length?'Mover para '+forward.map(s=>board.states[s]).join(' ou '):'';
|
||||
const priority=mayReorder(order.state)?'arraste para cima ou para baixo para mudar a prioridade':'';
|
||||
say(moves&&priority?moves+', ou '+priority:moves||priority,false,60000);
|
||||
};
|
||||
c.ondragend=()=>{dragging=null;clearDrop();for(const col of document.querySelectorAll('.col'))col.classList.remove('allowed','target');say('');};
|
||||
return c;
|
||||
@@ -858,8 +867,9 @@ function renderPanel(order){
|
||||
}
|
||||
function moves(order){
|
||||
const box=node('div',undefined,'panel-actions');
|
||||
if(!may('produce')){
|
||||
// Sellers read the order; a correction's notice is theirs to send too.
|
||||
// Sellers read the order; a correction's notice is theirs to send too. The
|
||||
// Revisor handles no artwork but releases to Finalizado, so gets the moves.
|
||||
if(!may('produce')&&!ME?.moves?.length){
|
||||
if(order.state==='cor'&&!order.cancelled_at)box.append(correctionNotice(order));
|
||||
if(waitingContact(order))box.append(contactNotice(order,false));
|
||||
box.append(node('p',order.cancelled_at?'Pedido cancelado.':'Somente consulta: seu perfil não move pedidos.','muted'));
|
||||
@@ -890,9 +900,9 @@ function moves(order){
|
||||
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)){
|
||||
// The queue needs an approved final: approving it is the next step,
|
||||
// shown first, with the file that would be printed.
|
||||
}else if(next==='tra'&&!finalDone(order)){
|
||||
// Arte conferida is the queue and needs an approved final: approving it
|
||||
// is the next step, shown first, with the file that would be printed.
|
||||
const ready=readyFinals(order), all=ready.every(Boolean), many=ready.length>1;
|
||||
const upload=finalForm(order,all?ready.map(()=>null):ready);forms.unshift(upload);
|
||||
const text=node('div');text.append(node('b','Próximo passo: aprovar o arquivo final'));
|
||||
@@ -927,7 +937,8 @@ function moves(order){
|
||||
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',order.state==='fin'?'Pedido concluído.':'Daqui em diante, com a produção.','muted'));
|
||||
if(!row.children.length&&!step)row.append(node('span',order.state==='fin'?'Pedido concluído.'
|
||||
:order.state==='rev'?'A folha impressa é conferida e liberada pelo Revisor.':'Daqui em diante, com a produção.','muted'));
|
||||
// Undo a mistaken move: one stage back, internal reason, no customer message.
|
||||
const previous=mayMove(order.state,board.back?.[order.state])?board.back?.[order.state]:null;
|
||||
const sub=node('div',undefined,'subactions');
|
||||
@@ -940,14 +951,14 @@ function moves(order){
|
||||
backForm.append(why,go);
|
||||
backForm.onsubmit=async e=>{e.preventDefault();go.disabled=true;try{await move(order,previous,why.value.trim());}catch(error){say(error.message,true);go.disabled=false;}};
|
||||
}
|
||||
// The proof may be checked before Imprimindo, while the order waits in the queue.
|
||||
if(order.state==='fil'&&proofPending(order)&&may('print')){
|
||||
// The proof is checked by the room, in the queue (Arte conferida) or while printing.
|
||||
if(['tra','imp'].includes(order.state)&&proofPending(order)&&may('print')){
|
||||
const b=button('✓ Prova OK',()=>proofOk(order),'linkbtn');b.title='A prova foi impressa e conferida';sub.append(b);
|
||||
}
|
||||
// Waiting for a word with the customer: shown on top with "Contato feito";
|
||||
// otherwise marked from here, with what has to be agreed.
|
||||
const contactForm=node('form',undefined,'reason');contactForm.hidden=true;forms.push(contactForm);
|
||||
if(order.state!=='fin'&&!waitingContact(order)){
|
||||
if(order.state!=='fin'&&!waitingContact(order)&&may('produce')){
|
||||
const b=node('button','☎ Aguardando contato','linkbtn');b.type='button';b.dataset.contact='';
|
||||
b.title='Marcar que é preciso falar com o cliente antes de imprimir';b.onclick=()=>toggle(contactForm);sub.append(b);
|
||||
const what=node('input');what.placeholder='O que precisa ser combinado com o cliente';what.setAttribute('aria-label','O que precisa ser combinado');
|
||||
@@ -987,7 +998,7 @@ function moves(order){
|
||||
const sendFix=node('button','Enviar para correção','btn danger');
|
||||
reason.append(text,sendFix);
|
||||
reason.onsubmit=async e=>{e.preventDefault();sendFix.disabled=true;try{await move(order,'cor',text.value.trim());}catch(error){say(error.message,true);sendFix.disabled=false;}};
|
||||
const contactNow=waitingContact(order)?contactNotice(order,true):null;
|
||||
const contactNow=waitingContact(order)?contactNotice(order,may('produce')):null;
|
||||
box.append(...(waiting?[waiting]:[]),...(contactNow?[contactNow]:[]),...(step?[step]:[]),row,...(sub.children.length?[sub]:[]),...forms.filter(f=>!f.parentNode));return box;
|
||||
}
|
||||
function contactNotice(order,canClear){
|
||||
@@ -1044,7 +1055,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(mayMove(order.state,'fil')?'Arquivo final aprovado. Agora é só mover para a fila.':'Arquivo final aprovado. A produção coloca na fila.');
|
||||
await load();say(mayMove(order.state,'tra')?'Arquivo final aprovado. Agora é só mover para Arte conferida.':'Arquivo final aprovado. Falta mover para Arte conferida.');
|
||||
}
|
||||
// The form for a file the operator prepared, or to pick per item; ready
|
||||
// files come ticked.
|
||||
@@ -1152,8 +1163,9 @@ function finalsSection(order,revisions,section){
|
||||
if(!revisions.length)section.append(node('p','Nenhum arquivo final ainda.','faint'));
|
||||
// Approving is the button at the top; this is for replacing an approved
|
||||
// final, or sending one before the art is marked as handled.
|
||||
// Before approval in Arte conferida, the step at the top is the way in.
|
||||
if(!may('produce')||!['rec','tra','cor'].includes(order.state)||(order.state==='tra'&&!finalDone(order)))return;
|
||||
// Before approval, the step at the top (on the way to Arte conferida) is the way in.
|
||||
// In Arte conferida, the queue, the finals stay as approved: to change one, the order goes back to Arte recebida.
|
||||
if(!may('produce')||!['rec','cor'].includes(order.state)||!finalDone(order))return;
|
||||
const form=finalForm(order,readyFinals(order).map(()=>null));
|
||||
const open=node('button',finalDone(order)?'Enviar nova versão':'Enviar arquivo final','btn ghost');open.type='button';
|
||||
open.style.alignSelf='flex-start';open.onclick=()=>{form.hidden=!form.hidden;if(!form.hidden)form.querySelector('input:not([hidden])')?.focus();};
|
||||
@@ -1167,7 +1179,7 @@ function historySection(order,rows,section){
|
||||
if(reason)text.append(node('span',' · '+reason,'muted'));
|
||||
li.append(text,node('small',when(at)));return li;
|
||||
};
|
||||
for(const r of [...rows].reverse())list.append(entry(STAGE_COLORS[r.to_state],r.back?'Voltou para '+board.states[r.to_state]:board.states[r.to_state],r.operator,r.created_at,r.reason));
|
||||
for(const r of [...rows].reverse())list.append(entry(STAGE_COLORS[r.to_state],r.back?'Voltou para '+stateName(r.to_state):stateName(r.to_state),r.operator,r.created_at,r.reason));
|
||||
list.append(entry('var(--rec)','Pedido recebido',board.environment==='local'&&order.payment?.provider==='fake'?'pagamento de teste':isTest(order)?'teste, sem pagamento':'Site',order.created_at,''));
|
||||
section.replaceChildren(node('p','Histórico','eyebrow'),list);
|
||||
}
|
||||
@@ -1234,7 +1246,7 @@ function renderUsers(){
|
||||
$('machines-list').replaceChildren(...(machines.length?machines.map(machineTile)
|
||||
:[node('p','Nenhuma máquina cadastrada.','faint')]));
|
||||
}
|
||||
const OPEN_STAGES=['rec','tra','fil','imp','cor'];
|
||||
const OPEN_STAGES=['rec','tra','imp','cor'];
|
||||
function machineTile(m){
|
||||
const tile=node('article',undefined,'mtile'+(m.active?'':' off'));
|
||||
const head=node('div',undefined,'mtile-head');
|
||||
@@ -1274,7 +1286,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','designer','operador','vendedor'];
|
||||
const roles=u?.role==='superadmin'?['superadmin']:['admin','gestao','designer','operador','revisor','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';
|
||||
@@ -1383,7 +1395,7 @@ async function loadStats(){
|
||||
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 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]);
|
||||
const st=data.stages[state], now=data.waiting[state];
|
||||
|
||||
@@ -29,7 +29,8 @@ function icone(nome){
|
||||
}
|
||||
const PRODUTO={file:'DTF Têxtil · folha montada',avulsa:'DTF Têxtil · artes avulsas',
|
||||
uvfile:'DTF UV · folha montada',uv:'DTF UV · artes avulsas'};
|
||||
const TRILHA=['rec','tra','fil','imp','fin'];
|
||||
// The order's steps as the customer sees them (Dropstar's flow, 2026-10-23).
|
||||
const TRILHA=['rec','tra','imp','rev','fin'];
|
||||
const TAMANHO=10;
|
||||
let scope,states={},environment='',conta=null;
|
||||
let filtro={status:'all',code:'',days:0,page:1};
|
||||
|
||||
Reference in New Issue
Block a user