mirror of https://github.com/BTCPrivate/copay.git
add transaction comment - custom popup (Gabriel)
This commit is contained in:
parent
97013ea5b6
commit
8759b633fb
|
@ -42,7 +42,7 @@
|
|||
"url": "https://github.com/bitpay/copay/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"bitcore-wallet-client": "2.5.0",
|
||||
"bitcore-wallet-client": "~2.5.0",
|
||||
"express": "^4.11.2",
|
||||
"fs": "0.0.2",
|
||||
"grunt": "^0.4.5",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<input type="text" ng-model="data.comment" autofocus>
|
||||
<div class="small-6 columns">
|
||||
<button class="round outline dark-gray expand" ng-click="commentPopupClose()" translate>CANCEL</button>
|
||||
</div>
|
||||
<div class="small-6 columns">
|
||||
<button ng-style="{'background-color': index.backgroundColor}" class="round outline expand" ng-click="commentPopupSave()" translate>SAVE</button>
|
||||
</div>
|
|
@ -11,54 +11,56 @@
|
|||
</section>
|
||||
</nav>
|
||||
|
||||
<ion-content>
|
||||
<div class="header-modal text-center p50t">
|
||||
<div class="size-42">
|
||||
{{unitTotal}} {{unitName}}
|
||||
<ion-content ng-style="{'background-color': '#F6F7F9'}">
|
||||
<div class="modal-content">
|
||||
<div class="header-modal text-center p50t">
|
||||
<div class="size-42">
|
||||
{{unitTotal}} {{unitName}}
|
||||
</div>
|
||||
<div class="size-18 m5t text-gray" ng-show="alternative">
|
||||
{{ alternative }} {{ alternativeIsoCode }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="size-18 m5t text-gray" ng-show="alternative">
|
||||
{{ alternative }} {{ alternativeIsoCode }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="title m10l" translate>Details</h4>
|
||||
<ul class="no-bullet size-14 m10t">
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Pay To</span>
|
||||
<span class="right enable_text_select">{{paypro.domain}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh" ng-if="paypro.toAddress">
|
||||
<span class="text-gray" translate>Address</span>
|
||||
<span class="right enable_text_select">{{paypro.toAddress}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Certified by</span>
|
||||
<span class="right text-right">
|
||||
<span ng-show="paypro.caTrusted">
|
||||
<i class="fi-lock color-greeni"></i>
|
||||
{{paypro.caName}}<br>
|
||||
<span translate>(Trusted)</span>
|
||||
</span>
|
||||
<span ng-show="!paypro.caTrusted">
|
||||
<span ng-show="paypro.selfSigned">
|
||||
<i class="fi-unlock color-yellowi"></i> <span translate>Self-signed Certificate</span>
|
||||
<h4 class="title m10l" translate>Details</h4>
|
||||
<ul class="no-bullet size-14 m10t">
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Pay To</span>
|
||||
<span class="right enable_text_select">{{paypro.domain}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh" ng-if="paypro.toAddress">
|
||||
<span class="text-gray" translate>Address</span>
|
||||
<span class="right enable_text_select">{{paypro.toAddress}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Certified by</span>
|
||||
<span class="right text-right">
|
||||
<span ng-show="paypro.caTrusted">
|
||||
<i class="fi-lock color-greeni"></i>
|
||||
{{paypro.caName}}<br>
|
||||
<span translate>(Trusted)</span>
|
||||
</span>
|
||||
<span ng-show="!paypro.selfSigned">
|
||||
<i class="fi-unlock color-yellowi"></i>{{paypro.caName}}<br>
|
||||
<span translate>WARNING: UNTRUSTED CERTIFICATE</span>
|
||||
<span ng-show="!paypro.caTrusted">
|
||||
<span ng-show="paypro.selfSigned">
|
||||
<i class="fi-unlock color-yellowi"></i> <span translate>Self-signed Certificate</span>
|
||||
</span>
|
||||
<span ng-show="!paypro.selfSigned">
|
||||
<i class="fi-unlock color-yellowi"></i>{{paypro.caName}}<br>
|
||||
<span translate>WARNING: UNTRUSTED CERTIFICATE</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh" ng-if="paypro.memo">
|
||||
<span class="text-gray" translate>Memo</span>
|
||||
<span class="right">{{paypro.memo}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh" ng-if="paypro.expires">
|
||||
<span class="text-gray" translate>Expires</span>
|
||||
<span class="right">{{paypro.expires * 1000 | amTimeAgo }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="line-b p10 oh" ng-if="paypro.memo">
|
||||
<span class="text-gray" translate>Memo</span>
|
||||
<span class="right">{{paypro.memo}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh" ng-if="paypro.expires">
|
||||
<span class="text-gray" translate>Expires</span>
|
||||
<span class="right">{{paypro.expires * 1000 | amTimeAgo }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
</ion-content>
|
||||
</ion-modal-view>
|
||||
</ion-modal-view>
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
</a>
|
||||
</section>
|
||||
<section class="middle tab-bar-section">
|
||||
<h1 class="title ellipsis" translate>
|
||||
Transaction
|
||||
</h1>
|
||||
<h1 class="title ellipsis" translate>Transaction</h1>
|
||||
</section>
|
||||
</nav>
|
||||
|
||||
<ion-content>
|
||||
<ion-content ng-style="{'background-color': '#F6F7F9'}">
|
||||
<div class="modal-content">
|
||||
<div class="header-modal text-center" ng-init="getAlternativeAmount(btx)">
|
||||
<div ng-show="btx.action != 'invalid'">
|
||||
|
@ -51,20 +49,19 @@
|
|||
<h4 class="title m0" translate>Details</h4>
|
||||
|
||||
<ul class="no-bullet size-14 m0">
|
||||
|
||||
<li ng-if="!btx.hasMultiplesOutputs && btx.addressTo && btx.addressTo != 'N/A'" class="line-b p10 oh"
|
||||
ng-click="copyToClipboard(btx.addressTo)">
|
||||
<span class="text-gray" translate>To</span>
|
||||
<span class="right">
|
||||
<span ng-if="btx.merchant">
|
||||
<span ng-show="btx.merchant.pr.ca"><i class="fi-lock color-greeni"></i> {{btx.merchant.domain}}</span>
|
||||
<span ng-show="!btx.merchant.pr.ca"><i class="fi-unlock color-yellowi"></i> {{btx.merchant.domain}}</span>
|
||||
<span class="text-gray" translate>To</span>
|
||||
<span class="right">
|
||||
<span ng-if="btx.merchant">
|
||||
<span ng-show="btx.merchant.pr.ca"><i class="fi-lock color-greeni"></i> {{btx.merchant.domain}}</span>
|
||||
<span ng-show="!btx.merchant.pr.ca"><i class="fi-unlock color-yellowi"></i> {{btx.merchant.domain}}</span>
|
||||
</span>
|
||||
<span ng-if="!btx.merchant">
|
||||
<span ng-show="btx.labelTo">{{btx.labelTo}}</span>
|
||||
<contact ng-show="!btx.labelTo" class="enable_text_select" address="{{btx.addressTo}}"></contact>
|
||||
</span>
|
||||
</span>
|
||||
<span ng-if="!btx.merchant">
|
||||
<span ng-show="btx.labelTo">{{btx.labelTo}}</span>
|
||||
<contact ng-show="!btx.labelTo" class="enable_text_select" address="{{btx.addressTo}}"></contact>
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<li ng-show="btx.hasMultiplesOutputs" class="line-b p10 oh"
|
||||
|
@ -82,47 +79,61 @@
|
|||
</div>
|
||||
|
||||
<li ng-if="btx.action == 'invalid'" class="line-b p10 oh">
|
||||
<span class="right" translate>
|
||||
This transaction has become invalid; possibly due to a double spend attempt.
|
||||
</span>
|
||||
<li ng-if="btx.time" class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Date</span>
|
||||
<span class="right enable_text_select">
|
||||
<time>{{ btx.time * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}}</time>
|
||||
<time>({{ btx.time * 1000 | amTimeAgo}})</time>
|
||||
</span>
|
||||
<span class="right" translate>
|
||||
This transaction has become invalid; possibly due to a double spend attempt.
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<li ng-if="btx.time" class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Date</span>
|
||||
<span class="right enable_text_select">
|
||||
<time>{{ btx.time * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}}</time>
|
||||
<time>({{ btx.time * 1000 | amTimeAgo}})</time>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<li class="line-b p10" ng-show="btx.action != 'received'"
|
||||
ng-click="copyToClipboard(btx.feeStr)">
|
||||
<span class="text-gray" translate>Fee</span>
|
||||
<span class="right enable_text_select">{{btx.feeStr}}</span>
|
||||
</li>
|
||||
|
||||
<li class="line-b p10 oh" ng-if="btx.message && btx.action != 'received'"
|
||||
ng-click="copyToClipboard(btx.message)">
|
||||
<span class="text-gray" translate>Note</span>
|
||||
<span class="right enable_text_select">{{btx.message}}</span>
|
||||
</li>
|
||||
|
||||
<li ng-if="btx.merchant" class="line-b p10 oh"
|
||||
ng-click="copyToClipboard(btx.merchant.pr.pd.memo)">
|
||||
<span class="text-gray" translate>Merchant message</span>
|
||||
<span class="right enable_text_select">
|
||||
{{btx.merchant.pr.pd.memo}}
|
||||
</span>
|
||||
<span class="text-gray" translate>Merchant message</span>
|
||||
<span class="right enable_text_select">
|
||||
{{btx.merchant.pr.pd.memo}}
|
||||
</span>
|
||||
</li>
|
||||
<li ng-if="btx.time" class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Confirmations</span>
|
||||
<span class="right" >
|
||||
<span class="text-warning" ng-show="!btx.confirmations || btx.confirmations == 0" translate>
|
||||
Unconfirmed
|
||||
</span>
|
||||
<span class="label gray radius" ng-show="btx.confirmations>0 && !btx.safeConfirmed">
|
||||
{{btx.confirmations}}
|
||||
</span>
|
||||
<span class="label gray radius" ng-show="btx.safeConfirmed">
|
||||
{{btx.safeConfirmed}}
|
||||
</span>
|
||||
|
||||
</span>
|
||||
<li ng-if="btx.time" class="line-b p10 oh">
|
||||
<span class="text-gray" translate>Confirmations</span>
|
||||
<span class="right" >
|
||||
<span class="text-warning" ng-show="!btx.confirmations || btx.confirmations == 0" translate>
|
||||
Unconfirmed
|
||||
</span>
|
||||
<span class="label gray radius" ng-show="btx.confirmations>0 && !btx.safeConfirmed">
|
||||
{{btx.confirmations}}
|
||||
</span>
|
||||
<span class="label gray radius" ng-show="btx.safeConfirmed">
|
||||
{{btx.safeConfirmed}}
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<li class="p10 oh" ng-show="comment">
|
||||
<span class="text-gray" translate>Comment</span>
|
||||
<span class="right enable_text_select">{{comment}}</span><br>
|
||||
<span class="right text-italic text-gray size-12 m10t">
|
||||
<span>{{editedBy}}</span>
|
||||
<time>{{createdOn * 1000 | amTimeAgo}}</time></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -146,10 +157,12 @@
|
|||
(getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid)">
|
||||
<span class="text-gray" translate>See it on the blockchain</span>
|
||||
</button>
|
||||
<button class="button outline round dark-gray tiny" ng-click="showCommentPopup()">
|
||||
<span class="text-gray" translate ng-show="!comment">Add a comment <i class="ion-ios-plus-outline"></i></span>
|
||||
<span class="text-gray" translate ng-show="comment">Edit comment <i class="ion-ios-compose-outline"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="extra-margin-bottom"></div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-modal-view>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<ion-content>
|
||||
<ion-content ng-style="{'background-color': '#F6F7F9'}">
|
||||
<div class="modal-content fix-modals-touch" ng-init="updateCopayerList()">
|
||||
<div class="payment-proposal-head" ng-style="{'background-color':color}">
|
||||
<div class="size-36">{{tx.amountStr}}</div>
|
||||
|
|
|
@ -204,12 +204,11 @@
|
|||
<div class="m10t">
|
||||
<span ng-show="btx.action == 'received'" translate>Received</span>
|
||||
<span ng-show="btx.action == 'sent'">
|
||||
{{index.addressbook[btx.addressTo]}}
|
||||
<span ng-show="!index.addressbook[btx.addressTo] && btx.message">
|
||||
<span class="ellipsis">{{btx.message}}</span>
|
||||
</span>
|
||||
<span ng-show="!index.addressbook[btx.addressTo] && !btx.message">
|
||||
<span translate> Sent</span>
|
||||
<span class="ellipsis">
|
||||
<span ng-if="btx.message">{{btx.message}}</span>
|
||||
<span ng-if="!btx.message && btx.note.body">{{btx.note.body}}</span>
|
||||
<span ng-if="!btx.message && !btx.note.body && index.addressbook[btx.addressTo]">{{index.addressbook[btx.addressTo]}}</span>
|
||||
<span ng-if="!btx.message && !btx.note.body && !index.addressbook[btx.addressTo]" translate> Sent</span>
|
||||
</span>
|
||||
</span>
|
||||
<span ng-show="btx.action == 'moved'" translate>Moved</span>
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
z-index: -1;
|
||||
}
|
||||
|
||||
.popup-container.active .popup {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.popup-container .popup {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.bct {
|
||||
background-color: transparent !important;
|
||||
margin-top: -25px;
|
||||
|
|
|
@ -1,50 +1,93 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $scope, $filter, profileService, nodeWebkit, configService, gettextCatalog) {
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $ionicPopup, gettextCatalog, profileService, configService) {
|
||||
|
||||
var self = $scope.self;
|
||||
var fc = profileService.focusedClient;
|
||||
var config = configService.getSync();
|
||||
var configWallet = config.wallet;
|
||||
var walletSettings = configWallet.settings;
|
||||
var self = $scope.self;
|
||||
var fc = profileService.focusedClient;
|
||||
var config = configService.getSync();
|
||||
var configWallet = config.wallet;
|
||||
var walletSettings = configWallet.settings;
|
||||
|
||||
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
|
||||
$scope.color = fc.backgroundColor;
|
||||
$scope.copayerId = fc.credentials.copayerId;
|
||||
$scope.isShared = fc.credentials.n > 1;
|
||||
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
|
||||
$scope.color = fc.backgroundColor;
|
||||
$scope.copayerId = fc.credentials.copayerId;
|
||||
$scope.isShared = fc.credentials.n > 1;
|
||||
|
||||
$scope.getAlternativeAmount = function() {
|
||||
var satToBtc = 1 / 100000000;
|
||||
fc.getFiatRate({
|
||||
code: $scope.alternativeIsoCode,
|
||||
ts: $scope.btx.time * 1000
|
||||
}, function(err, res) {
|
||||
if (err) {
|
||||
$log.debug('Could not get historic rate');
|
||||
return;
|
||||
}
|
||||
if (res && res.rate) {
|
||||
var alternativeAmountBtc = ($scope.btx.amount * satToBtc).toFixed(8);
|
||||
$scope.rateDate = res.fetchedOn;
|
||||
$scope.rateStr = res.rate + ' ' + $scope.alternativeIsoCode;
|
||||
$scope.alternativeAmountStr = $filter('noFractionNumber')(alternativeAmountBtc * res.rate, 2) + ' ' + $scope.alternativeIsoCode;
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
if ($scope.btx.txid) {
|
||||
fc.getTxNote({
|
||||
txid: $scope.btx.txid
|
||||
}, function(err, note) {
|
||||
if (err || !note) {
|
||||
$log.debug(gettextCatalog.getString('Could not fetch transaction note'));
|
||||
return;
|
||||
}
|
||||
$scope.comment = note.body;
|
||||
$scope.editedBy = gettextCatalog.getString('Edited by') + ' ' + note.editedByName;
|
||||
$scope.createdOn = note.createdOn;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.showCommentPopup = function() {
|
||||
$scope.data = {
|
||||
comment: ''
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
var n = fc.credentials.network;
|
||||
return n.substring(0, 4);
|
||||
var commentPopup = $ionicPopup.show({
|
||||
templateUrl: "views/includes/note.html",
|
||||
title: gettextCatalog.getString('Enter a new comment'),
|
||||
subTitle: gettextCatalog.getString('Save an empty content to delete it'),
|
||||
scope: $scope,
|
||||
});
|
||||
|
||||
$scope.commentPopupClose = function() {
|
||||
commentPopup.close();
|
||||
};
|
||||
|
||||
$scope.copyToClipboard = function(addr) {
|
||||
if (!addr) return;
|
||||
self.copyToClipboard(addr);
|
||||
$scope.commentPopupSave = function() {
|
||||
fc.editTxNote({
|
||||
txid: $scope.btx.txid,
|
||||
body: $scope.data.comment
|
||||
}, function() {});
|
||||
$scope.comment = $scope.data.comment;
|
||||
$scope.editedBy = gettextCatalog.getString('Edited by') + ' ' + fc.credentials.copayerName;
|
||||
$scope.createdOn = Math.floor(Date.now() / 1000);
|
||||
commentPopup.close();
|
||||
};
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$scope.txDetailsModal.hide();
|
||||
};
|
||||
$scope.getAlternativeAmount = function() {
|
||||
var satToBtc = 1 / 100000000;
|
||||
|
||||
});
|
||||
fc.getFiatRate({
|
||||
code: $scope.alternativeIsoCode,
|
||||
ts: $scope.btx.time * 1000
|
||||
}, function(err, res) {
|
||||
if (err) {
|
||||
$log.debug('Could not get historic rate');
|
||||
return;
|
||||
}
|
||||
if (res && res.rate) {
|
||||
var alternativeAmountBtc = ($scope.btx.amount * satToBtc).toFixed(8);
|
||||
$scope.rateDate = res.fetchedOn;
|
||||
$scope.rateStr = res.rate + ' ' + $scope.alternativeIsoCode;
|
||||
$scope.alternativeAmountStr = $filter('noFractionNumber')(alternativeAmountBtc * res.rate, 2) + ' ' + $scope.alternativeIsoCode;
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
var n = fc.credentials.network;
|
||||
return n.substring(0, 4);
|
||||
};
|
||||
|
||||
$scope.copyToClipboard = function(addr) {
|
||||
if (!addr) return;
|
||||
self.copyToClipboard(addr);
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$scope.txDetailsModal.hide();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue