/* 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'; const partes=ehFolha(it.modo) ? Math.ceil(it.metros/20) : 1; $('cPartes').textContent = partes>1 ? ' Sai em '+partes+' partes de até 20 m.' : ''; const sobraCm=Math.round((it.cob-it.metros)*100); $('cObs').textContent = it.cob===MINIMO_M && it.metrosadicionaAoCarrinho()); addEventListener('dtf-cart-changed',pintaCompra); pintaCompra(); })();