123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <div>
- <h2 id="modal-bondcal">Bond Calculator</h2>
- <p>Calculate the value of the property you could buy</p>
- <currency-input
- onClick="this.setSelectionRange(0, this.value.length)"
- name="price"
- :value="value"
- @input="value = $event"
- v-model="amount"
- id="gross-income"
- class="form-control mb-2"
- />
- <currency-input
- onClick="this.setSelectionRange(0, this.value.length)"
- name="deposit"
- :value="value"
- @input="value = $event"
- v-model="deposit"
- id="gross-income"
- class="form-control mb-2"
- />
- <div class="slidecontainer mt-4">
- <input type="range" min="5" max="30" value="10" class="slider" id="myRange" v-model="term" />
- </div>
- <p>{{ term }} Years</p>
- <input
- type="text"
- class="form-control mb-2"
- name="interest"
- id="interest"
- placeholder="Interest Rate (Percent)"
- v-model="rate"
- />
- <!-- <button @click="calculate()" class="btn-solid-blue scrollto">CALCULATE</button> -->
- <div class="container p-0 mt-5">
- <div class="row">
- <div class="col-md-7">
- Monthly Repayment
- </div>
- <div class="col-md-5">
- <strong>{{ totalMonthlyPayment | toCurrency }}</strong>
- </div>
- </div>
- <hr />
- <div class="row">
- <div class="col-md-7">
- Gross Montly Income
- </div>
- <div class="col-md-5">
- <strong>{{ grossIncome | toCurrency }}</strong>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- /* eslint-disable */
- export default {
- data() {
- return {
- amount: 1000000,
- deposit: 0,
- term: 10,
- rate: 7,
- isInputActive: false
- };
- },
- props: ["value"],
- methods: {
- calculate() {
- var rate = this.rate / 100 / 12;
- var years = this.term * 12;
- var topPart = rate * Math.pow(1 + rate, years);
- var bottomPart = Math.pow(1 + rate, years) - 1;
- var netAmnt = this.amount - this.deposit;
- var bond = (netAmnt * topPart) / bottomPart;
- }
- },
- computed: {
- totalMonthlyPayment() {
- var rate = this.rate / 100 / 12;
- var years = this.term * 12;
- var topPart = rate * Math.pow(1 + rate, years);
- var bottomPart = Math.pow(1 + rate, years) - 1;
-
- var netAmnt = this.amount - this.deposit;
-
- var bond = (netAmnt * topPart) / bottomPart;
- if (isNaN(bond)) {
- return 0;
- } else {
- return bond;
- }
- },
- grossIncome() {
- return this.totalMonthlyPayment * 3.335120643;
- }
- }
- };
- </script>
-
- <style lang="scss" scoped></style>
|