Browse Source

Setup estimates view

master
Immanuel Onyeka 2 years ago
parent
commit
b9486e6e4f
3 changed files with 92 additions and 28 deletions
  1. +20
    -3
      components/app.vue
  2. +58
    -0
      components/estimates.vue
  3. +14
    -25
      components/new.vue

+ 20
- 3
components/app.vue View File

@@ -9,7 +9,8 @@
</div> </div>


<home :user="user" v-else-if="active == 1" /> <home :user="user" v-else-if="active == 1" />
<new-estimate :user="user" v-else-if="active == 2" />
<new-estimate :user="user" :fees="fees" v-else-if="active == 2" />
<estimates :user="user" :fees="fees" v-else-if="active == 3" />


</div> </div>
</template> </template>
@@ -19,6 +20,7 @@ import SideBar from "./sidebar.vue"
import Spinner from "./spinner.vue" import Spinner from "./spinner.vue"
import Home from "./home.vue" import Home from "./home.vue"
import NewEstimate from "./new.vue" import NewEstimate from "./new.vue"
import Estimates from "./estimates.vue"


const user = { const user = {
firstName: "test", firstName: "test",
@@ -27,6 +29,20 @@ const user = {
status: 1, status: 1,
} }


// The default fees of a new loan
const fees = [
{ name: 'Processing fee', type: 'Lender Fees', amount: 500 },
{ name: 'Underwriting fee', type: 'Lender Fees', amount: 500 },
{ name: 'Credit Report', type: 'Services Required by Lender',
amount: 52.50 },
{ name: 'Appraisal', type: 'Services Required by Lender', amount: 52.50 },
{ name: 'Title Services', type: 'Title Company', amount: 1000 },
{ name: 'Lender\'s Title Insurance', type: 'Title Company', amount: 1599 },
{ name: 'Owner\'s Title Insurance', type: 'Title Company', amount: 451.00 },
{ name: 'Recording Charges', type: 'Government', amount: 99.00 },
{ name: 'State Tax', type: 'Government', amount: 2411.00 },
]

// Used to check the current section of the app generally without a regex match // Used to check the current section of the app generally without a regex match
// each time. // each time.
function active() { function active() {
@@ -46,11 +62,12 @@ function active() {
} }


export default { export default {
components: { SideBar, Spinner, Home, NewEstimate },
components: { SideBar, Spinner, Home, NewEstimate, Estimates },
computed: { active }, computed: { active },
data() { data() {
return { return {
loading: false, user: user, hash: window.location.hash
loading: false, user: user, hash: window.location.hash,
fees: fees
} }
}, },
created() { created() {


+ 58
- 0
components/estimates.vue View File

@@ -0,0 +1,58 @@
<template>
<div class="page">
<h2>Estimates</h2>

<section class="form inputs">
<h3>Default Fees</h3>
<div v-for="(fee, indx) in fees"
:key="fee.name + indx" class="fee"
>
<label @click="() => edit = fee">
${{fee.amount ?? fee.perc + "%"}} - {{fee.name}}<br>
{{fee.type}}
</label>
<img width="21" height="21" src="/assets/image/icon/x-red.svg"
@click="() => remove(indx, 1)">
</div>
<button @click="newFee">New Fee</button>
</section>

<Dialog v-if="edit" @close="() => edit = null">
<h3>hi</h3>
</Dialog>

<section class="inputs">
<h3>Saved Estimates</h3>

</section>

</div>
</template>

<script>
import Dialog from "./dialog.vue"

function newFee() {

}

function newType() {

}

function remove() {

}

export default {
props: [ 'user', 'fees' ],
emits: [ 'deleteFee', 'update' ],
components: { Dialog },
methods: { newFee, newType, remove },
data() {
return {
edit: null
}
},
}
</script>

+ 14
- 25
components/new.vue View File

@@ -164,11 +164,11 @@ type=""
@input="(e) => newFee.amount = strip(e)"> @input="(e) => newFee.amount = strip(e)">


<select id="" name="" v-model="newFee.type"> <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>
<option value="Title Company">Title Company</option>
<option value="Government">Government</option>
<option value="Lender">Lender</option>
<option value="Services Required by Lender">Required by Lender</option>
<option value="Other">Other</option>
</select> </select>


<button :disabled="!validFee" @click="addFee(true)">Debit</button> <button :disabled="!validFee" @click="addFee(true)">Debit</button>
@@ -203,20 +203,6 @@ selected="estimate.transaction == 1">
<script> <script>
import Dialog from "./dialog.vue" import Dialog from "./dialog.vue"


// The default fees of a new loan
const fees = [
{ name: 'Processing fee', type: 'Lender Fees', amount: 500 },
{ name: 'Underwriting fee', type: 'Lender Fees', amount: 500 },
{ name: 'Credit Report', type: 'Services Required by Lender',
amount: 52.50 },
{ name: 'Appraisal', type: 'Services Required by Lender', amount: 52.50 },
{ name: 'Title Services', type: 'Title Company', amount: 1000 },
{ name: 'Lender\'s Title Insurance', type: 'Title Company', amount: 1599 },
{ name: 'Owner\'s Title Insurance', type: 'Title Company', amount: 451.00 },
{ name: 'Recording Charges', type: 'Government', amount: 99.00 },
{ name: 'State Tax', type: 'Government', amount: 2411.00 },
]

// The default values of a new estimate // The default values of a new estimate
const example = { const example = {
title: "Example", title: "Example",
@@ -236,15 +222,15 @@ const example = {
program: "", program: "",
pud: true, // Property under development pud: true, // Property under development
zip: '', zip: '',
fees: fees,
fees: [],
} }


// The default loans on a new estimate // The default loans on a new estimate
const loans = [ const loans = [
Object.assign({}, example, {fees: createFees()}),
Object.assign({}, example,),
Object.assign( Object.assign(
Object.assign({}, example), Object.assign({}, example),
{title: "Another One", fees: createFees()}
{title: "Another One",}
), ),
] ]


@@ -271,7 +257,7 @@ function create() {
} }


function createFees() { function createFees() {
return fees.map(f => Object.assign({}, f))
return this.fees.map(f => Object.assign({}, f))
} }


// Setup this.newFee for the creation dialog // Setup this.newFee for the creation dialog
@@ -280,7 +266,7 @@ function createFee() {
} }


function resetFees() { function resetFees() {
this.estimate.loans[this.sel].fees = createFees()
this.estimate.loans[this.sel].fees = this.createFees()
} }


// If valid, add the current this.newFee to the array of fees and reset // If valid, add the current this.newFee to the array of fees and reset
@@ -446,7 +432,7 @@ export default {
computed: { computed: {
validFee, validFee,
}, },
props: ['user'],
props: ['user', 'fees'],
data() { data() {
return { return {
estimate: estimate, estimate: estimate,
@@ -456,5 +442,8 @@ export default {
errors: [], errors: [],
} }
}, },
created() {
this.estimate.loans.forEach(l => l.fees = this.createFees())
}
} }
</script> </script>

Loading…
Cancel
Save