mirror of https://github.com/BTCPrivate/copay.git
Fix location and iconName
This commit is contained in:
parent
a9edb90fbe
commit
7a5d32a269
|
@ -62,8 +62,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
self.bitpayCardTransactionHistoryCompleted = null;
|
self.bitpayCardTransactionHistoryCompleted = null;
|
||||||
self.bitpayCardTransactionHistoryConfirming = null;
|
self.bitpayCardTransactionHistoryConfirming = null;
|
||||||
self.bitpayCardTransactionHistoryPreAuth = null;
|
self.bitpayCardTransactionHistoryPreAuth = null;
|
||||||
self.underpaidInvoiceInList = null;
|
|
||||||
self.delayedInvoiceInList = null;
|
|
||||||
self.balance = null;
|
self.balance = null;
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get transactions'));
|
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get transactions'));
|
||||||
return;
|
return;
|
||||||
|
@ -72,16 +70,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
setGetStarted(history, function() {
|
setGetStarted(history, function() {
|
||||||
|
|
||||||
var txs = lodash.clone(history.txs);
|
var txs = lodash.clone(history.txs);
|
||||||
for (var i = 0; i < txs.length; i++) {
|
|
||||||
txs[i].icon = _getIconName(txs[i]);
|
|
||||||
txs[i].desc = _processDescription(txs[i]);
|
|
||||||
|
|
||||||
if (txs[i].merchant.city && txs[i].merchant.state) {
|
|
||||||
txs[i].merchant.location = txs[i].merchant.city + ', ' + txs[i].merchant.state;
|
|
||||||
} else {
|
|
||||||
txs[i].merchant.location = txs[i].merchant.city || txs[i].merchant.state || '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.bitpayCardTransactionHistoryConfirming = bitpayCardService.filterTransactions('confirming', txs);
|
self.bitpayCardTransactionHistoryConfirming = bitpayCardService.filterTransactions('confirming', txs);
|
||||||
self.bitpayCardTransactionHistoryCompleted = bitpayCardService.filterTransactions('completed', txs);
|
self.bitpayCardTransactionHistoryCompleted = bitpayCardService.filterTransactions('completed', txs);
|
||||||
|
@ -110,19 +98,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var _getIconName = function(tx) {
|
|
||||||
var icon = tx.mcc || tx.category || null;
|
|
||||||
if (!icon || bitpayCardService.iconMap[icon] == undefined) return 'default';
|
|
||||||
return bitpayCardService.iconMap[icon];
|
|
||||||
};
|
|
||||||
|
|
||||||
var _processDescription = function(tx) {
|
|
||||||
if (lodash.isArray(tx.description)) {
|
|
||||||
return tx.description[0];
|
|
||||||
}
|
|
||||||
return tx.description;
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.createdWithinPastDay = function(tx) {
|
$scope.createdWithinPastDay = function(tx) {
|
||||||
var result = false;
|
var result = false;
|
||||||
if (tx.date) {
|
if (tx.date) {
|
||||||
|
|
|
@ -38,6 +38,27 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
||||||
return tx;
|
return tx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _getIconName = function(tx) {
|
||||||
|
var icon = tx.mcc || tx.category || null;
|
||||||
|
if (!icon || root.iconMap[icon] == undefined) return 'default';
|
||||||
|
return root.iconMap[icon];
|
||||||
|
};
|
||||||
|
|
||||||
|
var _processDescription = function(tx) {
|
||||||
|
if (lodash.isArray(tx.description)) {
|
||||||
|
return tx.description[0];
|
||||||
|
}
|
||||||
|
return tx.description;
|
||||||
|
};
|
||||||
|
|
||||||
|
var _processLocation = function(tx) {
|
||||||
|
if (tx.merchant.city && tx.merchant.state) {
|
||||||
|
return tx.merchant.city + ', ' + tx.merchant.state;
|
||||||
|
} else {
|
||||||
|
return tx.merchant.city || tx.merchant.state || '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var _fromTransaction = function(txn, runningBalance) {
|
var _fromTransaction = function(txn, runningBalance) {
|
||||||
var dateTime = _buildDate(txn.date, txn.time);
|
var dateTime = _buildDate(txn.date, txn.time);
|
||||||
var merchant = _lowercaseMerchant(txn.merchant);
|
var merchant = _lowercaseMerchant(txn.merchant);
|
||||||
|
@ -102,6 +123,11 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (var i = 0; i < activityList.length; i++) {
|
||||||
|
activityList[i].icon = _getIconName(activityList[i]);
|
||||||
|
activityList[i].desc = _processDescription(activityList[i]);
|
||||||
|
activityList[i].merchant['location'] = _processLocation(activityList[i]);
|
||||||
|
}
|
||||||
return activityList;
|
return activityList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
<div class="tx-title">
|
<div class="tx-title">
|
||||||
<div class="ellipsis">
|
<div class="ellipsis">
|
||||||
<div class="tx-message ellipsis">{{tx.merchant.name || 'Unknown Merchant'}}</div>
|
<div class="tx-message ellipsis">{{tx.merchant.name || 'Unknown Merchant'}}</div>
|
||||||
<div class="tx-location ellipsis" ng-show="tx.merchant.city && tx.merchant.state">
|
<div class="tx-location ellipsis">{{tx.merchant.location}}</div>
|
||||||
{{tx.merchant.location}}
|
|
||||||
</div>
|
|
||||||
<div ng-show="tx.pending && tx.transactionId" class="size-12 tx-amount--pending">
|
<div ng-show="tx.pending && tx.transactionId" class="size-12 tx-amount--pending">
|
||||||
<div ng-click="bitpayCard.viewOnBlockchain(tx.transactionId)">View Confirmation Status</div>
|
<div ng-click="bitpayCard.viewOnBlockchain(tx.transactionId)">View Confirmation Status</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue