From 7642e524d61321474b08fbdf4a303c22b0bf9167 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 4 Dec 2014 13:42:50 -0300 Subject: [PATCH] add modal in Tx history --- css/src/mobile.css | 6 -- js/controllers/history.js | 75 ++++++++++----- views/history.html | 173 ++++++++++++----------------------- views/modals/tx-details.html | 91 ++++++++++++++++++ 4 files changed, 201 insertions(+), 144 deletions(-) create mode 100644 views/modals/tx-details.html diff --git a/css/src/mobile.css b/css/src/mobile.css index def7b760d..24116e58e 100644 --- a/css/src/mobile.css +++ b/css/src/mobile.css @@ -229,12 +229,6 @@ } @media (max-width: 640px) { - .tx-date { - margin-bottom: 10px; - padding-bottom: 10px; - border-bottom: 1px solid #eee; - } - .tx-comment { border-top: 1px solid #eee; padding-top: 10px; diff --git a/js/controllers/history.js b/js/controllers/history.js index c3c875b8a..77c632d97 100644 --- a/js/controllers/history.js +++ b/js/controllers/history.js @@ -2,7 +2,7 @@ var bitcore = require('bitcore'); angular.module('copayApp.controllers').controller('HistoryController', - function($scope, $rootScope, $filter, $timeout, rateService, notification) { + function($scope, $rootScope, $filter, $timeout, $modal, rateService, notification) { var w = $rootScope.wallet; $rootScope.title = 'History'; @@ -28,14 +28,27 @@ angular.module('copayApp.controllers').controller('HistoryController', var filename = "copay_history.csv"; var descriptor = { - columns: [ - { label: 'Date', property: 'ts', type: 'date' }, - { label: 'Amount (' + w.settings.unitName + ')', property: 'amount', type: 'number' }, - { label: 'Amount (' + w.settings.alternativeIsoCode + ')', property: 'alternativeAmount' }, - { label: 'Action', property: 'action' }, - { label: 'AddressTo', property: 'addressTo' }, - { label: 'Comment', property: 'comment' }, - ], + columns: [{ + label: 'Date', + property: 'ts', + type: 'date' + }, { + label: 'Amount (' + w.settings.unitName + ')', + property: 'amount', + type: 'number' + }, { + label: 'Amount (' + w.settings.alternativeIsoCode + ')', + property: 'alternativeAmount' + }, { + label: 'Action', + property: 'action' + }, { + label: 'AddressTo', + property: 'addressTo' + }, { + label: 'Comment', + property: 'comment' + }, ], }; if (w.isShared()) { descriptor.columns.push({ @@ -58,8 +71,8 @@ angular.module('copayApp.controllers').controller('HistoryController', notification.error('Could not get transaction history'); return; } - $scope._addRates(w, res.items, function (err) { - copay.csv.toCsv(res.items, descriptor, function (err, res) { + $scope._addRates(w, res.items, function(err) { + copay.csv.toCsv(res.items, descriptor, function(err, res) { if (err) { $scope.generating = false; logger.error(err); @@ -91,7 +104,7 @@ angular.module('copayApp.controllers').controller('HistoryController', }, 1); }; - $scope._getTransactions = function (w, opts, cb) { + $scope._getTransactions = function(w, opts, cb) { w.getTransactionHistory(opts, function(err, res) { if (err) return cb(err); if (!res) return cb(); @@ -107,7 +120,7 @@ angular.module('copayApp.controllers').controller('HistoryController', }); }; - $scope._addRates = function (w, txs, cb) { + $scope._addRates = function(w, txs, cb) { if (!txs || txs.length == 0) return cb(); var index = _.indexBy(txs, 'rateTs'); rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) { @@ -122,6 +135,29 @@ angular.module('copayApp.controllers').controller('HistoryController', }); }; + + $scope.openTxModal = function(btx) { + var ModalInstanceCtrl = function($scope, $modalInstance) { + $scope.btx = btx; + + $scope.getShortNetworkName = function() { + var w = $rootScope.wallet; + return w.getNetworkName().substring(0, 4); + }; + + + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + }; + + $modal.open({ + templateUrl: 'views/modals/tx-details.html', + windowClass: 'tiny', + controller: ModalInstanceCtrl, + }); + }; + $scope.getTransactions = function() { var w = $rootScope.wallet; if (!w) return; @@ -142,10 +178,10 @@ angular.module('copayApp.controllers').controller('HistoryController', } var items = res.items; - $scope._addRates(w, items, function (err) { - $timeout(function() { - $scope.$digest(); - }, 1); + $scope._addRates(w, items, function(err) { + $timeout(function() { + $scope.$digest(); + }, 1); }) $scope.blockchain_txs = w.cached_txs = items; @@ -164,9 +200,4 @@ angular.module('copayApp.controllers').controller('HistoryController', return actions.hasOwnProperty('create'); }; - $scope.getShortNetworkName = function() { - var w = $rootScope.wallet; - return w.getNetworkName().substring(0, 4); - }; - }); diff --git a/views/history.html b/views/history.html index 1f6ee583b..5bcaa1ef1 100644 --- a/views/history.html +++ b/views/history.html @@ -1,141 +1,82 @@
-
-
-

{{$root.title}}

-
- - Loading... -
-
- No transactions yet. -
+
+
+

{{$root.title}}

+
+ + Loading... +
+
+ No transactions yet.
-
-
-
-
-
-
-
- - - - - - -
- - - Unconfirmed - -
-
+
+
+
+
+
-
-
+
+ + + Unconfirmed + +
+
+ +
+
- {{btx.amount}} {{$root.wallet.settings.unitName}} - {{btx.alternativeAmount}} {{$root.wallet.settings.alternativeIsoCode}} -
- -
-
- -
-
- -
- {{btx.labelTo || btx.addressTo}} -
- -
-
- {{btx.comment}}
-
- - - -
-
-
-

- {{btx.merchant.pr.pd.memo}} -

- {{btx.paymentAckMemo}} - [{{btx.merchant.domain}}] - -

- - - - - - - - -
- - - - - {{c.cId === $root.wallet.getMyCopayerId() ? 'Me' : $root.wallet.publicKeyRing.nicknameForCopayer(c.cId)}} -
-
-
- More details - Transaction ID: {{btx.txid}}
+ +
+
+ {{btx.comment}} +
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+ + Generating file... +
+
-
-
-
-
- -
-
-
- - Generating file... -
- -
-
-
+
diff --git a/views/modals/tx-details.html b/views/modals/tx-details.html new file mode 100644 index 000000000..eefaed3cb --- /dev/null +++ b/views/modals/tx-details.html @@ -0,0 +1,91 @@ + +× + +

Transaction Details

+
+
+ ID: {{btx.txid}} +
+
+ + : + +
+ + +
+
+
+ +
+
+ + +
+
+ {{btx.amount}} {{$root.wallet.settings.unitName}} + + {{btx.alternativeAmount}} {{$root.wallet.settings.alternativeIsoCode}} + +
+
+
+ +
+ + Unconfirmed + + + Confirmations:{{btx.confirmations}} + +
+ +
+ To: {{btx.labelTo || btx.addressTo}} +
+ +
+ Payment Protocol Information: +
{{btx.merchant.pr.pd.memo}} +
{{btx.paymentAckMemo}} + [{{btx.merchant.domain}}] +
+ +
+ Copayers Actions + + + + + + + + +
+ + + + + {{c.cId === $root.wallet.getMyCopayerId() ? 'Me' : $root.wallet.publicKeyRing.nicknameForCopayer(c.cId)}} +
+
+ + +
+ +