feat: expired quotes leave the Kanban, and the buyer's name comes before the e-mail
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 2m42s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 57s
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 2m42s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 57s
A quote approved more than QUOTE_VALID_HOURS ago can never be paid; it no longer shows in Cotações, its count or the search. Wherever a customer is shown, the name comes first (the customer's, else whoever receives the delivery) with the e-mail under it; with no name, the e-mail alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -280,7 +280,8 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
/* Quote rows */
|
||||
.qitem .qmain{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
|
||||
.qhead{display:flex;align-items:center;gap:8px;min-width:0}
|
||||
.qmail{font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.qmail{min-width:0}
|
||||
.qmail b{display:block;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.qtotal{margin-left:auto;font-size:15px;flex-shrink:0}
|
||||
.qtotal.muted{font-size:13px;font-weight:600}
|
||||
.newdot{width:7px;height:7px;flex-shrink:0;border-radius:999px;background:var(--accent)}
|
||||
@@ -329,3 +330,10 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
.timeline small{flex-shrink:0;color:var(--faint);font-size:13px}
|
||||
/* Without a picture, a long sheet's layout drawing stays a preview, not a column. */
|
||||
.item .preview:not(.with-art) svg{width:auto;max-width:100%;max-height:260px;margin:0 auto}
|
||||
|
||||
/* The buyer: a name over the e-mail, or the e-mail alone. */
|
||||
.buyer{display:flex;flex-direction:column;min-width:0}
|
||||
.buyer b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.buyer-mail{font-size:12.5px;color:var(--faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.card .buyer b{font-size:14px;font-weight:600}
|
||||
.qname .buyer b{font-size:19px}
|
||||
|
||||
@@ -118,6 +118,20 @@ function facts(pairs){
|
||||
for(const [k,v] of pairs){if(v===null||v===undefined||v==='')continue;const d=node('div');d.append(node('dt',k),node('dd',v));dl.append(d);}
|
||||
return dl;
|
||||
}
|
||||
// Who is buying: a name when the order has one (the customer's, or whoever
|
||||
// receives the delivery), else the e-mail. With a name, the e-mail is the
|
||||
// second line, still searchable.
|
||||
function buyer(content){
|
||||
const c=content.customer||{}, name=(c.name||content.destination?.recipient||'').trim();
|
||||
return {title:name||c.mail, mail:name?c.mail:''};
|
||||
}
|
||||
function buyerBlock(content,className){
|
||||
const who=buyer(content);
|
||||
const box=node('div',undefined,'buyer '+(className||''));
|
||||
const title=node('b',who.title);title.title=who.mail||who.title;box.append(title);
|
||||
if(who.mail)box.append(node('span',who.mail,'buyer-mail'));
|
||||
return box;
|
||||
}
|
||||
const sheetSize=p=>p?cm(p.film_width_cm)+' × '+cm(p.height_cm)+' cm':null;
|
||||
const hoursSince=v=>Math.floor((Date.now()-new Date(v))/3600000);
|
||||
// The freight's weight: what the package weighs and, when Jadlog charges the
|
||||
@@ -303,7 +317,7 @@ function card(order){
|
||||
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)));
|
||||
}
|
||||
c.append(artBox(s.items,'card-art'),top,node('div',s.customer.mail,'cust'),meta,place(s.destination));
|
||||
c.append(artBox(s.items,'card-art'),top,buyerBlock(s,'cust'),meta,place(s.destination));
|
||||
if(flags.children.length)c.append(flags);
|
||||
c.onclick=()=>openPanel(order.id);
|
||||
c.ondragstart=e=>{
|
||||
@@ -372,7 +386,7 @@ function renderPanel(order){
|
||||
const facts=node('section',undefined,'facts');
|
||||
const who=node('div',undefined,'fcard');
|
||||
const doc=node('span',undefined,'line');doc.append('CNPJ '+cnpj(s.customer.cnpj),copyButton(cnpj(s.customer.cnpj),'Copiar CNPJ'));
|
||||
who.append(node('p','Cliente','eyebrow'),node('b',s.customer.mail),doc);
|
||||
who.append(node('p','Cliente','eyebrow'),buyerBlock(s),doc);
|
||||
const zap=whatsappLink(s.customer.zap);
|
||||
if(zap){const a=node('a','Abrir conversa','zapbtn');a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.title=s.customer.zap;a.prepend(icon(ICON_CHAT));who.append(a);}
|
||||
const where=node('div',undefined,'fcard');
|
||||
@@ -566,8 +580,7 @@ function renderQuotes(){
|
||||
const head=node('div',undefined,'qhead');
|
||||
// A quote from the last ten minutes carries a dot: someone just ordered.
|
||||
if(Date.now()-new Date(q.created_at)<600000){const dot=node('span',undefined,'newdot');dot.title='Chegou agora';head.append(dot);}
|
||||
const mail=node('b',q.draft.customer.mail,'qmail');mail.title=q.draft.customer.mail;
|
||||
head.append(mail,node('b',q.approved?money(q.approved.total_cents):'a revisar','qtotal'+(q.approved?'':' muted')));
|
||||
head.append(buyerBlock(q.draft,'qmail'),node('b',q.approved?money(q.approved.total_cents):'a revisar','qtotal'+(q.approved?'':' muted')));
|
||||
const meta=node('div',undefined,'meta');
|
||||
meta.append(gradePill(lowestGrade(items)),productBadge(items),node('b',metres(quoteMetres(q)),'mtr'),
|
||||
place(q.draft.destination),node('span',ago(q.created_at),'age'));
|
||||
@@ -594,7 +607,7 @@ function review(quote){
|
||||
const head=node('div',undefined,'head');const title=node('div',undefined,'qtitle');
|
||||
const status={pending_review:['● A revisar','accent'],approved:['● Aprovada · aguardando pagamento','ok'],
|
||||
expired:['Expirada','bad'],paid:['● Paga','info']}[quote.status]||[quote.status,''];
|
||||
const name=node('div',undefined,'qname');name.append(node('b',quote.draft.customer.mail),badge(...status));
|
||||
const name=node('div',undefined,'qname');name.append(buyerBlock(quote.draft),badge(...status));
|
||||
const sub=node('div',undefined,'qsub');const c=quote.draft.customer;
|
||||
const doc=node('span');doc.append('CNPJ '+cnpj(c.cnpj),copyButton(cnpj(c.cnpj),'Copiar CNPJ'));sub.append(doc);
|
||||
const zap=whatsappLink(c.zap);
|
||||
@@ -927,7 +940,7 @@ function hitRow(items,title,sub,meta,badge,color,open){
|
||||
}
|
||||
function orderHit(order){
|
||||
const s=order.snapshot;
|
||||
return hitRow(s.items,'#'+order.number,s.customer.mail,
|
||||
return hitRow(s.items,'#'+order.number,buyer(s).title,
|
||||
s.items.map(i=>SHORT[i.mode]+' · '+metres(i.billed_metres)).join(' + ')+' · '+(s.destination?'Entrega':'Retirada')+' · pago '+when(order.created_at),
|
||||
board.states[order.state],STAGE_COLORS[order.state],()=>{
|
||||
// An older finished order is not on the board yet: it joins, like "Carregar mais".
|
||||
@@ -935,7 +948,7 @@ function orderHit(order){
|
||||
showTab('board');openPanel(order.id);});
|
||||
}
|
||||
function quoteHit(q){
|
||||
return hitRow(q.draft.items,q.approved?money(q.approved.total_cents):'Cotação '+q.id.slice(0,8),q.draft.customer.mail,
|
||||
return hitRow(q.draft.items,q.approved?money(q.approved.total_cents):'Cotação '+q.id.slice(0,8),buyer(q.draft).title,
|
||||
q.draft.items.map(i=>SHORT[i.mode]).join(' + ')+' · '+metres(quoteMetres(q))+' · '+ago(q.created_at),
|
||||
q.approved?'Aguardando pagamento':'A revisar',q.approved?'':'var(--accent)',()=>{
|
||||
// Opens Cotações filtered to this customer, with this quote selected.
|
||||
|
||||
Reference in New Issue
Block a user