Guest User

Untitled

a guest
Sep 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. <div id="app">
  2. <h2>Mortgage Calculator</h2>
  3. <div class="form">
  4. <div class="form-group">
  5. <label>Home Value: </label>
  6. <custominput v-model="homeValue" :step="1000"/>
  7. </div>
  8. <div class="form-group">
  9. <label>Down Payment: </label>
  10. <custominput v-model="downpayment" :step="1000"/>
  11. </div>
  12. <div class="form-group">
  13. <label>Amortization Period: </label>
  14. <custominput v-model="amortization" :step="1" type="years"/>
  15. </div>
  16. <div class="form-group">
  17. <label>Interest Rate: </label>
  18. <custominput v-model="interestRate" :step="0.001" type="percent" decimals="3"/>
  19. </div>
  20. <div class="form-group">
  21. <label>Payment Frequency: </label>
  22. <select class="form-control" v-model="paymentSelection">
  23. <option v-for="payment, key in paymentPeriod" :value="key">{{key}}</option>
  24. </select>
  25. </div>
  26.  
  27. <div class="form-group">
  28. <label>Total cost of loan:</label>
  29. <span class="">{{formatAsCurrency(totalCostOfMortgage)}}</span>
  30. </div>
  31.  
  32. <div class="form-group">
  33. <label>Total Interest Paid:</label>
  34. <span class="">{{formatAsCurrency(interestPayed)}}</span>
  35. </div>
  36.  
  37. <div class="form-group">
  38. <label>{{paymentSelection}} Payment:</label>
  39. <span class="out">{{formatAsCurrency(payment, 2)}}</span>
  40. </div>
  41.  
  42. <h3>Amortization Schedule</h3>
  43. <svg viewBox="0 0 560 300">
  44.  
  45. <g class="xaxis">
  46. <line x1="0" y1="1" x2="500" y2="1"/>
  47. <g v-for="index in amortization">
  48. <line y1="0" :y2="index % 5 === 0 ? 10 : 5" v-bind="{ 'x1':index*500/(amortization), 'x2':index*500/(amortization) }"/>
  49. <text v-if="index % (amortization < 55 ? 5 : 10) === 0" v-bind="{ 'x':(index-0.4)*500/(amortization), 'y':30 }">{{ index }}</text>
  50. </g>
  51. </g>
  52.  
  53. <g class="graph">
  54. <rect v-for="p in amortizationGraphBars(500,250)" v-bind="p" @mouseMove="setHover(p, $event)" @mouseOut="graphSelection.visible = false"></rect>
  55. </g>
  56.  
  57. </svg>
  58. <div class="note">* amount of principal remaining at the end of a year</div>
  59. </div>
  60.  
  61. <div class="hover" v-if="graphSelection !== null" v-show="graphSelection.visible === true" :style="graphSelection.style">
  62. Year: {{ graphSelection.year }}<br/>
  63. Principal: {{ graphSelection.principal }} <br/>
  64. Remaining: {{ graphSelection.principalPercent }} <br/>
  65. </div>
  66.  
  67. </div>
  68.  
  69. <template id="custominput">
  70. <input type="text" class="form-control" @keydown.up.prevent="increment" @keydown.down.prevent="decrement" :value="active?val:formatted" @blur="update" @keyup.enter.stop="update" @focus="active = true">
  71. </template>
Add Comment
Please, Sign In to add comment