feat: an order in correction offers the customer's WhatsApp with the message written
Customers are not told automatically that their artwork needs a fix: Tiny has no situação for it. An order in Correção now opens with the reason and "Avisar no WhatsApp", which opens the customer's chat with the message ready: the order code, the reason and the link to send the new file in Minha conta. "Copiar mensagem" covers orders without a WhatsApp number. The board carries each corrected order's last reason and the Site's address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -329,6 +329,7 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
.copy:hover{color:var(--tx);border-color:var(--line3)}
|
||||
.zapbtn{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:7px;background:rgba(111,209,156,.1);color:var(--ok);text-decoration:none;font-size:13px;font-weight:600}
|
||||
.zapbtn:hover{background:rgba(111,209,156,.18)}
|
||||
.zapbtn.big{height:36px;padding:0 14px;font-size:14px;border-radius:8px}
|
||||
|
||||
/* Facts: small labelled boxes */
|
||||
.factgrid{margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:6px}
|
||||
|
||||
@@ -490,6 +490,9 @@ function moves(order){
|
||||
},'btn danger');remove.style.alignSelf='flex-start';
|
||||
box.append(note,remove);return box;
|
||||
}
|
||||
// In correction, the customer has to be told: a message ready to send on
|
||||
// WhatsApp with the reason and where to send the new file.
|
||||
const waiting=order.state==='cor'?correctionNotice(order):null;
|
||||
const row=node('div',undefined,'moves');
|
||||
// One form open at a time under the buttons.
|
||||
const forms=[];
|
||||
@@ -572,7 +575,26 @@ 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(...(step?[step]:[]),row,...(sub.children.length?[sub]:[]),...forms.filter(f=>!f.parentNode));return box;
|
||||
box.append(...(waiting?[waiting]:[]),...(step?[step]:[]),row,...(sub.children.length?[sub]:[]),...forms.filter(f=>!f.parentNode));return box;
|
||||
}
|
||||
function correctionNotice(order){
|
||||
const s=order.snapshot, reason=order.correction_reason||'';
|
||||
const link=board.site_origin+'/conta/pedidos?order='+order.id;
|
||||
const message='Olá! Aqui é da Dropstar. O seu pedido '+orderCode(order.id)+' precisa de um ajuste na arte antes da impressão'+
|
||||
(reason?': '+reason:'.')+'\n\nEnvie o arquivo corrigido por aqui: '+link;
|
||||
const text=node('div');
|
||||
text.append(node('b','Aguardando a correção do cliente'),node('span',reason?'Motivo: '+reason:'O motivo está no histórico.'));
|
||||
const actions=node('div',undefined,'stepactions');
|
||||
const zap=whatsappLink(s.customer.zap);
|
||||
if(zap){
|
||||
const a=node('a','Avisar no WhatsApp','zapbtn big');a.href=zap+'?text='+encodeURIComponent(message);
|
||||
a.target='_blank';a.rel='noopener noreferrer';a.prepend(icon(ICON_CHAT));actions.append(a);
|
||||
}
|
||||
const copy=button('Copiar mensagem',async()=>{await navigator.clipboard.writeText(message);say('Mensagem copiada.');},'btn ghost');
|
||||
actions.append(copy);
|
||||
text.append(actions);
|
||||
if(!zap)text.append(node('span','Sem WhatsApp no pedido: envie a mensagem para '+s.customer.mail+'.'));
|
||||
const box=node('div',undefined,'nextstep lead');box.append(node('span','!','nextmark'),text);return box;
|
||||
}
|
||||
// ---- Final files: the file each item is printed from, approved by an operator.
|
||||
const finalDone=order=>order.snapshot.items.every((_,index)=>(order.final_items||[]).includes(index));
|
||||
|
||||
Reference in New Issue
Block a user