Fix pricing calculation: remove feedback loop in updatePrice
wizard.addonFee was being subtracted and then recalculated each call, causing prices to accumulate/subtract randomly on checkbox toggle. Simplified to just sum base + checked addons + formation fees. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2927b5cebb
commit
b473bf1783
1 changed files with 9 additions and 5 deletions
|
|
@ -467,20 +467,24 @@ select:focus,input:focus{outline:none;border-color:#1e3a5f;box-shadow:0 0 0 2px
|
|||
function updatePrice() {
|
||||
var total = wizard.baseFee;
|
||||
var details = ['Base: $1,299'];
|
||||
|
||||
// Add-on fees from checked checkboxes
|
||||
document.querySelectorAll('[data-reg]').forEach(function(cb) {
|
||||
if (!cb.checked) return;
|
||||
var key = cb.dataset.reg;
|
||||
if (key === 'stir_shaken') { total += 49900; details.push('STIR/SHAKEN: +$499'); }
|
||||
if (key === 'ocn') { total += 265000; details.push('OCN: +$2,650'); }
|
||||
if (key === 'state_puc') { total += 39900; details.push('State PUC: +$399'); }
|
||||
if (key === 'state_puc') { total += 39900; details.push('State PUC: +$399/state'); }
|
||||
});
|
||||
total += wizard.formationFee + wizard.stateFee;
|
||||
if (wizard.formationFee) details.push('Formation: +$' + ((wizard.formationFee + wizard.stateFee) / 100).toLocaleString());
|
||||
total -= wizard.addonFee; // discount placeholder
|
||||
|
||||
// Formation fees (if new entity)
|
||||
if (wizard.formationFee || wizard.stateFee) {
|
||||
total += wizard.formationFee + wizard.stateFee;
|
||||
details.push('Formation: +$' + ((wizard.formationFee + wizard.stateFee) / 100).toLocaleString());
|
||||
}
|
||||
|
||||
document.getElementById('total-price').textContent = '$' + (total / 100).toLocaleString();
|
||||
document.getElementById('price-detail').textContent = details.join(' · ');
|
||||
wizard.addonFee = total - wizard.baseFee - wizard.formationFee - wizard.stateFee;
|
||||
}
|
||||
|
||||
// ── Step 2 → 3 ──
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue