feat: designer treatment as an optional paid line (front 5)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 4m20s
Build and deploy / Publish images (push) Successful in 1m5s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 4m20s
Build and deploy / Publish images (push) Successful in 1m5s
TREATMENT_CENTS sets a fixed price per order; 0 keeps the option hidden. The cart shows the designer treatment and adds 24 h; the quote total and Tiny line carry it, and the card gets the "Tratamento pago" label. The designer uploads the treated file through the existing card flow.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
stroke:item.strokeClass||null,strokeChoice:item.strokeChoice||null,
|
||||
sheets:(item.partes||[]).map(part=>part.production),
|
||||
files:(item.localFiles||[]).map(file=>({name:file.name,size:file.size,lastModified:file.lastModified}))
|
||||
}))});
|
||||
})),treatment:!!$('fTratamento')?.checked});
|
||||
}
|
||||
// The quote this browser is paying, forgotten. clearDraft also empties the
|
||||
// payment area; forgetDraft leaves on screen what is there (a confirmation).
|
||||
@@ -74,6 +74,17 @@
|
||||
if(typeof folhas!=='undefined'&&folhas.length&&typeof pintaFolha==='function')pintaFolha();
|
||||
if(typeof itemAtual!=='undefined'&&itemAtual&&typeof carrinho==='function')carrinho();
|
||||
}
|
||||
// Treatment by the designer (front 5): only offered when TREATMENT_CENTS
|
||||
// is set; the server adds the same amount and the 24 h to the quote.
|
||||
TAXA_TRATAMENTO=(session.treatment_cents||0)/100;
|
||||
const tratamentoBox=document.getElementById('tratamentoBox');
|
||||
if(tratamentoBox){
|
||||
tratamentoBox.hidden=!(TAXA_TRATAMENTO>0);
|
||||
const preco=document.getElementById('tratamentoPreco');
|
||||
if(preco)preco.textContent=TAXA_TRATAMENTO>0?rs(TAXA_TRATAMENTO):'';
|
||||
if(!(TAXA_TRATAMENTO>0)&&document.getElementById('fTratamento'))document.getElementById('fTratamento').checked=false;
|
||||
}
|
||||
if(typeof pintaPedido==='function')pintaPedido();
|
||||
}).catch(()=>{});
|
||||
window.dtfSessionReady=ready;
|
||||
window.dtfApi=api;
|
||||
@@ -122,6 +133,8 @@
|
||||
const prazo = approved.freight.days ? ' · até '+approved.freight.days+' dias úteis' : '';
|
||||
rows.push(linha(pickup ? 'Retirada em Franca' : (approved.freight.description || 'Frete')+prazo,
|
||||
approved.freight.total_cents ? rs(approved.freight.total_cents/100) : 'Grátis'));
|
||||
if(quote.treatment?.cents)
|
||||
rows.push(linha('Tratamento da arte pelo designer · +24 h', rs(quote.treatment.cents/100)));
|
||||
rows.push(linha('Total', rs(approved.total_cents/100), 'tot'));
|
||||
const prumoBox=node('div',null,'prumoResumo');
|
||||
if(quote.prumo?.length){
|
||||
@@ -377,6 +390,7 @@
|
||||
if (destination) content.destination = destination;
|
||||
// "Quero aprovar uma prova antes de imprimir": the order waits for the customer.
|
||||
if ($('fProva')?.checked) content.proof = true;
|
||||
if ($('fTratamento')?.checked) content.treatment = true;
|
||||
if (cartSnapshot()!==initialCart) throw new Error('O carrinho mudou durante o envio. Confira os itens e envie de novo.');
|
||||
// Browser timings for Números (item 0.12); they never affect the price.
|
||||
const T=window.dtfTimings, timings={};
|
||||
|
||||
@@ -1096,6 +1096,14 @@ h2 em{font-style:normal;color:var(--laranja)}
|
||||
Imprimimos até 30 cm da sua folha 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>
|
||||
|
||||
<div class="cxE" id="tratamentoBox" hidden>
|
||||
<h4>Tratamento da arte</h4>
|
||||
<label class="provaOp"><input type="checkbox" id="fTratamento">
|
||||
<span><b>Quero o tratamento pelo designer — <span id="tratamentoPreco"></span></b>
|
||||
O designer ajusta a arte para DTF, com fundo transparente e 300 DPI, e sobe o arquivo
|
||||
pelo card. O prazo do pedido aumenta em 24 h.</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="resumo">
|
||||
|
||||
@@ -1019,6 +1019,7 @@ function cardFlags(order){
|
||||
if(redo.length)out.push(['bad','Retrabalho',redo.map(r=>'Retrabalho · '+REWORK_CAUSES[r.cause]+' · '+metres(r.metres)+(r.authorized?'':' · aguardando autorização')).join(' · ')]);
|
||||
if(live&&s.items.some(mirroredItem))out.push(['warn','Espelhada',MIRROR_NOTE]);
|
||||
if(waitingContact(order))out.push(['warn','Contato','Aguardando contato: '+order.contact_note+' · '+contactWho(order)]);
|
||||
if(order.snapshot.treatment)out.push(['warn','Tratamento pago','O designer trata a arte antes de imprimir; prazo +24 h']);
|
||||
if(order.proof_parent)out.push(['warn','Prova do #'+order.proof_parent.number,'Card da prova do pedido #'+order.proof_parent.number]);
|
||||
if(live&&waitingProof(order)&&order.state!=='tra')out.push(['warn','Aguardando prova','Entra na fila com Prova OK no card #'+order.proof_card.number]);
|
||||
if(live&&proofRejected(order))out.push(['bad','Prova reprovada',order.proof_card.proof_reason+' · '+order.proof_card.proof_decided_by]);
|
||||
|
||||
@@ -55,7 +55,8 @@ function pintaPedido(){
|
||||
const aPagar = itensAPagar();
|
||||
const itens = aPagar.reduce((t,it)=>t+it.total,0);
|
||||
const frete = entrega.tipo==='frete' && entrega.cotado ? entrega.valor : 0;
|
||||
const soma = itens + frete;
|
||||
const tratamento=$('fTratamento')?.checked&&TAXA_TRATAMENTO>0?TAXA_TRATAMENTO:0;
|
||||
const soma = itens + frete + tratamento;
|
||||
const n = aPagar.length, noCarrinho = pedido.length + (itemAtual?1:0);
|
||||
$('resLin').innerHTML =
|
||||
'<div class="l"><span>'+n+(n===1?' item':' itens')+'</span><b>'+rs(itens)+'</b></div>'+
|
||||
@@ -64,6 +65,7 @@ function pintaPedido(){
|
||||
'</span><b>'+
|
||||
(entrega.tipo==='retira' ? '<span style="color:var(--verde-ml)">Grátis</span>'
|
||||
: entrega.cotado ? rs(frete) : 'a cotar')+'</b></div>'+
|
||||
(tratamento?'<div class="l"><span>Tratamento da arte · +24 h</span><b>'+rs(tratamento)+'</b></div>':'')+
|
||||
'<div class="l"><span>Revisão e reencaixe</span>'+
|
||||
'<b><span style="color:var(--verde-ml)">Grátis</span></b></div>';
|
||||
$('carrTot').textContent=rs(soma);
|
||||
@@ -73,6 +75,8 @@ function pintaPedido(){
|
||||
// The proof is only for orders above 10 m (Dropstar, 2026-10-28): below it the box is gone.
|
||||
const prova=$('fProva');
|
||||
if(prova){ const longo=aPagar.reduce((t,it)=>t+(it.cob||0),0)>10; prova.closest('.cxE').hidden=!longo; if(!longo) prova.checked=false; }
|
||||
const tratamentoBox=$('tratamentoBox');
|
||||
if(tratamentoBox){tratamentoBox.hidden=!(TAXA_TRATAMENTO>0);if(tratamentoBox.hidden)$('fTratamento').checked=false;}
|
||||
$('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk();
|
||||
if(pedido.length || itemAtual) $('carr').classList.add('on');
|
||||
if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;
|
||||
@@ -158,6 +162,7 @@ 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(); });
|
||||
$('fTratamento')?.addEventListener('change',()=>pintaPedido());
|
||||
$('bEsvaziar').addEventListener('click',()=>{
|
||||
const antes=pedido.slice();
|
||||
pedido=[]; invalidaItemAtual(); pintaPedido();
|
||||
|
||||
@@ -60,6 +60,8 @@ const PRECO={file:19.90, avulsa:21.90, uvfile:79.90, uv:89.90};
|
||||
// Folha que alguém abre na mão (CDR, AI, PSD, TIFF): R$ a mais por metro.
|
||||
// Vem do servidor (/api/session), que cobra o mesmo; zero não soma nada.
|
||||
let TAXA_MANUAL=0;
|
||||
// Fixed price of the designer treatment, set by the server (TREATMENT_CENTS).
|
||||
let TAXA_TRATAMENTO=0;
|
||||
const folhaManual=()=>ehFolha() && folhas.some(x=>!x.med);
|
||||
const ehFolha=m=>!!MODOS[m||modo].folha;
|
||||
const precoMetro=m=>PRECO[m||modo];
|
||||
|
||||
Reference in New Issue
Block a user