Parcourir la source

Show currency formated summary in estimates.vue

master
Immanuel Onyeka il y a 1 an
Parent
révision
4558d1b4cc
3 fichiers modifiés avec 10 ajouts et 7 suppressions
  1. +4
    -2
      components/estimates.vue
  2. +1
    -5
      components/new/summary.vue
  3. +5
    -0
      helpers.js

+ 4
- 2
components/estimates.vue Voir le fichier

@@ -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)


+ 1
- 5
components/new/summary.vue Voir le fichier

@@ -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>

+ 5
- 0
helpers.js Voir le fichier

@@ -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)
}


Chargement…
Annuler
Enregistrer