Procházet zdrojové kódy

Make dollar amounts more readable

master
Immanuel Onyeka před 1 rokem
rodič
revize
69009f286f
4 změnil soubory, kde provedl 15 přidání a 14 odebrání
  1. +9
    -10
      components/new/new.vue
  2. +1
    -1
      components/new/summary.vue
  3. +3
    -1
      skouter.go
  4. +2
    -2
      views/report/comparison.tpl

+ 9
- 10
components/new/new.vue Zobrazit soubor

@@ -5,7 +5,7 @@

<section class="loans-list">

<h3 v-for="(l, indx) in loans"
<h3 v-for="(l, indx) in estimate.loans"
:class="sel == indx ? 'sel' : ''"
@click="() => sel = indx"
>
@@ -46,14 +46,14 @@ class="bi bi-plus" viewBox="0 0 16 16"> <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0
@update:dti="setDti"
@update:hoi="(hoi) => loan.hoi = Math.round(hoi*100)"
@update:interest="(i) => loan.interest = i"
@update:interestDays="(d) => loans[sel].interestDays = d"
@update:hazardEscrow="(h) => loans[sel].hazardEscrow = h"
@update:interestDays="(d) => estimate.loans[sel].interestDays = d"
@update:hazardEscrow="(h) => estimate.loans[sel].hazardEscrow = h"
@update:hazard="(h) => loan.hazard = Math.round(h * 100)"
@update:taxEscrow="(t) => loans[sel].taxEscrow = t"
@update:taxEscrow="(t) => estimate.loans[sel].taxEscrow = t"
@update:tax="(t) => loan.tax = Math.round(t*100)"
@update:manualMI="perc => loan.mi.rate = perc"
@toggle:manualMIMonthly=
"() => loans[sel].mi.monthly = !loans[sel].mi.monthly"
"() => estimate.loans[sel].mi.monthly = !estimate.loans[sel].mi.monthly"
@continue="generate"
/>
<loan-summary v-if="hash == '#new/summary'"
@@ -130,10 +130,10 @@ function createFees() {


function del() {
if (this.loans.length > 1) {
if (this.estimate.loans.length > 1) {
let x = this.sel
this.sel = 0
this.loans.splice(x, 1)
this.estimate.loans.splice(x, 1)
}
}

@@ -176,7 +176,7 @@ function setAmount(e) {

function setDti(e) {
let dti = strip(e)
let loan = this.loans[this.sel]
let loan = this.estimate.loans[this.sel]
if (!loan.price) return

if (dti > 100) dti = 100
@@ -188,7 +188,7 @@ function setDti(e) {

function setHousingDti(e) {
let housingDti = strip(e)
let loan = this.loans[this.sel]
let loan = this.estimate.loans[this.sel]
if (!loan.price) return

if (housingDti > 100) housingDti = 100
@@ -238,7 +238,6 @@ export default {
data() {
return {
estimate: estimate,
loans: estimate.loans,
sel: 0,
errors: [],
hash: window.location.hash


+ 1
- 1
components/new/summary.vue Zobrazit soubor

@@ -22,7 +22,7 @@ Credits: ${{format(loan.result.totalCredits)}}
</label>
<label>Down payment: ${{format(downpayment)}}</label>
<label v-if="!loan.mi.monthly">
Mortgage insurance: ${{format(loan.amount*loan.mi.rate/100)}}
Mortgage insurance: ${{format(loan.mi.upfront)}}
</label>
</section>



+ 3
- 1
skouter.go Zobrazit soubor

@@ -270,7 +270,7 @@ func cachePdf(name string) Page {
// For calculating down payments
diff := func(a, b int) string {
return strconv.FormatFloat(float64(b - a)/100, 'f', 2, 32)
return humanize.Commaf(float64(b - a)/100)
}
sortFees := func(ftype string, fees []Fee) []Fee {
@@ -341,6 +341,8 @@ func (estimate *Estimate) makeResults() []Result {
if loan.Mi.Monthly {
result.TotalMonthly = result.TotalMonthly +
int(loan.Mi.Rate/100/12*float32(loan.Amount))
} else {
loan.Mi.Upfront = int(loan.Mi.Rate/100*float32(loan.Amount))
}
for i := range loan.Fees {


+ 2
- 2
views/report/comparison.tpl Zobrazit soubor

@@ -30,11 +30,11 @@
<tr><td>Loan amount</td>
{{range .Estimate.Loans}}<td>${{dollars .Amount}}</td>{{end}}</tr>
<tr><td>Down payment</td>
{{range .Estimate.Loans}}<td>${{diff .Amount $.Estimate.Price}}</td>{{end}}</tr>
{{range .Estimate.Loans}}<td>${{diff .Amount $.Estimate.Price }}</td>{{end}}</tr>
<tr><td>Closing costs</td>
{{range .Estimate.Loans}}<td>${{dollars .Result.TotalFees}}</td>{{end}}</tr>
<tr><td>MI Premium</td>
{{range .Estimate.Loans}}<td>${{.Mi.Upfront}}</td>{{end}}</tr>
{{range .Estimate.Loans}}<td>${{dollars .Mi.Upfront}}</td>{{end}}</tr>
<tr><td>Credits</td>
{{range .Estimate.Loans}}<td>${{dollars .Result.TotalCredits}}</td>{{end}}</tr>
<tr class="total"><td>Cash to close</td>


Načítá se…
Zrušit
Uložit