Compare commits

...

4 Commits

Author SHA1 Message Date
Cauê Faleiros
00c7fa3dfa Merge new layout phase B (Site tab)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 6m57s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m16s
2026-11-13 16:39:06 -03:00
Cauê Faleiros
2478c05ae6 Merge new layout phase C (Cotações) 2026-11-13 16:39:06 -03:00
Cauê Faleiros
70bdaf1a8d feat: new layout phase B, the Site tab as on the canvas
Roadmap Novo Layout, phase B (canvas S1 to S6): tabs Produtos e preços,
Cupons, Nota da arte and Vídeos; the products table with the on/off
switch, bands and next change; the price dialog with Agora/Agendar on
the Kanban calendar (calendar() takes options, Números unchanged), bands
and the live "O cliente vê" line; coupons, grade rules and videos in
tables with their dialogs; stacked rows and full-screen dialogs on the
phone. Same API calls and rules as before. Built by Prensa.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 16:39:06 -03:00
Cauê Faleiros
0e247e6b4c feat: new layout phase C, Cotações as on the canvas
Roadmap Novo Layout, phase C (canvas C1, C2): list rows with thumb,
product line, total and expiry; the "Tudo revisado" empty state with one
action to the quotes waiting for payment; the open quote with header,
total, facts in three columns, notes, Originais and the footer actions.
"Pedido pago fora do site" is now a dialog from the footer. Nothing
removed; the e-mail stays in the header. Built by Bobina.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 16:22:01 -03:00
6 changed files with 821 additions and 453 deletions

View File

@@ -171,9 +171,15 @@ try{
assert.equal(await kanban.eval('sessionStorage.getItem("dtf-operator")'),null);
assert.equal(await kanban.eval('document.getElementById("password").value'),'');
await kanban.click('[data-tab="site"]');
await waitFor(()=>kanban.eval('!!document.querySelector("[data-site-tab=\\"videos\\"]")'),'Site tabs in Gestão');
await kanban.click('[data-site-tab="videos"]');
await waitFor(()=>kanban.eval('document.querySelectorAll("#site-videos-list .siteVideoRow").length===6'),
'six video slots in Gestão');
assert.equal(await kanban.eval('document.querySelectorAll("#site-videos-list input[type=file]").length'),12);
assert.equal(await kanban.eval('document.querySelectorAll("#site-videos-list input[type=file]").length'),0);
await kanban.click('#site-videos-list .siteVideoRow .btn');
await waitFor(()=>kanban.eval('document.querySelectorAll(".modal input[type=file]").length===2'),'video edit dialog');
await kanban.eval('document.querySelector(".modal .dlghead .btn.sq")?.click()');
await waitFor(()=>kanban.eval('!document.querySelector(".modal")'),'video dialog closed');
await mkdir('output/local',{recursive:true});
await kanban.eval('document.getElementById("site-videos-panel").scrollIntoView()');
await kanban.screenshot('output/local/kanban-videos.png');

View File

@@ -33,17 +33,38 @@ function statsPeriod(){
wrap.replaceChildren(open);
}
// The calendar: presets on the left, a month where a click starts the
// period and the next one ends it.
function calendar(){
const pop=node('div',undefined,'pop calpop');pop.setAttribute('role','dialog');pop.setAttribute('aria-label','Escolher o período');
// period and the next one ends it. `single`, `future` and `time` add the
// Site's price picker (one future day and a time); without options this is
// exactly the Números range picker.
function calendar(options={}){
const single=!!options.single, future=!!options.future, withTime=!!options.time;
const onApply=options.onApply||null, onCancel=options.onCancel||null;
const pop=node('div',undefined,'pop calpop'+(single?' single':''));
pop.setAttribute('role','dialog');pop.setAttribute('aria-label',single?'Escolher a data':'Escolher o período');
pop.onclick=e=>e.stopPropagation();
const today=todayIso();
let pick=statsRange?{...statsRange}:null, month=new Date((statsRange?.end||today)+'T12:00:00');month.setDate(1);
const initial=options.value||null;
let pick=single
?(initial?.date?{start:initial.date,end:initial.date}:null)
:statsRange?{...statsRange}:null;
let month=new Date(((single?pick?.start:pick?.end)||today)+'T12:00:00');month.setDate(1);
const presets=node('div',undefined,'presets'),grid=node('div',undefined,'dgrid'),title=node('b');
const label=node('span','','lbl');
const time=node('input');time.type='time';time.className='inp';time.value=initial?.time||'08:00';
const apply=node('button','Aplicar','btn pri');apply.type='button';
const cancel=node('button','Cancelar','btn ghost right');cancel.type='button';cancel.onclick=()=>pop.remove();
apply.onclick=()=>{if(!pick?.end)return;statsRange=pick;pop.remove();loadStats().catch(e=>say(e.message,true));};
const cancel=node('button','Cancelar','btn ghost right');cancel.type='button';
cancel.onclick=()=>{onCancel?.();pop.remove();};
apply.onclick=()=>{
if(single){
if(!pick?.start)return;
if(onApply)onApply({date:pick.start,time:withTime?time.value||'08:00':null});
pop.remove();return;
}
if(!pick?.end)return;
if(onApply){onApply({start:pick.start,end:pick.end});pop.remove();return;}
statsRange=pick;pop.remove();loadStats().catch(e=>say(e.message,true));
};
if(!single){
const back=n=>{const d=new Date(today+'T12:00:00');d.setDate(d.getDate()-n);return isoDay(d);};
const first=new Date(today+'T12:00:00');first.setDate(1);
const prevEnd=new Date(first);prevEnd.setDate(0);const prevStart=new Date(prevEnd);prevStart.setDate(1);
@@ -52,34 +73,55 @@ function calendar(){
const b=node('button',text,'preset');b.type='button';b.dataset.range=range.join('|');
b.onclick=()=>{pick={start:range[0],end:range[1]};month=new Date(range[1]+'T12:00:00');month.setDate(1);paint();};presets.append(b);
}
}
const prev=iconButton(IC.left,'Mês anterior',()=>{month.setMonth(month.getMonth()-1);paint();},'btn sq ghost');
const next=iconButton(IC.right,'Próximo mês',()=>{month.setMonth(month.getMonth()+1);paint();},'btn sq ghost');
const head=node('div',undefined,'mhd');head.append(title,prev,next);
function paint(){
title.textContent=month.toLocaleDateString('pt-BR',{month:'long',year:'numeric'}).replace(/^./,c=>c.toUpperCase());
next.disabled=isoDay(month)>=today.slice(0,8)+'01';
next.disabled=future?false:isoDay(month)>=today.slice(0,8)+'01';
for(const b of presets.children){const [a,z]=b.dataset.range.split('|');b.classList.toggle('on',!!pick&&pick.start===a&&pick.end===z);}
const days=[...['D','S','T','Q','Q','S','S'].map(w=>node('span',w,'dow'))];
const start=new Date(month);start.setDate(1-start.getDay());
for(let i=0;i<42;i++){
const d=new Date(start);d.setDate(start.getDate()+i);const iso=isoDay(d);
if(i>=35&&d.getMonth()!==month.getMonth())break;
const allowed=future?iso>=today:iso<=today;
const cls=['day'];if(d.getMonth()!==month.getMonth())cls.push('mute');if(!allowed)cls.push('future');if(iso===today)cls.push('today');
if(single){
if(pick&&iso===pick.start)cls.push('s');
}else{
const end=pick?.end||pick?.start;
const cls=['day'];if(d.getMonth()!==month.getMonth())cls.push('mute');if(iso>today)cls.push('future');if(iso===today)cls.push('today');
if(pick&&iso===pick.start)cls.push('s');if(pick&&iso===end)cls.push('e');if(pick&&iso>pick.start&&iso<end)cls.push('in');
}
const b=node('button',undefined,cls.join(' '));b.type='button';b.append(node('span',String(d.getDate())));
b.setAttribute('aria-label',dayLabel(iso));b.disabled=iso>today;
b.onclick=()=>{if(!pick||pick.end)pick={start:iso,end:null};else if(iso<pick.start)pick={start:iso,end:pick.start};else pick.end=iso;paint();};
b.setAttribute('aria-label',dayLabel(iso));b.disabled=!allowed;
b.onclick=()=>{
if(single)pick={start:iso,end:iso};
else if(!pick||pick.end)pick={start:iso,end:null};
else if(iso<pick.start)pick={start:iso,end:pick.start};
else pick.end=iso;
paint();
};
days.push(b);
}
grid.replaceChildren(...days);
if(single){
label.textContent=pick?dayLabel(pick.start)+(withTime?' · '+(time.value||'08:00'):''):'Escolha o dia';
apply.disabled=!pick;
}else{
label.textContent=pick?dayLabel(pick.start)+(pick.end?' a '+dayLabel(pick.end):', escolha o fim'):'Escolha o início';
apply.disabled=!pick?.end;
}
}
if(withTime)time.oninput=()=>paint();
const monthBox=node('div',undefined,'month');monthBox.append(head,grid);
const body=node('div',undefined,'cal');body.append(presets,monthBox);
const body=node('div',undefined,'cal'+(single?' single':''));
if(single)body.append(monthBox);else body.append(presets,monthBox);
const timeBox=node('div',undefined,'time');
if(withTime)timeBox.append(node('span','Horário'),time);
const foot=node('div',undefined,'popfoot');foot.append(label,cancel,apply);
pop.append(body,foot);paint();
pop.append(body,...(withTime?[timeBox]:[]),foot);paint();
document.addEventListener('click',()=>pop.remove(),{once:true});
return pop;
}

View File

@@ -1,6 +1,7 @@
/* Kanban DTF: the Cotações tab. The quotes list, the review panel, approval,
a test order and an order paid outside the site. Loaded after kanban.js,
which defines api, absorb, node, button, money, metres, say, ask, load, may,
which defines api, absorb, node, button, dialogHost, formDialog, money, metres,
say, ask, load, may,
$, ago, shortAgo, svgIcon, IC, iconButton, badge, gradePill, lowestGrade,
productLine, productName, sheetSize, buyer, docKind, cnpj, copyButton,
paymentBadge, freightWeight, whatsappLink, artBox, itemPreview, itemNote,
@@ -89,10 +90,10 @@ function renderQuotes(){
const name=node('b',who.title);name.title=who.mail||who.title;
// 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';name.prepend(dot);}
first.append(name,node('span',q.approved?money(q.approved.total_cents):metres(quoteMetres(q)),'qm'));
first.append(name);
const second=node('span',undefined,'qline sub');
const what=node('span');what.append(gradePill(lowestGrade(items)),' '+productLine(items)+', '+(q.draft.destination?q.draft.destination.city+'/'+q.draft.destination.state:'Retirada'));
second.append(what,node('span',(quoteKind==='approved'?quoteExpiry(q):null)||shortAgo(q.created_at)));
const what=node('span');what.append(gradePill(lowestGrade(items)),' '+productLine(items)+' · '+(q.draft.destination?q.draft.destination.city+'/'+q.draft.destination.state:'Retirada'));
second.append(what);
main.append(first,second);
const warn=quoteWarning(q);
if(warn){const w=node('span',undefined,'qwarn'+(warn[0]==='bad'?' bad':''));w.append(svgIcon(IC.alert,'i s'),node('span',warn[1]));main.append(w);}
@@ -100,12 +101,25 @@ function renderQuotes(){
// Approved by the Site is the rule; only a person's review is worth a word.
if(pay||q.approved&&!q.auto_approved){const line=node('span',undefined,'qpay');
if(pay)line.append(pay);if(q.approved&&!q.auto_approved)line.append(badge('Revisada pela equipe',''));main.append(line);}
b.append(artBox(items,'qthumb'),main);
const side=node('span',undefined,'qside');
side.append(node('b',q.approved?money(q.approved.total_cents):metres(quoteMetres(q)),'qm'),
node('span',(quoteKind==='approved'?quoteExpiry(q):null)||shortAgo(q.created_at),'qt'));
b.append(artBox(items,'qthumb'),main,side);
b.onclick=()=>{currentQuote=q;$('tab-quotes').classList.toggle('reviewing',PHONE.matches);renderQuotes();};return b;
});
const filtered=quoteQuery||quoteProduct||quoteLayout||quoteFlag;
if(!list.length)list.push(node('p',filtered?'Nenhuma cotação com esses filtros.':
quoteKind==='pending'?'Nenhuma cotação para revisar.':'Nenhuma cotação aprovada aguardando pagamento.','empty pad'));
if(!list.length){
if(filtered)list.push(node('p','Nenhuma cotação com esses filtros.','empty pad'));
else if(quoteKind==='pending'){
const waiting=board.approved_total||0;
const action=button('Ver as '+waiting+' aguardando pagamento',async()=>{
quoteKind='approved';quotePage=1;quoteFitting=0;currentQuote=null;
await loadQuotes();
},'btn');
list.push(emptyState(IC.check,'Tudo revisado',
'Nenhuma cotação esperando revisão. '+waiting+' estão aguardando pagamento.',action));
}else list.push(node('p','Nenhuma cotação aprovada aguardando pagamento.','empty pad'));
}
$('quote-list').replaceChildren(...list);
$('quote-pager').replaceChildren(...(quoteTotal?[pager({page:quotePage,size:quoteSize,total:quoteTotal,noun:'cotações',compact:true,fixedSize:true,
onPage:n=>{quotePage=n;quoteFitting=0;loadQuotes().catch(e=>say(e.message,true));}})]:[]));
@@ -114,9 +128,9 @@ function renderQuotes(){
$('reviews').replaceChildren(...(currentQuote?[quoteHead(currentQuote),...review(currentQuote)]:[emptyState(IC.file,'Selecione uma cotação','A revisão dela abre aqui.')]));
}
// A page or a pane with nothing to show: a mark, a line, and what to do.
function emptyState(d,title,text){
function emptyState(d,title,text,action){
const box=node('div',undefined,'emptystate'),ico=node('span',undefined,'dropico');ico.append(svgIcon(d));
box.append(ico,node('b',title),...(text?[node('span',text)]:[]));return box;
box.append(ico,node('b',title),...(text?[node('span',text)]:[]),...(action?[action]:[]));return box;
}
// The phone's head of a quote's page: back to the list, who, and WhatsApp.
function quoteHead(quote){
@@ -127,31 +141,42 @@ function quoteHead(quote){
if(zap){const a=node('a',undefined,'mic');a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.setAttribute('aria-label','WhatsApp');a.append(svgIcon(IC.chat));h.append(a);}
return h;
}
const QUOTE_STATUS={pending_review:['A revisar','warn'],approved:['Aprovada, aguardando pagamento','ok'],expired:['Expirada','bad'],paid:['Paga','ok']};
const QUOTE_STATUS={pending_review:'A revisar',approved:'Aguardando pagamento',expired:'Expirada',paid:'Paga'};
function whatsappAction(quote){
const zap=whatsappLink(quote.draft.customer.zap);
if(!zap)return null;
const a=node('a','Abrir conversa','btn');
a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.title=quote.draft.customer.zap;
a.prepend(svgIcon(IC.chat,'i m'));
return a;
}
function review(quote){
const head=node('div',undefined,'rhead');head.dataset.quote=quote.id;
const words=node('div',undefined,'rwords');
const who=buyer(quote.draft), c=quote.draft.customer;
const title=node('div',undefined,'rtitle');
const h=node('h2',who.title);h.title=who.legal||who.title;
const [label,tone]=QUOTE_STATUS[quote.status]||[quote.status,''];
const status=badge(label,tone);status.prepend(node('span',undefined,'dot'));
title.append(h,status);
const h=node('h2',who.title);h.title=[who.legal,who.mail].filter(Boolean).join(' · ')||who.title;
title.append(h,node('span',QUOTE_STATUS[quote.status]||quote.status,'tag'));
const pay=paymentBadge(quote.payment);if(pay)title.append(pay);
const meta=node('div',undefined,'rmeta');
if(who.mail)meta.append(node('span',who.mail));
const doc=node('span');doc.append(docKind(c.cnpj)+' '+cnpj(c.cnpj),copyButton(cnpj(c.cnpj),'Copiar '+docKind(c.cnpj)));meta.append(doc);
const dest=quote.draft.destination,where=node('span');where.append(svgIcon(dest?IC.truck:IC.pin,'i s'),dest?'Entrega em '+dest.city+'/'+dest.state:'Retirada em Franca');meta.append(where);
// The e-mail stays in sight: for many customers it is the only way to tell them apart.
if(who.mail&&who.mail!==who.title)meta.append(node('span',who.mail));
const dest=quote.draft.destination;
meta.append(node('span',dest?'Entrega em '+dest.city+'/'+dest.state:'Retirada em Franca'));
meta.append(node('span','Recebida '+ago(quote.created_at)),node('span','#'+quote.id.slice(0,8),'code'));
words.append(title,meta);head.append(words);
if(quote.approved){const total=node('div',undefined,'qbig');total.append(node('span','Total','lbl'),node('b',money(quote.approved.total_cents)));head.append(total);}
const zap=whatsappLink(c.zap);
if(zap){const a=node('a',quote.status==='approved'?'Abrir conversa':'WhatsApp','btn');a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.title=c.zap;a.prepend(svgIcon(IC.chat,'i m'));head.append(a);}
const body=node('div',undefined,'rbody');
const foot=node('div',undefined,'rfoot');
const chat=whatsappAction(quote);
const withChat=parts=>{
if(chat){foot.append(node('span',undefined,'sp'),chat);parts.push(foot);}
return parts;
};
if(quote.status==='pending_review'&&quote.draft.items.some(item=>!LAYOUT_VERSIONS.includes(item.production?.version))){
body.append(callout(IC.alert,'Montagem antiga.','Solicite uma nova cotação ao cliente.','bad'));
return [head,body];
return withChat([head,body]);
}
const count=quote.draft.items.length;
if(quote.status!=='pending_review'){
@@ -165,23 +190,24 @@ function review(quote){
node('b',fr.total_cents?money(fr.total_cents):'grátis'),node('span','Total'),node('b',money(quote.approved.total_cents)));
body.append(sums);
}
if(quote.status==='approved'&&may('enter'))body.append(registerForm(quote));
if(quote.status==='approved'&&may('manage')){
foot.append(discardButton(quote));
foot.append(discardButton(quote),node('span',undefined,'sp'));
// Tries the whole production flow without a payment.
const test=button('Criar pedido de teste',async()=>{
if(!await ask('Criar um pedido de teste?','Ele entra em Arte recebida sem cobrar nada e não vai para o Tiny.','Criar pedido de teste'))return;
const order=await api('/quotes/'+quote.id+'/test-order',{});
say('Pedido de teste #'+order.number+' criado em Arte recebida.');await load();
},'btn right');
},'btn');
foot.append(test);
if(chat)foot.append(chat);
if(may('enter'))foot.append(button('Pedido pago fora do site',()=>registerDialog(quote),'btn pri'));
return [head,body,foot];
}
return [head,body];
return withChat([head,body]);
}
if(!may('manage')){
quote.draft.items.forEach((item,index)=>body.append(quoteItem(item,null,null,index,count)));
return [head,body];
return withChat([head,body]);
}
const form=node('form',undefined,'rform');
const edits=quote.draft.items.map((item,index)=>{const fields={};body.append(quoteItem(item,fields,null,index,count));
@@ -190,8 +216,8 @@ function review(quote){
const {residue_accepted_at,stroke_choice_at,...sent}=item;
return ()=>({...sent,metres:fields.metres.value,grade:Number(fields.grade.value)});});
const check=node('input');check.required=true;
const submit=node('button','Aprovar cotação','btn pri lg');
foot.append(checkbox('Arquivos, metragem e nota conferidos',check),discardButton(quote),submit);
const submit=node('button','Aprovar cotação','btn pri');
foot.append(checkbox('Arquivos, metragem e nota conferidos',check),...(chat?[chat]:[]),discardButton(quote),submit);
form.append(body,foot);
form.onsubmit=async e=>{e.preventDefault();submit.disabled=true;
try{const approved=await api('/quotes/'+quote.id+'/approve',{items:edits.map(fn=>fn())});
@@ -208,8 +234,7 @@ function callout(d,title,text,tone=''){
// cart on the Site, as a customer would, and registers it here. Origin and
// payment start unchosen: a default would become the answer to everything.
const PAID_OUTSIDE={pix:'Pix',card:'Cartão',cash:'Dinheiro',credit:'Crédito do cliente',faturado:'Faturado'};
function registerForm(quote){
const form=node('form',undefined,'register');
function registerDialog(quote){
const group=(name,label,options)=>{
const g=node('div',undefined,'fgroup2');g.setAttribute('role','radiogroup');g.setAttribute('aria-label',label);
const set=node('div',undefined,'fopts');
@@ -218,17 +243,17 @@ function registerForm(quote){
r.type='radio';r.name=name+'-'+quote.id;r.value=value;r.required=true;r.className='vh';l.append(r,text);set.append(l);}
g.append(node('span',label,'lbl'),set);return g;};
const note=node('input');note.type='text';note.maxLength=300;note.placeholder='Observação (opcional)';note.setAttribute('aria-label','Observação');note.className='inp';
const submit=node('button','Registrar pedido','btn pri');
const row=node('div',undefined,'decide');row.append(note,submit);
const head=node('div');head.append(node('h4','Pago fora do site?'),node('p','Registre o pedido: ele entra em Arte recebida como os outros.','nnote'));
form.append(head,group('origin','Origem',ORIGINS),group('method','Como foi pago',PAID_OUTSIDE),row);
form.onsubmit=async e=>{e.preventDefault();
const pick=name=>form.querySelector('input[name="'+name+'-'+quote.id+'"]:checked')?.value;
submit.disabled=true;
try{const order=await api('/quotes/'+quote.id+'/register',{origin:pick('origin'),method:pick('method'),note:note.value});
currentQuote=null;say('Pedido #'+order.number+' registrado em Arte recebida.');await load();}
catch(error){say(error.message,true);submit.disabled=false;}};
return form;
// The class keeps kanban.js' auto-refresh guard: the choices stay on screen.
const body=node('div',undefined,'register');
body.append(group('origin','Origem',ORIGINS),group('method','Como foi pago',PAID_OUTSIDE),note);
const pick=(form,name)=>form.querySelector('input[name="'+name+'-'+quote.id+'"]:checked')?.value;
formDialog('Pedido pago fora do site',{host:dialogHost(),width:640,
text:'Registre o pedido: ele entra em Arte recebida como os outros.',
fields:[body],label:'Registrar pedido',
onsave:async form=>{
const order=await api('/quotes/'+quote.id+'/register',{origin:pick(form,'origin'),method:pick(form,'method'),note:note.value});
currentQuote=null;say('Pedido #'+order.number+' registrado em Arte recebida.');await load();
}});
}
const paidOutside=order=>order.payment?.provider==='manual';
// An unpaid quote leaves the list and can no longer be paid.
@@ -236,7 +261,7 @@ function discardButton(quote){
return button('Descartar cotação',async()=>{
if(!await ask('Descartar esta cotação?','Ela sai do Kanban e o cliente não consegue mais pagá-la.','Descartar cotação',{tone:'red'}))return;
await api('/quotes/'+quote.id+'/discard',{});currentQuote=null;say('Cotação descartada.');await load();
},'btn quiet right');
},'btn quiet');
}
function quoteItem(item,fields,priced,index=0,count=1){
const box=node('section',undefined,'ritem');box.setAttribute('aria-label','Item '+(index+1));
@@ -244,14 +269,17 @@ function quoteItem(item,fields,priced,index=0,count=1){
tall.append(itemPreview(item));
const info=node('div',undefined,'iinfo');
const spec=item.production;
info.append(node('span',count>1?'Item '+(index+1)+' de '+count:'Item','lbl'),node('h3',productName(item)));
const ihead=node('div',undefined,'ihead');
ihead.append(node('h3',productName(item)));
if(count>1)ihead.append(node('span','item '+(index+1)+' de '+count,'ilbl'));
info.append(ihead);
const dl=node('dl',undefined,'dl');
const pair=(k,v)=>{if(v===null||v===undefined||v==='')return;const d=node('div');const dd=node('dd');dd.append(v);d.append(node('dt',k),dd);dl.append(d);};
pair('Folha',sheetSize(spec));pair('Peças',spec?String(spec.placements.length):null);
pair('Arquivos',spec?String(spec.sources.length):null);
const g=node('span',undefined,'gradeline');g.append(gradePill(item.grade));pair('Nota da arte',g);
pair('Metros cobrados',priced?metres(priced.billed_metres):null);
pair('Valor do metro',priced?money(priced.unit_cents)+manualExtra(priced):null);
const g=node('span',undefined,'gradeline');g.append(gradePill(item.grade));pair('Nota da arte',g);
pair('Valor',priced?money(priced.total_cents):null);
info.append(dl);
const notes=node('div',undefined,'inotes');
@@ -270,7 +298,9 @@ function quoteItem(item,fields,priced,index=0,count=1){
grid.append(m,gr);info.append(grid);
}
const links=node('div',undefined,'links');
const originals=node('details',undefined,'originals');originals.append(node('summary','Originais ('+item.uploads.length+')'));
const originals=node('details',undefined,'originals'),summary=node('summary');
summary.append(node('span','Originais ('+item.uploads.length+')'),svgIcon(IC.right,'i s'));
originals.append(summary);
item.uploads.forEach((uid,i)=>originals.append(downloadButton('Original '+(i+1),download(uid),'btn')));
links.append(originals);
info.append(links);box.append(tall,info);return box;

View File

@@ -3,7 +3,21 @@
which defines api, may, money, when, say, node and button.
A price is history: one that has started is never changed or deleted, so
only a scheduled (future) price may be cancelled. */
const SITE_UNIT_LABEL={metro:' /m',pedido:' por pedido',arte:' por arte'};
const SITE_TAB_KEY='dtf-site-tab';
const SITE_TICKET='M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z';
const SITE_TABS=[
{id:'products',label:'Produtos e preços',note:'Um produto desligado some do Site e não aceita pedidos novos.'},
{id:'coupons',label:'Cupons',note:'Um cupom por pedido.'},
{id:'grade',label:'Nota da arte',note:'A regra do Ajuste Fino precisa ser menor ou igual à do aviso.'},
{id:'videos',label:'Vídeos',note:'MP4 ou WebM até 500 MB; legenda VTT opcional. Só aparece no Site depois de publicado.'},
];
const SITE_VIDEO_PRODUCTS=[['','Só na categoria DTF'],['file','Arquivo por metro'],
['avulsa','Artes avulsas'],['uvfile','Arquivo por metro UV'],['uv','Artes avulsas UV']];
let siteTab=(()=>{
try{const saved=localStorage.getItem(SITE_TAB_KEY);return SITE_TABS.some(t=>t.id===saved)?saved:'products';}
catch(_){return 'products';}
})();
let siteProducts=[],siteCoupons=[],siteVideos=[],siteRules={};
// Reais with a comma, as the Site shows them: "19,90" is 1990 cents.
function moneyInputCents(value){
@@ -24,234 +38,359 @@ function bandsText(bands,unit='metro'){
return (bands||[]).map(band=>' · '+bandMetres(band.from_metres)+' '+
(unit==='arte'?(Number(band.from_metres)===1?'arte':'artes'):'m')+': '+money(band.unit_cents)).join('');
}
function siteQty(value,unit){
const n=Number(value);
if(unit==='arte')return bandMetres(n)+(n===1?' arte':' artes');
return bandMetres(n)+' m';
}
function siteTomorrow(){
const d=new Date(todayIso()+'T12:00:00');d.setDate(d.getDate()+1);return isoDay(d);
}
function siteDateText(value){
if(!value)return 'Escolher data';
const d=new Date(value.date+'T'+(value.time||'08:00')+':00');
if(Number.isNaN(d.getTime()))return 'Escolher data';
const day=d.toLocaleDateString('pt-BR',{day:'2-digit',month:'short',year:'numeric'})
.replace(/\./g,'').replace(/ de /g,' ');
return day+', '+(value.time||'08:00');
}
// ---- Tabs -----------------------------------------------------------------
function saveSiteTab(id){
try{localStorage.setItem(SITE_TAB_KEY,id);}catch(_){}
}
function paintSiteTabs(){
const host=$('site-tabs');if(!host)return;
host.replaceChildren(...SITE_TABS.map(tab=>{
const b=node('button');b.type='button';b.dataset.siteTab=tab.id;
b.setAttribute('role','tab');b.setAttribute('aria-selected',String(siteTab===tab.id));
if(siteTab===tab.id)b.classList.add('on');
b.append(node('span',tab.label));
if(tab.id==='coupons')b.append(node('span',String(siteCoupons.length),'n'));
if(tab.id==='videos')b.append(node('span',String(siteVideos.length),'n'));
b.onclick=()=>openSiteTab(tab.id);
return b;
}));
const current=SITE_TABS.find(tab=>tab.id===siteTab)||SITE_TABS[0];
$('site-note').textContent=current.note;
for(const tab of SITE_TABS){
const pane=$('site-pane-'+tab.id);
if(pane)pane.hidden=tab.id!==siteTab;
}
}
function openSiteTab(id){
if(!SITE_TABS.some(tab=>tab.id===id))return;
siteTab=id;saveSiteTab(id);paintSiteTabs();
}
// ---- Produtos e preços (S1) -----------------------------------------------
function renderSiteProducts(){
const host=$('site-products');if(!host)return;
host.replaceChildren(...siteProducts.map(siteProductRow));
const enabled=siteProducts.filter(product=>product.enabled).length;
$('site-sub').textContent=enabled+' de '+siteProducts.length+' produtos à venda';
}
function siteBandTag(band,unit){return siteQty(band.from_metres,unit)+': '+money(band.unit_cents);}
function siteProductRow(product){
const tr=node('tr');
const name=node('td');name.append(node('b',product.title));
const price=node('td',money(product.unit_cents)+SITE_UNIT_LABEL[product.unit],'nowrap');
if(product.fallback)price.append(node('span',' · padrão','muted'));
const state=node('td');
const label=node('label',undefined,'siteSwitch');
const input=node('input');input.type='checkbox';input.checked=product.enabled;
const word=node('span',product.enabled?'Ligado':'Desligado');
input.onchange=async()=>{
input.disabled=true;
const tr=node('tr',undefined,product.enabled?'':'off');
const name=node('td');
name.append(node('span',product.title,'pname'),node('span',product.unit,'unit'));
const sale=node('td');sale.dataset.label='À venda';
const sw=node('button',undefined,'sw'+(product.enabled?' on':''));
sw.type='button';sw.setAttribute('role','switch');sw.setAttribute('aria-checked',String(product.enabled));
sw.append(node('span',undefined,'t'),product.enabled?'Ligado':'Desligado');
sw.onclick=async()=>{
sw.disabled=true;
try{
await api('/site/products/'+product.id,{enabled:input.checked});
word.textContent=input.checked?'Ligado':'Desligado';
say(product.title+(input.checked?' ligado.':' desligado.'));
await api('/site/products/'+product.id,{enabled:!product.enabled});
say(product.title+(product.enabled?' desligado.':' ligado.'));
await loadSiteAdmin();
}catch(error){input.checked=!input.checked;say(error.message,true);}
finally{input.disabled=false;}
}catch(error){say(error.message,true);sw.disabled=false;}
};
label.append(input,word);
state.append(label);
tr.append(name,state,price);
sale.append(sw);
const price=node('td',undefined,'r');price.dataset.label='Preço atual';
price.append(node('span',money(product.unit_cents),'money'));
if(product.fallback)price.append(node('span',' · padrão','muted'));
const bands=node('td');bands.dataset.label='Faixas';
if(product.id==='redesenho')bands.append(node('span','preço único','muted'));
else if((product.bands||[]).length){
for(const band of product.bands)bands.append(node('span',siteBandTag(band,product.unit),'tag'));
}else bands.append(node('span','—','muted'));
const next=node('td');next.dataset.label='Próxima mudança';
if(product.scheduled.length){
for(const row of product.scheduled){
const line=node('div',undefined,'siteNext');
line.append(node('b',money(row.unit_cents)),node('span',when(row.starts_at),'muted'));
next.append(line);
}
}else next.append(node('span','nenhuma','muted'));
const action=node('td',undefined,'r siteAction');
action.append(button('Mudar preço',()=>priceDialog(product),'btn sm'));
tr.append(name,sale,price,bands,next,action);
return tr;
}
function sitePriceBlock(product){
const block=node('div',undefined,'sitePriceBlock');
const heading=node('h3',product.title);
heading.append(node('span',' · '+product.unit,'muted'));
// A live line of what the customer will see: the base price up to the first
// band, then each band's range, and the last one open-ended.
function siteBandPreview(base,rows,unit){
if(base===null)return 'Informe o preço acima para ver o que o cliente vê.';
const valid=rows.filter(row=>Number.isFinite(row.from)&&row.from>0&&row.cents!==null&&row.cents>0)
.sort((a,b)=>a.from-b.from);
if(!valid.length)return '1 '+(unit==='arte'?'arte':'m')+' ou mais por '+money(base)+'.';
const parts=[];
let start=1,price=base;
for(const row of valid){
if(row.from>start){
const end=unit==='arte'?row.from-1:Number.isInteger(row.from)?row.from-1:Number((row.from-0.1).toFixed(1));
if(end>=start)parts.push(bandMetres(start)+' a '+siteQty(end,unit)+' por '+money(price));
}
start=row.from;price=row.cents;
}
parts.push('a partir de '+siteQty(start,unit)+', '+money(price));
return parts.join(' · ');
}
// Novo preço: reais with a comma; empty "A partir de" means now.
const form=node('div',undefined,'sitePriceForm');
const priceLabel=node('label');priceLabel.append(node('span','Novo preço'));
const price=node('input');price.type='text';price.inputMode='decimal';price.className='siteMoney';
price.placeholder=(product.unit_cents/100).toFixed(2).replace('.',',');
price.setAttribute('aria-label','Novo preço de '+product.title);
priceLabel.append(price);
const startsLabel=node('label');startsLabel.append(node('span','A partir de'));
const starts=node('input');starts.type='datetime-local';
starts.setAttribute('aria-label','Quando o novo preço de '+product.title+' começa');
startsLabel.append(starts);
// Faixas progressivas (front 8.2): a nova tabela começa vazia; as faixas
// viajam com este preço. Ajuste Fino conta as faixas em artes, os produtos em
// metros. O Redesenho tem um preço único por arte, nunca faixas (front 1b).
function priceDialog(product){
const unit=product.unit==='arte'?'arte':'metro';
const current=product.unit_cents;
const permiteFaixas=product.id!=='redesenho';
const bandUnit=product.unit==='arte'?'artes':'m';
const bandRows=node('div',undefined,'siteBandRows');
const addBand=node('button','Adicionar faixa','btn ghost');addBand.type='button';
const paintAdd=()=>{addBand.disabled=bandRows.children.length>=5;};
const bandRow=()=>{
const row=node('div',undefined,'siteBandRow');
const fromLabel=node('label');fromLabel.append(node('span','A partir de ('+bandUnit+')'));
const from=node('input');from.type='text';from.inputMode='decimal';from.className='siteBandFrom';
from.setAttribute('aria-label','Início da faixa em '+bandUnit+' de '+product.title);
fromLabel.append(from);
const priceLabel=node('label');priceLabel.append(node('span','R$ por '+(product.unit==='arte'?'arte':'metro')));
const bandPrice=node('input');bandPrice.type='text';bandPrice.inputMode='decimal';bandPrice.className='siteBandPrice';
bandPrice.setAttribute('aria-label','Preço da faixa de '+product.title);
priceLabel.append(bandPrice);
const remove=button('Remover',()=>{row.remove();paintAdd();},'btn ghost');
row.append(fromLabel,priceLabel,remove);
return row;
};
addBand.onclick=()=>{if(bandRows.children.length>=5)return;bandRows.append(bandRow());paintAdd();};
const bands=node('div',undefined,'siteBands');
const bandsHead=node('div',undefined,'siteBandsHead');
bandsHead.append(node('span','Faixas'),addBand);
bands.append(bandsHead,bandRows);
const formBands=()=>[...bandRows.children].map(row=>{
const from=Number(row.querySelector('.siteBandFrom').value.replace(',','.'));
const unit=moneyInputCents(row.querySelector('.siteBandPrice').value);
if(!Number.isFinite(from)||from<=0||unit===null||unit<=0)
throw new Error('Confira as faixas: início e preço maiores que zero.');
return {from_metres:String(from),unit_cents:unit};
});
const save=button('Salvar',async()=>{
// Empty keeps the current price (the grey hint), so a band alone can be added.
const cents=price.value.trim()?moneyInputCents(price.value):product.unit_cents>0?product.unit_cents:null;
if(cents===null)throw new Error('Informe o preço em reais, como 19,90.');
const whenDate=starts.value?new Date(starts.value):null;
if(whenDate&&Number.isNaN(whenDate.getTime()))throw new Error('Data inválida.');
await api('/site/products/'+product.id+'/prices',
{unit_cents:cents,starts_at:whenDate?whenDate.toISOString():null,
bands:permiteFaixas?formBands():[]});
say(whenDate?'Preço salvo para '+when(whenDate)+'.':'Preço salvo. Vale a partir de agora.');
await loadSiteAdmin();
},'btn pri');
// Salvar after the bands: it saves the price and its bands together.
form.append(priceLabel,startsLabel,...(permiteFaixas?[bands]:[]),save);
let mode='now',chosen=null,m=null;
const bandRows=[];
const scheduled=node('div',undefined,'siteScheduled');
if(product.scheduled.length){
for(const row of product.scheduled){
const line=node('div',undefined,'siteScheduledRow');
line.append(node('span',money(row.unit_cents)+SITE_UNIT_LABEL[product.unit]+bandsText(row.bands,product.unit)+
' a partir de '+when(row.starts_at)));
const now=node('div',undefined,'sitePriceNow');
now.append(node('b',current>0?money(current):'Sem preço'),node('span','por '+unit+' · preço em vigor'));
const priceInput=node('input');priceInput.type='text';priceInput.inputMode='decimal';priceInput.className='siteInp';
priceInput.placeholder=current>0?(current/100).toFixed(2).replace('.',','):'0,00';
const priceBox=node('span',undefined,'inp siteInpBox');priceBox.append(node('span','R$','pre'),priceInput);
const priceField=node('div',undefined,'fld');
priceField.append(node('span','Novo preço por '+unit),priceBox,
node('small',current>0?'Vazio: mantém '+money(current)+'.':'Informe o preço em reais.'));
const modeSeg=node('div',undefined,'seg');modeSeg.setAttribute('role','radiogroup');
modeSeg.setAttribute('aria-label','Quando começa');
const nowBtn=node('button','Agora');nowBtn.type='button';nowBtn.setAttribute('role','radio');
const laterBtn=node('button','Agendar');laterBtn.type='button';laterBtn.setAttribute('role','radio');
modeSeg.append(nowBtn,laterBtn);
const dateText=node('span','Escolher data');
const dateButton=node('button',undefined,'inp');dateButton.type='button';
dateButton.setAttribute('aria-haspopup','dialog');dateButton.setAttribute('aria-expanded','false');
dateButton.append(svgIcon(IC.calendar,'i m'),dateText);
const dateWrap=node('div',undefined,'calwrap');dateWrap.append(dateButton);
const startRow=node('div',undefined,'siteStartRow');startRow.append(modeSeg,dateWrap);
const startField=node('div',undefined,'fld');startField.append(node('span','Começa'),startRow);
const paintDate=()=>{dateText.textContent=siteDateText(chosen);};
const setSaveLabel=()=>{
const save=m?.box.querySelector('.dfoot .btn.pri');
if(save)save.textContent=mode==='schedule'?'Agendar preço':'Salvar preço';
};
const setMode=next=>{
mode=next;
nowBtn.classList.toggle('on',next==='now');nowBtn.setAttribute('aria-checked',String(next==='now'));
laterBtn.classList.toggle('on',next==='schedule');laterBtn.setAttribute('aria-checked',String(next==='schedule'));
dateWrap.hidden=next!=='schedule';
if(next==='schedule'&&!chosen)chosen={date:siteTomorrow(),time:'08:00'};
paintDate();setSaveLabel();
};
nowBtn.onclick=()=>setMode('now');
laterBtn.onclick=()=>setMode('schedule');
dateButton.onclick=event=>{
event.stopPropagation();
const open=dateWrap.querySelector('.pop');
if(open){open.remove();dateButton.setAttribute('aria-expanded','false');return;}
dateButton.setAttribute('aria-expanded','true');
dateWrap.append(calendar({single:true,future:true,time:true,value:chosen,onApply:value=>{
chosen=value;paintDate();dateButton.setAttribute('aria-expanded','false');
}}));
};
const bandsSection=node('div',undefined,'siteDlgSection');
const bandsTitle=node('h3');bandsTitle.append('Faixas por quantidade',node('span',' · opcional','siteSoft'));
bandsSection.append(bandsTitle);
let preview=null,addBand=null,baseValue=null;
const paintBase=()=>{
const typed=priceInput.value.trim();
const cents=typed?moneyInputCents(typed):current>0?current:null;
if(baseValue)baseValue.textContent=cents===null?'—':money(cents);
};
const paintPreview=()=>{
if(!preview)return;
const typed=priceInput.value.trim();
const base=typed?moneyInputCents(typed):current>0?current:null;
const rows=bandRows.map(row=>({from:Number(row.from.value.replace(',','.')),
cents:moneyInputCents(row.price.value)}));
const line=siteBandPreview(base,rows,unit);
preview.replaceChildren(node('span','O cliente vê: '),node('b',line));
};
const paintAdd=()=>{if(addBand)addBand.disabled=bandRows.length>=5;};
const bandRow=()=>{
const row=node('tr');
const fromCell=node('td');
const fromBox=node('span',undefined,'inp siteInpBox');
const from=node('input');from.type='text';from.inputMode='decimal';from.className='siteInp';from.placeholder='10';
fromBox.append(from,node('span',unit==='arte'?'artes':'m','pre siteSuffix'));
fromCell.append(fromBox);
const priceCell=node('td');
const priceInput2=node('input');priceInput2.type='text';priceInput2.inputMode='decimal';priceInput2.className='siteInp';
priceInput2.placeholder='0,00';
const priceBox2=node('span',undefined,'inp siteInpBox');priceBox2.append(node('span','R$','pre'),priceInput2);
priceCell.append(priceBox2);
const action=node('td');
const entry={row,from,price:priceInput2};
action.append(button('Tirar',()=>{
row.remove();bandRows.splice(bandRows.indexOf(entry),1);paintAdd();paintPreview();
},'btn ghost sm'));
row.append(fromCell,priceCell,action);
from.oninput=paintPreview;priceInput2.oninput=paintPreview;
return entry;
};
if(permiteFaixas){
const bandsBox=node('div',undefined,'siteBands');
const table=node('table');
const thead=node('thead'),headRow=node('tr');
headRow.append(node('th','A partir de'),node('th','R$ por '+unit),node('th',''));
thead.append(headRow);
const tbody=node('tbody');
const baseRow=node('tr',undefined,'base');
const baseFrom=node('td',siteQty(1,unit));
const basePrice=node('td');
baseValue=node('b');
basePrice.append(baseValue,node('span',' · o preço acima','siteSoft'));
baseRow.append(baseFrom,basePrice,node('td'));
tbody.append(baseRow);
const addRow=node('tr',undefined,'add');
const addCell=node('td');addCell.colSpan=3;
addBand=button('Adicionar faixa',()=>{
if(bandRows.length>=5)return;
const entry=bandRow();bandRows.push(entry);
tbody.insertBefore(entry.row,addRow);paintAdd();paintPreview();
},'btn ghost sm');
addBand.prepend(svgIcon(IC.plus,'i m'));
addCell.append(addBand);addRow.append(addCell);tbody.append(addRow);
table.append(thead,tbody);bandsBox.append(table);
preview=node('p',undefined,'siteSee');
bandsSection.append(bandsBox,preview);
}else bandsSection.append(node('p','Preço único por arte, sem faixas.','siteSoft'));
const history=node('div',undefined,'siteDlgSection');
const paintHistory=()=>{
history.replaceChildren(node('h3','Histórico'));
const scheduledIds=new Set(product.scheduled.map(row=>row.id));
const past=product.history.filter(row=>!scheduledIds.has(row.id))
.sort((a,b)=>new Date(b.starts_at)-new Date(a.starts_at));
if(!product.scheduled.length&&!past.length){
history.append(node('p','Nenhuma mudança ainda. Preço agendado aparece aqui e pode ser cancelado até começar.','siteSoft'));
return;
}
for(const row of product.scheduled)history.append(historyRow(row,true));
for(const row of past)history.append(historyRow(row,false));
};
const historyRow=(row,scheduled)=>{
const line=node('div',undefined,'siteHistRow');
const main=node('div',undefined,'siteHistMain');
main.append(node('b',money(row.unit_cents)),node('span',when(row.starts_at)),
node('span',(row.bands||[]).length?bandsText(row.bands,unit):'sem faixas','siteSoft'),
...(row.created_by?[node('span',row.created_by,'siteSoft')]:[]));
line.append(main);
if(scheduled){
line.append(button('Cancelar',async()=>{
await cancelScheduledPrice(row.id);
say('Preço agendado cancelado.');
await loadSiteAdmin();
},'btn ghost'));
scheduled.append(line);
}
}else scheduled.append(node('span','Nenhum preço agendado.','muted'));
const table=node('table',undefined,'table');
const head=node('thead');const headRow=node('tr');
for(const title of ['Valor','A partir de','Quem','Quando'])headRow.append(node('th',title));
head.append(headRow);
const body=node('tbody');
for(const row of product.history){
const tr=node('tr');
tr.append(node('td',money(row.unit_cents)+bandsText(row.bands,product.unit),'nowrap'),node('td',when(row.starts_at),'nowrap'),
node('td',row.created_by),node('td',when(row.created_at),'nowrap'));
body.append(tr);
}
if(!product.history.length){
const tr=node('tr');const td=node('td','Nenhum preço registrado: vale o preço padrão.','muted');
td.colSpan=4;tr.append(td);body.append(tr);
}
table.append(head,body);
const history=node('div',undefined,'siteHistory');
history.append(node('h4','Histórico'),table);
block.append(heading,form,scheduled,history);
return block;
}
// ── Nota da arte (front 8.5) ────────────────────────────────────────────────
function ensureGradePanel(){
let panel=$('site-grade-panel');
if(panel)return panel;
panel=node('section',undefined,'panel clip');panel.id='site-grade-panel';
const head=node('div',undefined,'phead');head.append(node('h2','Nota da arte'));
panel.append(head,node('p','A menor nota dos itens do pedido decide. Sem regra, a nota não muda nada.','phint'));
const body=node('div',undefined,'siteGradeBody');body.id='site-grade-body';panel.append(body);
const coupons=$('site-coupons-panel');
if(coupons)coupons.before(panel);
else{
const videos=$('site-videos-panel');
if(videos)videos.before(panel);else $('tab-site').append(panel);
}
return panel;
}
function gradeRuleRow(label, value){
const row=node('div',undefined,'siteGradeRow');
const on=node('input');on.type='checkbox';on.checked=value!=null;
const word=node('span',on.checked?'Ligado':'Desligado');
const toggle=node('label',undefined,'siteSwitch');toggle.append(on,word);
const num=node('input');num.type='number';num.min='1';num.max='100';num.step='1';
num.className='siteGradeNumber';num.value=value!=null?String(value):'';num.disabled=!on.checked;
on.onchange=()=>{
word.textContent=on.checked?'Ligado':'Desligado';
num.disabled=!on.checked;
if(on.checked)num.focus();
product.scheduled=product.scheduled.filter(item=>item.id!==row.id);
product.history=product.history.filter(item=>item.id!==row.id);
paintHistory();await loadSiteAdmin();
},'btn ghost sm'));
}else line.append(node('span','já começou','siteSoft'));
return line;
};
const fieldLabel=node('label',undefined,'siteGradeField');
fieldLabel.append(node('span',label),num);
row.append(toggle,fieldLabel);
return {row,on,num};
const formBands=()=>bandRows.map(row=>{
const from=Number(row.from.value.replace(',','.'));
const cents=moneyInputCents(row.price.value);
if(!Number.isFinite(from)||from<=0||cents===null||cents<=0)
throw new Error('Confira as faixas: início e preço maiores que zero.');
return {from_metres:String(from),unit_cents:cents};
});
m=formDialog(product.title,{width:640,className:'siteDialog',
text:(product.enabled?'Ligado':'Desligado')+' · por '+unit,
fields:[now,priceField,startField,bandsSection,history],label:'Salvar preço',
onsave:async()=>{
const typed=priceInput.value.trim();
const cents=typed?moneyInputCents(typed):current>0?current:null;
if(cents===null)throw new Error('Informe o preço em reais, como 19,90.');
let starts_at=null;
if(mode==='schedule'){
if(!chosen)throw new Error('Escolha a data e o horário em que o preço começa.');
const date=new Date(chosen.date+'T'+(chosen.time||'08:00')+':00');
if(Number.isNaN(date.getTime()))throw new Error('Data inválida.');
starts_at=date.toISOString();
}
await api('/site/products/'+product.id+'/prices',{unit_cents:cents,starts_at,
bands:permiteFaixas?formBands():[]});
say(starts_at?'Preço salvo para '+when(starts_at)+'.':'Preço salvo. Vale a partir de agora.');
await loadSiteAdmin();
}});
priceInput.oninput=()=>{paintBase();paintPreview();};
setMode('now');paintBase();paintPreview();paintHistory();paintAdd();
}
async function loadGradeRules(){
if(!may('manage'))return;
ensureGradePanel();
const data=await api('/site/grade-rules');
const aviso=gradeRuleRow('Avisar o designer abaixo de',data.aviso);
const tratamento=gradeRuleRow('Exigir o Ajuste Fino abaixo de',data.tratamento);
const save=button('Salvar',async()=>{
const avisoValue=aviso.on.checked?Number(aviso.num.value):null;
const tratamentoValue=tratamento.on.checked?Number(tratamento.num.value):null;
for(const value of [avisoValue,tratamentoValue])
if(value!==null&&(!Number.isInteger(value)||value<1||value>100))
throw new Error('A nota vai de 1 a 100.');
if(avisoValue!==null&&tratamentoValue!==null&&tratamentoValue>avisoValue)
throw new Error('A regra do Ajuste Fino precisa ser menor ou igual à do aviso.');
await api('/site/grade-rules',{aviso:avisoValue,tratamento:tratamentoValue});
say('Regras da nota da arte salvas.');
await loadGradeRules();
},'btn pri');
const children=[aviso.row,tratamento.row];
if(!data.treatment_offered)
children.push(node('p','Ative e dê preço ao Ajuste Fino para esta regra valer.','siteGradeWarn'));
const foot=node('div',undefined,'siteGradeSave');foot.append(save);children.push(foot);
$('site-grade-body').replaceChildren(...children);
}
// ── Cupons (front 8.3) ──────────────────────────────────────────────────────
// A "ficha" of the date in the browser's timezone, for datetime-local inputs.
// ---- Cupons (S3) ----------------------------------------------------------
function couponDate(iso){
const d=new Date(iso),p=n=>String(n).padStart(2,'0');
return d.getFullYear()+'-'+p(d.getMonth()+1)+'-'+p(d.getDate())+'T'+p(d.getHours())+':'+p(d.getMinutes());
}
function ensureCouponsPanel(){
let panel=$('site-coupons-panel');
if(panel)return panel;
panel=node('section',undefined,'panel clip');panel.id='site-coupons-panel';
const head=node('div',undefined,'phead');
head.append(node('h2','Cupons'),button('Novo cupom',()=>couponDialog(null),'btn right'));
panel.append(head,node('p','Cupons de desconto do checkout: validade, mínimo de metros, limite de usos e produto. Um cupom por pedido.','phint'));
const list=node('div',undefined,'siteCouponList');list.id='site-coupons';panel.append(list);
const videos=$('site-videos-panel');
if(videos)videos.before(panel); else $('tab-site').append(panel);
return panel;
function couponStatus(coupon){
if(coupon.paused)return ['Pausado','warn'];
if(coupon.valid_until&&new Date(coupon.valid_until)<=new Date())return ['Expirado',''];
return ['Ativo','ok'];
}
function renderSiteCoupons(){
const host=$('site-coupons');if(!host)return;
if(!siteCoupons.length){
const panel=node('section',undefined,'panel clip');
const box=emptyState(SITE_TICKET,'Nenhum cupom ainda',
'Cupom dá desconto no checkout, com validade, mínimo de metros e limite de usos. Um por pedido.');
box.append(button('Novo cupom',()=>couponDialog(null),'btn pri'));
panel.append(box);host.replaceChildren(panel);
return;
}
const tools=node('div',undefined,'siteTools');
tools.append(node('span',siteCoupons.length+(siteCoupons.length===1?' cupom':' cupons'),'siteSoft'),
button('Novo cupom',()=>couponDialog(null),'btn pri'));
const table=node('table',undefined,'dtable site-table');
const head=node('thead'),headRow=node('tr');
for(const title of ['Código','Desconto','Produto','Validade','Usos','Situação','Ações']){
const th=node('th',title);if(title==='Ações')th.className='r';headRow.append(th);
}
head.append(headRow);
const body=node('tbody');body.replaceChildren(...siteCoupons.map(couponRow));
table.append(head,body);
const panel=node('section',undefined,'panel clip');panel.append(table);
host.replaceChildren(tools,panel);
}
function couponRow(coupon){
const expired=coupon.valid_until && new Date(coupon.valid_until)<=new Date();
const status=coupon.paused?['Pausado','warn']:expired?['Expirado','']:['Ativo','ok'];
const row=node('div',undefined,'siteCouponRow');
const top=node('div',undefined,'siteCouponTop');
top.append(node('b',coupon.code),badge(status[0],status[1]),
node('span',coupon.kind==='percent'?coupon.value+'%':money(coupon.value)+'/m','siteCouponOffer'));
const meta=node('div',undefined,'siteCouponMeta');
meta.append(node('span','Validade: de '+when(coupon.valid_from)+
(coupon.valid_until?' até '+when(coupon.valid_until):' sem fim')),
node('span','Produto: '+(coupon.product?SHORT[coupon.product]:'todos')),
node('span','Usos: '+coupon.uses+(coupon.max_uses?' de '+coupon.max_uses:'')));
const actions=node('div',undefined,'siteCouponActions');
const tr=node('tr');
const code=node('td');code.append(node('b',coupon.code,'code'));
if(coupon.note)code.append(node('span',coupon.note,'sub'));
const offer=node('td');offer.dataset.label='Desconto';
offer.append(node('b',coupon.kind==='percent'?coupon.value+'%':money(coupon.value)+'/m'));
const product=node('td',coupon.product?SHORT[coupon.product]:'Todos');product.dataset.label='Produto';
const valid=node('td');valid.dataset.label='Validade';
valid.append(node('span',when(coupon.valid_from)+(coupon.valid_until?' a '+when(coupon.valid_until):' sem fim')));
const uses=node('td');uses.dataset.label='Usos';
uses.append(node('span',coupon.uses+(coupon.max_uses?' de '+coupon.max_uses:'')),
...(coupon.max_uses_per_customer?[node('span',coupon.max_uses_per_customer+' por cliente','sub')]:[]));
const [status,tone]=couponStatus(coupon);
const situation=node('td');situation.dataset.label='Situação';
situation.append(node('span',status,'tag'+(tone?' '+tone:'')));
const actions=node('td',undefined,'r siteAction');
actions.append(button(coupon.paused?'Retomar':'Pausar',async()=>{
await api('/site/coupons/'+coupon.id,{paused:!coupon.paused});
say('Cupom '+coupon.code+(coupon.paused?' retomado.':' pausado.'));
await loadSiteCoupons();
},'btn'),
button('Editar',()=>couponDialog(coupon),'btn ghost'),
},'btn sm'),
button('Editar',()=>couponDialog(coupon),'btn sm ghost'),
button('Apagar',async()=>{
if(!(await ask('Apagar cupom',
'O cupom '+coupon.code+' deixa de valer. Os pedidos que já o usaram continuam no histórico.',
@@ -259,25 +398,27 @@ function couponRow(coupon){
await api('/site/coupons/'+coupon.id+'/delete',{});
say('Cupom '+coupon.code+' apagado.');
await loadSiteCoupons();
},'btn quiet'));
row.append(top,meta,actions);
if(coupon.note)row.append(node('p',coupon.note,'siteCouponNote'));
return row;
},'btn sm quiet'));
tr.append(code,offer,product,valid,uses,situation,actions);
return tr;
}
function couponDialog(coupon){
const editing=!!coupon;
const code=node('input');code.maxLength=30;code.value=coupon?coupon.code:'';code.placeholder='Ex.: REINA-2026';
if(editing)code.disabled=true;
const kind=node('select');
for(const [value,label] of [['percent','Porcentagem (%)'],['per_metre','Por metro (R$)']]){
const option=node('option',label);option.value=value;kind.append(option);
}
kind.value=coupon?coupon.kind:'percent';
const pct=node('input');pct.type='number';pct.min='1';pct.max='90';pct.step='1';
let kind=coupon?coupon.kind:'percent';
const kindSeg=node('div',undefined,'seg full');kindSeg.setAttribute('role','radiogroup');
kindSeg.setAttribute('aria-label','Tipo de desconto');
const pctBtn=node('button','Porcentagem');pctBtn.type='button';pctBtn.setAttribute('role','radio');
const metreBtn=node('button','Por metro');metreBtn.type='button';metreBtn.setAttribute('role','radio');
kindSeg.append(pctBtn,metreBtn);
const pct=node('input');pct.type='number';pct.min='1';pct.max='90';pct.step='1';pct.className='siteInp';
pct.value=coupon&&coupon.kind==='percent'?String(coupon.value):'';
const price=node('input');price.type='text';price.inputMode='decimal';price.placeholder='2,00';
const pctBox=node('span',undefined,'inp siteInpBox');pctBox.append(pct,node('span','%','pre siteSuffix'));
const price=node('input');price.type='text';price.inputMode='decimal';price.className='siteInp';
price.placeholder='2,00';
if(coupon&&coupon.kind==='per_metre')price.value=(coupon.value/100).toFixed(2).replace('.',',');
const priceBox=node('span',undefined,'inp siteInpBox');priceBox.append(node('span','R$','pre'),price);
const from=node('input');from.type='datetime-local';from.value=coupon?couponDate(coupon.valid_from):'';
const until=node('input');until.type='datetime-local';
until.value=coupon&&coupon.valid_until?couponDate(coupon.valid_until):'';
@@ -293,27 +434,37 @@ function couponDialog(coupon){
}
product.value=coupon?coupon.product||'':'';
const note=node('textarea');note.maxLength=1000;note.value=coupon?coupon.note:'';
const pctField=field('Desconto (%)',pct,'De 1 a 90.');
const priceField=field('Desconto por metro (R$)',price,'Valor em reais por metro, como 2,00.');
const paint=()=>{pctField.hidden=kind.value!=='percent';priceField.hidden=kind.value!=='per_metre';};
kind.onchange=paint;paint();
const fields=[
field('Código',code,editing?'O código não muda depois de criado.':'De 3 a 30 letras, números ou hífens.'),
field('Tipo de desconto',kind),
pctField,priceField,
field('Válido a partir de',from,'Vazio: agora.'),
field('Válido até',until,'Vazio: sem fim.'),
field('Mínimo de metros',min,'Vazio: sem mínimo. Conta só os metros dos itens do produto.'),
const descHint=node('small');
const descField=node('div',undefined,'fld');
descField.append(node('span','Desconto'),pctBox,priceBox,descHint);
const paint=()=>{
pctBtn.classList.toggle('on',kind==='percent');pctBtn.setAttribute('aria-checked',String(kind==='percent'));
metreBtn.classList.toggle('on',kind==='per_metre');metreBtn.setAttribute('aria-checked',String(kind==='per_metre'));
pctBox.hidden=kind!=='percent';priceBox.hidden=kind!=='per_metre';
descHint.textContent=kind==='percent'?'De 1 a 90.':'Valor em reais por metro, como 2,00.';
};
pctBtn.onclick=()=>{kind='percent';paint();};
metreBtn.onclick=()=>{kind='per_metre';paint();};
paint();
const kindField=node('div',undefined,'fld');kindField.append(node('span','Tipo de desconto'),kindSeg);
const row1=node('div',undefined,'g2');
row1.append(field('Código',code,editing?'O código não muda depois de criado.':'De 3 a 30 letras, números ou hífens.'),
field('Produto',product,'Todos os produtos, ou só um.'));
const row2=node('div',undefined,'g2');row2.append(kindField,descField);
const row3=node('div',undefined,'g2');
row3.append(field('Válido a partir de',from,'Vazio: agora.'),field('Válido até',until,'Vazio: sem fim.'));
const row4=node('div',undefined,'g3');
row4.append(field('Mínimo de metros',min,'Vazio: sem mínimo. Conta só os metros dos itens do produto.'),
field('Limite de usos',max,'Vazio: sem limite.'),
field('Limite por cliente',per,'Vazio: sem limite.'),
field('Produto',product,'Todos os produtos, ou só um.'),
field('Observação',note,'Aparece só no Kanban.'),
];
formDialog(editing?'Editar cupom':'Novo cupom',{width:640,fields,label:'Salvar cupom',onsave:async()=>{
field('Limite por cliente',per,'Vazio: sem limite.'));
formDialog(editing?'Editar cupom':'Novo cupom',{width:640,className:'siteDialog',
text:'Desconto no checkout. Um cupom por pedido.',fields:[row1,row2,row3,row4,
field('Observação',note,'Aparece só no Kanban.')],
label:editing?'Salvar cupom':'Criar cupom',onsave:async()=>{
const rawMin=min.value.trim().replace(',','.');
const payload={
kind:kind.value,
value:kind.value==='percent'?Number(pct.value):moneyInputCents(price.value),
kind,
value:kind==='percent'?Number(pct.value):moneyInputCents(price.value),
valid_from:from.value?new Date(from.value).toISOString():null,
valid_until:until.value?new Date(until.value).toISOString():null,
min_metres:rawMin||null,
@@ -322,9 +473,9 @@ function couponDialog(coupon){
product:product.value||null,
note:note.value.trim(),
};
if(kind.value==='percent'&&(!Number.isInteger(payload.value)||payload.value<1||payload.value>90))
if(kind==='percent'&&(!Number.isInteger(payload.value)||payload.value<1||payload.value>90))
throw new Error('A porcentagem precisa ser de 1 a 90.');
if(kind.value==='per_metre'&&(payload.value===null||payload.value<=0))
if(kind==='per_metre'&&(payload.value===null||payload.value<=0))
throw new Error('Informe o desconto por metro em reais, como 2,00.');
if(rawMin&&!/^\d+([.,]\d)?$/.test(rawMin))
throw new Error('O mínimo de metros usa no máximo uma casa decimal.');
@@ -348,67 +499,136 @@ function couponDialog(coupon){
}});
}
async function loadSiteCoupons(){
if(!may('manage'))return;
ensureCouponsPanel();
const data=await api('/site/coupons');
const host=$('site-coupons');
host.replaceChildren(...(data.coupons.length?data.coupons.map(couponRow)
:[node('p','Nenhum cupom criado ainda.','empty')]));
// ---- Nota da arte (S4) ----------------------------------------------------
function renderSiteGrade(){
const host=$('site-grade-body');if(!host)return;
const table=node('div',undefined,'siteGradeTable');
const head=node('div',undefined,'siteGradeHead');
head.append(node('span','Regra'),node('span','Nota abaixo de'),node('span','Situação'));
table.append(head);
const ruleRow=(label,value,soft=false)=>{
let on=value!=null;
const row=node('div',undefined,'siteGradeRow');
row.append(node('span',label,'siteGradeName'+(soft?' siteSoft':'')));
const num=node('input');num.type='number';num.min='1';num.max='100';num.step='1';
num.className='siteGradeNumber';num.placeholder='—';num.value=value!=null?String(value):'';num.disabled=!on;
const numBox=node('span',undefined,'inp siteInpBox');numBox.append(num);
row.append(numBox);
const sw=node('button',undefined,'sw'+(on?' on':''));
sw.type='button';sw.setAttribute('role','switch');sw.setAttribute('aria-checked',String(on));
const word=node('span',on?'Ligada':'Desligada');
sw.append(node('span',undefined,'t'),word);
const setOn=next=>{
on=next;sw.classList.toggle('on',next);sw.setAttribute('aria-checked',String(next));
word.textContent=next?'Ligada':'Desligada';num.disabled=!next;
};
sw.onclick=()=>setOn(!on);
row.append(sw);
return {row,value:()=>on?Number(num.value):null};
};
const aviso=ruleRow('Avisar o designer',siteRules.aviso);
const treatment=ruleRow('Exigir o Ajuste Fino',siteRules.tratamento,true);
table.append(aviso.row,treatment.row);
const warning=!siteRules.treatment_offered
?node('p','Ative e dê preço ao Ajuste Fino para esta regra valer.','siteGradeWarn')
:null;
const foot=node('div',undefined,'siteGradeSave');
foot.append(button('Salvar regras',async()=>{
const avisoValue=aviso.value(),treatmentValue=treatment.value();
for(const value of [avisoValue,treatmentValue])
if(value!==null&&(!Number.isInteger(value)||value<1||value>100))
throw new Error('A nota vai de 1 a 100.');
if(avisoValue!==null&&treatmentValue!==null&&treatmentValue>avisoValue)
throw new Error('A regra do Ajuste Fino precisa ser menor ou igual à do aviso.');
await api('/site/grade-rules',{aviso:avisoValue,tratamento:treatmentValue});
say('Regras da nota da arte salvas.');
siteRules=await api('/site/grade-rules');renderSiteGrade();
},'btn pri'));
host.replaceChildren(table,...(warning?[warning]:[]),foot);
}
async function loadSiteAdmin(){
if(!may('manage'))return;
const data=await api('/site/products');
$('site-products').replaceChildren(...data.products.map(siteProductRow));
$('site-prices').replaceChildren(...data.products.map(sitePriceBlock));
await loadSiteCoupons();
await loadGradeRules();
await loadSiteVideos();
// ---- Vídeos (S5, S6) ------------------------------------------------------
function videoProductLabel(product){
return (SITE_VIDEO_PRODUCTS.find(([value])=>value===(product||''))||SITE_VIDEO_PRODUCTS[0])[1];
}
async function loadSiteVideos(){
const host=$('site-videos-list'),panel=$('site-videos-panel');
panel.hidden=!may('manage');
if(panel.hidden)return;
const data=await api('/site-videos');
host.replaceChildren(...data.videos.map(video=>{
const row=node('div',undefined,'siteVideoRow');
const heading=node('div',undefined,'siteVideoHeading');
heading.append(node('b',video.title),node('span',video.enabled?'Publicado':'Rascunho','pill'+(video.enabled?' ok':'')));
function renderSiteVideos(){
const host=$('site-videos-list');if(!host)return;
host.replaceChildren(...siteVideos.map(siteVideoRow));
}
function siteVideoRow(video){
const tr=node('tr',undefined,'siteVideoRow');
const title=node('td');title.append(node('span',video.title,'pname'));
const file=node('td');file.dataset.label='Arquivo';
file.append(video.video_name?node('span',video.video_name,'siteFileName'):node('span','sem vídeo','muted'));
const captions=node('td');captions.dataset.label='Legenda';
captions.append(video.captions_name?node('span',video.captions_name,'siteFileName'):node('span','sem legenda','muted'));
const where=node('td',videoProductLabel(video.product));where.dataset.label='Onde aparece';
const situation=node('td');situation.dataset.label='Situação';
situation.append(node('span',video.enabled?'Publicado':'Rascunho','tag'+(video.enabled?' ok':'')));
const action=node('td',undefined,'r siteAction');
action.append(button('Editar',()=>videoDialog(video),'btn sm'));
tr.append(title,file,captions,where,situation,action);
return tr;
}
function videoDialog(video){
let published=!!video.enabled;
const videoInput=node('input');videoInput.type='file';videoInput.accept='.mp4,.webm,video/mp4,video/webm';
const videoField=node('div',undefined,'fld');
videoField.append(node('span','Vídeo'),
dropField(videoInput,{title:'Escolher arquivo',hint:'MP4 ou WebM até 500 MB.'}),
node('small',video.video_name||'Nenhum arquivo enviado.'));
const captionsInput=node('input');captionsInput.type='file';captionsInput.accept='.vtt,text/vtt';
const videoLabel=node('label',undefined,'siteVideoField');
videoLabel.append(node('span','Vídeo · '+(video.video_name||'nenhum arquivo')),videoInput);
const captionsLabel=node('label',undefined,'siteVideoField');
captionsLabel.append(node('span','Legenda (opcional) · '+(video.captions_name||'nenhuma legenda')),captionsInput);
const product=node('select');product.setAttribute('aria-label','Produto do vídeo '+video.title);
for(const [value,title] of [['','Só na categoria DTF'],['file','Arquivo por metro'],
['avulsa','Artes avulsas'],['uvfile','Arquivo por metro UV'],['uv','Artes avulsas UV']]){
const option=node('option',title);option.value=value;product.append(option);
const captionsField=node('div',undefined,'fld');
captionsField.append(node('span',video.captions_name?'Legenda':'Legenda · opcional'),
dropField(captionsInput,{title:'Escolher legenda',hint:'Arquivo VTT.'}),
node('small',video.captions_name||'Nenhuma legenda enviada.'));
const product=node('select');
for(const [value,label] of SITE_VIDEO_PRODUCTS){
const option=node('option',label);option.value=value;product.append(option);
}
product.value=video.product||'';
const productLabel=node('label',undefined,'siteVideoField');productLabel.append(node('span','Vídeo flutuante'),product);
const enabled=node('input');enabled.type='checkbox';enabled.checked=video.enabled;
const publish=node('label',undefined,'siteVideoToggle');publish.append(enabled,node('span','Publicado no Site'));
const errorMessage=node('p',undefined,'siteVideoError');errorMessage.setAttribute('role','alert');
const save=button('Salvar vídeo',async()=>{
save.disabled=true;
errorMessage.textContent='';
try{
const sw=node('button',undefined,'sw'+(published?' on':''));
sw.type='button';sw.setAttribute('role','switch');sw.setAttribute('aria-checked',String(published));
sw.append(node('span',undefined,'t'),'Publicar no Site');
sw.onclick=()=>{published=!published;sw.classList.toggle('on',published);sw.setAttribute('aria-checked',String(published));};
const situation=node('div',undefined,'fld');situation.append(node('span','Situação'),sw);
const row=node('div',undefined,'g2');
row.append(field('Onde aparece',product,'Ou flutuando na página de um produto.'),situation);
formDialog(video.title,{width:640,className:'siteDialog',
text:video.enabled?'Publicado no Site':'Rascunho · ainda não aparece no Site',
fields:[videoField,captionsField,row],label:'Salvar vídeo',onsave:async()=>{
let uploadId=video.upload_id,captionsId=video.captions_id;
if(videoInput.files[0])uploadId=await dtfUpload(videoInput.files[0],{api,startPath:'/site-videos/uploads',
scope:'site-video:'+video.id+':video',progress:text=>say(text)});
if(captionsInput.files[0])captionsId=await dtfUpload(captionsInput.files[0],{api,startPath:'/site-videos/uploads',
scope:'site-video:'+video.id+':captions',progress:text=>say(text)});
await api('/site-videos/'+video.id,{upload_id:uploadId,captions_id:captionsId,
product:product.value||null,enabled:enabled.checked});
product:product.value||null,enabled:published});
say('Vídeo salvo. O Site mostrará a nova versão na próxima abertura.');
await loadSiteVideos();
}catch(error){errorMessage.textContent=error.message;save.disabled=false;}
},'btn');
const fields=node('div',undefined,'siteVideoFields');
fields.append(videoLabel,captionsLabel,productLabel,publish,save,errorMessage);
row.append(heading,fields);return row;
}));
}});
}
// ---- Loading --------------------------------------------------------------
async function loadSiteCoupons(){
const data=await api('/site/coupons');
siteCoupons=data.coupons;renderSiteCoupons();paintSiteTabs();
}
async function loadSiteVideos(){
const data=await api('/site-videos');
siteVideos=data.videos;renderSiteVideos();paintSiteTabs();
}
async function loadSiteAdmin(){
if(!may('manage'))return;
const products=await api('/site/products');
siteProducts=products.products;renderSiteProducts();
const rest=await Promise.allSettled([api('/site/coupons'),api('/site/grade-rules'),api('/site-videos')]);
const [coupons,grade,videos]=rest;
if(coupons.status==='fulfilled')siteCoupons=coupons.value.coupons;
else say(coupons.reason.message,true);
if(grade.status==='fulfilled')siteRules=grade.value;
else say(grade.reason.message,true);
if(videos.status==='fulfilled')siteVideos=videos.value.videos;
else say(videos.reason.message,true);
renderSiteCoupons();renderSiteGrade();renderSiteVideos();paintSiteTabs();
}

View File

@@ -555,27 +555,28 @@ main{padding:0}
never scrolls the page; the review on the right scrolls inside. */
.split{display:grid;grid-template-columns:460px minmax(0,1fr);height:calc(100vh - 72px)}
.qlist{border-right:1px solid var(--ln);display:flex;flex-direction:column;min-height:0}
.qtools{display:flex;flex-direction:column;gap:12px;padding:18px 20px 14px;border-bottom:1px solid var(--ln)}
.qtools{display:flex;flex-direction:column;gap:12px;padding:20px 20px 16px;border-bottom:1px solid var(--ln)}
.qtools .seg{align-self:flex-start}
.qsearch{width:100%}
.toggles{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.tg{height:28px;padding:0 11px;border-radius:999px;border:1px solid var(--ln2);background:transparent;color:var(--tx2);font-size:12.5px;font-weight:550;display:inline-flex;align-items:center;gap:5px}
.toggles{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.tg{height:30px;padding:0 11px;border-radius:8px;border:1px solid var(--ln2);background:transparent;color:var(--tx2);font-size:13px;font-weight:550;display:inline-flex;align-items:center;gap:5px}
.tg:hover{background:var(--sf3);color:var(--tx)}
.tg.on{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.qrows{flex:1;min-height:0;overflow:hidden;padding:8px;display:flex;flex-direction:column;gap:4px}
.qrow{display:grid;grid-template-columns:52px minmax(0,1fr);gap:14px;width:100%;padding:12px;border:1px solid transparent;border-radius:11px;background:transparent;text-align:left;color:inherit;align-items:start;flex:none}
.qrows{flex:1;min-height:0;overflow:hidden;padding:0;display:flex;flex-direction:column;gap:0}
.qrow{display:grid;grid-template-columns:44px minmax(0,1fr) auto;gap:12px;width:100%;padding:14px 20px;border:0;border-bottom:1px solid var(--ln);border-radius:0;background:transparent;text-align:left;color:inherit;align-items:center;flex:none}
.qrow:hover{background:var(--sf2)}
.qrow.on{background:var(--sf);border-color:var(--ln2)}
.qthumb{width:52px;height:52px;border-radius:8px;padding:4px;border:0;box-shadow:inset 0 0 0 1px var(--ln);background:repeating-conic-gradient(var(--chka) 0 25%,var(--chkb) 0 50%) 0 0/8px 8px}
.qrow.on{background:var(--sf);box-shadow:inset 3px 0 0 var(--tx)}
.qthumb{width:44px;height:44px;border-radius:8px;padding:0;border:0;box-shadow:inset 0 0 0 1px var(--ln);background:repeating-conic-gradient(var(--chka) 0 25%,var(--chkb) 0 50%) 0 0/8px 8px}
.qthumb.layout,.qthumb.none{background:var(--sf3)}
.qmain{display:flex;flex-direction:column;gap:3px;min-width:0}
.qline{display:flex;align-items:baseline;gap:10px;min-width:0}
.qline>:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.qline b{font-size:13.5px;font-weight:600}
.qline b{font-size:14px;font-weight:600}
.qline.sub{align-items:center;color:var(--tx2);font-size:12.5px}
.qline.sub>:last-child{color:var(--tx3);white-space:nowrap}
.qline .grade{height:19px;min-width:26px;font-size:11.5px;vertical-align:1px}
.qm{font-size:13.5px;font-weight:600;white-space:nowrap}
.qside{display:flex;flex-direction:column;align-items:flex-end;gap:3px;text-align:right;white-space:nowrap}
.qside .qm{font-size:14px;font-weight:650}
.qside .qt{font-size:12px;color:var(--tx3)}
.qwarn{display:flex;align-items:center;gap:5px;margin-top:3px;font-size:12px;font-weight:600;color:var(--warn)}
.qwarn.bad{color:var(--bad)}
.qwarn span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -587,16 +588,18 @@ main{padding:0}
.rhead{display:flex;align-items:flex-start;gap:16px;padding:22px 28px 18px;border-bottom:1px solid var(--ln)}
.rwords{flex:1;min-width:0}
.rtitle{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.rhead h2{margin:0;font-size:22px;font-weight:650;letter-spacing:-.01em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rmeta{display:flex;gap:6px 16px;flex-wrap:wrap;margin-top:6px;color:var(--tx2);font-size:13px}
.rhead h2{margin:0;font-size:20px;font-weight:650;letter-spacing:-.01em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rmeta{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:6px;color:var(--tx2);font-size:13.5px}
.rmeta>span{display:flex;align-items:center;gap:6px}
.rmeta>span+span::before{content:"·";color:var(--tx3)}
.qbig{text-align:right;flex-shrink:0}
.qbig b{display:block;font-size:24px;font-weight:650;letter-spacing:-.02em;line-height:1.1}
.rbody{flex:1;min-height:0;overflow:auto;padding:22px 28px;display:flex;flex-direction:column;gap:22px;background:var(--sf)}
.qbig .lbl{display:block}
.qbig b{display:block;font-size:26px;font-weight:650;letter-spacing:-.02em;line-height:1.1}
.rbody{flex:1;min-height:0;overflow:auto;padding:24px 28px;display:flex;flex-direction:column;gap:22px;background:var(--bg)}
.rbody>*{flex-shrink:0}
.ritem{display:grid;grid-template-columns:336px minmax(0,1fr);gap:36px;align-items:start}
.ritem{display:grid;grid-template-columns:360px minmax(0,1fr);gap:28px;align-items:start}
.ritem+.ritem{padding-top:22px;border-top:1px solid var(--ln)}
.tall{width:336px;max-height:calc(100vh - 72px - 220px);min-height:320px;overflow-y:auto;border-radius:10px;box-shadow:inset 0 0 0 1px var(--ln);scrollbar-width:thin;padding:8px}
.tall{width:360px;max-height:calc(100vh - 72px - 220px);min-height:320px;overflow-y:auto;border-radius:10px;box-shadow:inset 0 0 0 1px var(--ln);scrollbar-width:thin;padding:8px}
.tall .preview{display:flex;flex-direction:column;gap:8px}
.tall .preview>svg{display:block;width:100%;height:auto}
.tall .preview .view{display:flex;flex-direction:column;gap:6px;border-radius:8px;overflow:hidden;padding:6px;background:repeating-conic-gradient(var(--chka) 0 25%,var(--chkb) 0 50%) 0 0/14px 14px}
@@ -607,19 +610,34 @@ main{padding:0}
.inputs .fld input{font-size:15px;font-weight:550}
.fld.warn input{border-color:var(--warn)}
.fld.warn small{color:var(--warn);font-weight:600}
.ritem .ihead{display:flex;align-items:baseline;gap:10px;margin:0 0 18px}
.ritem .ihead h3{margin:0;font-size:17px;font-weight:650;letter-spacing:-.01em}
.ritem .ihead .ilbl{font-size:13px;color:var(--tx3)}
.ritem .dl{grid-template-columns:repeat(3,minmax(0,1fr))}
.ritem .links{flex-direction:column;align-items:stretch}
.ritem .originals{width:100%;padding:0;border:1px solid var(--ln);border-radius:9px;background:var(--sf2)}
.ritem .originals summary{display:flex;align-items:center;gap:10px;height:40px;padding:0 12px;font-size:13.5px;font-weight:600;cursor:pointer;list-style:none}
.ritem .originals summary::-webkit-details-marker{display:none}
.ritem .originals summary span{flex:1}
.ritem .originals summary .i{color:var(--tx2);transition:transform .2s}
.ritem .originals[open] summary .i{transform:rotate(90deg)}
.ritem .originals .btn{display:flex;width:calc(100% - 24px);margin:8px 12px 0}
.ritem .originals .btn:last-child{margin-bottom:10px}
.qsums{display:grid;grid-template-columns:auto auto;justify-content:end;gap:6px 24px;font-size:13.5px;color:var(--tx2);padding-top:16px;border-top:1px solid var(--ln)}
.qsums b{text-align:right;color:var(--tx);font-weight:600}
.qsums b:last-child{font-size:16px}
.rfoot{display:flex;align-items:center;gap:10px;padding:16px 28px;border-top:1px solid var(--ln);background:var(--bg);flex-shrink:0}
.rfoot{display:flex;align-items:center;gap:10px;padding:14px 28px;border-top:1px solid var(--ln);background:var(--bg);flex-shrink:0}
.rfoot .ckb{margin-right:auto}
.register{display:flex;flex-direction:column;gap:14px;padding:16px;border:1px solid var(--ln2);border-radius:12px}
.register h4{margin:0 0 2px;font-size:15px;font-weight:650}
.rfoot .sp{flex:1}
.register{display:contents}
.fgroup2{display:grid;grid-template-columns:110px minmax(0,1fr);align-items:center;gap:10px}
label.fopt{cursor:pointer;user-select:none}
.fopt:has(input:checked){background:var(--ink);border-color:var(--ink);color:var(--onink)}
.fopt:has(input:focus-visible){outline:2px solid var(--acc);outline-offset:2px}
.emptystate{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:60px 20px;text-align:center;color:var(--tx2);font-size:13.5px}
.emptystate b{font-size:15px;font-weight:650;color:var(--tx)}
.emptystate{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:60px 20px;text-align:center;color:var(--tx2);font-size:13.5px}
.emptystate b{font-size:16px;font-weight:650;color:var(--tx)}
.emptystate>span{max-width:440px;line-height:1.5}
.emptystate .btn{margin-top:6px}
.empty.pad{padding:20px 12px}
/* The page bar under a list. */
.pager{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:12px 20px;border-top:1px solid var(--ln);font-size:12.5px;color:var(--tx2)}
@@ -637,56 +655,90 @@ label.fopt{cursor:pointer;user-select:none}
/* Pages (redesign, steps 5 to 7): Pagamentos, Números, Integrações and
Usuários, made of panels with a head and a table or a list. */
.page:not([hidden]){padding:24px 28px 40px;display:flex;flex-direction:column;gap:20px;animation:fadeUp .35s cubic-bezier(.2,.8,.2,1) both}
.siteVideoList{display:flex;flex-direction:column;padding:0 18px 18px}
.siteVideoRow{display:flex;flex-direction:column;gap:12px;padding:18px 0;border-top:1px solid var(--ln)}
.siteVideoHeading{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.siteVideoHeading b{font-size:14px}
.siteVideoFields{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
.siteVideoField{display:flex;flex-direction:column;gap:6px;min-width:175px;font-size:12px;color:var(--tx2)}
.siteVideoField input,.siteVideoField select{max-width:240px;min-height:38px;color:var(--tx);background:var(--sf);border:1px solid var(--ln2);border-radius:8px;padding:6px}
.siteVideoToggle{display:flex;align-items:center;gap:7px;min-height:38px;font-size:13px}
.siteVideoError{width:100%;margin:0;color:var(--bad);font-size:12px}
/* Site (front 8): what the Site sells, its prices and their history. */
#tab-site .siteSwitch{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:550;cursor:pointer}
#tab-site .siteSwitch input{width:16px;height:16px;margin:0;accent-color:var(--acc)}
#tab-site .sitePriceBlock{display:flex;flex-direction:column;gap:12px;padding:16px 18px}
#tab-site .sitePriceBlock+.sitePriceBlock{border-top:1px solid var(--ln)}
#tab-site .sitePriceBlock h3{margin:0;font-size:14px;font-weight:650}
#tab-site .sitePriceBlock h3 .muted{font-size:12.5px;font-weight:500}
#tab-site .sitePriceForm{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
#tab-site .sitePriceForm label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--tx2)}
#tab-site .sitePriceForm input{height:38px;padding:0 10px;border-radius:8px;border:1px solid var(--ln2);background:var(--sf);color:var(--tx);font-size:14px;font-family:inherit}
#tab-site .sitePriceForm input:focus{border-color:var(--acc);box-shadow:0 0 0 3px color-mix(in srgb,var(--acc) 18%,transparent);outline:none}
#tab-site .siteMoney{width:140px}
#tab-site .siteBands{display:flex;flex-direction:column;gap:8px;flex:1 0 100%}
#tab-site .siteBandsHead{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#tab-site .siteBandsHead>span{font-size:12px;color:var(--tx2)}
#tab-site .siteBandRows{display:flex;flex-direction:column;gap:8px}
#tab-site .siteBandRow{display:flex;align-items:end;gap:10px;flex-wrap:wrap}
#tab-site .siteBandFrom{width:100px}
#tab-site .siteBandPrice{width:120px}
#tab-site .siteScheduled{display:flex;flex-direction:column;gap:8px;font-size:13.5px}
#tab-site .siteScheduledRow{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#tab-site .siteScheduledRow .btn{height:30px;padding:0 10px;font-size:12.5px}
#tab-site .siteHistory{display:flex;flex-direction:column;gap:6px}
#tab-site .siteHistory h4{margin:0;font-size:12.5px;font-weight:600;color:var(--tx3)}
#tab-site .siteCouponList{display:flex;flex-direction:column;padding:0 18px 18px}
#tab-site .siteCouponRow{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid var(--ln)}
#tab-site .siteCouponTop{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#tab-site .siteCouponTop b{font-size:14px}
#tab-site .siteCouponOffer{font-size:13.5px;font-weight:650;color:var(--tx2)}
#tab-site .siteCouponMeta{display:flex;gap:16px;flex-wrap:wrap;font-size:12.5px;color:var(--tx3)}
#tab-site .siteCouponActions{display:flex;gap:8px;flex-wrap:wrap}
#tab-site .siteCouponActions .btn{height:32px;padding:0 10px;font-size:12.5px}
#tab-site .siteCouponNote{margin:0;font-size:13px;color:var(--tx2)}
#tab-site .siteGradeBody{display:flex;flex-direction:column;gap:14px;padding:16px 18px}
#tab-site .siteGradeRow{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
#tab-site .siteGradeField{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--tx2)}
#tab-site .siteGradeNumber{width:80px;height:38px;padding:0 10px;border-radius:8px;border:1px solid var(--ln2);background:var(--sf);color:var(--tx);font-size:14px;font-family:inherit}
#tab-site .siteGradeWarn{margin:0;font-size:12.5px;font-weight:600;color:var(--warn)}
#tab-site .siteGradeSave{display:flex;gap:8px}
#tab-site .siteHistory .table{font-size:13px}
#tab-site .siteHistory .table th,#tab-site .siteHistory .table td{padding:8px 12px}
/* Site (Phase B): the segmented tabs, the product/coupon/video tables and the
price, coupon and video dialogs. */
#tab-site .site-sub{font-size:13.5px;color:var(--tx2)}
#tab-site .site-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
#tab-site .site-note{margin-left:auto;font-size:13px;color:var(--tx3)}
#tab-site .site-pane{display:flex;flex-direction:column;gap:20px}
#tab-site .site-pane[hidden]{display:none}
#tab-site .site-table .pname{font-weight:600;font-size:14.5px}
#tab-site .site-table .unit{font-size:12.5px;color:var(--tx3);margin-left:8px}
#tab-site .site-table tr.off .pname,#tab-site .site-table tr.off .money{color:var(--tx3)}
#tab-site .site-table .money{font-size:14.5px;font-weight:600}
#tab-site .site-table .tag{margin-right:4px}
#tab-site .site-table .siteFileName{font-size:13px}
#tab-site .siteAction{width:1%;white-space:nowrap}
#tab-site .siteNext{display:flex;align-items:baseline;gap:8px;font-size:13px}
#tab-site .siteTools{display:flex;align-items:center;gap:12px}
#tab-site .siteTools .btn{margin-left:auto}
#tab-site .tag.ok{background:color-mix(in srgb,var(--mine) 14%,transparent);color:var(--mine)}
#tab-site .tag.warn{background:color-mix(in srgb,var(--warn) 14%,transparent);color:var(--warn)}
#tab-site #site-grade-panel{max-width:880px;width:100%}
#tab-site .siteGradeTable{display:flex;flex-direction:column;padding:0 18px}
#tab-site .siteGradeHead,#tab-site .siteGradeRow{display:grid;grid-template-columns:minmax(0,1fr) 120px 140px;align-items:center;gap:16px;padding:12px 0;border-bottom:1px solid var(--ln)}
#tab-site .siteGradeHead{padding:10px 0;font-size:12.5px;color:var(--tx3);font-weight:500}
#tab-site .siteGradeName{font-size:14.5px}
#tab-site .siteGradeRow .inp{height:38px;justify-content:center}
#tab-site .siteGradeNumber{border:0;background:transparent;width:100%;text-align:center;height:auto;padding:0}
#tab-site .siteGradeWarn{margin:0;padding:0 18px 12px;font-size:12.5px;font-weight:600;color:var(--warn)}
#tab-site .siteGradeSave{display:flex;justify-content:flex-end;padding:14px 18px}
/* The same pieces live inside the Site dialogs, which open over the page. */
.siteSoft{color:var(--tx3);font-size:13px;font-weight:500}
.siteInpBox{display:flex;align-items:center;gap:8px}
.inp .siteInp{border:0;background:transparent;height:auto;padding:0;min-width:0;flex:1;font:inherit;font-weight:600;color:inherit;outline:none;width:100%;box-shadow:none}
.inp .siteInp:focus{border:0;box-shadow:none}
.siteSuffix{margin-left:auto}
.sitePriceNow{display:flex;align-items:baseline;gap:10px}
.sitePriceNow b{font-size:28px;font-weight:650;letter-spacing:-.01em}
.sitePriceNow span{font-size:13px;color:var(--tx3)}
.siteStartRow{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.siteStartRow .calwrap{flex:1;min-width:200px}
.siteStartRow .inp{width:100%;text-align:left;display:flex;align-items:center;gap:8px}
.modal.siteDialog:has(.calpop) .dfoot{visibility:hidden}
.siteDlgSection{display:flex;flex-direction:column;gap:10px}
.siteDlgSection h3{margin:0;font-size:14px;font-weight:650}
.siteBands{border:1px solid var(--ln);border-radius:10px;overflow:hidden}
.siteBands table{width:100%;border-collapse:collapse}
.siteBands th{text-align:left;font-size:12.5px;font-weight:500;color:var(--tx3);padding:9px 14px;border-bottom:1px solid var(--ln)}
.siteBands td{padding:8px 14px;border-bottom:1px solid var(--ln);font-size:14px}
.siteBands .base td{color:var(--tx2);height:48px}
.siteBands .inp{height:36px;width:150px}
.siteBands .add td{border-bottom:0;padding:6px 8px}
.siteSee{margin:0;font-size:13px;color:var(--tx2)}
.siteSee b{color:var(--tx);font-weight:600}
.siteHistRow{display:flex;align-items:center;gap:12px;padding:8px 0;border-bottom:1px solid var(--ln);font-size:13px}
.siteHistRow:last-child{border-bottom:0}
.siteHistMain{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;flex:1;min-width:0}
.siteHistMain b{font-weight:600}
.seg.full{width:100%}
.seg.full button{flex:1;justify-content:center}
@media (max-width:700px){
#tab-site .site-note{margin-left:0;flex-basis:100%}
#tab-site .site-bar .seg{width:100%;overflow-x:auto;scrollbar-width:none}
#tab-site .site-bar .seg button{min-height:44px;flex:none}
#tab-site .site-table thead{display:none}
#tab-site .site-table tbody{display:block}
#tab-site .site-table tr{display:block;padding:12px 14px;border-bottom:1px solid var(--ln)}
#tab-site .site-table td{display:flex;justify-content:flex-end;align-items:baseline;gap:6px;height:auto;padding:6px 0;border:0;white-space:normal;text-align:right}
#tab-site .site-table td::before{content:attr(data-label);color:var(--tx3);font-size:12.5px;font-weight:500;text-align:left;flex:none;margin-right:auto;padding-right:6px}
#tab-site .site-table td:first-child::before{display:none}
#tab-site .site-table td:first-child,#tab-site .site-table td.siteAction{justify-content:flex-start;text-align:left}
#tab-site .siteAction{justify-content:flex-end}
#tab-site .siteAction::before{display:none}
#tab-site .siteTools{flex-wrap:wrap}
#tab-site .siteTools .btn{margin-left:0}
#tab-site .siteGradeHead{display:none}
#tab-site .siteGradeRow{grid-template-columns:1fr;gap:8px;padding:14px 0}
#tab-site .siteGradeRow .inp{justify-content:flex-start}
#tab-site .siteGradeNumber{text-align:left}
.modal.siteDialog{left:0;right:0;top:0;bottom:0;width:auto!important;max-width:none;max-height:none;height:100%;transform:none;border-radius:0;padding:18px 16px;animation:none}
.modal.siteDialog .g2,.modal.siteDialog .g3{grid-template-columns:1fr}
.modal.siteDialog .sw{min-height:44px}
.siteStartRow{flex-direction:column;align-items:stretch}
.siteStartRow .calwrap{min-width:0}
.siteBands .inp{width:100%}
}
.page>*{flex-shrink:0}
.pagetools{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.panel{background:var(--sf);border:1px solid var(--ln);border-radius:12px}
@@ -746,6 +798,9 @@ select.inp{appearance:none;-webkit-appearance:none;padding-right:32px;background
.calwrap{position:relative}
.calpop{left:0;top:calc(100% + 8px)}
.cal{display:grid;grid-template-columns:170px 300px}
.cal.single{grid-template-columns:1fr}
.calpop .time{display:flex;align-items:center;gap:10px;padding:10px 14px;border-top:1px solid var(--ln);font-size:13px;color:var(--tx2)}
.calpop .time .inp{height:36px;width:110px}
.presets{display:flex;flex-direction:column;gap:2px;padding:10px;border-right:1px solid var(--ln)}
.preset{height:34px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:var(--tx2);font-size:13px;font-weight:550;text-align:left}
.preset:hover{background:var(--sf2);color:var(--tx)}
@@ -1099,8 +1154,10 @@ select.inp{appearance:none;-webkit-appearance:none;padding-right:32px;background
.mfact b{font-weight:550;text-align:right;min-width:0;overflow-wrap:anywhere}
.mfacts select{margin-top:10px;height:44px;padding:0 12px;border-radius:10px;border:1px solid var(--ln2);background:var(--bg);color:var(--tx)}
.rework{border-radius:12px;background:var(--sf)}
/* dialogs: sheets from the bottom */
.modal{left:0;right:0;top:auto;bottom:0;width:auto!important;max-width:none;max-height:92vh;transform:none;border-radius:18px 18px 0 0;padding:22px 18px 18px;animation:sheetUp .4s cubic-bezier(.16,1,.3,1) both}
/* dialogs: sheets from the bottom, over a quote opened as a page */
.scrim.hi{z-index:27}
.modal{z-index:28;left:0;right:0;top:auto;bottom:0;width:auto!important;max-width:none;max-height:92vh;transform:none;border-radius:18px 18px 0 0;padding:22px 18px 18px;animation:sheetUp .4s cubic-bezier(.16,1,.3,1) both}
.register .fopt{height:44px}
.frow,.inputs{grid-template-columns:1fr}
.dfoot{flex-wrap:wrap}
.dfoot .btn{flex:1;height:48px}
@@ -1123,23 +1180,26 @@ select.inp{appearance:none;-webkit-appearance:none;padding-right:32px;background
#quote-chips{display:none}
.qrows{max-height:none;overflow:visible;padding:6px 12px 12px;gap:0}
.qrow{border-radius:0;border:0;border-bottom:1px solid var(--ln);padding:12px 2px}
.qrow.on{background:transparent;border-color:var(--ln)}
.qrow.on{background:transparent;border-color:var(--ln);box-shadow:none}
.review{display:none}
#tab-quotes.reviewing .review{display:flex;position:fixed;inset:0;z-index:25;background:var(--bg);animation:pageIn .38s cubic-bezier(.16,1,.3,1) both}
.review .rhead{display:none}
.rbody{padding:12px 12px 170px;gap:10px;background:var(--bg)}
.rbody{padding:12px 12px 200px;gap:10px;background:var(--bg)}
.ritem{grid-template-columns:1fr;gap:12px}
.tall{width:100%;height:140px;min-height:0;max-height:none;padding:0;background:repeating-conic-gradient(var(--chka) 0 25%,var(--chkb) 0 50%) 0 0/10px 10px}
.tall .preview>svg,.tall .preview .view{width:120px;margin:0 auto}
.ritem .iinfo>.lbl{display:none}
.ritem .iinfo>h3{margin:0 0 6px;font-size:16px}
.ritem .ihead{margin-bottom:12px}
.ritem .ihead h3{font-size:16px}
.ritem .originals summary{height:44px}
.ritem .dl{display:flex;flex-direction:column;gap:0;padding:4px 16px;border:1px solid var(--ln);border-radius:12px;background:var(--sf)}
.ritem .inputs{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:12px}
.ritem .inputs input{height:48px;font-size:16px}
.qsums{justify-content:stretch;grid-template-columns:1fr auto}
.rfoot{position:fixed;left:0;right:0;bottom:0;z-index:26;display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;padding:12px 16px 18px;background:var(--top)}
.rfoot .ckb{grid-column:1/-1;margin:0}
.rfoot .ckb{grid-column:1/-1;margin:0;min-height:44px}
.rfoot .sp{display:none}
.rfoot .btn{height:50px;font-size:15px}
.rfoot .btn.pri{grid-column:1/-1}
.rfoot .btn.right{margin:0}
.register .fgroup2{grid-template-columns:1fr}
/* Pagamentos: one card per payment */

View File

@@ -249,21 +249,31 @@
<table class="table"><thead><tr><th scope="col">Etapa</th><th scope="col" class="r">Média</th><th scope="col" class="r">p95</th><th scope="col" class="r">Amostras</th></tr></thead><tbody id="stats-speed"></tbody></table></section>
</section>
<section id="tab-site" class="page" hidden>
<div class="site-sub" id="site-sub"></div>
<div class="site-bar">
<div class="seg" id="site-tabs" role="tablist" aria-label="Partes do Site"></div>
<span class="site-note" id="site-note"></span>
</div>
<div class="site-pane" id="site-pane-products" role="tabpanel">
<section class="panel clip">
<div class="phead"><h2>Produtos</h2></div>
<p class="phint">O que o Site mostra e vende agora. Um produto desligado some do Site e o servidor recusa novos pedidos com ele.</p>
<div class="scrollx"><table class="table"><thead><tr><th scope="col">Produto</th><th scope="col">Situação</th><th scope="col">Preço atual</th></tr></thead><tbody id="site-products"></tbody></table></div>
<table class="dtable site-table site-products"><thead><tr><th scope="col">Produto</th><th scope="col">À venda</th><th scope="col" class="r">Preço atual</th><th scope="col">Faixas</th><th scope="col">Próxima mudança</th><th scope="col"><span class="vh">Ações</span></th></tr></thead><tbody id="site-products"></tbody></table>
</section>
<section class="panel clip">
<div class="phead"><h2>Preços</h2></div>
<p class="phint">Cada preço vale a partir da data escolhida. Um preço que já começou não muda mais: o histórico fica abaixo. Só um preço agendado pode ser cancelado.</p>
<div id="site-prices"></div>
</div>
<div class="site-pane" id="site-pane-coupons" role="tabpanel" hidden>
<div id="site-coupons"></div>
</div>
<div class="site-pane" id="site-pane-grade" role="tabpanel" hidden>
<section class="panel clip" id="site-grade-panel">
<div class="phead"><h2>Regras pela nota da arte</h2></div>
<p class="phint">A menor nota entre os itens do pedido decide. Desligada, a regra não muda nada.</p>
<div id="site-grade-body"></div>
</section>
<section class="panel clip" id="site-videos-panel" hidden>
<div class="phead"><h2>Vídeos do Site</h2></div>
<p class="phint">Envie o vídeo em MP4 ou WebM (até 500 MB). A legenda VTT é opcional. Escolha o produto para o vídeo flutuante e publique quando estiver pronto.</p>
<div id="site-videos-list" class="siteVideoList"></div>
</div>
<div class="site-pane" id="site-pane-videos" role="tabpanel" hidden>
<section class="panel clip" id="site-videos-panel">
<table class="dtable site-table"><thead><tr><th scope="col">Vídeo</th><th scope="col">Arquivo</th><th scope="col">Legenda</th><th scope="col">Onde aparece</th><th scope="col">Situação</th><th scope="col"><span class="vh">Ações</span></th></tr></thead><tbody id="site-videos-list"></tbody></table>
</section>
</div>
</section>
<section id="tab-users" class="page" hidden>
<section class="panel clip">