diff --git a/components/new/details.vue b/components/new/details.vue index 760da35..019d257 100644 --- a/components/new/details.vue +++ b/components/new/details.vue @@ -48,7 +48,7 @@

Property Details

- + - @@ -127,14 +127,14 @@ - -
@@ -144,7 +144,8 @@ :key="fee.name + indx" class="fee" > estimate.property = p" @update:loanType="(lt) => loan.type.id = lt" - @update:term="(lt) => loans[sel].term = lt" + @update:term="(lt) => loan.term = lt" @update:program="(p) => loans[sel].program = p" @update:ltv="setLtv" @update:amount="setAmount" @update:housingDti="setHousingDti" @update:dti="setDti" - @update:hoa="(hoa) => loans[sel].hoa = hoa" - @update:interest="(i) => loans[sel].interest = i" + @update:hoa="(hoa) => loan.hoa = hoa*100" + @update:interest="(i) => loan.interest = i" @update:interestDays="(d) => loans[sel].interestDays = d" @update:hazardEscrow="(h) => loans[sel].hazardEscrow = h" - @update:hazard="(h) => loans[sel].hazard = h" + @update:hazard="(h) => loan.hazard = h * 100" @update:taxEscrow="(t) => loans[sel].taxEscrow = t" - @update:tax="(t) => loans[sel].tax = t" - @update:manualMI="perc => loans[sel].mi.rate = perc" + @update:tax="(t) => loan.tax = t*100" + @update:manualMI="perc => loan.mi.rate = perc" @toggle:manualMIMonthly= "() => loans[sel].mi.monthly = !loans[sel].mi.monthly" @continue="generate" /> + :loan="loan" :downpayment="estimate.price - loan.amount" :token="token" :estimate="estimate"/> @@ -81,7 +81,7 @@ const example = { hazardEscrow: 0, // Hazard insurance escrow in months (0 is none) tax: 0, // Real Estate taxes monthly payment taxEscrow: 0, // Months to escrow (0 is none) - hoa: 100, // Home owner's association monthly fee + hoa: 10000, // Home owner's association monthly fee program: "", pud: true, // Property under development zip: '', @@ -133,7 +133,7 @@ function del() { // Updates the property price for all loans and their fee amounts. function setPrice(value) { - this.estimate.price = value + this.estimate.price = Math.round(value*100) this.estimate.loans[this.sel].fees.forEach(fee => { if (fee.perc) fee.amount = (fee.perc / 100 * value).toFixed(2) }) @@ -151,21 +151,21 @@ function setLtv(e) { this.loan.ltv = ltv let num = ltv / 100 * this.estimate.price - this.loan.amount = Math.round(num*100) + this.loan.amount = Math.round(num) } // Changes loan.amount\'s and data() values, then syncs with data.ltv // Loan amount is in cents but LTV is in decimals so some rounding needs to be done. function setAmount(e) { - let amount = strip(e) + let amount = strip(e) * 100 if (!this.estimate.price) return - if (amount > this.loan.price) amount = this.loan.price + if (amount > this.estimate.price) amount = this.estimate.price if (amount < 0) amount = 0 - this.loan.amount = Math.round(amount * 100) - let num = amount / this.estimate.price * 100 - this.loan.ltv = Math.round(num*100) / 100 + this.loan.amount = Math.round(amount) + let num = amount / this.estimate.price + this.loan.ltv = Math.round(num*100) } function setDti(e) { diff --git a/components/new/summary.vue b/components/new/summary.vue index 83e3db7..594bb99 100644 --- a/components/new/summary.vue +++ b/components/new/summary.vue @@ -1,22 +1,23 @@