feat: give payment its own page
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 2m12s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m35s

The PIX and card choices appeared under the cart, on the same page as the
customer's details. "Ir para o pagamento" now sends the order and opens
/pagamento, step 3 of the progress bar: the server's order summary, then PIX
or card, each opening below. The cart keeps only the sending progress and its
errors; a changed cart is sent again instead of offering the old quote.
Portal links open the payment page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-09-28 11:45:44 -03:00
parent 536510b148
commit 43043c361c
9 changed files with 113 additions and 40 deletions

View File

@@ -11,6 +11,7 @@ const TITULO_INICIO=document.title;
function tituloPagina(){
const p=paginaDe(location.pathname);
if(p.pagina==='carrinho') return 'Carrinho · DTF Dropstar';
if(p.pagina==='pagamento') return 'Pagamento · DTF Dropstar';
if(p.pagina==='produto') return MODOS[p.modo].tit+' · DTF Dropstar';
return TITULO_INICIO;
}
@@ -91,7 +92,7 @@ function vaiPara(url){
passos.hidden = r==='inicio' || carrinhoVazio;
alturas();
if(!passos.hidden){
const atual = r==='produto' ? 1 : temCheckout() ? 3 : 2;
const atual = r==='produto' ? 1 : r==='pagamento' ? 3 : 2;
passos.querySelectorAll('[data-passo]').forEach(a=>{
const n=Number(a.dataset.passo);
a.classList.toggle('atual',n===atual); a.classList.toggle('feito',n<atual);
@@ -124,8 +125,10 @@ function vaiPara(url){
// Payment is a step only once the order has been sent.
passos.querySelector('[data-passo="3"]').addEventListener('click',e=>{
if(!temCheckout()) e.preventDefault();
});
let enviado=false;
try{ enviado=!!localStorage.getItem('dtf-quote'); }catch(_){}
if(!enviado){ e.preventDefault(); e.stopPropagation(); }
},true);
$('barraMBtn').addEventListener('click',e=>{
e.preventDefault();
alvoBarra()?.scrollIntoView({behavior:'smooth',block:'center'});