feat: above 10 m the payment asks for the proof in a pop-up, not mandatory (Marcus, 2026-12-02)
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 8m36s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m6s

The proof checkbox in the cart becomes a pop-up when the customer presses
pay on an order above 10 m: "Quero aprovar uma prova" sends proof=true,
"Seguir sem prova", Escape or closing goes on without one. Same text as the
old box. Below 10 m nothing is asked. A cart already sent goes straight to
its payment without asking again. The dialog sits outside the panels so it
shows wherever pay is pressed. The automatic proof above 10 m is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 10:43:17 -03:00
parent 41126a42fd
commit 1633b995eb
6 changed files with 56 additions and 22 deletions

View File

@@ -526,6 +526,8 @@
const totalArquivos=item=>(item.localFiles||[]).length+(item.savedFiles||[]).length;
if (semCap.some(item=>totalArquivos(item)>200))
return message('Este item tem mais de 200 arquivos. Divida em dois itens.','error');
// Above 10 m the pop-up asks for the proof; the answer is part of the order.
if ((await perguntaProva())===null || busy) return;
const initialCart=cartSnapshot();
busy = true;
$('bPagar').disabled = true;
@@ -576,8 +578,8 @@
...(cupom?{coupon:cupom}:{})};
const destination = destinoApi();
if (destination) content.destination = destination;
// "Quero aprovar uma prova antes de imprimir": the order waits for the customer.
if ($('fProva')?.checked) content.proof = true;
// "Quero aprovar uma prova", chosen in the pop-up: the order waits for the customer.
if (querProva) content.proof = true;
// Ajuste Fino: true for every art, or the [item, source] pairs chosen.
const treatment=tratamentoParaItens(sheets);
if (treatment) content.treatment = treatment;

View File

@@ -1126,15 +1126,6 @@ h2 em{font-style:normal;color:var(--laranja)}
</div>
</div>
<div class="cxE">
<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 uma prova de até 30 cm e mandamos a foto pelo WhatsApp. O resto sai depois
que você aprovar. Até 3 provas por pedido, sem custo.</span></label>
<p class="provaMin" id="provaMin" hidden>A prova é para pedidos acima de 10 m.</p>
</div>
<div class="cxE" id="tratamentoBox" hidden>
<h4>Ajuste Fino</h4>
<label class="provaOp"><input type="checkbox" id="fTratamento">
@@ -1242,6 +1233,15 @@ h2 em{font-style:normal;color:var(--laranja)}
</div>
</div></footer>
<!-- A prova no pagamento (Marcus, 2026-12-02): fora dos painéis, que se escondem. -->
<dialog class="ampliaDlg mistaDlg" id="provaDlg" aria-labelledby="provaTit">
<div class="ampliaCab"><b id="provaTit">Prova antes de imprimir</b></div>
<div class="mistaCorpo">
<p>Imprimimos uma prova de até 30 cm e mandamos a foto pelo WhatsApp. O resto sai depois
que você aprovar. Até 3 provas por pedido, sem custo.</p>
<div class="mistaBot"><button type="button" class="ec-go" id="provaSim">Quero aprovar uma prova</button><button type="button" id="provaNao">Seguir sem prova</button></div>
</div>
</dialog>
<!-- The Site's behaviour, split by responsibility. Classic scripts on purpose:
they share one global scope and run in this order, which is exactly how the
single inline script this replaces behaved. Order is therefore significant. -->

View File

@@ -224,6 +224,26 @@ function folhasEstreitas(it){
'Folha de '+n1(Number(s.width_cm))+' cm no tamanho real, centralizada no filme de '+
String(filme).replace('.',',')+' cm');
}
// A prova é para pedidos acima de 10 m (Dropstar, 2026-10-28; o
// PROOF_ABOVE_METRES do servidor) e não é obrigatória: no pagamento um pop-up
// pergunta (Marcus, 2026-12-02). Fechar sem escolher é seguir sem prova.
let querProva=false;
function pedidoLongo(aPagar=itensAPagar()){
return aPagar.reduce((t,it)=>t+(it.cob||0),0)>10;
}
// Resolve com a escolha; null quando o pop-up já está aberto (clique repetido).
function perguntaProva(){
const dlg=$('provaDlg');
if(dlg?.open) return Promise.resolve(null);
querProva=false;
if(!dlg || !pedidoLongo()){ pintaPedido(); return Promise.resolve(false); }
return new Promise(resolve=>{
dlg.returnValue='';
dlg.onclose=()=>{ dlg.onclose=null; querProva=dlg.returnValue==='sim'; pintaPedido(); resolve(querProva); };
dlg.showModal();
$('provaSim').focus();
});
}
// O carrinho junta itens de produtos diferentes e cobra uma vez só.
function pintaPedido(){
const aPagar = itensAPagar();
@@ -309,7 +329,7 @@ function pintaPedido(){
' · +24 h</span><b>'+rs(tratamento)+'</b></div>':'')+
(redesenho?'<div class="l"><span>Ajuste Fino Redesenho · '+artesRedesenho+
(artesRedesenho===1?' arte':' artes')+' · +48 h</span><b>'+rs(redesenho)+'</b></div>':'')+
($('fProva')?.checked?'<div class="l"><span>Prova antes de imprimir</span>'+
(querProva && pedidoLongo(aPagar)?'<div class="l"><span>Prova antes de imprimir</span>'+
'<b><span style="color:var(--verde-ml)">Grátis</span></b></div>':'')+
'<div class="l"><span>Revisão e reencaixe</span>'+
'<b><span style="color:var(--verde-ml)">Grátis</span></b></div>';
@@ -322,12 +342,6 @@ function pintaPedido(){
: n>1
? 'Pagar os '+n+' itens de uma vez'
: 'Ir para o pagamento';
// The proof is only for orders above 10 m (Dropstar, 2026-10-28; the server's
// PROOF_ABOVE_METRES). Below it the box stays, closed, and says the rule
// (Rodada 5, B3).
const prova=$('fProva');
if(prova){ const longo=aPagar.reduce((t,it)=>t+(it.cob||0),0)>10;
prova.disabled=!longo; if(!longo) prova.checked=false; $('provaMin').hidden=longo; }
$('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk() || falta>0;
if(pedido.length || itemAtual) $('carr').classList.add('on');
if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;
@@ -432,7 +446,8 @@ function avisaDesfazer(texto,acao){
function fechaDesfazer(){ clearTimeout(desfazerTimer); desfazerAcao=null; $('desfazer').hidden=true; }
addEventListener('dtf-page-changed',fechaDesfazer);
$('desfazerBtn').addEventListener('click',()=>{ const acao=desfazerAcao; fechaDesfazer(); if(acao) acao(); });
$('fProva')?.addEventListener('change',()=>pintaPedido());
$('provaSim')?.addEventListener('click',()=>$('provaDlg').close('sim'));
$('provaNao')?.addEventListener('click',()=>$('provaDlg').close('nao'));
$('fTratamento')?.addEventListener('change',()=>{
if($('fTratamento').checked){ ajusteTudo=true; limpaRedesenho(); }
else limpaAjuste();

View File

@@ -32,7 +32,7 @@ const TEXTO_MISTA={
// avulsa: imprimir assim mesmo (C1), ou trocar o arquivo por dois.
function perguntaMista(){
const dlg=$('mistaDlg');
if(!dlg || dlg.open || $('larguraDlg')?.open || $('tamanhoDlg')?.open) return;
if(!dlg || dlg.open || $('larguraDlg')?.open || $('tamanhoDlg')?.open || $('provaDlg')?.open) return;
const lista=ehFolha()?folhas:artes;
const x=lista.find(y=>!y.mistaVista && mista(tracoDoArquivo(y)));
if(!x) return;

View File

@@ -372,7 +372,6 @@ section+section{border-top:0}
.provaOp input{margin-top:3px;width:17px;height:17px;flex:none;accent-color:var(--laranja)}
.provaOp b{display:block;color:var(--preto);font-weight:700}
.provaOp:has(input:disabled){cursor:default;opacity:.55}
.provaMin{margin:8px 0 0 27px;font-size:14px;color:var(--fraco)}
.cp input,.cepL input{height:46px;border-radius:var(--raio2)}
.cp input:focus,.cepL input:focus{border-color:var(--laranja2);box-shadow:0 0 0 3px rgba(255,168,26,.18)}
.opE{border-radius:12px}