From 38495f11b78b4dd22451855adfe086287bfba5d4 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sat, 3 Jan 2015 20:32:31 -0300 Subject: [PATCH] send form --- js/controllers/send.js | 50 +++++++++++++++++++++++++----------------- views/send.html | 18 ++++++++++++++- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index 53f84f207..3f6e029be 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -3,7 +3,7 @@ var bitcore = require('bitcore'); var preconditions = require('preconditions').singleton(); angular.module('copayApp.controllers').controller('SendController', - function($scope, $rootScope, $window, $timeout, $modal, $filter, notification, isMobile, rateService, txStatus) { + function($scope, $rootScope, $window, $timeout, $modal, $filter, notification, isMobile, rateService, txStatus, isCordova) { var satToUnit; @@ -73,7 +73,7 @@ angular.module('copayApp.controllers').controller('SendController', } $timeout(function() { $rootScope.$digest(); - }, 1); + }, 100); }; $scope.setInputs = function() { @@ -178,25 +178,35 @@ angular.module('copayApp.controllers').controller('SendController', } $scope.loading = true; - 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)); - } + $scope.creatingTX = true; + if ($scope.isWindowsPhoneApp) + $rootScope.wpInputFocused = true; - w.spend({ - merchantData: merchantData, - toAddress: address, - amountSat: amount, - comment: comment, - }, function(err, txid, status) { - $scope.loading = false; - if (err) - return $scope.setError(err); - txStatus.notify(status); - $scope.resetForm(); + $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)); + } + + 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; + + if (err) + return $scope.setError(err); + txStatus.notify(status); + $scope.resetForm(); + }); }); }; diff --git a/views/send.html b/views/send.html index 7e226e47d..168aecf06 100644 --- a/views/send.html +++ b/views/send.html @@ -28,8 +28,24 @@ + +
+
+
+
+
+ +
+ + Creating Transaction... + +
+
+
+
-
+ +