feat: Kanban badges: grade pills, product and warning badges, facts in a grid
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 3m17s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m13s
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 3m17s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m13s
One badge system on every screen (canvas "Kanban DTF — redesign", v2). The grade is a pill coloured by the price ladder's bands (90/75/60/40); product, status and warnings are pills with text, so colour never carries meaning alone. Quote rows: grade, product, metres, delivery city and age on one line; the "Aprovada automaticamente" line is gone (only a team review is noted), and a dot marks quotes from the last ten minutes. The quote detail has a status badge, the total in large type, a copyable CNPJ, a WhatsApp button, facts in a grid and items and freight apart. Board cards carry the grade, product, place and a row of warning badges; columns take their stage colour and filter chips their counts. The order panel shows what was paid and whether it is stalled at the top, customer and delivery as cards, a print problem as a callout, the final-file form behind a "next step", and dates on the right of the history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,7 +138,8 @@ try{
|
||||
await waitFor(()=>kanban.eval('document.querySelectorAll("#quote-filters button").length===2'),'quote filters');
|
||||
await kanban.eval('document.querySelectorAll("#quote-filters button")[1].click()');
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-quote-pick="${qid}"]')`),'approved quote listed on Kanban');
|
||||
assert.equal(await kanban.eval(`document.querySelector('[data-quote-pick="${qid}"]').textContent.includes('Aprovada automaticamente')`),true);
|
||||
// Approved by the Site itself; the row shows the grade instead of saying so.
|
||||
assert.equal(await kanban.eval(`quoteRows.find(q=>q.id==='${qid}').auto_approved && !!document.querySelector('[data-quote-pick="${qid}"] .grade')`),true);
|
||||
assert.equal(await site.eval('pedido[0].production.sources[0].copies'),1);
|
||||
await site.eval('pedido[0].production.sources[0].copies=2;pintaPedido()');
|
||||
await waitFor(async()=> (await site.text()).includes('O carrinho mudou'),'same-price production edit invalidates quote');
|
||||
|
||||
@@ -86,7 +86,7 @@ main{padding:0 24px 24px}
|
||||
.chips{display:flex;gap:8px;flex-wrap:wrap}
|
||||
.bar .chips{margin-left:auto}
|
||||
.kan{display:grid;grid-template-columns:repeat(6,minmax(220px,1fr));gap:12px;overflow-x:auto;padding-bottom:8px;align-items:start}
|
||||
.col{display:flex;flex-direction:column;gap:10px;background:var(--col);border:1px solid #22262B;border-radius:12px;padding:12px;min-height:320px}
|
||||
.col{display:flex;flex-direction:column;gap:10px;background:var(--col);border:1px solid #22262B;border-top:3px solid var(--c,#22262B);border-radius:12px;padding:12px;min-height:320px}
|
||||
.col.allowed{border-color:rgba(255,139,43,.45);background:#17140F}
|
||||
.col.target{border-color:var(--accent)}
|
||||
.col-head{display:flex;flex-direction:column;gap:6px;padding:2px 2px 8px;border-bottom:1px solid #22262B}
|
||||
@@ -102,11 +102,7 @@ main{padding:0 24px 24px}
|
||||
.card .num{font-size:14.5px;font-weight:800}
|
||||
.card .age{margin-left:auto;font-size:13.5px;color:var(--faint)}
|
||||
.card .cust{font-size:14px;font-weight:600;color:var(--tx);width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.tags{display:flex;flex-wrap:wrap;gap:6px}
|
||||
.tag{font-size:13.5px;padding:3px 8px;border-radius:6px;background:var(--card2);color:var(--tx2)}
|
||||
.tag-teste{font-size:12.5px;font-weight:800;letter-spacing:.04em;padding:2px 7px;border-radius:6px;background:var(--warn);color:#1a1300}
|
||||
.card .foot{display:flex;align-items:center;gap:6px;font-size:13.5px}
|
||||
.card .foot .where{margin-left:auto;color:var(--muted)}
|
||||
.late{font-size:13.5px;color:#F06A5B;font-weight:600}
|
||||
|
||||
/* Order panel */
|
||||
@@ -146,9 +142,7 @@ main{padding:0 24px 24px}
|
||||
.finals form{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--line2);border-radius:12px}
|
||||
.finals .slot{display:flex;flex-direction:column;gap:6px;font-size:14px;font-weight:600}
|
||||
.timeline{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:10px}
|
||||
.timeline li{display:flex;gap:12px;font-size:14px}
|
||||
.timeline li::before{content:"";width:8px;height:8px;margin-top:6px;border-radius:999px;background:var(--c,var(--muted));flex-shrink:0}
|
||||
.timeline small{display:block;color:var(--faint);font-size:13.5px}
|
||||
|
||||
/* Quotes */
|
||||
#tab-quotes{padding-top:18px}
|
||||
@@ -157,17 +151,12 @@ main{padding:0 24px 24px}
|
||||
.split .list{width:clamp(460px,34vw,640px);flex-shrink:0;border-right:1px solid var(--line);padding:16px;display:flex;flex-direction:column;gap:12px;background:#111316}
|
||||
.qitem{text-align:left;display:flex;align-items:center;gap:12px;padding:12px;border-radius:10px;border:1px solid var(--line2);background:var(--card);width:100%}
|
||||
.qitem .qmain{flex:1;min-width:0}
|
||||
.qitem .qmain>span{display:block}
|
||||
.qsearch{display:flex;align-items:center;gap:8px;height:38px;padding:0 12px;border:1px solid var(--line2);border-radius:9px;background:var(--card);color:var(--faint)}
|
||||
.qsearch:focus-within{border-color:var(--accent)}
|
||||
.qsearch input{flex:1;min-width:0;border:0;background:transparent;height:auto;padding:0;outline:none}
|
||||
.chips.small{gap:6px}
|
||||
.chips.small .chip{height:30px;padding:0 10px;font-size:13px}
|
||||
.qitem[aria-current=true]{border-color:var(--accent);background:#1F1A15}
|
||||
.qitem b{display:block;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.qitem span{font-size:13.5px;color:var(--muted)}
|
||||
.qitem .right{text-align:right;flex-shrink:0}
|
||||
.qitem .flag{display:block;color:var(--warn);font-weight:600;margin-top:4px}
|
||||
.pane{flex:1;min-width:0;display:flex;flex-direction:column}
|
||||
.pane .head{padding:18px 24px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:14px;flex-wrap:wrap}
|
||||
.pane .head b{font-size:18px;overflow-wrap:anywhere}
|
||||
@@ -232,7 +221,6 @@ table.log td{padding:10px 12px;border-bottom:1px solid #1E2226;vertical-align:to
|
||||
|
||||
/* Icons beside a label: the download buttons, where a card ships, the WhatsApp link. */
|
||||
.btn.with-icon{display:inline-flex;align-items:center;gap:6px}
|
||||
.card .foot .where{display:inline-flex;align-items:center;gap:4px}
|
||||
a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
|
||||
/* Artwork pictures, made by the customer's browser. The checkerboard shows
|
||||
@@ -259,3 +247,85 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom}
|
||||
.preview .view.art img{flex:1;min-width:0;max-height:100%;object-fit:contain}
|
||||
.preview .view.layout{padding:6px;background:var(--bg)}
|
||||
.item .preview .view.layout svg{height:100%;width:auto;max-width:100%}
|
||||
|
||||
/* v2: one badge system. Grade by the price ladder's bands, product, status,
|
||||
warnings; text always says what the colour means. */
|
||||
.grade{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:22px;padding:0 7px;border-radius:6px;font-size:12.5px;font-weight:800;flex-shrink:0}
|
||||
.grade.g90{color:#6FD19C;background:rgba(111,209,156,.16)}
|
||||
.grade.g75{color:#B5DB6E;background:rgba(181,219,110,.15)}
|
||||
.grade.g60{color:#F2B33D;background:rgba(242,179,61,.16)}
|
||||
.grade.g40{color:#FF9B4A;background:rgba(255,155,74,.16)}
|
||||
.grade.g0{color:#F4968B;background:rgba(244,150,139,.16)}
|
||||
.grade.gnone{color:var(--muted);border:1px solid var(--line3)}
|
||||
.pbadge{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:999px;font-size:12px;font-weight:700;color:var(--tx2);background:var(--card2);white-space:nowrap}
|
||||
.pbadge.uv{color:#C9B8FF;background:rgba(167,139,250,.14)}
|
||||
.pill{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 9px;border-radius:999px;font-size:12px;font-weight:700;color:var(--tx2);background:var(--card2);white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
|
||||
.pill.ok{color:var(--ok);background:rgba(111,209,156,.12)}
|
||||
.pill.warn{color:var(--warn);background:rgba(242,179,61,.12)}
|
||||
.pill.bad{color:var(--bad);background:rgba(244,150,139,.14)}
|
||||
.pill.accent{color:var(--accent-tx);background:rgba(255,139,43,.14)}
|
||||
.pill.info{color:var(--rec);background:rgba(43,182,217,.14)}
|
||||
.pill.muted{color:var(--muted)}
|
||||
.place{display:inline-flex;align-items:center;gap:5px;font-size:13px;color:var(--muted);white-space:nowrap}
|
||||
.meta{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
|
||||
.meta .mtr{font-size:13px;color:var(--tx2)}
|
||||
.meta .age{margin-left:auto;font-size:12.5px;color:var(--faint)}
|
||||
.flags{display:flex;flex-wrap:wrap;gap:5px}
|
||||
.chip .chip-n{margin-left:6px;font-size:12px;opacity:.75}
|
||||
|
||||
/* Production cards */
|
||||
.card .meta{width:100%}
|
||||
.card .flags{width:100%;padding-top:8px;border-top:1px solid var(--line)}
|
||||
|
||||
/* 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}
|
||||
.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)}
|
||||
|
||||
/* Quote detail */
|
||||
.pane .head{align-items:flex-start;gap:24px}
|
||||
.qtitle{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
|
||||
.qname{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
|
||||
.qname b{font-size:19px}
|
||||
.qsub{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;font-size:13.5px;color:var(--muted)}
|
||||
.qsub>span{display:inline-flex;align-items:center;gap:6px}
|
||||
.qbig{text-align:right;flex-shrink:0}
|
||||
.qbig span{display:block;font-size:12.5px;color:var(--faint)}
|
||||
.qbig b{font-size:26px;font-weight:800}
|
||||
.qsums{display:flex;justify-content:flex-end;align-items:baseline;gap:6px;font-size:14px;color:var(--muted)}
|
||||
.qsums b{color:var(--tx)}
|
||||
.copy{width:26px;height:26px;padding:0;border-radius:6px;border:1px solid var(--line2);background:transparent;color:var(--faint);display:inline-flex;align-items:center;justify-content:center}
|
||||
.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)}
|
||||
|
||||
/* Facts: small labelled boxes */
|
||||
.factgrid{margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:6px}
|
||||
.factgrid div{padding:8px 10px;border-radius:8px;background:var(--bg)}
|
||||
.factgrid dt{font-size:12px;color:var(--faint)}
|
||||
.factgrid dd{margin:2px 0 0;font-size:14px;font-weight:700}
|
||||
.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)}
|
||||
|
||||
/* Order panel */
|
||||
.paidline{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;font-size:14px;color:var(--muted)}
|
||||
.paidline b{font-size:18px;color:var(--tx)}
|
||||
.fcard{display:flex;flex-direction:column;gap:6px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--card)}
|
||||
.fcard .eyebrow{margin:0}
|
||||
.fcard>b{display:flex;align-items:center;gap:6px}
|
||||
.fcard .line{display:inline-flex;align-items:center;gap:6px;font-size:13.5px;color:var(--muted)}
|
||||
.fcard .zapbtn{align-self:flex-start}
|
||||
.nextstep{display:flex;align-items:center;gap:14px;padding:14px 16px;border:1px dashed var(--line3);border-radius:12px}
|
||||
.nextstep>div{flex:1;display:flex;flex-direction:column;gap:2px}
|
||||
.nextstep b{font-size:14.5px}
|
||||
.nextstep span{font-size:13.5px;color:var(--muted)}
|
||||
.nextmark{width:32px;height:32px;flex-shrink:0;border-radius:9px;background:rgba(255,139,43,.14);color:var(--accent-tx);display:flex;align-items:center;justify-content:center;font-weight:800}
|
||||
.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}
|
||||
/* 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}
|
||||
|
||||
265
web/kanban.js
265
web/kanban.js
@@ -52,16 +52,6 @@ function whatsappLink(zap){
|
||||
if(digits.length<10)return null;
|
||||
return 'https://wa.me/'+(digits.length<=11?'55':'')+digits;
|
||||
}
|
||||
function contato(customer){
|
||||
const line=node('span','CNPJ '+customer.cnpj+' · ');
|
||||
const href=whatsappLink(customer.zap);
|
||||
if(!href){line.append(customer.zap||'');return line;}
|
||||
const d=String(customer.zap).replace(/\D/g,'').replace(/^55(?=\d{10,11}$)/,'');
|
||||
const shown=d.length===11?'('+d.slice(0,2)+') '+d.slice(2,7)+'-'+d.slice(7):d.length===10?'('+d.slice(0,2)+') '+d.slice(2,6)+'-'+d.slice(6):customer.zap;
|
||||
const a=node('a',shown,'zap');a.href=href;a.target='_blank';a.rel='noopener noreferrer';
|
||||
a.title='Abrir conversa no WhatsApp';a.prepend(icon(ICON_CHAT));
|
||||
line.append(a);return line;
|
||||
}
|
||||
function node(tag,text,className){const e=document.createElement(tag);if(text!==undefined&&text!==null)e.textContent=text;if(className)e.className=className;return e;}
|
||||
function button(text,fn,className='btn'){
|
||||
const b=node('button',text,className);b.type='button';
|
||||
@@ -91,6 +81,45 @@ const ICON_TRUCK=['M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2','M
|
||||
const ICON_PIN=['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 12 10 3'];
|
||||
const ICON_DOWNLOAD=['M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4','m7 10 5 5 5-5','M12 15V3'];
|
||||
const ICON_CHAT=['M7.9 20A9 9 0 1 0 4 16.1L2 22Z'];
|
||||
const ICON_COPY=['M9 9h12v12H9z','M5 15V5a2 2 0 0 1 2-2h10'];
|
||||
|
||||
// ---- Badges: one system on every screen (canvas "Kanban DTF — redesign", v2) --
|
||||
// The grade pill is coloured by the price ladder's bands (90/75/60/40), the
|
||||
// same for all four products; product, status and warnings are pills with text.
|
||||
const GRADE_BANDS=[[90,'g90'],[75,'g75'],[60,'g60'],[40,'g40'],[0,'g0']];
|
||||
function gradePill(grade){
|
||||
const n=grade===null||grade===undefined||grade===''?NaN:Number(grade);
|
||||
const ok=Number.isFinite(n);
|
||||
const b=node('span',ok?String(n):'—','grade '+(ok?GRADE_BANDS.find(([min])=>n>=min)[1]:'gnone'));
|
||||
b.title=ok?'Nota da arte: '+n:'Sem nota: conferência manual';return b;
|
||||
}
|
||||
const lowestGrade=items=>{const g=items.map(i=>Number(i.grade)).filter(Number.isFinite);return g.length?Math.min(...g):null;};
|
||||
const PRODUCT_BADGE={file:'Têxtil · Folha',avulsa:'Têxtil · Avulsa',uvfile:'UV · Folha',uv:'UV · Avulsa'};
|
||||
function productBadge(items){
|
||||
const counts=new Map();for(const i of items)counts.set(i.mode,(counts.get(i.mode)||0)+1);
|
||||
const [mode,n]=[...counts][0]||['file',0];
|
||||
return node('span',PRODUCT_BADGE[mode]+(n>1?' ×'+n:'')+(counts.size>1?' +'+(counts.size-1):''),'pbadge'+(mode.startsWith('uv')?' uv':''));
|
||||
}
|
||||
function badge(text,tone='',title=''){const b=node('span',text,'pill '+tone);if(title)b.title=title;return b;}
|
||||
function place(dest,prefix=''){
|
||||
const s=node('span',undefined,'place');s.append(icon(dest?ICON_TRUCK:ICON_PIN),dest?prefix+dest.city+'/'+dest.state:'Retirada em Franca');return s;
|
||||
}
|
||||
const cm=v=>Number(v).toLocaleString('pt-BR',{maximumFractionDigits:1});
|
||||
const plural=(n,one,many)=>n+' '+(n===1?one:many);
|
||||
function cnpj(value){const d=String(value||'').replace(/\D/g,'');return d.length===14?d.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/,'$1.$2.$3/$4-$5'):String(value||'');}
|
||||
function copyButton(text,label){
|
||||
const b=node('button',undefined,'copy');b.type='button';b.title=label;b.setAttribute('aria-label',label);b.append(icon(ICON_COPY));
|
||||
b.onclick=async e=>{e.stopPropagation();try{await navigator.clipboard.writeText(text);say('Copiado.');}catch(_){say('Não foi possível copiar.',true);}};
|
||||
return b;
|
||||
}
|
||||
// Facts as a grid of small labelled boxes; empty values are left out.
|
||||
function facts(pairs){
|
||||
const dl=node('dl',undefined,'factgrid');
|
||||
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;
|
||||
}
|
||||
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);
|
||||
// A download button: the arrow, then its label.
|
||||
function downloadButton(text,fn,className){const b=button(text,fn,className);b.prepend(icon(ICON_DOWNLOAD));b.classList.add('with-icon');return b;}
|
||||
async function api(path,body){
|
||||
@@ -200,27 +229,32 @@ 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;
|
||||
function matches(order){
|
||||
function matchesFilter(order,key){
|
||||
const modes=order.snapshot.items.map(i=>i.mode);
|
||||
if(filter==='textil'&&!modes.some(m=>m==='file'||m==='avulsa'))return false;
|
||||
if(filter==='uv'&&!modes.some(m=>m==='uvfile'||m==='uv'))return false;
|
||||
if(filter==='entrega'&&!order.snapshot.destination)return false;
|
||||
if(filter==='retirada'&&order.snapshot.destination)return false;
|
||||
if(filter==='parados'&&!stalled(order))return false;
|
||||
if(filter==='manual'&&!(order.print_files||[]).some(r=>r.status==='manual'||r.status==='failed'))return false;
|
||||
if(key==='textil')return modes.some(m=>m==='file'||m==='avulsa');
|
||||
if(key==='uv')return modes.some(m=>m==='uvfile'||m==='uv');
|
||||
if(key==='entrega')return !!order.snapshot.destination;
|
||||
if(key==='retirada')return !order.snapshot.destination;
|
||||
if(key==='parados')return stalled(order);
|
||||
if(key==='manual')return (order.print_files||[]).some(r=>r.status==='manual'||r.status==='failed');
|
||||
return true;
|
||||
}
|
||||
const matches=order=>matchesFilter(order,filter);
|
||||
function renderBoard(){
|
||||
const filters=[['all','Todos'],['textil','Têxtil'],['uv','UV'],['entrega','Entrega'],['retirada','Retirada'],
|
||||
['parados','Parados há '+LATE_HOURS+' h'],['manual','Preparar à mão']];
|
||||
['parados','Parados'],['manual','Preparar à mão']];
|
||||
// Each chip says how many orders in progress it would show.
|
||||
const inProgress=board.orders.filter(o=>o.state!=='fin');
|
||||
$('filters').replaceChildren(...filters.map(([key,label])=>{
|
||||
const b=node('button',label,'chip');b.type='button';b.setAttribute('aria-pressed',String(filter===key));
|
||||
b.append(node('span',String(inProgress.filter(o=>matchesFilter(o,key)).length),'chip-n'));
|
||||
if(key==='parados')b.title='Sem mudar de etapa há mais de '+LATE_HOURS+' h';
|
||||
b.onclick=()=>{filter=key;renderBoard();};return b;}));
|
||||
const active=board.orders.filter(o=>['rec','tra','fil','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])=>{
|
||||
const column=node('section',undefined,'col');column.dataset.state=state;
|
||||
const column=node('section',undefined,'col');column.dataset.state=state;column.style.setProperty('--c',STAGE_COLORS[state]);
|
||||
const orders=board.orders.filter(o=>o.state===state&&matches(o));
|
||||
const total=orders.reduce((s,o)=>s+o.snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0),0);
|
||||
const head=node('div',undefined,'col-head');const line=node('div');
|
||||
@@ -247,18 +281,22 @@ 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=true;
|
||||
if(order.id===openOrder)c.classList.add('open');
|
||||
const s=order.snapshot;
|
||||
const top=node('div',undefined,'row');
|
||||
top.append(node('span','#'+order.number,'num'),...(isTest(order)?[node('span','TESTE','tag-teste')]:[]),node('span',ago(order.updated_at),'age'));
|
||||
const tags=node('div',undefined,'tags');
|
||||
for(const item of order.snapshot.items)tags.append(node('span',SHORT[item.mode]+' · '+metres(item.billed_metres),'tag'));
|
||||
const foot=node('div',undefined,'foot');const p=printState(order);
|
||||
const status=node('span',p.text,p.tone);status.style.display='flex';status.style.alignItems='center';status.style.gap='5px';
|
||||
if(p.tone==='ok')status.prepend(icon(ICON_OK));if(p.tone==='warn')status.prepend(icon(ICON_WARN));
|
||||
const dest=order.snapshot.destination;
|
||||
const where=node('span',dest?'Entrega · '+dest.state:'Retirada','where');where.prepend(icon(dest?ICON_TRUCK:ICON_PIN));
|
||||
foot.append(status,where);
|
||||
c.append(artBox(order.snapshot.items,'card-art'),top,node('div',order.snapshot.customer.mail,'cust'),tags,foot);
|
||||
if(stalled(order))c.append(node('div','Parado há mais de '+LATE_HOURS+' h','late'));
|
||||
const meta=node('div',undefined,'meta');
|
||||
meta.append(gradePill(lowestGrade(s.items)),productBadge(s.items),
|
||||
node('b',metres(s.items.reduce((t,i)=>t+Number(i.billed_metres),0)),'mtr'));
|
||||
// What needs attention, as badges; a finished order needs none.
|
||||
const flags=node('div',undefined,'flags');
|
||||
if(order.state!=='fin'){
|
||||
const p=printState(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)));
|
||||
}
|
||||
c.append(artBox(s.items,'card-art'),top,node('div',s.customer.mail,'cust'),meta,place(s.destination));
|
||||
if(flags.children.length)c.append(flags);
|
||||
c.onclick=()=>openPanel(order.id);
|
||||
c.ondragstart=e=>{
|
||||
e.dataTransfer.setData('text/plain',order.id);
|
||||
@@ -308,26 +346,37 @@ function renderPanel(order){
|
||||
const row=node('div',undefined,'row');
|
||||
const stage=node('span',board.states[order.state],'stage');stage.style.setProperty('--c',color);
|
||||
const close=node('button',undefined,'close');close.type='button';close.setAttribute('aria-label','Fechar');close.append(icon(['M6 6l12 12M18 6L6 18']));close.onclick=closePanel;
|
||||
row.append(node('span','#'+order.number,'num'),stage,
|
||||
isTest(order)?node('span','pedido de teste · sem pagamento, não vai ao Tiny nem ao WhatsApp','tag-teste'):node('span','pago '+when(order.created_at),'faint'),close);
|
||||
const test=isTest(order)?node('span','TESTE','tag-teste'):null;
|
||||
if(test)test.title='Pedido de teste: sem pagamento, não vai ao Tiny nem ao WhatsApp';
|
||||
row.append(node('span','#'+order.number,'num'),stage,...(test?[test]:[]),close);
|
||||
// What was paid and when, and whether it is stuck: the first things asked of an order.
|
||||
const paid=node('div',undefined,'paidline');
|
||||
paid.append(node('b',money(order.snapshot.total_cents)),isTest(order)?' sem pagamento · '+when(order.created_at):' pago em '+when(order.created_at));
|
||||
if(stalled(order))paid.append(badge('⏱ Parado há '+hoursSince(order.updated_at)+' h','bad'));
|
||||
const steps=node('ol',undefined,'steps');steps.setAttribute('aria-label','Etapas');
|
||||
const at=FLOW.indexOf(order.state);
|
||||
for(const [i,s] of FLOW.entries()){const li=node('li',board.states[s]);li.style.setProperty('--c',STAGE_COLORS[s]);
|
||||
if(at>=0&&i<at)li.classList.add('done');if(i===at)li.classList.add('now');steps.append(li);}
|
||||
head.append(row,steps,moves(order));
|
||||
head.append(row,paid,steps,moves(order));
|
||||
|
||||
const body=node('div',undefined,'panel-body');
|
||||
const s=order.snapshot, dest=s.destination;
|
||||
const facts=node('section',undefined,'facts');
|
||||
const who=node('div');who.append(node('p','Cliente','eyebrow'),node('b',s.customer.mail),contato(s.customer));
|
||||
const where=node('div');where.append(node('p','Entrega','eyebrow'),node('b',dest?dest.recipient:'Retirada em Franca'),
|
||||
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);
|
||||
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');
|
||||
const placeLine=node('b');placeLine.append(icon(dest?ICON_TRUCK:ICON_PIN),dest?dest.recipient:'Retirada em Franca');
|
||||
where.append(node('p','Entrega','eyebrow'),placeLine,
|
||||
node('span',dest?dest.street+', '+dest.number+(dest.complement?' '+dest.complement:'')+' · '+dest.district+' · '+dest.city+'/'+dest.state+' · CEP '+dest.postal_code:'Cliente retira na fábrica'));
|
||||
if(dest&&s.freight?.total_cents)where.append(node('span','Jadlog · '+money(s.freight.total_cents)+(s.freight.weight_kg?' · '+String(s.freight.weight_kg).replace('.',',')+' kg':''),'faint'));
|
||||
facts.append(who,where);
|
||||
const items=node('section');items.append(node('p','Itens e arquivos de impressão','eyebrow'));
|
||||
const items=node('section');items.append(node('p',s.items.length>1?'Itens':'Item','eyebrow'));
|
||||
const itemsList=node('div');itemsList.style.display='flex';itemsList.style.flexDirection='column';itemsList.style.gap='10px';
|
||||
s.items.forEach((item,index)=>itemsList.append(itemCard(order,item,index)));
|
||||
items.append(itemsList);
|
||||
const total=node('p',undefined,'muted');total.append('Total pago: ',node('b',money(s.total_cents)));items.append(total);
|
||||
const finals=node('section',undefined,'finals');finals.append(node('p','Arquivos finais','eyebrow'),node('p','Carregando…','faint'));
|
||||
const history=node('section');history.append(node('p','Histórico','eyebrow'),node('p','Carregando…','faint'));
|
||||
body.append(facts,items,finals,history);
|
||||
@@ -374,27 +423,36 @@ function itemCard(order,item,index){
|
||||
if(row&&(row.status==='manual'||row.status==='failed'))box.classList.add('attention');
|
||||
const preview=itemPreview(item);
|
||||
const body=node('div',undefined,'body');
|
||||
const title=node('div',undefined,'title');title.append(node('b',PRODUCT[item.mode]),node('span',metres(item.billed_metres),'mono'));
|
||||
const spec=item.production;
|
||||
const line=spec?(spec.placements.length+' peças em '+spec.film_width_cm+' × '+spec.height_cm+' cm · nota '+item.grade):('nota '+item.grade);
|
||||
body.append(title,node('div',line,'line'));
|
||||
const file=node('div',undefined,'file');
|
||||
if(row){
|
||||
const tone=row.status==='ready'?'ok':row.status==='manual'||row.status==='failed'?'warn':'muted';
|
||||
const title=node('div',undefined,'title');title.append(node('b',PRODUCT[item.mode]),gradePill(item.grade),node('span',metres(item.billed_metres),'mono'));
|
||||
body.append(title,facts([['Folha',sheetSize(spec)],['Peças',spec?String(spec.placements.length):null],
|
||||
['Metro',item.unit_cents?money(item.unit_cents):null],['Arquivos',spec&&spec.sources.length>1?String(spec.sources.length):null]]));
|
||||
if(item.quality_status==='warning')body.append(badge('! Ressalva de resolução aceita','warn'));
|
||||
// The print file: a line when it is fine, a callout when someone must act.
|
||||
if(!row)body.append(node('div','Arquivo de impressão ainda não gerado','line'));
|
||||
else if(row.status==='manual'||row.status==='failed'){
|
||||
const call=node('div',undefined,'callout');
|
||||
call.append(node('b',row.status==='failed'?'! Falhou ao gerar':'! Preparar à mão'),
|
||||
node('span',row.detail?.reason||'Monte a folha a partir do original.'));
|
||||
body.append(call);
|
||||
}else{
|
||||
const original=row.status==='ready'&&row.detail?.source==='original';
|
||||
const label=node('span',(original?'Arquivo grande: o original é o arquivo de impressão':PRINT_TEXT[row.status])+
|
||||
(row.status==='ready'&&row.name?' · '+row.name:'')+(row.status==='manual'&&row.detail.reason?': '+row.detail.reason:''),tone);
|
||||
file.append(tone==='ok'?icon(ICON_OK):tone==='warn'?icon(ICON_WARN):'',label);
|
||||
if(row.status==='ready'&&row.detail&&!original){body.append(file,node('div',[row.detail.film_width_cm+' × '+row.detail.height_cm+' cm',
|
||||
row.detail.min_dpi?'menor resolução '+row.detail.min_dpi+' DPI':'',row.detail.vector_sources?'PDF vetorial':''].filter(Boolean).join(' · '),'line'));}
|
||||
else body.append(file);
|
||||
}else body.append(node('div','Arquivo de impressão ainda não gerado','line'));
|
||||
const tone=row.status==='ready'?'ok':'muted';
|
||||
const file=node('div',undefined,'file');
|
||||
file.append(tone==='ok'?icon(ICON_OK):'',node('span',(original?'O original é o arquivo de impressão':PRINT_TEXT[row.status])+
|
||||
(row.status==='ready'&&row.name&&!original?' · '+row.name:''),tone));
|
||||
body.append(file);
|
||||
if(row.status==='ready'&&row.detail&&!original){
|
||||
const extra=[row.detail.min_dpi?'menor resolução '+row.detail.min_dpi+' DPI':'',row.detail.vector_sources?'PDF vetorial':''].filter(Boolean).join(' · ');
|
||||
if(extra)body.append(node('div',extra,'line'));
|
||||
}
|
||||
}
|
||||
const buttons=node('div',undefined,'buttons');
|
||||
if(row?.status==='ready'&&row.detail?.source!=='original')buttons.append(downloadButton('Baixar PDF',download(row.upload_id)));
|
||||
item.uploads.forEach((uid,i)=>buttons.append(downloadButton(item.uploads.length>1?'Original '+(i+1):'Baixar original',download(uid),'btn ghost')));
|
||||
if(row?.status==='ready'&&row.detail?.source!=='original')buttons.append(downloadButton('PDF',download(row.upload_id)));
|
||||
item.uploads.forEach((uid,i)=>buttons.append(downloadButton(item.uploads.length>1?'Original '+(i+1):'Original',download(uid),'btn ghost')));
|
||||
if(spec?.placements)buttons.append(button('Manifesto',()=>manifest(spec),'btn ghost'));
|
||||
if(['rec','tra'].includes(order.state)&&(!row||row.status==='manual'||row.status==='failed'))
|
||||
buttons.append(button('Gerar novamente',async()=>{await api('/orders/'+order.id+'/print-files',{});await load();},'btn ghost'));
|
||||
buttons.append(button('Gerar de novo',async()=>{await api('/orders/'+order.id+'/print-files',{});await load();},'btn ghost'));
|
||||
body.append(buttons);
|
||||
box.append(preview,body);return box;
|
||||
}
|
||||
@@ -411,7 +469,14 @@ function finalsSection(order,revisions,section){
|
||||
// A generated print file reproduces the approved layout: offer it first. Not
|
||||
// after a customer correction, which replaced the artwork it was made from.
|
||||
const corrected=revisions.some(file=>file.kind==='correction');
|
||||
const form=node('form');
|
||||
// The form stays folded behind the next step until someone opens it.
|
||||
const next=node('div',undefined,'nextstep');
|
||||
const nextText=node('div');nextText.append(node('b',revisions.some(f=>f.kind==='final'&&f.active)?'Arquivo final enviado':'Próximo passo: arquivo final'),
|
||||
node('span','Aprove o arquivo pronto para imprimir antes de ir para a fila.'));
|
||||
const open=node('button',revisions.some(f=>f.kind==='final')?'Enviar nova versão':'Enviar arquivo','btn');open.type='button';
|
||||
next.append(node('span','!','nextmark'),nextText,open);
|
||||
const form=node('form');form.hidden=true;
|
||||
open.onclick=()=>{form.hidden=false;next.hidden=true;form.querySelector('input')?.focus();};
|
||||
const inputs=order.snapshot.items.map((item,index)=>{
|
||||
const slot=node('label',undefined,'slot');slot.append('Item '+(index+1)+' · '+PRODUCT[item.mode]);
|
||||
const input=node('input');input.type='file';input.multiple=true;input.required=true;input.dataset.finalItem=index;
|
||||
@@ -442,19 +507,18 @@ function finalsSection(order,revisions,section){
|
||||
await api('/orders/'+order.id+'/final-files',{version:order.version,files:refs,note:note.value});
|
||||
await load();
|
||||
}catch(error){say(error.message,true);submit.disabled=false;}};
|
||||
section.append(form);
|
||||
section.append(next,form);
|
||||
}
|
||||
function historySection(order,rows,section){
|
||||
const list=node('ol',undefined,'timeline');
|
||||
for(const r of [...rows].reverse()){
|
||||
const li=node('li');li.style.setProperty('--c',STAGE_COLORS[r.to_state]);
|
||||
const text=node('div');text.append(node('b',r.back?'Voltou para '+board.states[r.to_state]:board.states[r.from_state]+' → '+board.states[r.to_state]));
|
||||
if(r.reason)text.append(node('span',' · '+r.reason,'muted'));
|
||||
text.append(node('small',when(r.created_at)+' · '+r.operator));li.append(text);list.append(li);
|
||||
}
|
||||
const first=node('li');first.style.setProperty('--c','var(--rec)');
|
||||
const t=node('div');t.append(node('b','Pedido recebido e pago'),node('small',when(order.created_at)+' · '+(board.environment==='local'&&order.payment?.provider==='fake'?'pagamento de teste':'Site')));
|
||||
first.append(t);list.append(first);
|
||||
const entry=(color,title,who,at,reason)=>{
|
||||
const li=node('li');li.style.setProperty('--c',color);
|
||||
const text=node('div');text.append(node('b',title),node('span',' · '+who,'faint'));
|
||||
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));
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -490,16 +554,23 @@ function renderQuotes(){
|
||||
else currentQuote=quoteRows.find(q=>q.id===currentQuote.id)||currentQuote;
|
||||
const list=quoteRows.map(q=>{
|
||||
const b=node('button',undefined,'qitem');b.type='button';b.dataset.quotePick=q.id;b.setAttribute('aria-current',String(q.id===currentQuote?.id));
|
||||
const mail=node('b',q.draft.customer.mail);mail.title=q.draft.customer.mail;
|
||||
const left=node('div',undefined,'qmain');left.append(mail,
|
||||
node('span',q.draft.items.map(i=>SHORT[i.mode]).join(' + ')+' · '+metres(quoteMetres(q))));
|
||||
if(q.draft.items.some(i=>i.production?.version!==2))left.append(node('span','Montagem antiga: peça nova cotação','flag'));
|
||||
else if(q.draft.items.some(i=>i.quality_status==='warning'))left.append(node('span','Ressalva de resolução aceita pelo cliente','flag'));
|
||||
if(q.auto_approved)left.append(node('span','Aprovada automaticamente'));
|
||||
else if(q.review_reason)left.append(node('span','Revisão manual: '+q.review_reason,'flag'));
|
||||
const right=node('div',undefined,'right');
|
||||
right.append(node('b',q.approved?money(q.approved.total_cents):q.id.slice(0,8),'mono'),node('span',ago(q.created_at)));
|
||||
b.append(artBox(q.draft.items,'qart'),left,right);b.onclick=()=>{currentQuote=q;renderQuotes();};return b;
|
||||
const items=q.draft.items;
|
||||
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')));
|
||||
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'));
|
||||
const flags=node('div',undefined,'flags');
|
||||
if(items.some(i=>i.production?.version!==2))flags.append(badge('Montagem antiga','bad','Peça uma nova cotação ao cliente'));
|
||||
else if(items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva aceita','warn','O cliente aceitou a ressalva de resolução'));
|
||||
if(!q.approved&&q.review_reason)flags.append(badge('! '+q.review_reason,'warn','Revisão manual: '+q.review_reason));
|
||||
// Approved by the Site is the rule; only a person's review is worth a line.
|
||||
if(q.approved&&!q.auto_approved)flags.append(badge('Revisada pela equipe',''));
|
||||
const main=node('div',undefined,'qmain');main.append(head,meta);if(flags.children.length)main.append(flags);
|
||||
b.append(artBox(items,'qart'),main);b.onclick=()=>{currentQuote=q;renderQuotes();};return b;
|
||||
});
|
||||
const filtered=quoteQuery||quoteProduct||quoteLayout||quoteFlag;
|
||||
if(!list.length)list.push(node('p',filtered?'Nenhuma cotação com esses filtros.':
|
||||
@@ -512,10 +583,17 @@ function renderQuotes(){
|
||||
}
|
||||
function review(quote){
|
||||
const card=node('article',undefined,'review');card.style.display='contents';card.dataset.quote=quote.id;
|
||||
const head=node('div',undefined,'head');const title=node('div');
|
||||
title.append(node('b',quote.draft.customer.mail),node('div','Cotação '+quote.id.slice(0,8)+' · enviada '+ago(quote.created_at)+' · '+
|
||||
(quote.draft.destination?'entrega em '+quote.draft.destination.city+'/'+quote.draft.destination.state:'retirada em Franca'),'muted'));
|
||||
head.append(title);
|
||||
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 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);
|
||||
if(zap){const a=node('a',c.zap,'zapbtn');a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.prepend(icon(ICON_CHAT));sub.append(a);}
|
||||
sub.append(place(quote.draft.destination,'Entrega em '),node('span','#'+quote.id.slice(0,8)+' · '+ago(quote.created_at),'faint'));
|
||||
title.append(name,sub);head.append(title);
|
||||
if(quote.approved){const total=node('div',undefined,'qbig');total.append(node('span','Total'),node('b',money(quote.approved.total_cents)));head.append(total);}
|
||||
const content=node('div',undefined,'content');
|
||||
const foot=node('div',undefined,'foot');
|
||||
if(quote.status==='pending_review'&"e.draft.items.some(item=>item.production?.version!==2)){
|
||||
@@ -523,9 +601,16 @@ function review(quote){
|
||||
card.append(head,content);return card;
|
||||
}
|
||||
if(quote.status!=='pending_review'){
|
||||
content.append(node('p',quote.status==='expired'?'Cotação expirada. O cliente precisa solicitar outra.':
|
||||
'Aprovada: '+money(quote.approved.total_cents)+' · aguardando pagamento','muted'));
|
||||
for(const item of quote.draft.items)content.append(quoteItem(item,null));
|
||||
if(quote.status==='expired')content.append(node('p','Cotação expirada. O cliente precisa solicitar outra.','muted'));
|
||||
quote.draft.items.forEach((item,index)=>content.append(quoteItem(item,null,quote.approved?.items?.[index])));
|
||||
if(quote.approved){
|
||||
const sums=node('div',undefined,'qsums');const fr=quote.approved.freight||{};
|
||||
const itemsTotal=quote.approved.items.reduce((t,i)=>t+i.total_cents,0);
|
||||
sums.append(node('span','Itens '),node('b',money(itemsTotal)),
|
||||
node('span',fr.service==='pickup'||!fr.total_cents?' · Retirada ':' · Frete Jadlog'+(fr.weight_kg?' · '+String(fr.weight_kg).replace('.',',')+' kg':'')+' '),
|
||||
node('b',fr.total_cents?money(fr.total_cents):'grátis'));
|
||||
content.append(sums);
|
||||
}
|
||||
card.append(head,content);
|
||||
if(quote.status==='approved'){
|
||||
// Tries the whole production flow without a payment.
|
||||
@@ -555,17 +640,21 @@ function review(quote){
|
||||
catch(error){say(error.message,true);submit.disabled=false;}};
|
||||
card.append(head,form);return card;
|
||||
}
|
||||
function quoteItem(item,fields){
|
||||
function quoteItem(item,fields,priced){
|
||||
const box=node('div',undefined,'item');
|
||||
const preview=itemPreview(item);
|
||||
if(!preview.classList.contains('with-art'))preview.style.width='160px';
|
||||
const body=node('div',undefined,'body');
|
||||
const spec=item.production;
|
||||
const title=node('div',undefined,'title');
|
||||
const quality=item.quality_status==='ok'?'qualidade ok':item.quality_status==='warning'?'ressalva '+(item.quality_acknowledged?'aceita':'não aceita'):'qualidade não verificada';
|
||||
title.append(node('b',PRODUCT[item.mode]),node('span',quality+' · nota '+item.grade,item.quality_status==='ok'?'ok':'warn'));
|
||||
body.append(title);
|
||||
if(item.production)body.append(node('div',item.production.sources.length+' arquivo(s) · '+item.production.placements.length+' peças · '+
|
||||
item.production.film_width_cm+' × '+item.production.height_cm+' cm','line'));
|
||||
title.append(node('b',PRODUCT[item.mode]),gradePill(item.grade),...(priced?[node('span',money(priced.total_cents),'mono')]:[]));
|
||||
body.append(title,facts([['Folha',sheetSize(spec)],['Cobrado',priced?metres(priced.billed_metres):null],
|
||||
['Metro',priced?money(priced.unit_cents):null],['Peças',spec?String(spec.placements.length):null],
|
||||
['Arquivos',spec?String(spec.sources.length):null]]));
|
||||
const chips=node('div',undefined,'flags');
|
||||
chips.append(item.quality_status==='ok'?badge('✓ Qualidade conferida','ok'):item.quality_status==='warning'?
|
||||
badge(item.quality_acknowledged?'! Ressalva aceita pelo cliente':'! Ressalva não aceita','warn'):badge('Qualidade não conferida',''));
|
||||
body.append(chips);
|
||||
if(fields){
|
||||
const grid=node('div',undefined,'fields');
|
||||
const asked=node('label','Metros do cliente');const a=node('input');a.value=item.metres;a.readOnly=true;asked.append(a);
|
||||
@@ -574,8 +663,8 @@ function quoteItem(item,fields){
|
||||
grid.append(asked,m,g);body.append(grid);
|
||||
}
|
||||
const buttons=node('div',undefined,'buttons');
|
||||
item.uploads.forEach((uid,i)=>buttons.append(downloadButton(item.uploads.length>1?'Original '+(i+1):'Baixar original',download(uid),'btn ghost')));
|
||||
if(item.production?.placements)buttons.append(button('Manifesto',()=>manifest(item.production),'btn ghost'));
|
||||
item.uploads.forEach((uid,i)=>buttons.append(downloadButton(item.uploads.length>1?'Original '+(i+1):'Original',download(uid),'btn ghost')));
|
||||
if(spec?.placements)buttons.append(button('Manifesto',()=>manifest(spec),'btn ghost'));
|
||||
body.append(buttons);box.append(preview,body);return box;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user