diff --git a/tests/artwork_browser_test.mjs b/tests/artwork_browser_test.mjs index 4149a72..a204844 100644 --- a/tests/artwork_browser_test.mjs +++ b/tests/artwork_browser_test.mjs @@ -615,6 +615,24 @@ try{ }finally{carregarPdfJs=realLoader;window.setTimeout=realTimer;temWorker=realWorker;} })()`); assert.deepEqual(timeoutCleanup,{timedOut:true,destroyed:true}); + // Proof pop-up (Marcus, 2026-12-02): only above 10 m, not mandatory; closing + // it is going on without a proof, and the cart summary follows the answer. + assert.deepEqual(await evaluate(`[pedidoLongo([{cob:10}]),pedidoLongo([{cob:6},{cob:4.5}])]`),[false,true]); + assert.equal(await evaluate(`perguntaProva()`),false); + assert.equal(await evaluate(`$('provaDlg').open`),false); + await evaluate(`window.provaLongo=pedidoLongo; pedidoLongo=()=>true; window.provaResp=perguntaProva(); 1`); + await waitFor(()=>evaluate(`$('provaDlg').open && document.activeElement.id==='provaSim'`),'proof pop-up opens'); + assert.equal(await evaluate(`perguntaProva()`),null); + await click('#provaSim'); + assert.equal(await evaluate(`window.provaResp`),true); + assert.equal(await evaluate(`querProva && $('resLin').textContent.includes('Prova antes de imprimir')`),true); + await evaluate(`window.provaResp=perguntaProva(); 1`); + await click('#provaNao'); + assert.equal(await evaluate(`window.provaResp`),false); + assert.equal(await evaluate(`$('resLin').textContent.includes('Prova antes de imprimir')`),false); + await evaluate(`window.provaResp=perguntaProva(); $('provaDlg').close(); 1`); + assert.equal(await evaluate(`window.provaResp`),false); + await evaluate(`pedidoLongo=window.provaLongo; 1`); // Inspect the supplied local artwork, when requested, using the real file input. if(process.env.ARTWORK_FILE){ await click('#bVoltar');await click('[data-modo="file"]'); @@ -629,6 +647,6 @@ try{ console.log('Supplied image:',JSON.stringify(layout)); } assert.deepEqual(errors,[]); - console.log('PASS: PNG upload and drop, JPG refused, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, stale renders, strict inline CSP.'); + console.log('PASS: PNG upload and drop, JPG refused, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, proof pop-up above 10 m, stale renders, strict inline CSP.'); }catch(error){console.error(error);if(stderr)console.error(stderr.slice(-1200));process.exitCode=1;} finally{ws?.close();chrome.kill();server.closeAllConnections();await new Promise(r=>server.close(r));} diff --git a/web/checkout.js b/web/checkout.js index 520225d..28b25a5 100644 --- a/web/checkout.js +++ b/web/checkout.js @@ -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; diff --git a/web/index.html b/web/index.html index 948a257..46e022b 100644 --- a/web/index.html +++ b/web/index.html @@ -1126,15 +1126,6 @@ h2 em{font-style:normal;color:var(--laranja)} -
-

Prova antes de imprimir

- - -
- + + +
Prova antes de imprimir
+
+

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.

+
+
+
diff --git a/web/site-cart.js b/web/site-cart.js index 3724563..2511dbf 100644 --- a/web/site-cart.js +++ b/web/site-cart.js @@ -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'+rs(tratamento)+'':'')+ (redesenho?'
Ajuste Fino Redesenho · '+artesRedesenho+ (artesRedesenho===1?' arte':' artes')+' · +48 h'+rs(redesenho)+'
':'')+ - ($('fProva')?.checked?'
Prova antes de imprimir'+ + (querProva && pedidoLongo(aPagar)?'
Prova antes de imprimir'+ 'Grátis
':'')+ '
Revisão e reencaixe'+ 'Grátis
'; @@ -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(); diff --git a/web/site-quality.js b/web/site-quality.js index 195cc16..c862591 100644 --- a/web/site-quality.js +++ b/web/site-quality.js @@ -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; diff --git a/web/site-v2.css b/web/site-v2.css index 9c3e2d6..89afc45 100644 --- a/web/site-v2.css +++ b/web/site-v2.css @@ -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}