diff --git a/components/estimates.vue b/components/estimates.vue index f5f0eec..4a9091d 100644 --- a/components/estimates.vue +++ b/components/estimates.vue @@ -50,10 +50,11 @@ ${{(estimate.price / 100).toLocaleString()}} <label>Credit: {{estimate.borrower.credit}}</label> <label>Income: {{(estimate.borrower.income/100).toLocaleString()}}</label> -<div v-for="l in estimate.loans" class="details"> +<div v-for="(l, i) in estimate.loans" class="details"> <h4>{{l.title}}</h4> <label>{{l.type.name}}</label> -<label>{{l.id}}</label> +<label>Total monthly: ${{format(estimate.results[i].totalMonthly)}}</label> +<label>Cash to close: ${{format(estimate.results[i].cashToClose)}}</label> </div> <button @click="() => estimate = null">Cancel</button> @@ -67,6 +68,7 @@ ${{(estimate.price / 100).toLocaleString()}} <script setup> import { ref, computed, onMounted } from 'vue' import FeeDialog from "./fee-dialog.vue" +import { format } from "../helpers.js" const props = defineProps(['user', 'fees', 'token']) let edit = ref(null) diff --git a/components/new/summary.vue b/components/new/summary.vue index 135d117..877750d 100644 --- a/components/new/summary.vue +++ b/components/new/summary.vue @@ -34,6 +34,7 @@ <script setup> import { ref, computed, onMounted } from 'vue' +import { format } from '../../helpers.js' let valid = ref(false) let saved = ref(false) const props = defineProps(['downpayment', 'loan', 'token', 'estimate']) @@ -127,11 +128,6 @@ function create() { } -// Print number of cents as a nice string of dollars -function format(num) { - return (num/100).toFixed(2) -} - onMounted(() => {validate()}) </script> diff --git a/helpers.js b/helpers.js index 1ef7836..7d65107 100644 --- a/helpers.js +++ b/helpers.js @@ -34,3 +34,8 @@ export function stripPerc(e) { return num } +// Print number of cents as a nice string of dollars +export function format(num) { + return (num/100).toLocaleString(2) +} +