Disable Sendform when sending a transaction

This commit is contained in:
Gustavo Maximiliano Cortez 2015-02-13 16:34:12 -03:00
parent 112c1adc11
commit 575e99b490
2 changed files with 27 additions and 44 deletions

View File

@ -183,35 +183,33 @@ angular.module('copayApp.controllers').controller('SendController',
}
$scope.loading = true;
$scope.creatingTX = true;
if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = true;
$timeout(function () {
var comment = form.comment.$modelValue;
var merchantData = $scope._merchantData;
var address, amount;
if (!merchantData) {
address = form.address.$modelValue;
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
}
var comment = form.comment.$modelValue;
var merchantData = $scope._merchantData;
var address, amount;
if (!merchantData) {
address = form.address.$modelValue;
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
}
w.spend({
merchantData: merchantData,
toAddress: address,
amountSat: amount,
comment: comment,
}, function (err, txid, status) {
$scope.loading = false;
$scope.creatingTX = false;
if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = false;
w.spend({
merchantData: merchantData,
toAddress: address,
amountSat: amount,
comment: comment,
}, function (err, txid, status) {
$scope.loading = false;
if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = false;
if (err)
return $scope.setError(err);
txStatus.notify(status);
$scope.resetForm();
});
if (err)
return $scope.setError(err);
txStatus.notify(status);
$scope.resetForm();
});
}, 100);
};

View File

@ -1,5 +1,5 @@
<div class="send" ng-controller="SendController" ng-init="init()">
<div class="columns" ng-show="$root.wallet.balanceInfo.lockedBalance && !walletSelection">
<div class="columns" ng-show="$root.wallet.balanceInfo.lockedBalance">
<div class="panel">
<div class="left">
<i class="fi-info size-42 m10r"></i>
@ -32,25 +32,9 @@
</div>
</div>
<div class="row" ng-show="creatingTX">
<div class="large-12 columns">
<div class="panel">
<div class="box-notification">
<div class="box-icon secondary">
<i class="fi-bitcoin-circle icon-rotate spinner size-24"></i>
</div>
<span class="text-secondary size-14">
Creating Transaction...
</span>
</div>
</div>
</div>
</div>
<div class="row" ng-show="!fetchingURL && !creatingTX">
<div class="row" ng-show="!fetchingURL">
<div class="large-8 large-centered columns">
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
<form name="sendForm" ng-submit="submitForm(sendForm)" ng-disabled="loading" novalidate>
<div class="panel">
<div class="box-notification" ng-show="error && !hideForWP ">
<div class="box-icon error">
@ -159,7 +143,7 @@
<div class="row">
<div class="large-6 medium-6 small-12 columns text-right">
<button type="submit" class="button primary expand" ng-disabled="sendForm.$invalid || loading">
<i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i> Send
Send
</button>
</div>
<div class="large-4 medium-4 small-12 columns text-left">
@ -171,7 +155,8 @@
<a translate class="button radius tiny warning" ng-click="cancelScanner()"><i class="fi-x size-18"></i> </a>
</div>
</div>
<a ng-click="resetForm()" class="button expand warning m0" ng-show="_merchantData || lockAddress" ng-disabled="loading">Cancel</a>
<a ng-click="resetForm()" class="button expand warning m0"
ng-show="(_merchantData || lockAddress) && !loading">Cancel</a>
</div>
</div>
</div>