diff --git a/src/js/controllers/tx-details.js b/src/js/controllers/tx-details.js index e41cca9c2..c84304700 100644 --- a/src/js/controllers/tx-details.js +++ b/src/js/controllers/tx-details.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $ionicHistory, $scope, $stateParams, walletService, lodash, gettextCatalog, profileService, configService, externalLinkService, popupService) { +angular.module('copayApp.controllers').controller('txDetailsController', function($log, $ionicHistory, $scope, $stateParams, walletService, lodash, gettextCatalog, profileService, externalLinkService, popupService) { $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.title = gettextCatalog.getString('Transaction'); @@ -130,6 +130,27 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio return n.substring(0, 4); }; + $scope.getFiatRate = function() { + if ($scope.rateDate) return; + var alternativeIsoCode = $scope.wallet.status.alternativeIsoCode; + $scope.loadingRate = true; + $scope.wallet.getFiatRate({ + code: alternativeIsoCode, + ts: $scope.btx.time * 1000 + }, function(err, res) { + $scope.loadingRate = false; + if (err) { + $log.debug('Could not get historic rate'); + return; + } + if (res && res.rate) { + $scope.rateDate = res.fetchedOn; + $scope.rateStr = res.rate + ' ' + alternativeIsoCode; + $scope.$apply(); + } + }); + }; + $scope.cancel = function() { $scope.txDetailsModal.hide(); }; diff --git a/www/views/tx-details.html b/www/views/tx-details.html index 790a34c50..c855b7180 100644 --- a/www/views/tx-details.html +++ b/www/views/tx-details.html @@ -16,7 +16,13 @@
{{displayAmount}} {{displayUnit}}
-
{{btx.alternativeAmountStr}}
+
+ {{btx.alternativeAmountStr}} + + {{rateStr}} ({{rateDate | amDateFormat:'MM/DD/YYYY HH:mm a'}}) + ... + +