feat: an order can be marked "Aguardando contato" until the customer is reached
All checks were successful
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Integration suite on a real stack (push) Successful in 4m8s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m7s
All checks were successful
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Integration suite on a real stack (push) Successful in 4m8s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m7s
The 7 October meeting asked for a way to flag orders whose file needs a word with the customer before printing: rename Arte tratada, or tag the card. A tag keeps the stage meaning "file checked" and the order where it is in the queue. In the order panel, "☎ Aguardando contato" asks what has to be agreed; the card then shows the mark, the board has an "Aguardando contato" filter, and the panel shows the note, who marked it and when, the customer's WhatsApp and "Contato feito", which clears it. The customer is not told. Sellers see the mark but cannot set it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -389,6 +389,8 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
.callout{display:flex;flex-direction:column;gap:3px;padding:10px 12px;border-radius:9px;background:rgba(242,179,61,.1)}
|
||||
.callout b{font-size:13.5px;color:var(--warn)}
|
||||
.callout span{font-size:13px;color:var(--tx2)}
|
||||
.callout span.faint{color:var(--faint)}
|
||||
.callout .buttons{margin-top:6px;align-items:center}
|
||||
|
||||
/* Order panel */
|
||||
.paidline{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;font-size:14px;color:var(--muted)}
|
||||
@@ -410,7 +412,7 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
.readyfile b{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13.5px}
|
||||
.stepactions{display:flex;gap:10px;margin-top:12px;flex-wrap:wrap}
|
||||
.btn.small{height:30px;padding:0 10px;font-size:13px}
|
||||
.subactions{display:flex;margin-top:-4px}
|
||||
.subactions{display:flex;flex-wrap:wrap;gap:4px 18px;margin-top:-4px}
|
||||
.timeline li{display:flex;align-items:baseline;gap:10px;font-size:14px}
|
||||
.timeline li div{flex:1;min-width:0}
|
||||
.timeline small{flex-shrink:0;color:var(--faint);font-size:13px}
|
||||
|
||||
@@ -475,6 +475,10 @@ function printState(order){
|
||||
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;
|
||||
// "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';
|
||||
const contactWho=order=>(order.contact_by||'')+' em '+when(order.contact_since);
|
||||
function matchesFilter(order,key){
|
||||
// A cancelled order shows only under "Cancelados", and only there.
|
||||
if(key==='cancelados')return !!order.cancelled_at;
|
||||
@@ -485,6 +489,7 @@ function matchesFilter(order,key){
|
||||
if(key==='entrega')return !!order.snapshot.destination;
|
||||
if(key==='retirada')return !order.snapshot.destination;
|
||||
if(key==='parados')return stalled(order);
|
||||
if(key==='contato')return waitingContact(order);
|
||||
if(key==='manual')return ['rec','tra'].includes(order.state)&&!finalDone(order)&&(order.print_files||[]).some(r=>
|
||||
(r.status==='manual'||r.status==='failed')&&!(order.corrections||[]).some(f=>f.item_index===r.item_index));
|
||||
return true;
|
||||
@@ -492,7 +497,7 @@ function matchesFilter(order,key){
|
||||
const matches=order=>matchesFilter(order,filter);
|
||||
function renderBoard(){
|
||||
const filters=[['all','Todos'],['textil','Têxtil'],['uv','UV'],['entrega','Entrega'],['retirada','Retirada'],
|
||||
['parados','Parados'],['manual','Preparar à mão'],['cancelados','Cancelados']];
|
||||
['parados','Parados'],['contato','Aguardando contato'],['manual','Preparar à mão'],['cancelados','Cancelados']];
|
||||
// Each chip says how many orders in progress it would show.
|
||||
const inProgress=board.orders.filter(o=>o.state!=='fin'&&!o.cancelled_at);
|
||||
$('filters').replaceChildren(...filters.map(([key,label])=>{
|
||||
@@ -563,6 +568,7 @@ function card(order){
|
||||
flags.append(badge((p.tone==='ok'?'✓ ':p.tone==='warn'?'! ':'')+p.text,p.tone));
|
||||
if(s.items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva','warn','O cliente aceitou a ressalva de resolução'));
|
||||
if(stalled(order))flags.append(badge('⏱ Parado '+hoursSince(order.updated_at)+' h','bad','Sem mudar de etapa desde '+when(order.updated_at)));
|
||||
if(waitingContact(order))flags.append(badge('☎ Aguardando contato','warn',order.contact_note+' · '+contactWho(order)));
|
||||
}
|
||||
c.append(artBox(s.items,'card-art'),top,buyerBlock(s,'cust'),meta,place(s.destination));
|
||||
if(order.machine&&order.state!=='fin'){const m=node('div',undefined,'place machine');m.append(icon(ICON_PRINTER),order.machine.name);c.append(m);}
|
||||
@@ -694,6 +700,7 @@ function moves(order){
|
||||
if(!may('produce')){
|
||||
// Sellers read the order; a correction's notice is theirs to send too.
|
||||
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'));
|
||||
return box;
|
||||
}
|
||||
@@ -762,6 +769,20 @@ 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;}};
|
||||
}
|
||||
// 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)){
|
||||
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');
|
||||
what.required=true;what.minLength=3;what.maxLength=500;
|
||||
const go=node('button','Marcar aguardando contato','btn');
|
||||
contactForm.append(what,go);
|
||||
contactForm.onsubmit=async e=>{e.preventDefault();go.disabled=true;
|
||||
try{await api('/orders/'+order.id+'/contact',{waiting:true,note:what.value.trim()});say('Pedido #'+order.number+' aguardando contato.');await load();}
|
||||
catch(error){say(error.message,true);go.disabled=false;}};
|
||||
}
|
||||
// Rare and destructive: behind a menu. A test order is deleted; a paid one
|
||||
// is cancelled, with a reason, and kept.
|
||||
const cancelForm=node('form',undefined,'reason');cancelForm.hidden=true;forms.push(cancelForm);
|
||||
@@ -791,7 +812,19 @@ 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;}};
|
||||
box.append(...(waiting?[waiting]:[]),...(step?[step]:[]),row,...(sub.children.length?[sub]:[]),...forms.filter(f=>!f.parentNode));return box;
|
||||
const contactNow=waitingContact(order)?contactNotice(order,true):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){
|
||||
const box=node('div',undefined,'callout contact');
|
||||
box.append(node('b','☎ Aguardando contato com o cliente'),node('span',order.contact_note),node('span',contactWho(order),'faint'));
|
||||
const actions=node('div',undefined,'buttons');
|
||||
const zap=whatsappLink(order.snapshot.customer.zap);
|
||||
if(zap){const a=node('a','Abrir conversa','zapbtn');a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.prepend(icon(ICON_CHAT));actions.append(a);}
|
||||
if(canClear)actions.append(button('Contato feito',async()=>{
|
||||
await api('/orders/'+order.id+'/contact',{waiting:false});say('Contato registrado: a marca saiu do pedido #'+order.number+'.');await load();},'btn small'));
|
||||
if(actions.children.length)box.append(actions);
|
||||
return box;
|
||||
}
|
||||
function correctionNotice(order){
|
||||
const s=order.snapshot, reason=order.correction_reason||'';
|
||||
|
||||
Reference in New Issue
Block a user