Refining the display of available funds.

This commit is contained in:
Brendon Duncan 2018-07-30 18:28:27 +12:00
commit f0ccee8a0a
3 changed files with 11 additions and 5 deletions

View file

@ -316,6 +316,7 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
}); });
} }
updateAvailableFundsStringIfNeeded();
updateUnitUI(); updateUnitUI();
}; };
@ -663,18 +664,21 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
availableUnits[altUnitIndex].name = newAltCurrency.isoCode; availableUnits[altUnitIndex].name = newAltCurrency.isoCode;
availableUnits[altUnitIndex].shortName = newAltCurrency.isoCode; availableUnits[altUnitIndex].shortName = newAltCurrency.isoCode;
fiatCode = newAltCurrency.isoCode; fiatCode = newAltCurrency.isoCode;
updateAvailableFiatIfNeeded(); updateAvailableFundsStringIfNeeded();
updateUnitUI(); updateUnitUI();
close(); close();
}); });
}; };
function updateAvailableFiatIfNeeded() { function updateAvailableFundsStringIfNeeded() {
console.log('updateAvailableFundsStringIfNeeded()');
if (vm.fromWalletId && availableSatoshis !== null) { if (vm.fromWalletId && availableSatoshis !== null) {
console.log('updating');
availableFundsInFiat = ''; availableFundsInFiat = '';
vm.availableFunds = availableFundsInCrypto; vm.availableFunds = availableFundsInCrypto;
var coin = availableUnits[altUnitIndex].isFiat ? availableUnits[unitIndex].id : availableUnits[altUnitIndex].id; var coin = availableUnits[altUnitIndex].isFiat ? availableUnits[unitIndex].id : availableUnits[altUnitIndex].id;
txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){ txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){
console.log('txFormatService returned');
if (formatted) { if (formatted) {
availableFundsInFiat = formatted; availableFundsInFiat = formatted;
if (availableUnits[unitIndex].isFiat) { if (availableUnits[unitIndex].isFiat) {

View file

@ -387,7 +387,7 @@
.extra, .extra,
button.extra { button.extra {
display: flex; /*display: flex;*/
flex: 0 1 auto; flex: 0 1 auto;
} }

View file

@ -44,8 +44,10 @@
<span translate>Change Currency</span> <span translate>Change Currency</span>
</span> </span>
</button> </button>
<div class="extra available-funds" ng-class="{warning: vm.fundsAreInsufficient}" translate> <div class="extra available-funds"
Available Funds: {{vm.availableFunds}}</span> ng-class="{warning: vm.fundsAreInsufficient}"
ng-if="!vm.isRequestingSpecificAmount" translate>
<span>Available Funds:</span>&ensp;<span>{{vm.availableFunds}}</span>
</div> </div>
</div> </div>
</div> </div>