First code for #658

This commit is contained in:
James Cole
2017-07-07 17:51:14 +02:00
parent e62b979708
commit 19774f32c2
5 changed files with 64 additions and 37 deletions

View File

@@ -23,7 +23,6 @@ $(document).ready(function () {
updateForm();
updateLayout();
updateDescription();
updateNativeCurrency();
// when user changes source account or destination, native currency may be different.
@@ -60,9 +59,15 @@ function getExchangeInstructions() {
* There is an input that shows the currency symbol that is native to the selected
* acccount. So when the user changes the selected account, the native currency is updated:
*/
function updateNativeCurrency() {
var newAccountId = getAccountId();
var nativeCurrencyId = accountInfo[newAccountId].preferredCurrency;
function updateNativeCurrency(useAccountCurrency) {
var nativeCurrencyId;
if (useAccountCurrency) {
var newAccountId = getAccountId();
nativeCurrencyId = accountInfo[newAccountId].preferredCurrency;
}
if (!useAccountCurrency) {
nativeCurrencyId = overruleCurrency;
}
$('.currency-option[data-id="' + nativeCurrencyId + '"]').click();
$('[data-toggle="dropdown"]').parent().removeClass('open');
@@ -180,7 +185,9 @@ function updateForm() {
default:
break;
}
updateNativeCurrency();
// get instructions all the time.
updateNativeCurrency(useAccountCurrency);
selectsForeignCurrency();
}
/**