Details
- -
- To:
- {{tx.toAddress}}
-
- -
- Amount:
- {{amountStr}}
- {{alternativeAmountStr}}
-
-
+
+
+
+
+
+
-
Fee:
{{feeStr}}
@@ -38,10 +40,6 @@
Created by:
{{tx.creatorName}}
- -
- Note:
- {{tx.message}}
-
Payment details
diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js
index 53a9b5703..737cb0520 100644
--- a/src/js/controllers/index.js
+++ b/src/js/controllers/index.js
@@ -425,19 +425,47 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
+ self.summarizeOutputs = function(tx, formatAmount) {
+ tx.showSingle = true;
+ if (tx.outputs) {
+ tx.showSingle = false;
+ tx.outputs.details = lodash.clone(tx.outputs);
+ tx.amount = lodash.reduce(tx.outputs.details, function(total, o) {
+ formatAmount(o);
+ return total + o.amount;
+ }, 0);
+ tx.outputs.summary = {
+ amount: tx.amount,
+ message: tx.message,
+ isSummary: true,
+ showDetails: false,
+ recipientCount: tx.outputs.details.length
+ };
+ formatAmount(tx.outputs.summary);
+ if (tx.outputs.length === 1 && !tx.outputs[0].message) {
+ tx.showSingle = true;
+ tx.toAddress = tx.outputs[0].toAddress; // txproposal
+ tx.address = tx.outputs[0].address; // txhistory
+ }
+ }
+ };
+
self.setPendingTxps = function(txps) {
var config = configService.getSync().wallet.settings;
self.pendingTxProposalsCountForUs = 0;
lodash.each(txps, function(tx) {
- var amount = tx.amount * self.satToUnit;
- tx.amountStr = profileService.formatAmount(tx.amount) + ' ' + config.unitName;
+ function formatAmount(tx) {
+ tx.amountStr = profileService.formatAmount(tx.amount) + ' ' + config.unitName;
+ tx.alternativeAmount = rateService.toFiat(tx.amount, config.alternativeIsoCode) ? rateService.toFiat(tx.amount, config.alternativeIsoCode).toFixed(2) : 'N/A';
+ tx.alternativeAmountStr = tx.alternativeAmount + " " + config.alternativeIsoCode;
+ };
+
+ self.summarizeOutputs(tx, formatAmount);
+ formatAmount(tx);
+
tx.feeStr = profileService.formatAmount(tx.fee) + ' ' + config.unitName;
- tx.alternativeAmount = rateService.toFiat(tx.amount, config.alternativeIsoCode) ? rateService.toFiat(tx.amount, config.alternativeIsoCode).toFixed(2) : 'N/A';
- tx.alternativeAmountStr = tx.alternativeAmount + " " + config.alternativeIsoCode;
tx.alternativeIsoCode = config.alternativeIsoCode;
-
-
var action = lodash.find(tx.actions, {
copayerId: self.copayerId
});
@@ -476,10 +504,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r
tx.time = now;
tx.rateTs = Math.floor((tx.ts || now) / 1000);
- tx.amountStr = profileService.formatAmount(tx.amount); //$filter('noFractionNumber')(
if (tx.fees)
tx.feeStr = profileService.formatAmount(tx.fees) + ' ' + config.unitName;
+ function formatAmount(tx) {
+ tx.amountStr = profileService.formatAmount(tx.amount); //$filter('noFractionNumber')(
+ };
+
+ self.summarizeOutputs(tx, formatAmount);
+ formatAmount(tx);
if (c < self.limitHistory) {
self.txHistory.push(tx);
c++;
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js
index c4d19c977..c5f4868c5 100644
--- a/src/js/controllers/walletHome.js
+++ b/src/js/controllers/walletHome.js
@@ -364,6 +364,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.copyAddress(addr);
};
+ $scope.toggleOutputDetails = function(summary) {
+ summary.showDetails = !summary.showDetails;
+ };
+
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
@@ -1049,6 +1053,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
+
+ $scope.toggleOutputDetails = function(summary) {
+ summary.showDetails = !summary.showDetails;
+ };
};
var modalInstance = $modal.open({