backups/2026-03-28-pre-sidebar-refactor/konfigurator-isolering.js

Code: DEV-FBFA8E0A Size: 1.7 KB Lines: 29 Path: /home/prodconfig.wenesthosting.com/dev.solargroup.wenest.se/backups/2026-03-28-pre-sidebar-refactor/konfigurator-isolering.js

Task / Comment

Open report form
// konfigurator-isolering.js
// Visar: isolering

// === ISOLERING KONFIGURATOR ===
let _isoDeduction='rot', _isoOwners=1, _isoFinYears=15;
function initIsoConfig(){ var _lbl=document.getElementById('cfgFileLabel');if(_lbl)_lbl.textContent='konfigurator-isolering.js';updateIsoCalc();}
function setIsoDeduction(t){_isoDeduction=t;cfgSetBtns('deduct','iso-deduct-btn',t);updateIsoCalc();}
function setIsoOwners(n){_isoOwners=n;cfgSetBtns('owner','iso-owner-btn',n);updateIsoCalc();}
function setIsoFinYears(y){_isoFinYears=y;cfgSetBtns('fin','iso-fin-btn',y);updateIsoCalc();}
function updateIsoCalc(){
    const area=parseInt(document.getElementById('isoArea')?.value)||0;
    const type=document.getElementById('isoType')?.value||'';
    const thickness=parseInt(document.getElementById('isoThickness')?.value)||0;
    const price=parseInt(document.getElementById('isoPrice')?.value)||0;
    const subtotal=price;
    const deduct=cfgDeduct(subtotal,0.50,_isoDeduction,_isoOwners);
    const total=subtotal-deduct;
    const monthly=cfgMonthly(total,_isoFinYears);
    document.getElementById('isoPrDesc').textContent=area?area+' m², '+(type||'?')+', '+thickness+'mm':'';
    document.getElementById('isoPrMaterial').textContent=fmt(subtotal);
    document.getElementById('isoPrSubtotal').textContent=fmt(subtotal);
    document.getElementById('isoDeductLabel').textContent=_isoDeduction==='rot'?'ROT-AVDRAG':'INGET AVDRAG';
    document.getElementById('isoDeductKr').textContent=deduct?'-'+fmt(deduct):'0 kr';
    document.getElementById('isoPrTotal').textContent=fmt(total);
    document.getElementById('isoFinInfo').textContent='('+_isoFinYears+' år, 4.9%)';
    document.getElementById('isoPrMonthly').textContent=fmt(monthly)+'/mån';
}