Adds historic fiat rate to tx-details
This commit is contained in:
parent
9fa46fd56f
commit
164c775a79
2 changed files with 29 additions and 2 deletions
|
|
@ -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();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@
|
|||
</div>
|
||||
<div class="amount-label">
|
||||
<div class="amount">{{displayAmount}} <span class="unit">{{displayUnit}}</span></div>
|
||||
<div class="alternative">{{btx.alternativeAmountStr}}</div>
|
||||
<div class="alternative" ng-click="getFiatRate(); showRate = !showRate">
|
||||
<span ng-show="!showRate">{{btx.alternativeAmountStr}}</span>
|
||||
<span ng-show="showRate">
|
||||
<span ng-show="!loadingRate">{{rateStr}} ({{rateDate | amDateFormat:'MM/DD/YYYY HH:mm a'}})</span>
|
||||
<span ng-show="loadingRate">...</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue