All checks were successful
Build and deploy / Validate source (push) Successful in 12s
Build and deploy / Integration suite on a real stack (push) Successful in 10m50s
Build and deploy / Secret scan and release gate (push) Successful in 13s
Build and deploy / Publish images (push) Successful in 2m6s
Help, editor notices, cart, checkout and Minha conta rewritten by the approved copy guide: no "a gente", no em dashes, no rhetorical questions, who acts is clear, at most two sentences per notice. The proof text says 30 cm (was 15 cm) and the billed length no longer says it only rounds up (8 mm grace). Buttons follow the redesign: "Imprimir assim mesmo", "Subir em dois arquivos". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
131 lines
6.3 KiB
JavaScript
131 lines
6.3 KiB
JavaScript
/* Site DTF — Choosing a product, and the declared sheet/loose-artwork switch.
|
|
Extracted verbatim from the single inline script in web/index.html.
|
|
Loaded as classic scripts in the order listed there: they share one global
|
|
scope and run top to bottom, exactly as the original did. */
|
|
// ── escolha
|
|
document.querySelectorAll('.ec').forEach(b=>b.addEventListener('click',()=>escolheProduto(b.dataset.modo)));
|
|
// Back on the home and into the same product: the artworks sent are still there.
|
|
function escolheProduto(m){
|
|
if(modo===m && $('foco').classList.contains('on')) vaiPara(PAGINAS[m]);
|
|
else abrir(m);
|
|
}
|
|
// Um pedido, uma máquina (Marcus, 26/11/2026): UV e têxtil nunca no mesmo
|
|
// pedido, que vira um card numa máquina só. Têxtil e Premium vão juntos.
|
|
// Conta todo o carrinho, também o que ficou guardado para depois; o servidor
|
|
// recusa o mesmo pedido misto (app/core/models.py check_one_machine).
|
|
const linhaUV=m=>m==='uvfile'||m==='uv';
|
|
function outraMaquina(m){ return pedido.some(it=>linhaUV(it.modo)!==linhaUV(m)); }
|
|
function avisaOutraMaquina(m,depois){
|
|
const dlg=$('linhaDlg');
|
|
if(!dlg || dlg.open) return;
|
|
$('linhaFim').onclick=()=>{ dlg.close(); vaiPara(CARRINHO); };
|
|
$('linhaTroca').onclick=()=>{
|
|
dlg.close();
|
|
const antes=pedido.slice();
|
|
pedido=[]; pintaPedido();
|
|
avisaDesfazer('Carrinho trocado por '+MODOS[m].tit+'.',()=>{ pedido=antes; pintaPedido(); });
|
|
if(depois) depois();
|
|
};
|
|
dlg.showModal();
|
|
}
|
|
function abrir(m){
|
|
modo=m; artes=[]; folhas=[]; metros=0; nota=0; reencaixado=false;
|
|
montagemCm=0;
|
|
avisoTipo('');
|
|
pintaModo();
|
|
$('lista').innerHTML=''; $('rA').style.display='none'; recusa([]);
|
|
recemChegada=null;
|
|
$('vMt').textContent='—'; previaAoVivo(); agendaAvaliacao();
|
|
limpaPaineis(); // o carrinho só some se o pedido estiver vazio
|
|
vaiPara(PAGINAS[m]);
|
|
// Produto da outra máquina: avisa já ao abrir, antes de o cliente subir arquivos.
|
|
if(outraMaquina(m)) avisaOutraMaquina(m);
|
|
}
|
|
function pintaModo(){
|
|
const m=modo;
|
|
const c=MODOS[m];
|
|
$('cards').style.display='none'; $('foco').classList.add('on');
|
|
$('fTit').textContent=c.tit; $('fLg').textContent=c.lg;
|
|
$('zTit').textContent=c.zt; $('zSub').textContent=c.zs;
|
|
$('zManual').hidden=!ehFolha(m);
|
|
$('zOutra').textContent = ehFolha(m) ? 'Adicionar outra folha' : 'Adicionar mais artes';
|
|
$('zona').classList.remove('compacta');
|
|
$('inp').multiple=c.multi;
|
|
// The file decides how it is checked: PNG and PDF here, the others by hand
|
|
// (TAXA_MANUAL). JPG has no transparency and is refused (ACEITA, web/site-config.js).
|
|
$('inp').accept = ehFolha(m) ? '.png,.pdf,.tif,.tiff,.psd,.psb,.ai,.cdr'
|
|
: '.png,.webp';
|
|
$('catFoco').className='cat '+(ehFolha(m)?'file':'av');
|
|
$('larguraFolhaPronta').textContent=String(c.larg).replace('.',',');
|
|
$('foco2').classList.remove('sofila'); // a caixa de requisitos vale nos 4 modos
|
|
$('montcabTit').textContent = ehFolha(m) ? 'Sua folha' : 'Montagem ao vivo';
|
|
$('qOk').innerHTML = ehFolha(m) ? icone('adicionar')+'<span>Adicionar ao carrinho</span>' : 'Ver a folha montada';
|
|
pintaTipoEnvio();
|
|
}
|
|
// O par folha montada / artes separadas fica visível e com preço nos dois lados,
|
|
// nos dois modos: nenhuma troca acontece sem o cliente ver o que muda, e sempre
|
|
// dá para voltar atrás sem recomeçar o pedido.
|
|
function pintaTipoEnvio(){
|
|
const el=$('tipoEnvio'); if(!el) return;
|
|
// A product without its loose-art counterpart (Premium) has nothing to choose.
|
|
el.hidden=!modo || (ehFolha() && !PAR[modo]);
|
|
if(el.hidden) return;
|
|
const folha = ehFolha() ? modo : PAR[modo];
|
|
const avulsa = ehFolha() ? PAR[modo] : modo;
|
|
$('tipoFolhaPreco').textContent=rs(PRECO[folha])+' /m';
|
|
$('tipoAvulsaPreco').textContent=rs(PRECO[avulsa])+' /m';
|
|
$('larguraFolhaPronta').textContent=String(MODOS[folha].larg).replace('.',',');
|
|
const atual = ehFolha() ? 'folha' : 'avulsa';
|
|
// A product switched off in the Kanban cannot be chosen (front 8).
|
|
const ligado=m=>!(window.dtfProducts&&window.dtfProducts[m]&&!window.dtfProducts[m].enabled);
|
|
el.querySelectorAll('.cam').forEach(b=>{
|
|
const alvo=b.dataset.tipo==='folha'?folha:avulsa;
|
|
b.classList.toggle('on', b.dataset.tipo===atual);
|
|
b.disabled=!ligado(alvo) || folhas.length>0 || artes.length>0; // já tem arquivo: a escolha está feita
|
|
});
|
|
}
|
|
function avisoTipo(txt){
|
|
const el=$('avisoTipo'); if(!el) return;
|
|
el.innerHTML=txt; el.style.display = txt? '' : 'none';
|
|
}
|
|
// A imagem foi declarada folha montada mas não tem resolução para isso. Devolve o
|
|
// arquivo com o motivo e o caminho certo — sem trocar preço por conta própria.
|
|
function recusaFolha(x, md){
|
|
const arquivo=x.f, destino = modo==='uvfile' ? 'uv' : 'avulsa';
|
|
folhas=folhas.filter(y=>y!==x);
|
|
pintaFolha();
|
|
avisoTipo('<b>'+escapeHTML(arquivo.name)+' não é uma folha montada.</b> '+
|
|
'Nos '+n1(larguraFilme())+' cm do filme ela teria só '+md.dpiFolha+
|
|
' DPI, abaixo do mínimo de '+DPI_RECUSA+'. '+
|
|
'Se for uma arte para montarmos, use <b>'+MODOS[destino].tit+'</b>, '+
|
|
'a '+rs(PRECO[destino])+' o metro. '+
|
|
'<button type="button" id="usarAvulsa">Enviar como '+MODOS[destino].tit.toLowerCase()+'</button>');
|
|
const botao=$('usarAvulsa');
|
|
if(botao) botao.addEventListener('click',()=>{
|
|
avisoTipo(''); trocaTipo(destino); sel([arquivo]);
|
|
});
|
|
}
|
|
document.querySelectorAll('#tipoEnvio .cam').forEach(b=>b.addEventListener('click',()=>{
|
|
if(b.disabled) return;
|
|
const querFolha=b.dataset.tipo==='folha';
|
|
if(querFolha===ehFolha()) return;
|
|
avisoTipo(''); trocaTipo(PAR[modo]); // escolha explícita do cliente
|
|
}));
|
|
// Troca declarada, nunca silenciosa: o cliente já viu os dois preços no seletor.
|
|
function trocaTipo(destino){
|
|
if(!destino || modo===destino) return;
|
|
folhas=[]; artes=[]; recemChegada=null; metros=0; nota=0; montagemCm=0;
|
|
modo=destino;
|
|
history.replaceState(history.state,'',PAGINAS[modo]); document.title=tituloPagina();
|
|
$('lista').innerHTML=''; $('rA').style.display='none'; recusa([]);
|
|
pintaModo(); limpaPaineis(); agendaAvaliacao(); previaAoVivo();
|
|
}
|
|
$('bVoltar').addEventListener('click',()=>{
|
|
itemAtual=null; modo=null; $('atual').style.display='none'; $('carrLin').innerHTML=''; pintaPedido();
|
|
$('foco').classList.remove('on');
|
|
['qual','prev'].forEach(id=>$(id).classList.remove('on'));
|
|
if(!pedido.length) $('carr').classList.remove('on');
|
|
vaiPara('/#envio');
|
|
});
|
|
|