txp and txhistory share outputs.html for all amount/address/message
This commit is contained in:
parent
4867e9983f
commit
43bca75728
5 changed files with 75 additions and 65 deletions
|
|
@ -1,24 +1,24 @@
|
||||||
<div class="ng-animate-disabled row collapse line-b" ng-class="text-gray">
|
<div class="ng-animate-disabled row collapse line-b" ng-class="text-gray">
|
||||||
<li ng-if="output.parent.isSummarized" class="line-b p10 oh" ng-click="toggleOutputSummary(output)">
|
<li ng-if="output.isSummary" class="line-b p10 oh" ng-click="toggleOutputDetails(output)">
|
||||||
<span class="text-gray" translate>Recipients</span>:
|
<span class="text-gray" translate>Recipients</span>:
|
||||||
<span class="right enable_text_select">{{output.parent.length}}
|
<span class="right enable_text_select">{{output.recipientCount}}
|
||||||
<i class="icon-arrow-down size-24"></i>
|
<i ng-show="output.showDetails" class="icon-arrow-up3 size-24"></i>
|
||||||
|
<i ng-show="!output.showDetails" class="icon-arrow-down3 size-24"></i>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li ng-if="!output.parent.isSummarized" class="line-b p10 oh" ng-click="toggleOutputSummary(output)">
|
<li ng-if="!output.isSummary" class="line-b p10 oh" ng-click="copyAddress(output.toAddress)">
|
||||||
<span class="text-gray" translate>To</span>:
|
<span class="text-gray" translate>To</span>:
|
||||||
<span class="right enable_text_select">{{output.toAddress}}
|
<span class="right enable_text_select">{{output.toAddress || output.address}}</span>
|
||||||
<i class="icon-arrow-up size-24"></i>
|
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="line-b p10" ng-click="toggleOutputSummary(output)">
|
<li class="line-b p10">
|
||||||
<span class="text-gray" translate>Amount</span>:
|
<span ng-show="output.isSummary" class="text-gray" translate>Total</span>
|
||||||
|
<span ng-show="!output.isSummary" class="text-gray" translate>Amount</span>:
|
||||||
<span class="right">{{output.amountStr}}
|
<span class="right">{{output.amountStr}}
|
||||||
<span class="label gray radius enable_text_select">{{output.alternativeAmountStr}}</span>
|
<span ng-show="output.alternativeAmountStr" class="label gray radius">{{output.alternativeAmountStr}}</span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="line-b p10 oh" ng-click="toggleOutputSummary(output)">
|
<li class="line-b p10 oh">
|
||||||
<span class="text-gray" translate>Note</span>:
|
<span class="text-gray" translate>Note</span>:
|
||||||
<span class="right enable_text_select">{{output.message}}</span>
|
<span class="right">{{output.message}}</span>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4 class="title m0" translate>Details</h4>
|
<h4 class="title m0" translate>Details</h4>
|
||||||
|
|
||||||
<ul class="no-bullet size-14 m0">
|
<ul class="no-bullet size-14 m0">
|
||||||
<li ng-if="btx.addressTo && btx.addressTo != 'N/A'" class="line-b p10 oh" ng-click="copyAddress(btx.addressTo)">
|
<div ng-if="!btx.showSingle"
|
||||||
|
ng-repeat="output in [ btx.outputs.summary ]"
|
||||||
|
ng-include="'views/includes/output.html'">
|
||||||
|
</div>
|
||||||
|
<div ng-if="!btx.showSingle && btx.outputs.summary.showDetails"
|
||||||
|
ng-repeat="output in btx.outputs.details"
|
||||||
|
ng-include="'views/includes/output.html'">
|
||||||
|
</div>
|
||||||
|
<li ng-if="btx.showSingle && btx.addressTo && btx.addressTo != 'N/A'" class="line-b p10 oh" ng-click="copyAddress(btx.addressTo)">
|
||||||
<span class="text-gray" translate>To</span>:
|
<span class="text-gray" translate>To</span>:
|
||||||
<span class="right">
|
<span class="right">
|
||||||
<span ng-if="btx.merchant">
|
<span ng-if="btx.merchant">
|
||||||
|
|
@ -54,12 +63,6 @@
|
||||||
<span class="text-gray" translate>Fee</span>:
|
<span class="text-gray" translate>Fee</span>:
|
||||||
<span class="right">{{feeStr}}</span>
|
<span class="right">{{feeStr}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li ng-if="btx.message" class="line-b p10 oh">
|
|
||||||
<span class="text-gray" translate>Note</span>:
|
|
||||||
<span class="right">
|
|
||||||
{{btx.message}}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li ng-if="btx.merchant" class="line-b p10 oh">
|
<li ng-if="btx.merchant" class="line-b p10 oh">
|
||||||
<span class="text-gray" translate>Merchant message</span>:
|
<span class="text-gray" translate>Merchant message</span>:
|
||||||
<span class="right">
|
<span class="right">
|
||||||
|
|
|
||||||
|
|
@ -14,24 +14,18 @@
|
||||||
<div class="modal-content fix-modals-touch" ng-init="updateCopayerList()">
|
<div class="modal-content fix-modals-touch" ng-init="updateCopayerList()">
|
||||||
<h4 class="title m0" translate>Details</h4>
|
<h4 class="title m0" translate>Details</h4>
|
||||||
<ul class="no-bullet size-14 m0">
|
<ul class="no-bullet size-14 m0">
|
||||||
<div ng-if="tx.outputs"
|
<div ng-if="!tx.showSingle"
|
||||||
ng-repeat="output in tx.outputs.list"
|
ng-repeat="output in [ tx.outputs.summary ]"
|
||||||
|
ng-include="'views/includes/output.html'">
|
||||||
|
</div>
|
||||||
|
<div ng-if="!tx.showSingle && tx.outputs.summary.showDetails"
|
||||||
|
ng-repeat="output in tx.outputs.details"
|
||||||
|
ng-include="'views/includes/output.html'">
|
||||||
|
</div>
|
||||||
|
<div ng-if="tx.showSingle"
|
||||||
|
ng-repeat="output in [ tx ]"
|
||||||
ng-include="'views/includes/output.html'">
|
ng-include="'views/includes/output.html'">
|
||||||
</div>
|
</div>
|
||||||
<li ng-if="!tx.outputs" class="line-b p10 oh" ng-click="copyAddress(tx.toAddress)">
|
|
||||||
<span class="text-gray" translate>To</span>:
|
|
||||||
<span class="right enable_text_select">{{tx.toAddress}}</span>
|
|
||||||
</li>
|
|
||||||
<li ng-if="!tx.outputs" class="line-b p10">
|
|
||||||
<span class="text-gray" translate>Amount</span>:
|
|
||||||
<span class="right">{{amountStr}}
|
|
||||||
<span class="label gray radius">{{alternativeAmountStr}}</span>
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li ng-if="!tx.outputs" class="line-b p10 oh">
|
|
||||||
<span class="text-gray" translate>Note</span>:
|
|
||||||
<span class="right">{{tx.message}}</span>
|
|
||||||
</li>
|
|
||||||
<li class="line-b p10">
|
<li class="line-b p10">
|
||||||
<span class="text-gray" translate>Fee</span>:
|
<span class="text-gray" translate>Fee</span>:
|
||||||
<span class="right">{{feeStr}}</span>
|
<span class="right">{{feeStr}}</span>
|
||||||
|
|
|
||||||
|
|
@ -425,33 +425,43 @@ 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) {
|
self.setPendingTxps = function(txps) {
|
||||||
var config = configService.getSync().wallet.settings;
|
var config = configService.getSync().wallet.settings;
|
||||||
self.pendingTxProposalsCountForUs = 0;
|
self.pendingTxProposalsCountForUs = 0;
|
||||||
lodash.each(txps, function(tx) {
|
lodash.each(txps, function(tx) {
|
||||||
function formatAmount(obj, amount) {
|
function formatAmount(tx) {
|
||||||
obj.amountStr = profileService.formatAmount(obj.amount) + ' ' + config.unitName;
|
tx.amountStr = profileService.formatAmount(tx.amount) + ' ' + config.unitName;
|
||||||
obj.alternativeAmount = rateService.toFiat(obj.amount, config.alternativeIsoCode) ? rateService.toFiat(obj.amount, config.alternativeIsoCode).toFixed(2) : 'N/A';
|
tx.alternativeAmount = rateService.toFiat(tx.amount, config.alternativeIsoCode) ? rateService.toFiat(tx.amount, config.alternativeIsoCode).toFixed(2) : 'N/A';
|
||||||
obj.alternativeAmountStr = obj.alternativeAmount + " " + config.alternativeIsoCode;
|
tx.alternativeAmountStr = tx.alternativeAmount + " " + config.alternativeIsoCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (tx.outputs) {
|
self.summarizeOutputs(tx, formatAmount);
|
||||||
tx.outputs.details = JSON.parse(JSON.stringify(tx.outputs));
|
formatAmount(tx);
|
||||||
tx.amount = lodash.reduce(tx.outputs.details, function(total, o) {
|
|
||||||
o.parent = tx.outputs;
|
|
||||||
formatAmount(o, o.amount * self.satToUnit);
|
|
||||||
return total + o.amount;
|
|
||||||
}, 0);
|
|
||||||
tx.outputs.summary = [{
|
|
||||||
amount: tx.amount,
|
|
||||||
message: tx.message,
|
|
||||||
parent: tx.outputs
|
|
||||||
}];
|
|
||||||
formatAmount(tx.outputs.summary[0], tx.amount * self.satToUnit);
|
|
||||||
tx.outputs.isSummarized = true;
|
|
||||||
tx.outputs.list = tx.outputs.summary;
|
|
||||||
}
|
|
||||||
formatAmount(tx, tx.amount * self.satToUnit);
|
|
||||||
|
|
||||||
tx.feeStr = profileService.formatAmount(tx.fee) + ' ' + config.unitName;
|
tx.feeStr = profileService.formatAmount(tx.fee) + ' ' + config.unitName;
|
||||||
tx.alternativeIsoCode = config.alternativeIsoCode;
|
tx.alternativeIsoCode = config.alternativeIsoCode;
|
||||||
|
|
@ -494,10 +504,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
tx.time = now;
|
tx.time = now;
|
||||||
|
|
||||||
tx.rateTs = Math.floor((tx.ts || now) / 1000);
|
tx.rateTs = Math.floor((tx.ts || now) / 1000);
|
||||||
tx.amountStr = profileService.formatAmount(tx.amount); //$filter('noFractionNumber')(
|
|
||||||
if (tx.fees)
|
if (tx.fees)
|
||||||
tx.feeStr = profileService.formatAmount(tx.fees) + ' ' + config.unitName;
|
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) {
|
if (c < self.limitHistory) {
|
||||||
self.txHistory.push(tx);
|
self.txHistory.push(tx);
|
||||||
c++;
|
c++;
|
||||||
|
|
|
||||||
|
|
@ -364,14 +364,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
self.copyAddress(addr);
|
self.copyAddress(addr);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleOutputSummary = function(output) {
|
$scope.toggleOutputDetails = function(summary) {
|
||||||
if (output.parent.isSummarized) {
|
summary.showDetails = !summary.showDetails;
|
||||||
output.parent.isSummarized = false;
|
|
||||||
output.parent.list = output.parent.details;
|
|
||||||
} else {
|
|
||||||
output.parent.isSummarized = true;
|
|
||||||
output.parent.list = output.parent.summary;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
|
|
@ -1059,6 +1053,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$modalInstance.dismiss('cancel');
|
$modalInstance.dismiss('cancel');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.toggleOutputDetails = function(summary) {
|
||||||
|
summary.showDetails = !summary.showDetails;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var modalInstance = $modal.open({
|
var modalInstance = $modal.open({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue