display fiat amount on transaction history screen

This commit is contained in:
Kadir Sekha 2018-01-31 14:52:14 -04:00
commit e25187850f
2 changed files with 23 additions and 7 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window, bwcError, gettextCatalog, timeService, feeService, appConfigService) {
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window, bwcError, gettextCatalog, timeService, feeService, appConfigService, rateService) {
var HISTORY_SHOW_LIMIT = 10;
var currentTxHistoryPage = 0;
@ -182,7 +182,16 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
}
applyCurrencyAliases(txHistory);
$scope.completeTxHistory = txHistory;
var config = configService.getSync();
var fiatCode = config.wallet.settings.alternativeIsoCode;
lodash.each(txHistory, function(t) {
var r = rateService.toFiat(t.amount, fiatCode, $scope.wallet.coin);
t.alternativeAmountStr = r.toFixed(2) + ' ' + fiatCode;
});
$scope.completeTxHistory = txHistory;
$scope.showHistory();
$timeout(function() {
$scope.$apply();

View file

@ -22,6 +22,10 @@
<div ng-show="btx.action == 'received'" class="ellipsis">
<div ng-if="btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
<div ng-if="!btx.note.body" class="wallet-details__tx-message ellipsis" translate>Received</div>
<time class="wallet-details__tx-time" ng-if="btx.time && createdWithinPastDay(btx.time * 1000)">{{btx.time * 1000 | amTimeAgo}} &emsp;</time>
<time class="wallet-details__tx-time" ng-if="btx.time && !createdWithinPastDay(btx.time * 1000)">
{{btx.time * 1000 | amDateFormat:'MMM D, YYYY'}} &emsp;
</time>
<div class="low-fees" ng-if="btx.lowFees">
<i class="icon"><img src="img/icon-warning.png" width="20px"></i>
<span class="comment" translate>Low fees</span>
@ -40,6 +44,10 @@
{{addressbook[btx.addressTo].name || addressbook[btx.addressTo]}}
</div>
<div ng-if="!btx.message && !btx.note.body && !addressbook[btx.addressTo]" translate>Sent</div>
<time class="wallet-details__tx-time" ng-if="btx.time && createdWithinPastDay(btx.time * 1000)">{{btx.time * 1000 | amTimeAgo}} &emsp;</time>
<time class="wallet-details__tx-time" ng-if="btx.time && !createdWithinPastDay(btx.time * 1000)">
{{btx.time * 1000 | amDateFormat:'MMM D, YYYY'}} &emsp;
</time>
</div>
<div ng-show="btx.action == 'moved'" class="ellipsis">
@ -64,15 +72,14 @@
<span class="size-12" ng-if="btx.action == 'invalid'" translate>
(possible double spend)
</span>
<span ng-if="btx.action != 'invalid'">
<span ng-if="btx.action != 'invalid'">
{{btx.amountValueStr}} {{btx.amountUnitStr}}
</span>
</span>
<div>
<time class="wallet-details__tx-time" ng-if="btx.time && createdWithinPastDay(btx.time * 1000)">{{btx.time * 1000 | amTimeAgo}}</time>
<time class="wallet-details__tx-time" ng-if="btx.time && !createdWithinPastDay(btx.time * 1000)">
{{btx.time * 1000 | amDateFormat:'MMM D, YYYY'}}
</time>
<span class="size-12 wallet-details__tx-amount" ng-class="{'wallet-details__tx-amount--recent': btx.recent, 'wallet-details__tx-amount--received': btx.action == 'received', 'wallet-details__tx-amount--sent': btx.action == 'sent'}">
{{btx.alternativeAmountStr}}
</span>
</div>
</span>
</div>