|
|
@@ -173,9 +173,9 @@ selected="estimate.transaction == 1"> |
|
|
|
|
|
|
|
<button @click="generate">Generate</button> |
|
|
|
|
|
|
|
<div class="errors"> |
|
|
|
<span v-for="e in errors">{{e}}</span> |
|
|
|
</div> |
|
|
|
<ul class="errors"> |
|
|
|
<li v-for="e in errors">{{e}}</li> |
|
|
|
</ul> |
|
|
|
|
|
|
|
</section> |
|
|
|
|
|
|
@@ -283,7 +283,7 @@ function setLtv(e) { |
|
|
|
loan.amount = (ltv / 100 * this.estimate.price).toFixed(2) |
|
|
|
} |
|
|
|
|
|
|
|
// Changes loan.amount's <input> and data() values, then syncs with data.ltv |
|
|
|
// Changes loan.amount\'s <input> and data() values, then syncs with data.ltv |
|
|
|
function setAmount(e) { |
|
|
|
let amount = strip(e) |
|
|
|
let loan = this.loans[this.sel] |
|
|
@@ -356,6 +356,18 @@ function validate() { |
|
|
|
} else if (!estimate.mIncome) { |
|
|
|
errors.push("Missing monthly income.") |
|
|
|
} |
|
|
|
|
|
|
|
estimate.loans.forEach(l => { |
|
|
|
if (errors.length) return |
|
|
|
|
|
|
|
if (!l.amount) { |
|
|
|
errors.push("Loan amount cannot be zero") |
|
|
|
} else if (!l.interest) { |
|
|
|
errors.push("Interest rate cannot be zero") |
|
|
|
} else if (!l.term) { |
|
|
|
errors.push("Loan term cannot be zero") |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
return errors |
|
|
|
} |
|
|
|