From ade2fb1c806c5137f029c82f1c3b73bf92259503 Mon Sep 17 00:00:00 2001 From: Marty Alcala Date: Fri, 21 Oct 2016 17:16:35 -0400 Subject: [PATCH] get memos working --- src/js/controllers/modals/txDetails.js | 19 ++++++++++++++++++- www/views/modals/tx-details.html | 25 ++++++++++++++++++++----- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index b5c13717e..09aa59af8 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -28,18 +28,32 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio if ($scope.btx.action == 'moved') $scope.title = gettextCatalog.getString('Moved Funds'); } + //$scope.toAmount = parseInt($scope.toAmount); + //$scope.amountStr = txFormatService.formatAmountStr($scope.toAmount); + $scope.displayAmount = getDisplayAmount($scope.btx.amountStr); + $scope.displayUnit = getDisplayUnit($scope.btx.amountStr); + updateMemo(); initActionList(); getAlternativeAmount(); }; + function getDisplayAmount(amountStr) { + return amountStr.split(' ')[0]; + } + + function getDisplayUnit(amountStr) { + return amountStr.split(' ')[1]; + } + function updateMemo() { + console.log('in updateMemo()'); walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) { if (err) { $log.warn('Could not fetch transaction note: ' + err); return; } - + console.log('note', note); if (!note) return; $scope.btx.note = note; @@ -94,6 +108,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio $scope.showCommentPopup = function() { var opts = {}; + if($scope.btx.message) { + opts.defaultText = $scope.btx.message; + } if ($scope.btx.note && $scope.btx.note.body) opts.defaultText = $scope.btx.note.body; popupService.showPrompt(wallet.name, gettextCatalog.getString('Memo'), opts, function(text) { diff --git a/www/views/modals/tx-details.html b/www/views/modals/tx-details.html index 9647b9d52..30a882231 100644 --- a/www/views/modals/tx-details.html +++ b/www/views/modals/tx-details.html @@ -58,17 +58,32 @@
{{wallet.name}}
- - Add Memo + + Memo - {{description}} + + {{btx.note.body || btx.message}} + +
- Fee: {{feeLevel}} + Fee - {{fee || '...'}} + {{btx.feeStr}}