Document page currencies feature and change currency dynamic fixed..
This commit is contained in:
31
resources/assets/js/views/common/documents.js
vendored
31
resources/assets/js/views/common/documents.js
vendored
@ -50,10 +50,10 @@ const app = new Vue({
|
||||
discounts: [],
|
||||
tax_id: [],
|
||||
|
||||
|
||||
items: [],
|
||||
taxes: [],
|
||||
page_loaded: false,
|
||||
currencies: [],
|
||||
}
|
||||
},
|
||||
|
||||
@ -61,6 +61,10 @@ const app = new Vue({
|
||||
if ((document.getElementById('items') != null) && (document.getElementById('items').rows)) {
|
||||
this.colspan = document.getElementById("items").rows[0].cells.length - 1;
|
||||
}
|
||||
|
||||
if (document_currencies) {
|
||||
this.currencies = document_currencies;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -513,6 +517,31 @@ const app = new Vue({
|
||||
// always executed
|
||||
});
|
||||
},
|
||||
|
||||
// Change currency get money
|
||||
onChangeCurrency(currency_code) {
|
||||
if (!this.currencies.length) {
|
||||
let currency_promise = Promise.resolve(window.axios.get((url + '/settings/currencies')));
|
||||
|
||||
currency_promise.then(response => {
|
||||
if ( response.data.success) {
|
||||
this.currencies = response.data.data;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.onChangeCurrency();
|
||||
});
|
||||
}
|
||||
|
||||
this.currencies.forEach(function (currency, index) {
|
||||
if (currency_code == currency.code) {
|
||||
this.currency = currency;
|
||||
|
||||
this.form.currency_code = currency.code;
|
||||
this.form.currency_rate = currency.rate;
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
|
Reference in New Issue
Block a user