From 39d84acba6e608f2f9bdf436b07712669b4dca4a Mon Sep 17 00:00:00 2001 From: Immanuel Onyeka Date: Sat, 8 Jul 2023 13:35:33 -0400 Subject: [PATCH] Calculate monthly MI --- components/new/details.vue | 2 -- components/new/new.vue | 16 +++++++--------- components/new/summary.vue | 27 ++++++++++++++++++--------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/components/new/details.vue b/components/new/details.vue index 753178f..68a43c3 100644 --- a/components/new/details.vue +++ b/components/new/details.vue @@ -260,8 +260,6 @@ function generate() { this.errors = errors return } - - window.location.hash = 'new/summary' } export default { diff --git a/components/new/new.vue b/components/new/new.vue index e0b9ad8..1c0c160 100644 --- a/components/new/new.vue +++ b/components/new/new.vue @@ -93,7 +93,7 @@ const loans = [ Object.assign({}, example,), Object.assign( Object.assign({}, example), - {title: "Another One", mi: {}} + {title: "Another One", mi: {rate: 0}} ), ] @@ -146,27 +146,25 @@ function setPrice(value) { // Changes loan.ltv's and data() values, then syncs with data.amount function setLtv(e) { let ltv = strip(e) - let loan = this.loans[this.sel] if (!this.estimate.price) return if (ltv > 100) ltv = 100 if (ltv < 0) ltv = 0 - loan.ltv = ltv - loan.amount = (ltv / 100 * this.estimate.price).toFixed(2) + this.loan.ltv = ltv + this.loan.amount = (ltv / 100 * this.estimate.price).toFixed(2) } // Changes loan.amount\'s and data() values, then syncs with data.ltv function setAmount(e) { let amount = strip(e) - let loan = this.loans[this.sel] if (!this.estimate.price) return - if (amount > loan.price) amount = loan.price + if (amount > this.loan.price) amount = this.loan.price if (amount < 0) amount = 0 - loan.amount = amount - loan.ltv = (amount / this.estimate.price * 100).toFixed(2) + this.loan.amount = amount + this.loan.ltv = (amount / this.estimate.price * 100).toFixed(2) } function setDti(e) { @@ -197,7 +195,7 @@ function generate() { window.location.hash = 'new/summary' } -// Percentage values of fees always takek precedent over amounts. The conversion +// Percentage values of fees always take precedent over amounts. The conversion // happens in setPrice() export default { components: { LoanSummary, LoanDetails }, diff --git a/components/new/summary.vue b/components/new/summary.vue index 2b54f5b..adbdb3a 100644 --- a/components/new/summary.vue +++ b/components/new/summary.vue @@ -1,11 +1,11 @@