Ref BitPay Card TX list

This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-21 20:33:28 -03:00
commit 15c20f38ac
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
4 changed files with 48 additions and 21 deletions

View file

@ -3,6 +3,7 @@
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, $state, lodash, bitpayCardService, moment, popupService, gettextCatalog, $ionicHistory) {
var self = this;
var runningBalance;
$scope.dateRange = { value: 'last30Days'};
$scope.network = bitpayCardService.getEnvironment();
@ -68,10 +69,14 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
self.getStarted = getStarted;
var txs = lodash.clone(history.txs);
runningBalance = parseFloat(history.endingBalance);
for (var i = 0; i < txs.length; i++) {
txs[i] = _getMerchantInfo(txs[i]);
txs[i].icon = _getIconName(txs[i]);
txs[i].desc = _processDescription(txs[i]);
txs[i].price = _price(txs[i]);
txs[i].runningBalance = runningBalance;
_runningBalance(txs[i]);
}
self.bitpayCardTransactionHistory = txs;
self.bitpayCardCurrentBalance = history.currentCardBalance;
@ -117,6 +122,14 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
return tx.description;
};
var _price = function(tx) {
return parseFloat(tx.amount) + parseFloat(tx.fee)
};
var _runningBalance = function(tx) {
runningBalance -= parseFloat(tx.amount);
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.cardId = data.stateParams.id;
if (!$scope.cardId) {

View file

@ -401,6 +401,14 @@ input[type=number] {
font-weight: 700;
}
.text-gray {
color: gray;
}
.text-italic {
font-style: italic;
}
.no-border {
border-style: none;
background-color: transparent !important;

View file

@ -34,4 +34,7 @@
padding: 0;
width: 100%;
}
.item-select select {
color: #667;
}
}