All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 8m42s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m10s
Marcus: a length that passes a 10 cm step by up to 8 mm is billed at that
step; by more, at the next. One rule for every product, on the server
(pricing.billed_length), the Site (arredonda10) and the Montador's estimate;
the print file accepts the 8 mm past the billed length instead of sending
the sheet to hand preparation.
The Site showed four numbers that did not add up (0,88 m, 4,42 m, 4,45 m,
4,50 m), and the team read 4,40 m. The copies line now gives the whole
sum ("5 × 88,4 cm + 4 espaços de 8 mm = 445,2 cm"), and the buy box says
why the billed metres are what they are, as a benefit ("os 4 mm a mais
ficam por nossa conta"). The buy box's parts note said 20 m; parts are
10 m since 18/11.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
2.0 KiB
JavaScript
40 lines
2.0 KiB
JavaScript
/* Site DTF — the product page's buy box: the grade, price per metre, billed length,
|
|
total and the add-to-cart button, beside the live sheet. It shows the item
|
|
the other site-*.js files already priced (itemAtual) and never computes a
|
|
price of its own, so the box and the cart always agree. */
|
|
(function(){
|
|
const vals=$('compraVals'), add=$('bAdd');
|
|
function pintaCompra(){
|
|
const it=itemAtual;
|
|
vals.hidden=!it;
|
|
add.disabled=!it || !itemPodeEnviar(it);
|
|
if(!it) return;
|
|
$('cMetroLbl').textContent = it.extra ? 'Metro · com '+rs(it.extra)+' de arquivo manual' : 'Metro';
|
|
$('cMetro').textContent=rs(it.unit);
|
|
$('cMetragem').textContent=fmtM(it.cob)+' m';
|
|
// Partes de até 10 m (Marcus, 18/11/2026): o FlexiPRINT não abre mais que isso.
|
|
const partes=ehFolha(it.modo) ? Math.ceil(it.metros/10) : 1;
|
|
$('cPartes').textContent = partes>1 ? ' Sai em '+partes+' partes de até 10 m.' : '';
|
|
const sobraCm=Math.round((it.cob-it.metros)*100);
|
|
// A metragem cobrada explicada como vantagem (Marcus, 27/11/2026): a cada
|
|
// 10 cm, e até 8 mm a mais ficam por nossa conta.
|
|
const exata=n1(it.metros*100)+' cm';
|
|
const aMais=Math.round((it.metros-it.cob)*1000);
|
|
$('cObs').textContent =
|
|
it.cob===MINIMO_M && it.metros<MINIMO_M
|
|
? (ehFolha(it.modo) ? 'Pedido mínimo de 1 m.'
|
|
: 'Pedido mínimo de 1 m: ainda cabem '+sobraCm+' cm de artes sem custo.')
|
|
: it.cob<it.metros-1e-6
|
|
? 'A folha tem '+exata+': cobramos a cada 10 cm e '+
|
|
(aMais>1?'os '+aMais+' mm a mais ficam':aMais===1?'o 1 mm a mais fica':'o que passou fica')+' por nossa conta.'
|
|
: it.cob>it.metros+1e-6
|
|
? 'A folha tem '+exata+'. Cobramos a cada 10 cm, então fica '+fmtM(it.cob)+' m. '+
|
|
'Se passar até 8 mm de uma faixa, esse pedaço fica por nossa conta.'
|
|
: '';
|
|
$('cTotal').textContent=rs(it.total);
|
|
}
|
|
add.addEventListener('click',()=>adicionaAoCarrinho());
|
|
addEventListener('dtf-cart-changed',pintaCompra);
|
|
pintaCompra();
|
|
})();
|