浏览代码

Add mandatory FHA MIP as a fee

master
父节点
当前提交
bbb7bf5f1e
共有 5 个文件被更改,包括 39 次插入9 次删除
  1. +5
    -0
      assets/main.css
  2. +1
    -0
      components/app.vue
  3. +5
    -4
      components/new/details.vue
  4. +27
    -4
      components/new/new.vue
  5. +1
    -1
      skouter.go

+ 5
- 0
assets/main.css 查看文件

@@ -319,6 +319,11 @@ section.form .fee {
display: flex;
}

section.form .fee.required {
display: flex;
background: #ddd;
}

section.form .fee img {
margin-left: auto;
}


+ 1
- 0
components/app.vue 查看文件

@@ -99,6 +99,7 @@ function getFees() {
}).then (result => {
if (!result || !result.length) return // Exit if token is invalid or no fees are saved
this.fees = result
console.log(result)
})

}


+ 5
- 4
components/new/details.vue 查看文件

@@ -26,7 +26,7 @@
<input :value="estimate.borrower.credit"
@input="(e) => $emit('update:borrowerCredit', stripInt(e))">
<label>Monthly Income ($)</label>
<input :value="estimate.borrower.income"
<input :value="estimate.borrower.income/100"
@input="(e) => $emit('update:borrowerIncome', strip(e))">

</section>
@@ -141,14 +141,14 @@
<section class="form inputs">
<h3>Fees</h3>
<div v-for="(fee, indx) in loan.fees"
:key="fee.name + indx" class="fee"
:key="fee.name + indx" class="fee" :class="fee.required && 'required'"
>
<label>
${{(fee.amount / 100).toFixed(2)}}
{{ fee.perc ? ` ${fee.perc}%` : ''}} - {{fee.name}}<br>
{{fee.type}}
</label>
<img width="21" height="21" src="/assets/image/icon/x-red.svg"
<img v-if="!fee.required" width="21" height="21" src="/assets/image/icon/x-red.svg"
@click="() => loan.fees.splice(indx, 1)">
</div>
<button @click="resetFees">Reset</button>
@@ -172,7 +172,8 @@
<label>monthly</label>
</div>
<div class="row">
<input :value="loan.mi.rate" @input="e => $emit('update:manualMI', stripPerc(e))" />
<input :value="loan.mi.rate"
@input="e => $emit('update:manualMI', stripPerc(e))" />
</div>
</section>



+ 27
- 4
components/new/new.vue 查看文件

@@ -31,12 +31,12 @@ class="bi bi-plus" viewBox="0 0 16 16"> <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0
@del="del"
@update:borrowerNum="(b) => estimate.borrower.num = b"
@update:borrowerCredit="(c) => estimate.borrower.credit = c"
@update:borrowerIncome="(m) => estimate.borrower.income = m"
@update:borrowerIncome="(m) => estimate.borrower.income = m*100"
@update:transaction="(t) => estimate.transaction = t"
@update:price="setPrice"
@update:property="(p) => estimate.property = p"

@update:loanType="(lt) => loan.type.id = lt"
@update:loanType="changeLoanType"
@update:term="(lt) => loan.term = lt"
@update:program="(p) => loans[sel].program = p"
@update:ltv="setLtv"
@@ -135,7 +135,7 @@ function del() {
function setPrice(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)
if (fee.perc) fee.amount = Math.round(fee.perc * value)
})
this.estimate.loans.forEach(l => {l.ltv = 0; l.amount = 0})
}
@@ -192,6 +192,29 @@ function setHousingDti(e) {
loan.housingDti = housingDti
}

function changeLoanType(id) {
if (id == this.loan.type.id) return
// Set mandatory upfront MIP in fees if type is FHA
let i = this.loan.fees.findIndex(
l => l.required && l.name == "FHA Upfront MIP"
)
if (id == 2) {
this.loan.fees.push({
amount: Math.round(this.estimate.price*1.75/100),
perc: 1.75,
name: "FHA Upfront MIP",
type: "Required",
id: 0,
required: true
})
} else if (i >= 0) {
this.loan.fees.splice(i, 1)
}
this.loan.type.id = id
}

function generate() {
window.location.hash = 'new/summary'
}
@@ -202,7 +225,7 @@ export default {
components: { LoanSummary, LoanDetails },
methods: {
generate, createFees, del, create, setPrice, setLtv, setAmount,
setDti, setHousingDti
setDti, setHousingDti, changeLoanType
},
computed: { loan },
props: ['user', 'fees', 'token'],


+ 1
- 1
skouter.go 查看文件

@@ -70,7 +70,7 @@ type Fee struct {
Id int `json:"id"`
LoanId int `json:"loan_id"`
Amount int `json:"amount"`
Perc int `json:"perc"`
Perc float32 `json:"perc"`
Type string `json:"type"`
Notes string `json:"notes"`
Name string `json:"name"`


正在加载...
取消
保存