* Copy available funds to input (amount) on Chrome browser.
* Improve style of topAvailable button.
* Show valid message immediately after copy.
* Hide link if not have funds
This commit is contained in:
Gustavo Cortez 2014-06-25 18:54:08 -03:00
parent c669fc2d17
commit 2de90d093e
3 changed files with 18 additions and 4 deletions

View File

@ -635,3 +635,9 @@ ul.pagination li.current a:hover, ul.pagination li.current a:focus {
color:white;
}
.input-note {
margin-top: -10px;
display: block;
margin-bottom: 1rem;
}

View File

@ -678,7 +678,6 @@
<div class="row collapse">
<label for="amount">Amount
<small ng-hide="!sendForm.amount.$pristine">required</small>
<i class="fi-arrow-up" title="Send all funds" ng-click="topAmount()"></i>
<small class="is-valid" ng-show="!sendForm.amount.$invalid && !sendForm.amount.$pristine">Valid</small>
<small class="has-error" ng-show="sendForm.amount.$invalid && !sendForm.amount.$pristine && !notEnoughAmount">
Not valid
@ -691,6 +690,11 @@
min="0.0001" max="10000000000" enough-amount required
autocomplete="off"
>
<a class="small input-note" title="Send all funds"
ng-show="$root.availableBalance > 0"
ng-click="topAmount(sendForm)">
Use all funds ({{getAvailableAmount()}} {{$root.unitName}})
</a>
</div>
<div class="small-3 columns">
<span class="postfix">{{$root.unitName}}</span>

View File

@ -267,8 +267,12 @@ angular.module('copayApp.controllers').controller('SendController',
});
};
$scope.topAmount = function() {
var maxSat = ($rootScope.availableBalance * config.unitToSatoshi).toFixed(0) - bitcore.TransactionBuilder.FEE_PER_1000B_SAT;
$scope.amount = maxSat / config.unitToSatoshi;
$scope.getAvailableAmount = function() {
return ((($rootScope.availableBalance * config.unitToSatoshi).toFixed(0) - bitcore.TransactionBuilder.FEE_PER_1000B_SAT) / config.unitToSatoshi);
};
$scope.topAmount = function(form) {
$scope.amount = $scope.getAvailableAmount();
form.amount.$pristine = false;
};
});