added all currencies in global mix
This commit is contained in:
parent
6a392fd9d2
commit
4ebe2ae51d
39
resources/assets/js/mixins/global.js
vendored
39
resources/assets/js/mixins/global.js
vendored
@ -70,6 +70,7 @@ export default {
|
|||||||
"decimal_mark":".",
|
"decimal_mark":".",
|
||||||
"thousands_separator":",",
|
"thousands_separator":",",
|
||||||
},
|
},
|
||||||
|
all_currencies: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -83,6 +84,10 @@ export default {
|
|||||||
if (aka_currency) {
|
if (aka_currency) {
|
||||||
this.currency = aka_currency;
|
this.currency = aka_currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof all_currencies !== 'undefined' && all_currencies) {
|
||||||
|
this.all_currencies = all_currencies;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@ -210,6 +215,10 @@ export default {
|
|||||||
|
|
||||||
// Change bank account get money and currency rate
|
// Change bank account get money and currency rate
|
||||||
onChangeAccount(account_id) {
|
onChangeAccount(account_id) {
|
||||||
|
if (!account_id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
axios.get(url + '/banking/accounts/currency', {
|
axios.get(url + '/banking/accounts/currency', {
|
||||||
params: {
|
params: {
|
||||||
account_id: account_id
|
account_id: account_id
|
||||||
@ -227,19 +236,31 @@ export default {
|
|||||||
|
|
||||||
// Change currency get money
|
// Change currency get money
|
||||||
onChangeCurrency(currency_code) {
|
onChangeCurrency(currency_code) {
|
||||||
axios.get(url + '/settings/currencies/currency', {
|
if (!currency_code) {
|
||||||
params: {
|
return;
|
||||||
code: currency_code
|
}
|
||||||
|
|
||||||
|
if (!this.all_currencies.length) {
|
||||||
|
let currency_promise = Promise.resolve(window.axios.get((url + '/settings/currencies')));
|
||||||
|
|
||||||
|
currency_promise.then(response => {
|
||||||
|
if ( response.data.success) {
|
||||||
|
this.all_currencies = response.data.data;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
|
||||||
this.currency = response.data;
|
|
||||||
|
|
||||||
this.form.currency_code = response.data.code;
|
|
||||||
this.form.currency_rate = response.data.rate;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
this.onChangeCurrency(currency_code);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.all_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);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pages limit change
|
// Pages limit change
|
||||||
|
Loading…
x
Reference in New Issue
Block a user