|
@@ -144,11 +144,39 @@ selected="estimate.transaction == 1"> |
|
|
${{fee.amount}} - {{fee.name}}<br> |
|
|
${{fee.amount}} - {{fee.name}}<br> |
|
|
{{fee.type}} |
|
|
{{fee.type}} |
|
|
</label> |
|
|
</label> |
|
|
<img width="21" height="21" src="/assets/image/icon/x-red.svg" alt="" |
|
|
|
|
|
|
|
|
<img width="21" height="21" src="/assets/image/icon/x-red.svg" |
|
|
@click="() => estimate.loans[sel].fees.splice(indx, 1)"> |
|
|
@click="() => estimate.loans[sel].fees.splice(indx, 1)"> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<button @click="resetFees">Reset</button> |
|
|
|
|
|
<button @click="createFee">New</button> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
|
|
|
<Dialog v-if="newFee" @close="() => newFee = null"> |
|
|
|
|
|
<h3>New Fee</h3> |
|
|
|
|
|
|
|
|
|
|
|
<label>Name</label> |
|
|
|
|
|
<input type="" |
|
|
|
|
|
:value="newFee.name" |
|
|
|
|
|
@input="(e) => newFee.name = stripLetters(e)"> |
|
|
|
|
|
|
|
|
|
|
|
<label>Amount</label> |
|
|
|
|
|
<input |
|
|
|
|
|
type="" |
|
|
|
|
|
:value="newFee.amount" |
|
|
|
|
|
@input="(e) => newFee.amount = strip(e)"> |
|
|
|
|
|
|
|
|
|
|
|
<select id="" name="" v-model="newFee.type"> |
|
|
|
|
|
<option value="title">Title Company</option> |
|
|
|
|
|
<option value="gov">Government</option> |
|
|
|
|
|
<option value="lender">Lender</option> |
|
|
|
|
|
<option value="lender_required">Required by Lender</option> |
|
|
|
|
|
<option value="other">Other</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<button :disabled="!validFee" @click="addFee(true)">Debit</button> |
|
|
|
|
|
<button :disabled="!validFee" @click="addFee(false)">Credit</button> |
|
|
|
|
|
</Dialog> |
|
|
|
|
|
|
|
|
<section class="form radios"> |
|
|
<section class="form radios"> |
|
|
<h3>Mortgage Insurance</h3> |
|
|
<h3>Mortgage Insurance</h3> |
|
|
<input type="radio" name="transaction_type" value="transaction" |
|
|
<input type="radio" name="transaction_type" value="transaction" |
|
@@ -169,6 +197,8 @@ selected="estimate.transaction == 1"> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
|
|
|
import Dialog from "./dialog.vue" |
|
|
|
|
|
|
|
|
const fees = [ |
|
|
const fees = [ |
|
|
{ name: 'Processing fee', type: 'Lender Fees', amount: 500 }, |
|
|
{ name: 'Processing fee', type: 'Lender Fees', amount: 500 }, |
|
|
{ name: 'Underwriting fee', type: 'Lender Fees', amount: 500 }, |
|
|
{ name: 'Underwriting fee', type: 'Lender Fees', amount: 500 }, |
|
@@ -221,6 +251,10 @@ const estimate = { |
|
|
loans: loans, |
|
|
loans: loans, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const newFee = { |
|
|
|
|
|
name: '', type: '', amount: 0 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Clone loan from initial example as a new loan |
|
|
// Clone loan from initial example as a new loan |
|
|
function create() { |
|
|
function create() { |
|
|
this.estimate.loans.push( |
|
|
this.estimate.loans.push( |
|
@@ -232,6 +266,37 @@ function createFees() { |
|
|
return fees.map(f => Object.assign({}, f)) |
|
|
return fees.map(f => Object.assign({}, f)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Setup this.newFee for the creation dialog |
|
|
|
|
|
function createFee() { |
|
|
|
|
|
this.newFee = Object.assign({}, newFee) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function resetFees() { |
|
|
|
|
|
this.estimate.loans[this.sel].fees = createFees() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If valid, add the current this.newFee to the array of fees and reset |
|
|
|
|
|
// this.newFee to null |
|
|
|
|
|
function addFee(isDebit) { |
|
|
|
|
|
const fee = this.newFee |
|
|
|
|
|
if (!this.validFee) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!isDebit) fee.amount = fee.amount * -1 |
|
|
|
|
|
this.estimate.loans[this.sel].fees.push(fee) |
|
|
|
|
|
this.newFee = null |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function validFee() { |
|
|
|
|
|
const fee = this.newFee |
|
|
|
|
|
if (!fee.name || !fee.type || !fee.amount) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Strips non-digits from an input box event and returns it's rounded integer. |
|
|
// Strips non-digits from an input box event and returns it's rounded integer. |
|
|
// It also preserves current valid entry (.) |
|
|
// It also preserves current valid entry (.) |
|
|
function strip(e) { |
|
|
function strip(e) { |
|
@@ -333,9 +398,14 @@ function setHousingDti(e) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
|
|
|
components: { Dialog }, |
|
|
methods: { |
|
|
methods: { |
|
|
setPrice, setLtv, setAmount, setDti, setHousingDti, strip, stripInt, |
|
|
setPrice, setLtv, setAmount, setDti, setHousingDti, strip, stripInt, |
|
|
stripLetters, stripPerc, del, create, |
|
|
|
|
|
|
|
|
stripLetters, stripPerc, del, create, createFees, createFee, resetFees, |
|
|
|
|
|
addFee |
|
|
|
|
|
}, |
|
|
|
|
|
computed: { |
|
|
|
|
|
validFee, |
|
|
}, |
|
|
}, |
|
|
props: ['user'], |
|
|
props: ['user'], |
|
|
data() { |
|
|
data() { |
|
@@ -343,7 +413,7 @@ export default { |
|
|
estimate: estimate, |
|
|
estimate: estimate, |
|
|
loans: estimate.loans, |
|
|
loans: estimate.loans, |
|
|
sel: 0, |
|
|
sel: 0, |
|
|
fees: loans.fees |
|
|
|
|
|
|
|
|
newFee: null, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|