|
|
@@ -20,14 +20,14 @@ |
|
|
|
|
|
|
|
<h3>Borrower</h3> |
|
|
|
<label>Number of Borrowers</label> |
|
|
|
<input :value="estimate.borrowers" |
|
|
|
@input="(e) => $emit('update:borrowers', stripInt(e))"> |
|
|
|
<input :value="estimate.borrower.num" |
|
|
|
@input="(e) => $emit('update:borrowerNum', stripInt(e))"> |
|
|
|
<label>Credit Score</label> |
|
|
|
<input :value="estimate.creditScore" |
|
|
|
@input="(e) => $emit('update:creditScore', stripInt(e))"> |
|
|
|
<input :value="estimate.borrower.credit" |
|
|
|
@input="(e) => $emit('update:borrowerCredit', stripInt(e))"> |
|
|
|
<label>Monthly Income ($)</label> |
|
|
|
<input :value="estimate.mIncome" |
|
|
|
@input="(e) => $emit('update:mIncome', strip(e))"> |
|
|
|
<input :value="estimate.borrower.income" |
|
|
|
@input="(e) => $emit('update:borrowerIncome', strip(e))"> |
|
|
|
|
|
|
|
</section> |
|
|
|
|
|
|
@@ -64,26 +64,27 @@ |
|
|
|
<h3>Loan Type</h3> |
|
|
|
<input type="radio" |
|
|
|
name="loan_type" |
|
|
|
value="conv" |
|
|
|
:checked="loan.type.id == 1" |
|
|
|
value="1" |
|
|
|
@change="(e) => $emit('update:loanType', e.target.value)" |
|
|
|
> |
|
|
|
<label>Conventional</label> |
|
|
|
<input type="radio" |
|
|
|
name="loan_type" |
|
|
|
value="fha" |
|
|
|
:checked="loan.type == 'fha'" |
|
|
|
value="2" |
|
|
|
:checked="loan.type.id == 2" |
|
|
|
@change="(e) => $emit('update:loanType', e.target.value)"> |
|
|
|
<label>FHA</label> |
|
|
|
<input type="radio" |
|
|
|
name="loan_type" |
|
|
|
value="va" |
|
|
|
:checked="loan.type == 'va'" |
|
|
|
value="3" |
|
|
|
:checked="loan.type.id == 3" |
|
|
|
@change="(e) => $emit('update:loanType', e.target.value)"> |
|
|
|
<label>VA</label> |
|
|
|
<input type="radio" |
|
|
|
name="loan_type" |
|
|
|
value="usda" |
|
|
|
:checked="loan.type == 'usda'" |
|
|
|
value="4" |
|
|
|
:checked="loan.type.id == 4" |
|
|
|
@change="(e) => $emit('update:loanType', e.target.value)"> |
|
|
|
<label>USDA</label> |
|
|
|
</section> |
|
|
@@ -217,55 +218,16 @@ function validate() { |
|
|
|
"Accept": "application/json", |
|
|
|
"Authorization": `Bearer ${this.token}`, |
|
|
|
}, |
|
|
|
}).then(response => { |
|
|
|
if (response.ok) { return response.json() } |
|
|
|
response.text().then(t => this.errors = [t]) |
|
|
|
}).then(result => { |
|
|
|
if (result) this.$emit('continue', result) |
|
|
|
}) |
|
|
|
/* |
|
|
|
let errors = [] |
|
|
|
const estimate = this.estimate |
|
|
|
|
|
|
|
// Alternative attribute names for error messages |
|
|
|
const names = { |
|
|
|
term: "loan term", |
|
|
|
ltv: "loan to value", |
|
|
|
hazard: "hazard insurance", |
|
|
|
hazardEscrow: "hazard insurance escrow", |
|
|
|
} |
|
|
|
|
|
|
|
if (!estimate.property) { |
|
|
|
errors.push("Missing property type.") |
|
|
|
} else if (!estimate.price) { |
|
|
|
errors.push("Missing property price.") |
|
|
|
} else if (!estimate.borrowers) { |
|
|
|
errors.push("Missing number of borrowers.") |
|
|
|
} else if (!estimate.creditScore) { |
|
|
|
errors.push("Missing credit score.") |
|
|
|
} else if (!estimate.mIncome) { |
|
|
|
errors.push("Missing monthly income.") |
|
|
|
} |
|
|
|
|
|
|
|
estimate.loans.forEach(l => { |
|
|
|
if (errors.length) return |
|
|
|
|
|
|
|
if (!l.amount) { |
|
|
|
errors.push(`${l.title} Loan amount cannot be zero`) |
|
|
|
} else if (!l.interest) { |
|
|
|
errors.push(`${l.title} Interest rate cannot be zero`) |
|
|
|
} else if (!l.term) { |
|
|
|
errors.push(`${l.title} Loan term cannot be zero`) |
|
|
|
}).then(resp => { |
|
|
|
if (resp.ok && resp.status == 200) { |
|
|
|
this.errors = [] |
|
|
|
this.$emit('continue') |
|
|
|
return |
|
|
|
} else { |
|
|
|
resp.text().then(t => this.errors = [t]) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (errors.length) { |
|
|
|
this.errors = errors |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
*/ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function generate() { |
|
|
@@ -288,9 +250,9 @@ export default { |
|
|
|
emits: [ |
|
|
|
'del', |
|
|
|
'update:name', |
|
|
|
'update:borrowers', |
|
|
|
'update:creditScore', |
|
|
|
'update:mIncome', |
|
|
|
'update:borrowerNum', |
|
|
|
'update:borrowerCredit', |
|
|
|
'update:borrowerIncome', |
|
|
|
'update:transaction', |
|
|
|
'update:price', |
|
|
|
'update:property', |
|
|
|