add not available message

This commit is contained in:
Javier 2016-08-24 12:29:22 -03:00
commit 8a88e712e1
4 changed files with 8 additions and 1 deletions

View file

@ -42,6 +42,7 @@
<div class="item item-icon-left">
<i class="icon ion-briefcase size-21"></i>
<label translate>From</label>
<span class="badge badge-assertive" ng-show="content.notAvailable" translate>Not available</span>
</div>
<wallets only-complete="true" network="{{network}}" min-balance="{{minBalance}}"></wallets>

View file

@ -92,6 +92,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
};
$scope.init = function() {
$scope.notAvailable = false;
$scope.wallet = profileService.getWallets()[0];
if ($stateParams.paypro) {

View file

@ -47,6 +47,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
$log.debug('No wallet provided');
return;
}
$scope.defaultWallet = wallet;
$log.debug('Wallet changed: ' + wallet.name);
$scope.setAddress(wallet);
});

View file

@ -156,6 +156,7 @@ angular.module('copayApp.directives')
scope.content = {};
scope.content.wallets = [];
scope.content.notAvailable = false;
var minBalance = attrs.minBalance ? parseInt(attrs.minBalance) : 0;
var wallets = profileService.getWallets(opts);
var filteredWallets = [];
@ -182,13 +183,16 @@ angular.module('copayApp.directives')
if (!lodash.isEmpty(filteredWallets)) {
scope.content.wallets = filteredWallets;
scope.$emit('Wallet/Changed', scope.content.wallets[0]);
} else {
scope.content.notAvailable = true;
$log.warn('No wallet available to make the payment');
}
return;
}
walletService.getStatus(wallets[index], {}, function(err, status) {
if (err) $log.error(err);
if (!status.availableBalanceSat) $log.debug('Balance not available on wallet: ' + wallets[index].name);
if (!status.availableBalanceSat) $log.debug('No balance available in: ' + wallets[index].name);
if (status.availableBalanceSat > minBalance) filteredWallets.push(wallets[index]);
index++;
filterWallet();