fix: align proof, treatment, metrics and site videos with PDF
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 5m44s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m22s
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 5m44s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m22s
This commit is contained in:
@@ -447,7 +447,7 @@
|
||||
}
|
||||
if (quote.status==='pending_review') {
|
||||
message((await ready).environment==='local'
|
||||
? 'Arquivos enviados. No Kanban, confira metragem e nota e aprove a cotação '+draftId.slice(0,8)+'.'
|
||||
? 'Arquivos enviados. No Kanban, confira a metragem e os arquivos e aprove a cotação '+draftId.slice(0,8)+'.'
|
||||
: 'Arquivos enviados. Nossa equipe está conferindo a cotação '+draftId.slice(0,8)+'; o valor final aparece aqui em seguida.');
|
||||
} else if (quote.status==='approved') {
|
||||
if ((await ready).payment_provider === 'mercadopago') {
|
||||
@@ -526,7 +526,7 @@
|
||||
titulo.insertAdjacentHTML('afterbegin', icone('okCirculo'));
|
||||
box.append(titulo,
|
||||
node('p','Recebemos seu pedido e ele já está na produção. Você acompanha cada etapa em Meus pedidos.'),
|
||||
node('p','O Prumo está preparando o arquivo de impressão. Em geral leva até 1 min por 10 m; o card aparece em Meus pedidos quando fica pronto.'));
|
||||
node('p','Seu pedido já aparece em Meus pedidos. O Prumo está preparando o arquivo de impressão; você pode acompanhar o andamento por lá.'));
|
||||
button('Ver meus pedidos',()=>location.assign('/conta/pedidos?order='+quote.order.id),box);
|
||||
actions.append(box);
|
||||
}
|
||||
|
||||
@@ -717,7 +717,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<span class="chip2">Franca · SP · envio em até 24 h</span>
|
||||
</div>
|
||||
<h1>A gente encaixa sua folha e você paga <em>menos metro</em></h1>
|
||||
<p>Mande a arte, veja a nota e a folha montada antes de pagar. Revisão de 5 pontos e reencaixe por nossa conta.</p>
|
||||
<p>Mande a arte, confira a folha montada e veja o preço antes de pagar. Revisão de 5 pontos e reencaixe por nossa conta.</p>
|
||||
<div class="hero2-cta">
|
||||
<a href="/#envio" class="btn-laranja">Enviar minha arte <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a>
|
||||
<span>Sem cadastro · preço em segundos</span>
|
||||
@@ -736,7 +736,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
</div>
|
||||
<div class="hf-num">
|
||||
<div><span>Metragem</span><b>0,60 m</b></div>
|
||||
<div><span>Nota da arte</span><b class="verde">92</b></div>
|
||||
<div><span>Conferência</span><b class="verde">Inclusa</b></div>
|
||||
<div><span>Preço do metro</span><b class="laranja" data-preco="file">R$ 19,90</b></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -745,7 +745,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
|
||||
<section class="etapas2"><div class="w">
|
||||
<div><span>1</span><div><b>Envie a arte</b><p>PNG ou PDF, conforme o produto. Sem cadastro.</p></div></div>
|
||||
<div><span>2</span><div><b>Veja nota e montagem</b><p>A folha e o preço aparecem na hora.</p></div></div>
|
||||
<div><span>2</span><div><b>Confira a montagem</b><p>A folha e o preço aparecem na hora.</p></div></div>
|
||||
<div><span>3</span><div><b>Pague na hora</b><p>Cartão de crédito ou PIX, na própria página.</p></div></div>
|
||||
<div><span>4</span><div><b>Acompanhe</b><p>Em Minha conta, com aviso no WhatsApp quando ficar pronto.</p></div></div>
|
||||
</div></section>
|
||||
@@ -776,7 +776,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<div class="cards-cab">
|
||||
<div><div class="et">Escolha o produto</div>
|
||||
<h2>Qual é o seu caso?</h2></div>
|
||||
<p>Preço único por produto. A nota da arte aparece na tela para você entender o seu arquivo; ela não muda o preço.</p>
|
||||
<p>Preço único por produto. Você confere a resolução e a montagem antes de pagar.</p>
|
||||
</div>
|
||||
<div class="escolha">
|
||||
<button class="ec f" data-modo="file">
|
||||
@@ -864,14 +864,13 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<details>
|
||||
<summary>Dicas para o seu arquivo</summary>
|
||||
<ul>
|
||||
<li class="s"><b>300 DPI no tamanho que vai imprimir.</b> É a nota máxima</li>
|
||||
<li class="s"><b>300 DPI no tamanho que vai imprimir.</b> É a resolução ideal</li>
|
||||
<li class="s"><b>O tamanho manda mais que o arquivo.</b> A mesma arte passa
|
||||
em 20 cm e não passa em 40. Reduzir um pouco costuma subir a nota</li>
|
||||
em 20 cm e não passa em 40. Reduzir um pouco costuma melhorar a resolução</li>
|
||||
<li class="s"><b>Larguras parecidas rendem mais.</b> Se as suas artes têm
|
||||
medidas próximas, cabem mais por fileira e a folha encolhe</li>
|
||||
</ul>
|
||||
<p class="obs2">A nota não muda o preço do metro: ela serve para você
|
||||
entender o seu arquivo.</p>
|
||||
<p class="obs2">A resolução não muda o preço do metro; ela mostra se o arquivo pode sair nítido.</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
@@ -893,8 +892,8 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<b>do arquivo</b>: se a arte foi ampliada antes de exportar, isso não aparece
|
||||
para nós — e sai serrilhado no filme do mesmo jeito</li>
|
||||
<li class="s"><b>PDF é o que conferimos melhor.</b> Nele medimos a resolução de
|
||||
cada imagem dentro da folha, uma por uma. Se a sua arte é boa, é onde a nota
|
||||
aparece com mais precisão</li>
|
||||
cada imagem dentro da folha, uma por uma. É onde a conferência
|
||||
de resolução fica mais precisa</li>
|
||||
<li class="a"><b>PDF grande.</b> Sem UserUnit, a página passa do limite de 508 cm
|
||||
do formato; divida a folha ou mande PNG. Envie um PDF de uma página por folha.</li>
|
||||
<li class="a"><b>TIFF, PSD, AI e CDR</b> a gente aceita, mas ninguém consegue
|
||||
@@ -1036,7 +1035,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<div class="cp"><label>WhatsApp <span class="obr" aria-hidden="true">*</span></label>
|
||||
<input id="fZap" aria-required="true" autocomplete="off" inputmode="numeric" maxlength="15" placeholder="(16) 99999-9999">
|
||||
<span class="err" id="eZap"></span></div>
|
||||
<div class="cp larga"><label>E-mail para a nota <span class="obr" aria-hidden="true">*</span></label>
|
||||
<div class="cp larga"><label>E-mail para o pedido <span class="obr" aria-hidden="true">*</span></label>
|
||||
<input id="fMail" aria-required="true" autocomplete="off" type="email" placeholder="voce@empresa.com.br">
|
||||
<span class="err" id="eMail"></span></div>
|
||||
</div>
|
||||
@@ -1093,7 +1092,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<h4>Prova antes de imprimir</h4>
|
||||
<label class="provaOp"><input type="checkbox" id="fProva">
|
||||
<span><b>Quero aprovar uma prova antes de imprimir</b>
|
||||
Imprimimos até 30 cm da sua folha e mandamos a foto pelo WhatsApp. O resto só é impresso
|
||||
Imprimimos até 15 cm por classe de contração e mandamos a foto pelo WhatsApp. O resto só é impresso
|
||||
depois do seu ok, então o pedido espera a sua resposta. Até 3 provas por pedido, sem custo.</span></label>
|
||||
</div>
|
||||
|
||||
@@ -1148,7 +1147,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
<div class="info2-preco">
|
||||
<div class="et">Preço</div>
|
||||
<h2>Preço único por produto</h2>
|
||||
<p>A nota da arte aparece na tela antes de você pagar, para você entender o seu arquivo. Ela não muda o preço. Preço do metro:</p>
|
||||
<p>O preço por metro depende do produto. Você confere a arte e a montagem antes de pagar:</p>
|
||||
<table>
|
||||
<thead><tr><th scope="col">Produto</th><th scope="col">Têxtil 57 cm</th><th scope="col">UV 27 cm</th></tr></thead>
|
||||
<tbody>
|
||||
|
||||
@@ -611,6 +611,15 @@ 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}
|
||||
.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}
|
||||
|
||||
@@ -141,9 +141,9 @@
|
||||
<table class="table"><tbody id="stats-rework-printers"></tbody></table>
|
||||
<h3>Aguardando autorização</h3><ul class="plainlist" id="stats-rework-pending"></ul></details></section>
|
||||
<section class="panel clip s6"><div class="phead"><h2>Tempo em cada etapa</h2><span class="hint tip-l" tabindex="0" data-tip="Tempo mediano por pedido: quem voltou para a etapa soma cada passagem. O tempo em Aguardando contato não conta."><svg class="i s" viewBox="0 0 20 20" aria-hidden="true"><path d="M2.75 10a7.25 7.25 0 1 0 14.5 0a7.25 7.25 0 1 0 -14.5 0 M10 9v4.5 M10 6.25v.75"></path></svg></span><button class="btn right" id="edit-stage-limits" type="button" hidden>Editar tempos</button></div>
|
||||
<table class="table"><thead><tr><th scope="col">Etapa</th><th scope="col" class="r">Mediana</th><th scope="col" class="r">Aceitável</th><th scope="col" class="r">Estouros</th><th scope="col">Agora</th></tr></thead><tbody id="stats-stages"></tbody></table></section>
|
||||
<table class="table"><thead><tr><th scope="col">Etapa</th><th scope="col" class="r">Média</th><th scope="col" class="r">Aceitável</th><th scope="col" class="r">Estouros</th><th scope="col">Agora</th></tr></thead><tbody id="stats-stages"></tbody></table></section>
|
||||
</div>
|
||||
<section class="panel clip"><div class="phead"><h2>Velocidade do site e do Prumo</h2><span class="hint tip-l" tabindex="0" data-tip="Média e p95 do que o cliente sente, por pedido pago no período: abrir a página, subir o arquivo (MB/s), a conferência do Prumo, a montagem das avulsas, a geração do arquivo final por 10 m e o tempo do evento de pagamento até o card. Referências: página < 3 s; conferência < 30 s; geração < 2 min por 10 m; card em até 1 min."><svg class="i s" viewBox="0 0 20 20" aria-hidden="true"><path d="M2.75 10a7.25 7.25 0 1 0 14.5 0a7.25 7.25 0 1 0 -14.5 0 M10 9v4.5 M10 6.25v.75"></path></svg></span></div>
|
||||
<section class="panel clip"><div class="phead"><h2>Velocidade do site e do Prumo</h2><span class="hint tip-l" tabindex="0" data-tip="Média e p95 do que o cliente sente, por pedido pago no período: abrir a página, subir o arquivo (segundos por MB), a conferência do Prumo, a montagem das avulsas, a geração do arquivo final por 10 m e o tempo do evento de pagamento até o card. Referências: página < 3 s; conferência < 30 s; geração < 2 min por 10 m; card em até 1 min."><svg class="i s" viewBox="0 0 20 20" aria-hidden="true"><path d="M2.75 10a7.25 7.25 0 1 0 14.5 0a7.25 7.25 0 1 0 -14.5 0 M10 9v4.5 M10 6.25v.75"></path></svg></span></div>
|
||||
<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-users" class="page" hidden>
|
||||
@@ -164,6 +164,11 @@
|
||||
</section>
|
||||
<section id="tab-integrations" class="page" hidden>
|
||||
<div class="panel" id="integrations"></div>
|
||||
<section class="panel clip" id="site-videos-panel" hidden>
|
||||
<div class="phead"><h2>Vídeos do Site</h2></div>
|
||||
<p class="phint">Envie MP4 ou WebM e legenda VTT. Escolha o produto para o vídeo flutuante e publique quando estiver pronto.</p>
|
||||
<div id="site-videos-list" class="siteVideoList"></div>
|
||||
</section>
|
||||
<section class="panel clip" id="event-log">
|
||||
<div class="phead"><h2>Envios ao Tiny</h2><div class="pfilters" id="event-filters"></div></div>
|
||||
<div class="scrollbox log"><table class="table"><thead><tr><th scope="col">Quando</th><th scope="col">Pedido</th><th scope="col">Evento</th><th scope="col">Resultado</th></tr></thead><tbody id="events"></tbody></table></div>
|
||||
|
||||
@@ -684,7 +684,7 @@ const contactWho=order=>(order.contact_by||'')+' em '+when(order.contact_since);
|
||||
// The print proof (app/proof.py): asked for at checkout, or an order above 10 m.
|
||||
// The room marks "Prova OK" once it is checked; without it, no Finalizado.
|
||||
const PROOF_ABOVE_METRES=10;
|
||||
const PROOF_RULE='Até 30 cm, do trecho de traço mais fino, um pedaço de cada arte diferente; no máximo 3 provas por pedido, sem cobrança.';
|
||||
const PROOF_RULE='Até 15 cm por classe, do trecho de traço mais fino; no máximo 3 provas por pedido, sem cobrança.';
|
||||
const needsProof=order=>!!order.snapshot.proof||order.snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0)>PROOF_ABOVE_METRES;
|
||||
const proofPending=order=>needsProof(order)&&!order.proof_ok_at&&order.state!=='fin'&&!order.cancelled_at&&!order.proof_parent;
|
||||
// The proof card (app/proof.py): the order's own card waits outside the queue
|
||||
@@ -1549,6 +1549,12 @@ function contractionList(order){
|
||||
return box;
|
||||
}
|
||||
function approveParts(order,main=true){
|
||||
if(order.snapshot.treatment){
|
||||
const approve=button('Enviar arte tratada',()=>treatDialog(order),'btn lg'+(main?' pri':''));
|
||||
approve.dataset.treat='';
|
||||
return {text:'Tratamento pago: o designer precisa enviar o PNG tratado de cada item antes da fila.',
|
||||
files:null,approve,extra:[]};
|
||||
}
|
||||
const ready=readyFinals(order), all=ready.every(Boolean), many=ready.length>1;
|
||||
const files=node('div',undefined,'files');
|
||||
if(all)ready.forEach((r,i)=>r.files.forEach((f,k)=>files.append(fileRow(f.name,(many?'Item '+(i+1)+', ':'')+FINAL_TITLE[r.source]+
|
||||
@@ -1576,7 +1582,10 @@ function nextBox(order){
|
||||
const moveBtn=(to,label,className='btn pri lg')=>{const b=button(label||'Mover para '+board.states[to],()=>move(order,to),className);b.dataset.move=to;return b;};
|
||||
if(waitingProof(order)){
|
||||
title='Aguardando prova do #'+order.proof_card.number;
|
||||
note('O pedido segue para Arte conferida após Prova OK no card da prova. Você pode abrir o arquivo para consultar.');
|
||||
const manual=(board.orders.find(o=>o.id===order.proof_card.id)?.print_files||[]).some(r=>r.status==='manual');
|
||||
note(manual?'O Prumo não abriu o original. Prepare o PNG completo deste pedido; a prova será gerada automaticamente a partir dele.'
|
||||
:'O pedido segue para Arte conferida após Prova OK no card da prova. Você pode abrir o arquivo para consultar.');
|
||||
if(manual&&may('produce'))main.push(button('Preparar arquivo para a prova',()=>finalDialog(order,readyFinals(order)),'btn pri lg'));
|
||||
return composeNext(title,body,main,more);
|
||||
}
|
||||
// A proof card in Revisão waits for its answer (Dropstar, 2026-11-03).
|
||||
@@ -1614,13 +1623,23 @@ function nextBox(order){
|
||||
}
|
||||
if(st==='rec'&&order.proof_parent){
|
||||
title=finalDone(order)?'Conferir a prova':'Gerando a prova';
|
||||
note(finalDone(order)?'Abra o PNG gerado pelo Prumo e confirme a contração.':'O Prumo prepara até 15 cm por classe e aprova o PNG final automaticamente.');
|
||||
const manual=(order.print_files||[]).some(r=>r.status==='manual');
|
||||
note(finalDone(order)?'Abra o PNG gerado pelo Prumo e confirme a contração.':manual
|
||||
?'O original exige preparo manual. Abra o pedido pai, envie o PNG completo e depois gere a prova de novo.'
|
||||
:'O Prumo prepara até 15 cm por classe e aprova o PNG final automaticamente.');
|
||||
if(manual&&may('produce'))more.push(button('Abrir pedido pai',()=>openPanel(order.proof_parent.id),'btn lg'));
|
||||
if(finalDone(order)&&may('produce'))main.push(checkButton(order,'btn pri lg'));
|
||||
if((order.print_files||[]).some(r=>r.status==='failed'||r.status==='manual'||r.timed_out)&&may('produce'))
|
||||
more.push(button('Gerar de novo',async()=>{await api('/orders/'+order.id+'/print-files',{});await load();},'btn lg'));
|
||||
return composeNext(title,body,main,more);
|
||||
}
|
||||
if(st==='rec'||st==='cor'){
|
||||
if(st==='rec'&&order.snapshot.treatment&&!treatmentDone(order)&&finalDone(order)){
|
||||
title='Enviar a arte tratada';
|
||||
note('O tratamento foi pago. Envie o PNG tratado de cada item antes de colocar o pedido na fila.');
|
||||
if(may('produce'))main.push(button('Tratar a arte',()=>treatDialog(order),'btn pri lg'));
|
||||
return composeNext(title,body,main,more);
|
||||
}
|
||||
if(!finalDone(order)&&trans.includes('tra')){
|
||||
if(st==='rec')title='Aprovar o arquivo final';
|
||||
// The designer approves every file (D-16); the others see it waiting.
|
||||
@@ -1750,6 +1769,7 @@ function pickupDialog(order){
|
||||
const isPickup=order=>order.snapshot.freight?.service==='pickup';
|
||||
// ---- Final files: the file each item is printed from, approved by an operator.
|
||||
const finalDone=order=>order.snapshot.items.every((_,index)=>(order.final_items||[]).includes(index));
|
||||
const treatmentDone=order=>order.snapshot.items.every((_,index)=>order.treated?.items?.includes(index));
|
||||
const FINAL_SOURCE={correction:'correção do cliente',generated:'arquivo gerado',original:'original'};
|
||||
const FINAL_TITLE={correction:'Correção do cliente',generated:'Gerado pelo sistema',original:'Original do cliente'};
|
||||
// What the system generated for an item: one PNG, or the parts of a film
|
||||
@@ -1917,11 +1937,13 @@ function treatDialog(order){
|
||||
const file=row.input.files[0];
|
||||
if(file)return {file};
|
||||
const kept=(order.finals||[]).filter(f=>f.item_index===index).map(f=>f.upload_id);
|
||||
return {ids:kept.length?kept:ready[index]?[ready[index].upload_id]:[]};
|
||||
const treated=order.treated?.items?.includes(index);
|
||||
return {ids:order.snapshot.treatment&&!treated?[]:
|
||||
kept.length?kept:ready[index]?ready[index].files.map(f=>f.upload_id):[]};
|
||||
});
|
||||
if(!plan.some(p=>p.file))throw new Error('Escolha o arquivo tratado.');
|
||||
const empty=plan.findIndex(p=>!p.file&&!p.ids.length);
|
||||
if(empty>=0)throw new Error('O item '+(empty+1)+' ainda não tem arquivo: suba a arte tratada dele também.');
|
||||
if(empty>=0)throw new Error('O item '+(empty+1)+' ainda não tem arte tratada: envie o PNG dele também.');
|
||||
const refs=[];
|
||||
for(const [index,p] of plan.entries()){
|
||||
if(!p.file){refs.push(...p.ids.map(upload_id=>({item_index:index,upload_id})));continue;}
|
||||
@@ -2621,15 +2643,15 @@ async function loadStats(){
|
||||
// Orders; when some came back to the stage, how many times it was entered.
|
||||
const passed=st?plural(st.orders,'pedido','pedidos')+(st.passages>st.orders?', '+st.passages+' passagens':''):'nenhum';
|
||||
name.append(node('span',passed,'sub'));
|
||||
tr.append(name,node('td',st?duration(st.median_hours):'—','r strong'),
|
||||
tr.append(name,node('td',st?duration(st.average_hours):'—','r strong'),
|
||||
node('td',limit?duration(limit.hours):'—','r'),
|
||||
node('td',late.count?String(late.count)+(late.today?' · '+late.today+' hoje':''):'—','r'),
|
||||
node('td',now?plural(now.orders,'pedido','pedidos')+', o mais antigo há '+duration(now.oldest_hours):'nenhum','muted'));
|
||||
return tr;}));
|
||||
// Speed (item 0.12): average and p95 of what the customer feels.
|
||||
const secs=v=>v==null?'—':v<60?Math.max(1,Math.round(v))+' s':Math.round(v/60)+' min';
|
||||
const speedFmt=s=>s.unit==='MB/s'
|
||||
? (v=>v==null?'—':v.toFixed(1).replace('.',',')+' MB/s')
|
||||
const speedFmt=s=>s.unit==='s/MB'
|
||||
? (v=>v==null?'—':v.toFixed(1).replace('.',',')+' s/MB')
|
||||
: (v=>s.unit==='s'?secs(v):String(v));
|
||||
$('stats-speed').replaceChildren(...(data.speed||[]).map(s=>{
|
||||
const tr=node('tr'),fmt=speedFmt(s);
|
||||
@@ -3208,7 +3230,53 @@ function renderEvents(){
|
||||
|
||||
// Integrações: the print room's folder for whoever produces, what is on and off
|
||||
// for the managers, and the buttons, details and the Tiny log for the superadmin.
|
||||
const eventsIfAllowed=async()=>{if(may('integrations'))await loadEvents();};
|
||||
const eventsIfAllowed=async()=>{if(may('integrations'))await loadEvents();if(may('manage'))await loadSiteVideos();};
|
||||
|
||||
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':'')));
|
||||
const videoInput=node('input');videoInput.type='file';videoInput.accept='.mp4,.webm,video/mp4,video/webm';
|
||||
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 · '+(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);
|
||||
}
|
||||
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{
|
||||
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});
|
||||
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;
|
||||
}));
|
||||
}
|
||||
// A row with only its name, state and summary, for whoever may not change it.
|
||||
const integRow=o=>may('integrations')?integration(o):integration({name:o.name,state:o.state,tone:o.tone,summary:o.summary});
|
||||
let mpCheck=null;
|
||||
|
||||
@@ -147,7 +147,7 @@ function carrinho(){
|
||||
// The residue dots the customer accepted printing (Dropstar, 2026-10-29).
|
||||
residueAccepted:residuosAceitos(),
|
||||
// The thinnest stroke and its contraction class (item 9), for the room.
|
||||
...tracoDoItem(),
|
||||
...tracoDoItem(null,layout),
|
||||
desc:(partes?partes.length+' folhas · ':'')+fmtM(cob)+' m · '+rs(unit)+'/m'};
|
||||
pintaPedido();
|
||||
previa();
|
||||
|
||||
@@ -555,8 +555,8 @@ function pintaFolha(){
|
||||
'<span class="progT">'+textoProgresso(x)+'</span>'
|
||||
: x.semAnalise
|
||||
? '<div class="progF"><b>Não conseguimos conferir esta folha.</b> '+escapeHTML(x.semAnalise)+
|
||||
'. Seguimos sem a nota, e a conferência é feita na mão. Se quiser a nota, exporte a mesma '+
|
||||
'folha em <b>PNG</b>, que a conferência é bem mais leve.</div>'
|
||||
'. A conferência será feita na sala. Para conferir a resolução aqui, exporte a mesma '+
|
||||
'folha em <b>PNG</b>.</div>'
|
||||
: '';
|
||||
// A small thumbnail made once: the list is rebuilt on every change, and the
|
||||
// full preview of a file up to 150 MB would be re-parsed each time.
|
||||
|
||||
@@ -66,7 +66,7 @@ function tracoDoItem(lista,layout){
|
||||
const avisado=arquivos.some(x=>x.mistaVista && mista(lista?tracoDaArte(x):tracoDoArquivo(x)));
|
||||
return {strokePx:fino.traco.px, strokeClass:fino.traco.classe, strokeChoice:avisado?'measured':null,
|
||||
proofSourceIndex:fino.index,
|
||||
proofYFraction:fracaoNoFilme(lista?layout:montagemLayout,fino.index,fino.traco.proofYFraction||0)};
|
||||
proofYFraction:fracaoNoFilme(layout||montagemLayout,fino.index,fino.traco.proofYFraction||0)};
|
||||
}
|
||||
// Fecha a medida da conferência quando não há mais arquivo sendo lido (0.12).
|
||||
function marcaTempos(){
|
||||
@@ -109,7 +109,7 @@ function avaliar(){
|
||||
const ausentes=folhas.filter(f=>!f.an);
|
||||
const exts=[...new Set(ausentes.map(f=>extDe(f.f.name)))].join(', ');
|
||||
mostraNota([
|
||||
['av','Sem nota · '+exts+' sem análise completa',
|
||||
['av','Conferência manual · '+exts+' sem análise completa',
|
||||
ausentes.length+' de '+folhas.length+' folha(s) precisam de conferência manual'],
|
||||
['fix','Alguém abre seu arquivo','a conferência é feita na mão, na sala']
|
||||
], 0, folhas.length>1? folhas.length+' folhas' : folhas[0].f.name,
|
||||
@@ -154,7 +154,7 @@ function avaliar(){
|
||||
n1(larguraFilme())+' cm. Reduza a medida solicitada antes de continuar.'};
|
||||
const sem=artes.filter(a=>!a.cm).length;
|
||||
if(sem) return {pronto:false, falta:'Informe a largura de '+sem+' arte'+(sem>1?'s':'')+
|
||||
' para ver a nota e o preço.'};
|
||||
' para ver a conferência e o preço.'};
|
||||
// Item 4: a dot under 2 mm in a loose artwork holds the order like on a
|
||||
// sheet, until the customer erases it or accepts printing that artwork so.
|
||||
const lendoArte=artes.find(a=>a.lendoArte);
|
||||
@@ -171,7 +171,7 @@ function avaliar(){
|
||||
const media=Math.round(notas.reduce((s,n)=>s+n,0)/notas.length), pior=Math.min(...notas);
|
||||
mostraNota([
|
||||
['ok','Montagem por nossa conta','5 mm garantidos'],
|
||||
[cls(pior),'Pior arte em '+pior+'%',pior>=85?'todas em boa resolução':'há arte abaixo da resolução ideal']
|
||||
[cls(pior),'Resolução das artes',pior>=85?'todas em boa resolução':'há arte abaixo da resolução ideal']
|
||||
],media,artes.length+' arte'+(artes.length>1?'s':''),
|
||||
'folha montada por nós · '+fmtM(metros)+' m');
|
||||
return {pronto:true};
|
||||
@@ -189,7 +189,7 @@ function agendaAvaliacao(){
|
||||
if(!el) return;
|
||||
if(r.pronto){
|
||||
el.className='aoVivo pronto';
|
||||
el.innerHTML='<span class="pt2"></span><span><b>Nota e preço calculados.</b> '+
|
||||
el.innerHTML='<span class="pt2"></span><span><b>Conferência e preço calculados.</b> '+
|
||||
'Confira abaixo e feche o pedido.</span>';
|
||||
}else{
|
||||
el.className='aoVivo';
|
||||
|
||||
@@ -71,16 +71,18 @@ section+section{border-top:0}
|
||||
.videoCard span{font-size:14.5px;line-height:1.4;color:var(--fraco)}
|
||||
.videoCard em{margin-top:auto;font-style:normal;font-size:12.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--laranja-escuro)}
|
||||
.videoCard[data-soon="1"]{cursor:default;opacity:.72}
|
||||
.videoFloat{position:fixed;right:22px;bottom:22px;z-index:70;width:min(280px,calc(100vw - 32px));border-radius:14px;overflow:hidden;background:var(--preto);box-shadow:0 14px 40px rgba(3,6,11,.35)}
|
||||
.videoCard[data-soon="1"]:hover{border-color:var(--linha)}
|
||||
.videoFloat{position:fixed;right:max(22px,env(safe-area-inset-right));bottom:max(22px,env(safe-area-inset-bottom));z-index:70;width:min(280px,calc(100vw - 32px));border-radius:14px;overflow:hidden;background:var(--preto);box-shadow:0 14px 40px rgba(3,6,11,.35)}
|
||||
.videoFloat video{display:block;width:100%;height:auto;aspect-ratio:16/9;background:#000}
|
||||
.videoFloat .vfClose{position:absolute;top:8px;right:8px;width:30px;height:30px;border:0;border-radius:999px;background:rgba(0,0,0,.62);color:#fff;font-size:18px;line-height:1;cursor:pointer}
|
||||
.videoFloat .vfClose{position:absolute;top:8px;right:8px;width:44px;height:44px;border:0;border-radius:999px;background:rgba(0,0,0,.62);color:#fff;font-size:20px;line-height:1;cursor:pointer}
|
||||
.videoFloat .vfLabel{padding:8px 12px;color:#fff;font-size:13px;line-height:1.3}
|
||||
.videoFloat .vfLabel b{display:block;font-family:"Inter",sans-serif;font-size:14px}
|
||||
.videoModal{position:fixed;inset:0;z-index:120;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(3,6,11,.78)}
|
||||
.videoAberto{overflow:hidden}
|
||||
.videoModal{position:fixed;inset:0;z-index:120;display:flex;align-items:center;justify-content:center;padding:max(24px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));background:rgba(3,6,11,.78)}
|
||||
.videoModal[hidden]{display:none}
|
||||
.videoModal .vmBox{position:relative;width:min(920px,100%);border-radius:16px;overflow:hidden;background:#000}
|
||||
.videoModal video{display:block;width:100%;height:auto;max-height:82vh;background:#000}
|
||||
.videoModal .vmClose{position:absolute;top:10px;right:10px;width:34px;height:34px;border:0;border-radius:999px;background:rgba(0,0,0,.65);color:#fff;font-size:20px;cursor:pointer}
|
||||
.videoModal .vmClose{position:absolute;top:10px;right:10px;width:44px;height:44px;border:0;border-radius:999px;background:rgba(0,0,0,.65);color:#fff;font-size:22px;cursor:pointer}
|
||||
@media(max-width:900px){.videosGrid{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
||||
@media(max-width:620px){.videosGrid{grid-template-columns:1fr}.videos2{padding:36px 0}}
|
||||
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
/* Site DTF — vídeos da categoria DTF e o vídeo flutuante por produto (frente 4).
|
||||
|
||||
O espaço e o player ficam prontos agora; os seis arquivos entram quando a
|
||||
Dropstar gravar. Para publicar um vídeo, coloque o MP4/WebM em web/videos/
|
||||
e preencha `src` (e, se houver, `captions`) abaixo. `product` liga o vídeo
|
||||
ao modo do produto: file, avulsa, uvfile ou uv. */
|
||||
/* Site DTF — the public catalog is filled by videos published in Gestão. */
|
||||
const VIDEOS = [
|
||||
{id: 'subindo', title: 'Subindo a arte pelo celular',
|
||||
desc: 'Do primeiro toque ao preço, sem instalar nada.', product: null,
|
||||
@@ -32,6 +27,7 @@ function videoElement(video, {controls = false} = {}) {
|
||||
el.playsInline = true;
|
||||
el.preload = 'metadata';
|
||||
if (controls) el.controls = true;
|
||||
if (controls) el.tabIndex = 0;
|
||||
if (video.captions) {
|
||||
const track = document.createElement('track');
|
||||
track.kind = 'captions';
|
||||
@@ -44,54 +40,68 @@ function videoElement(video, {controls = false} = {}) {
|
||||
return el;
|
||||
}
|
||||
|
||||
// The category strip: six cards. A card without a file says it is being made
|
||||
// instead of opening a broken player.
|
||||
(function videosSection() {
|
||||
// The category shows only videos with a published file.
|
||||
function videosSection() {
|
||||
const grid = document.getElementById('videosGrid');
|
||||
if (!grid) return;
|
||||
for (const video of VIDEOS) {
|
||||
const published=VIDEOS.filter(video=>video.src);
|
||||
document.getElementById('videos').hidden=!published.length;
|
||||
grid.replaceChildren();
|
||||
for (const video of published) {
|
||||
const card = document.createElement('button');
|
||||
card.type = 'button';
|
||||
card.className = 'videoCard';
|
||||
card.dataset.video = video.id;
|
||||
if (!video.src) card.dataset.soon = '1';
|
||||
const play = document.createElement('span');
|
||||
play.className = 'vcPlay';
|
||||
play.textContent = video.src ? '▶' : '…';
|
||||
play.textContent = '▶';
|
||||
const title = document.createElement('b');
|
||||
title.textContent = video.title;
|
||||
const desc = document.createElement('span');
|
||||
desc.textContent = video.desc;
|
||||
const note = document.createElement('em');
|
||||
note.textContent = video.src ? 'Assistir · 30 s' : 'Em produção';
|
||||
note.textContent = 'Assistir · 30 s';
|
||||
card.append(play, title, desc, note);
|
||||
if (!video.src) {
|
||||
card.setAttribute('aria-disabled', 'true');
|
||||
} else {
|
||||
card.addEventListener('click', () => openVideo(video));
|
||||
}
|
||||
card.addEventListener('click', () => openVideo(video, card));
|
||||
grid.append(card);
|
||||
}
|
||||
})();
|
||||
}
|
||||
videosSection();
|
||||
|
||||
// The category player, opened from a card.
|
||||
let videoModal = null;
|
||||
function openVideo(video) {
|
||||
let videoReturnFocus = null;
|
||||
function openVideo(video, trigger=document.activeElement) {
|
||||
videoReturnFocus = trigger;
|
||||
if (!videoModal) {
|
||||
videoModal = document.createElement('div');
|
||||
videoModal.className = 'videoModal';
|
||||
videoModal.setAttribute('role', 'dialog');
|
||||
videoModal.setAttribute('aria-modal', 'true');
|
||||
videoModal.setAttribute('aria-label', 'Vídeo: '+video.title);
|
||||
videoModal.hidden = true;
|
||||
videoModal.innerHTML = '<div class="vmBox"><button type="button" class="vmClose" aria-label="Fechar vídeo">×</button></div>';
|
||||
videoModal.addEventListener('click', event => {
|
||||
if (event.target === videoModal || event.target.closest('.vmClose')) closeVideo();
|
||||
});
|
||||
videoModal.addEventListener('keydown', event => {
|
||||
if (event.key === 'Escape') { event.preventDefault(); closeVideo(); return; }
|
||||
if (event.key !== 'Tab') return;
|
||||
const focusable = [...videoModal.querySelectorAll('button,video[controls]')];
|
||||
const first=focusable[0], last=focusable[focusable.length-1];
|
||||
if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
|
||||
else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); }
|
||||
});
|
||||
document.body.append(videoModal);
|
||||
}
|
||||
const box = videoModal.querySelector('.vmBox');
|
||||
box.querySelectorAll('video').forEach(el => el.remove());
|
||||
const player = videoElement(video, {controls: true});
|
||||
player.addEventListener('timeupdate', () => { if (player.currentTime >= 30) player.pause(); });
|
||||
box.append(player);
|
||||
videoModal.hidden = false;
|
||||
videoModal.setAttribute('aria-label', 'Vídeo: '+video.title);
|
||||
videoModal.querySelector('.vmClose').focus();
|
||||
player.play().catch(() => {});
|
||||
document.documentElement.classList.add('videoAberto');
|
||||
}
|
||||
@@ -100,6 +110,8 @@ function closeVideo() {
|
||||
videoModal.querySelectorAll('video').forEach(el => { el.pause(); el.removeAttribute('src'); el.load(); });
|
||||
videoModal.hidden = true;
|
||||
document.documentElement.classList.remove('videoAberto');
|
||||
videoReturnFocus?.focus();
|
||||
videoReturnFocus = null;
|
||||
}
|
||||
|
||||
// A floating, muted 30 s video on each product page. It only appears when the
|
||||
@@ -136,7 +148,7 @@ function syncFloatingVideo() {
|
||||
const title = document.createElement('b');
|
||||
title.textContent = video.title;
|
||||
const desc = document.createElement('span');
|
||||
desc.textContent = 'Mudo · com legenda · 30 s';
|
||||
desc.textContent = video.captions ? 'Mudo · com legenda · 30 s' : 'Mudo · 30 s';
|
||||
label.append(title, desc);
|
||||
floating.append(player, close, label);
|
||||
document.body.append(floating);
|
||||
@@ -145,3 +157,11 @@ function syncFloatingVideo() {
|
||||
|
||||
addEventListener('dtf-page-changed', syncFloatingVideo);
|
||||
syncFloatingVideo();
|
||||
window.siteVideosReady=fetch('/api/site/videos').then(response=>response.ok?response.json():null).then(data=>{
|
||||
for(const published of data?.videos||[]){
|
||||
const video=VIDEOS.find(item=>item.id===published.id);
|
||||
if(video){video.src=published.src;video.captions=published.captions;video.product=published.product;}
|
||||
}
|
||||
videosSection();
|
||||
syncFloatingVideo();
|
||||
}).catch(()=>{});
|
||||
|
||||
Reference in New Issue
Block a user