diff --git a/public/views/modals/tx-details.html b/public/views/modals/tx-details.html index 3052c391d..d7145f679 100644 --- a/public/views/modals/tx-details.html +++ b/public/views/modals/tx-details.html @@ -1,33 +1,26 @@ - + - Close + {{'Close' | translate}} - Transaction + {{title}} - + - - - Received - - - - Sent - - - - Moved - + + + + {{btx.amountStr}} - + + {{alternativeAmountStr}} @@ -36,17 +29,34 @@ + + + Sent from {{wallet.credentials.walletName}} + + + + + + + + + + Received Funds + + + + Moved Funds + + - - - Details - - To - + + + + {{btx.merchant.domain}} {{btx.merchant.domain}} @@ -55,60 +65,27 @@ {{btx.labelTo}} - - - - - Recipients - {{btx.recipientCount}} - - - - - - + - - - This transaction has become invalid; possibly due to a double spend attempt. + + + View transaction on the blockchain + + + + Created by + {{btx.creatorName}} + + {{ btx.createdOn * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}} - + - - Date - - {{ btx.time * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}} - ({{ btx.time * 1000 | amTimeAgo}}) - - - - - Fee - {{btx.feeStr}} - - - - Description - {{btx.message}} - - - - Merchant message - - {{btx.merchant.pr.pd.memo}} - - - - - Confirmations - + + Fee + {{btx.feeLevel}} ({{btx.feeStr}}) + Unconfirmed @@ -118,42 +95,73 @@ {{btx.safeConfirmed}} + Confirmations - - - - Comment - {{btx.note.body}} - - Edited by {{btx.note.editedByName}}, - {{btx.note.editedOn * 1000 | amTimeAgo}} - - - - - - Participants - - - - - - {{c.copayerName}} ({{'Me'|translate}}) - - - - - See it on the blockchain - + + Description + {{btx.message}} - - - Add comment - Edit comment - + + + Merchant message + + {{btx.merchant.pr.pd.memo}} + + + + + Recipients + {{btx.recipientCount}} + + + + + + + + + + + This transaction has become invalid; possibly due to a double spend attempt. + + + + + Add Memo + Memo + + + {{btx.note.body}} + + Edited by {{btx.note.editedByName}}, + {{btx.note.editedOn * 1000 | amTimeAgo}} + + + + + + Timeline + + + + + {{$index + 1}} + + + {{a.description}} + + {{a.by}} + + {{ a.time * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}} + + + + + diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index 3de9cda31..2324ac4b9 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -1,43 +1,71 @@ 'use strict'; -angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo, externalLinkService) { - +angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $scope, $filter, $stateParams, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) { var self = $scope.self; var wallet = profileService.getWallet($stateParams.walletId); var config = configService.getSync(); var configWallet = config.wallet; var walletSettings = configWallet.settings; - $scope.alternativeIsoCode = walletSettings.alternativeIsoCode; - $scope.color = wallet.color; - $scope.copayerId = wallet.credentials.copayerId; - $scope.isShared = wallet.credentials.n > 1; + $scope.init = function() { + $scope.alternativeIsoCode = walletSettings.alternativeIsoCode; + $scope.color = wallet.color; + $scope.copayerId = wallet.credentials.copayerId; + $scope.isShared = wallet.credentials.n > 1; - $scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName; - $scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName; + $scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName; + $scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName; + $scope.btx.feeLevel = walletSettings.feeLevel; - $scope.showCommentPopup = function() { - $scope.data = { - comment: $scope.btx.note ? $scope.btx.note.body : '', + if ($scope.btx.action != 'invalid') { + if ($scope.btx.action == 'sent') $scope.title = gettextCatalog.getString('Sent Funds'); + if ($scope.btx.action == 'received') $scope.title = gettextCatalog.getString('Received Funds'); + if ($scope.btx.action == 'moved') $scope.title = gettextCatalog.getString('Moved Funds'); + } + initActionList(); + }; + + function initActionList() { + $scope.actionList = []; + if ($scope.btx.action != 'sent' || !$scope.isShared) return; + + var actionDescriptions = { + created: gettextCatalog.getString('Proposal Created'), + accept: gettextCatalog.getString('Accepted'), + reject: gettextCatalog.getString('Rejected'), + broadcasted: gettextCatalog.getString('Broadcasted'), }; - var commentPopup = $ionicPopup.show({ - templateUrl: "views/includes/note.html", - scope: $scope, + $scope.actionList.push({ + type: 'created', + time: $scope.btx.createdOn, + description: actionDescriptions['created'], + by: $scope.btx.creatorName }); - $scope.commentPopupClose = function() { - commentPopup.close(); - }; + lodash.each($scope.btx.actions, function(action) { + $scope.actionList.push({ + type: action.type, + time: action.createdOn, + description: actionDescriptions[action.type], + by: action.copayerName + }); + }); + + $scope.actionList.push({ + type: 'broadcasted', + time: $scope.btx.time, + description: actionDescriptions['broadcasted'], + }); + }; + + $scope.showCommentPopup = function() { + popupService.showPrompt(gettextCatalog.getString('Memo'), ' ', {}, function(res) { + $log.debug('Saving memo'); - $scope.commentPopupSave = function() { - $log.debug('Saving note'); var args = { txid: $scope.btx.txid, - }; - - if ($scope.data.comment) { - args.body = $scope.data.comment; + body: res }; wallet.editTxNote(args, function(err) { @@ -49,14 +77,17 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio $scope.btx.note = null; if (args.body) { $scope.btx.note = {}; - $scope.btx.note.body = $scope.data.comment; + $scope.btx.note.body = res; $scope.btx.note.editedByName = wallet.credentials.copayerName; $scope.btx.note.editedOn = Math.floor(Date.now() / 1000); } $scope.btx.searcheableString = null; - commentPopup.close(); + + $timeout(function() { + $scope.$apply(); + }, 200); }); - }; + }); }; $scope.getAlternativeAmount = function() { diff --git a/src/sass/main.scss b/src/sass/main.scss index 28823794d..1fa71938e 100644 --- a/src/sass/main.scss +++ b/src/sass/main.scss @@ -994,3 +994,4 @@ input[type=number] { @import "views/includes/walletActivity"; @import "views/includes/wallets"; @import "views/includes/modals/modals"; +@import "views/includes/tx-details"; diff --git a/src/sass/views/includes/tx-details.scss b/src/sass/views/includes/tx-details.scss new file mode 100644 index 000000000..5248dcab8 --- /dev/null +++ b/src/sass/views/includes/tx-details.scss @@ -0,0 +1,13 @@ +#tx-details { + .action-created.action-accepted { + color: green; + } + + .action-rejected { + color: red; + } +} + + + +
Received
Sent
Moved