views/modals/tx-status.html
This commit is contained in:
parent
475f6ea29e
commit
bba7b50539
2 changed files with 43 additions and 31 deletions
|
|
@ -3,7 +3,7 @@ var bitcore = require('bitcore');
|
||||||
var preconditions = require('preconditions').singleton();
|
var preconditions = require('preconditions').singleton();
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('SendController',
|
angular.module('copayApp.controllers').controller('SendController',
|
||||||
function($scope, $rootScope, $window, $timeout, $modal, $filter, $location, isMobile, notification, rateService) {
|
function($scope, $rootScope, $window, $timeout, $modal, $filter, notification, isMobile, rateService) {
|
||||||
|
|
||||||
var satToUnit, unitToSat, w;
|
var satToUnit, unitToSat, w;
|
||||||
|
|
||||||
|
|
@ -154,11 +154,17 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
amountSat: amount,
|
amountSat: amount,
|
||||||
comment: comment,
|
comment: comment,
|
||||||
}, function(err, txid, status) {
|
}, function(err, txid, status) {
|
||||||
|
console.log('[send.js.156:txid:]', txid); //TODO
|
||||||
|
console.log('[send.js.156:status:]', status); //TODO
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
||||||
|
console.log('[send.js.158]'); //TODO
|
||||||
if (err)
|
if (err)
|
||||||
return $scope.setError(err);
|
return $scope.setError(err);
|
||||||
|
|
||||||
|
|
||||||
|
console.log('[send.js.162:status:]', status); //TODO
|
||||||
|
|
||||||
$scope.resetForm(status);
|
$scope.resetForm(status);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -307,20 +313,21 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.notifyStatus = function(status) {
|
$scope.notifyStatus = function(status) {
|
||||||
if (status == copay.Wallet.TX_BROADCASTED)
|
var msg;
|
||||||
$scope.success = 'Transaction broadcasted!';
|
|
||||||
else if (status == copay.Wallet.TX_PROPOSAL_SENT)
|
|
||||||
$scope.success = 'Transaction proposal created';
|
|
||||||
else if (status == copay.Wallet.TX_SIGNED)
|
|
||||||
$scope.success = 'Transaction proposal was signed';
|
|
||||||
else if (status == copay.Wallet.TX_SIGNED_AND_BROADCASTED)
|
|
||||||
$scope.success = 'Transaction signed and broadcasted!';
|
|
||||||
else
|
|
||||||
$scope.error = status;
|
|
||||||
|
|
||||||
$timeout(function() {
|
if (status == copay.Wallet.TX_BROADCASTED)
|
||||||
$scope.$digest();
|
msg = 'Transaction broadcasted!';
|
||||||
});
|
else if (status == copay.Wallet.TX_PROPOSAL_SENT)
|
||||||
|
msg = 'Transaction proposal created';
|
||||||
|
else if (status == copay.Wallet.TX_SIGNED)
|
||||||
|
msg = 'Transaction proposal was signed';
|
||||||
|
else if (status == copay.Wallet.TX_SIGNED_AND_BROADCASTED)
|
||||||
|
msg = 'Transaction signed and broadcasted!';
|
||||||
|
|
||||||
|
if (msg)
|
||||||
|
$scope.openTxStatusModal(msg);
|
||||||
|
else
|
||||||
|
$scope.error = status;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -377,14 +384,13 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
form.comment.$render();
|
form.comment.$render();
|
||||||
form.$setPristine();
|
form.$setPristine();
|
||||||
|
|
||||||
|
if (form.address) {
|
||||||
|
form.address.$pristine = true;
|
||||||
|
form.address.$setViewValue('');
|
||||||
|
form.address.$render();
|
||||||
|
}
|
||||||
$scope.notifyStatus(status);
|
$scope.notifyStatus(status);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
if (form.address) {
|
|
||||||
form.address.$pristine = true;
|
|
||||||
form.address.$setViewValue('');
|
|
||||||
form.address.$render();
|
|
||||||
}
|
|
||||||
|
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
}, 1);
|
}, 1);
|
||||||
};
|
};
|
||||||
|
|
@ -408,6 +414,19 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.openTxStatusModal = function(statusStr) {
|
||||||
|
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||||
|
$scope.statusStr = statusStr;
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$modalInstance.dismiss('cancel');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
$modal.open({
|
||||||
|
templateUrl: 'views/modals/tx-status.html',
|
||||||
|
windowClass: 'tiny',
|
||||||
|
controller: ModalInstanceCtrl,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.setFromPayPro = function(uri) {
|
$scope.setFromPayPro = function(uri) {
|
||||||
console.log('[send.js.391:uri:]', uri); //TODO
|
console.log('[send.js.391:uri:]', uri); //TODO
|
||||||
|
|
@ -503,6 +522,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
$scope.showForm = !$scope.showForm;
|
$scope.showForm = !$scope.showForm;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO change to modal
|
||||||
$scope.submitAddressBook = function(form) {
|
$scope.submitAddressBook = function(form) {
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -516,7 +536,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
try {
|
try {
|
||||||
w.setAddressBook(entry.address, entry.label);
|
w.setAddressBook(entry.address, entry.label);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('[send.js:583]', e); //TODO
|
copay.logger.warn(e);
|
||||||
errorMsg = e.message;
|
errorMsg = e.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,17 +544,11 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
$scope.error = errorMsg;
|
$scope.error = errorMsg;
|
||||||
} else {
|
} else {
|
||||||
$scope.toggleForm();
|
$scope.toggleForm();
|
||||||
$scope.success = 'New entry has been created';
|
notification.success('Entry created', 'New addressbook entry created')
|
||||||
}
|
}
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
}, 500);
|
}, 1);
|
||||||
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.error = $scope.success = null;
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.close = function() {
|
$scope.close = function() {
|
||||||
|
|
|
||||||
|
|
@ -10,23 +10,21 @@
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
|
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
|
|
||||||
<div class="box-notification" ng-show="error">
|
<div class="box-notification" ng-show="error">
|
||||||
<div class="box-icon error">
|
<div class="box-icon error">
|
||||||
<i class="fi-x size-24"></i>
|
<i class="fi-x size-24"></i>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-warning size-14">
|
<span class="text-warning size-14">
|
||||||
{{error|translate}}
|
{{error|translate}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box-notification" ng-show="success">
|
<div class="box-notification" ng-show="success">
|
||||||
<div class="box-icon success">
|
<div class="box-icon success">
|
||||||
<i class="fi-check size-24"></i>
|
<i class="fi-check size-24"></i>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-success size-14">
|
<span class="text-success size-14">
|
||||||
{{success|translate}}
|
{{success|translate}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="!_merchantData">
|
<div ng-if="!_merchantData">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue