Merge pull request #6145 from gabrielbazan7/fix/txsearch
fix transactions search modal
This commit is contained in:
commit
7ac8860206
5 changed files with 88 additions and 134 deletions
|
|
@ -1,13 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('searchController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService) {
|
||||
angular.module('copayApp.controllers').controller('searchController', function($scope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService) {
|
||||
|
||||
var HISTORY_SHOW_LIMIT = 10;
|
||||
var currentTxHistoryPage = 0;
|
||||
var wallet;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
$scope.txHistorySearchResults = [];
|
||||
$scope.filteredTxHistory = [];
|
||||
|
||||
$scope.updateSearchInput = function(search) {
|
||||
if (isCordova)
|
||||
|
|
@ -26,7 +24,7 @@ angular.module('copayApp.controllers').controller('searchController', function($
|
|||
|
||||
function computeSearchableString(tx) {
|
||||
var addrbook = '';
|
||||
if (tx.addressTo && self.addressbook && self.addressbook[tx.addressTo]) addrbook = self.addressbook[tx.addressTo] || '';
|
||||
if (tx.addressTo && $scope.addressbook && $scope.addressbook[tx.addressTo]) addrbook = $scope.addressbook[tx.addressTo].name || $scope.addressbook[tx.addressTo] || '';
|
||||
var searchableDate = computeSearchableDate(new Date(tx.time * 1000));
|
||||
var message = tx.message ? tx.message : '';
|
||||
var comment = tx.note ? tx.note.body : '';
|
||||
|
|
@ -54,7 +52,6 @@ angular.module('copayApp.controllers').controller('searchController', function($
|
|||
|
||||
if ($scope.filteredTxHistory.length > HISTORY_SHOW_LIMIT) $scope.txHistoryShowMore = true;
|
||||
else $scope.txHistoryShowMore = false;
|
||||
|
||||
return $scope.filteredTxHistory;
|
||||
};
|
||||
|
||||
|
|
@ -64,7 +61,7 @@ angular.module('copayApp.controllers').controller('searchController', function($
|
|||
window.plugins.toast.showShortBottom(gettextCatalog.getString('Matches: ' + $scope.filteredTxHistory.length));
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
}, 1000);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
|
||||
$scope.openSearchModal = function() {
|
||||
$scope.color = $scope.wallet.color;
|
||||
$scope.isSearching = true;
|
||||
$scope.txHistorySearchResults = [];
|
||||
$scope.filteredTxHistory = [];
|
||||
|
||||
$ionicModal.fromTemplateUrl('views/modals/search.html', {
|
||||
scope: $scope,
|
||||
|
|
@ -87,6 +90,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
});
|
||||
|
||||
$scope.close = function() {
|
||||
$scope.isSearching = false;
|
||||
$scope.searchModal.hide();
|
||||
};
|
||||
|
||||
|
|
@ -94,7 +98,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$scope.searchModal.hide();
|
||||
$scope.close();
|
||||
$scope.openTxModal(tx);
|
||||
};
|
||||
};
|
||||
|
|
@ -197,6 +201,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
};
|
||||
|
||||
function createdDuringSameMonth(tx1, tx2) {
|
||||
if (!tx1 || !tx2) return false;
|
||||
var date1 = new Date(tx1.time * 1000);
|
||||
var date2 = new Date(tx2.time * 1000);
|
||||
return getMonthYear(date1) === getMonthYear(date2);
|
||||
|
|
|
|||
74
www/views/includes/walletHistory.html
Normal file
74
www/views/includes/walletHistory.html
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<div class="wallet-details__group-label" ng-if="!isSearching ? isFirstInGroup($index) : false">
|
||||
<span ng-if="isDateInCurrentMonth(getDate(btx.time))">
|
||||
<span translate>Recent</span>
|
||||
</span>
|
||||
|
||||
<span ng-if="!isDateInCurrentMonth(getDate(btx.time))">
|
||||
{{getDate(btx.time) | amDateFormat:'MMMM'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<a class="wallet-details__item item">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-confirming.svg" width="40" ng-if="isUnconfirmed(btx)">
|
||||
<span ng-if="!isUnconfirmed(btx)">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-tx-received-outline.svg" width="40" ng-if="btx.action == 'received'">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-tx-sent-outline.svg" width="40" ng-if="btx.action == 'sent'">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-tx-moved-outline.svg" width="40" ng-if="btx.action == 'moved'">
|
||||
</span>
|
||||
|
||||
<div class="wallet-details__tx-content" ng-class="{'no-border': !isSearching ? isLastInGroup($index) : false}">
|
||||
|
||||
<div class="wallet-details__tx-title" ng-if="!isUnconfirmed(btx)">
|
||||
<div ng-show="btx.action == 'received'" class="ellipsis">
|
||||
<div ng-if="btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" class="wallet-details__tx-message ellipsis" translate>Received</div>
|
||||
<div class="low-fees" ng-if="btx.lowFees">
|
||||
<i class="icon"><img src="img/icon-warning.png" width="20px"></i>
|
||||
<span class="comment" translate>Low fees</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="btx.action == 'sent'" class="ellipsis">
|
||||
<div ng-if="btx.message" class="wallet-details__tx-message ellipsis">{{btx.message}}</div>
|
||||
<div ng-if="!btx.message && btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.message && !btx.note.body && addressbook[btx.addressTo]" class="wallet-details__tx-message ellipsis">
|
||||
{{addressbook[btx.addressTo].name || addressbook[btx.addressTo]}}
|
||||
</div>
|
||||
<div ng-if="!btx.message && !btx.note.body && !addressbook[btx.addressTo]" translate>Sent</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="btx.action == 'moved'" class="ellipsis">
|
||||
<div ng-if="btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" class="wallet-details__tx-message ellipsis" translate>Moved</div>
|
||||
</div>
|
||||
<span class="label tu warning radius" ng-if="btx.action == 'invalid'" translate>Invalid</span>
|
||||
</div>
|
||||
|
||||
<div class="wallet-details__tx-title" ng-if="isUnconfirmed(btx)">
|
||||
<div class="ellipsis" style="color: #B4B4B4;">
|
||||
<span ng-if="btx.action == 'sent' || btx.action == 'moved'">
|
||||
{{addressbook[btx.addressTo].name || addressbook[btx.addressTo] || 'Sending'|translate}}
|
||||
</span>
|
||||
<span ng-if="btx.action == 'received'" translate>Receiving</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="item-note text-right wallet-details__tx-amount">
|
||||
<span class="wallet-details__tx-amount" ng-class="{'wallet-details__tx-amount--recent': btx.recent, 'wallet-details__tx-amount--received': btx.action == 'received', 'wallet-details__tx-amount--sent': btx.action == 'sent'}">
|
||||
<span ng-if="btx.action == 'sent'">–</span>
|
||||
<span class="size-12" ng-if="btx.action == 'invalid'" translate>
|
||||
(possible double spend)
|
||||
</span>
|
||||
<span ng-if="btx.action != 'invalid'">
|
||||
{{btx.amountStr}}
|
||||
</span>
|
||||
</span>
|
||||
<div>
|
||||
<time class="wallet-details__tx-time" ng-if="btx.time && createdWithinPastDay(btx.time)">{{btx.time * 1000 | amTimeAgo}}</time>
|
||||
<time class="wallet-details__tx-time" ng-if="btx.time && !createdWithinPastDay(btx.time)">
|
||||
{{btx.time * 1000 | amDateFormat:'MMM D, YYYY'}}
|
||||
</time>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
|
|
@ -18,58 +18,10 @@
|
|||
</div>
|
||||
|
||||
<div class="list">
|
||||
<div class="item" ng-repeat="btx in txHistorySearchResults track by btx.txid" ng-click="openTx(btx)">
|
||||
|
||||
<span class="item-note text-right">
|
||||
<span class="size-16" ng-class="{'text-bold': btx.recent}">
|
||||
<span ng-if="btx.action == 'received'">+</span>
|
||||
<span ng-if="btx.action == 'sent'">-</span>
|
||||
<span class="size-12" ng-if="btx.action == 'invalid'" translate>
|
||||
(possible double spend)
|
||||
</span>
|
||||
<span ng-if="btx.action != 'invalid'">
|
||||
{{btx.amountStr}}
|
||||
</span>
|
||||
</span>
|
||||
<p>
|
||||
<time ng-if="btx.time">{{btx.time * 1000 | amTimeAgo}}</time>
|
||||
<span translate class="text-warning"
|
||||
ng-show="!btx.time && (!btx.confirmations || btx.confirmations == 0)" translate>
|
||||
Unconfirmed
|
||||
</span>
|
||||
</p>
|
||||
</span>
|
||||
|
||||
<img class="left m10r" src="img/icon-tx-received-outline.svg" alt="sync" width="40" ng-if="btx.action == 'received'">
|
||||
<img class="left m10r" src="img/icon-tx-sent-outline.svg" alt="sync" width="40" ng-if="btx.action == 'sent'">
|
||||
<img class="left m10r" src="img/icon-tx-moved-outline.svg" alt="sync" width="40" ng-if="btx.action == 'moved'">
|
||||
|
||||
<h2>
|
||||
<div class="padding" ng-if="btx.action == 'received'">
|
||||
<span class="ellipsis">
|
||||
<h2 ng-if="btx.note.body">{{btx.note.body}}</h2>
|
||||
<h2 ng-if="!btx.note.body" translate> Received</h2>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="btx.action == 'sent'">
|
||||
<span class="ellipsis">
|
||||
<h2 ng-if="btx.message">{{btx.message}}</h2>
|
||||
<h2 ng-if="!btx.message && btx.note.body">{{btx.note.body}}</h2>
|
||||
<h2 ng-if="!btx.message && !btx.note.body && wallet.addressbook[btx.addressTo]">{{wallet.addressbook[btx.addressTo]}}</h2>
|
||||
<h2 ng-if="!btx.message && !btx.note.body && !wallet.addressbook[btx.addressTo]" translate> Sent</h2>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="btx.action == 'moved'">
|
||||
<span class="ellipsis">
|
||||
<h2 ng-if="btx.note.body">{{btx.note.body}}</h2>
|
||||
<h2 ng-if="!btx.note.body" translate>Moved</h2>
|
||||
</span>
|
||||
</div>
|
||||
<span class="label tu warning radius" ng-if="btx.action == 'invalid'" translate>Invalid</span>
|
||||
</h2>
|
||||
|
||||
<div class="wallet-details__list" ng-show="txHistory[0]">
|
||||
<div ng-repeat="btx in txHistorySearchResults track by $index" ng-click="openTx(btx)">
|
||||
<span ng-include="'views/includes/walletHistory.html'"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-gray text-center size-12 p10t" ng-if="txHistoryShowMore">
|
||||
<span class="size-12">{{filteredTxHistory.length - txHistorySearchResults.length}} more</span>
|
||||
|
|
|
|||
|
|
@ -214,81 +214,7 @@
|
|||
|
||||
<div class="wallet-details__list" ng-show="txHistory[0]">
|
||||
<div ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
|
||||
<div class="wallet-details__group-label" ng-if="isFirstInGroup($index)">
|
||||
<span ng-if="isDateInCurrentMonth(getDate(btx.time))">
|
||||
<span translate>Recent</span>
|
||||
</span>
|
||||
|
||||
<span ng-if="!isDateInCurrentMonth(getDate(btx.time))">
|
||||
{{getDate(btx.time) | amDateFormat:'MMMM'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<a class="wallet-details__item item">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-confirming.svg" width="40" ng-if="isUnconfirmed(btx)">
|
||||
<span ng-if="!isUnconfirmed(btx)">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-tx-received-outline.svg" width="40" ng-if="btx.action == 'received'">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-tx-sent-outline.svg" width="40" ng-if="btx.action == 'sent'">
|
||||
<img class="wallet-details__tx-icon" src="img/icon-tx-moved-outline.svg" width="40" ng-if="btx.action == 'moved'">
|
||||
</span>
|
||||
|
||||
<div class="wallet-details__tx-content" ng-class="{'no-border': isLastInGroup($index)}">
|
||||
|
||||
<div class="wallet-details__tx-title" ng-if="!isUnconfirmed(btx)">
|
||||
<div ng-show="btx.action == 'received'" class="ellipsis">
|
||||
<div ng-if="btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" class="wallet-details__tx-message ellipsis" translate>Received</div>
|
||||
<div class="low-fees" ng-if="btx.lowFees">
|
||||
<i class="icon"><img src="img/icon-warning.png" width="20px"></i>
|
||||
<span class="comment" translate>Low fees</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="btx.action == 'sent'" class="ellipsis">
|
||||
<div ng-if="btx.message" class="wallet-details__tx-message ellipsis">{{btx.message}}</div>
|
||||
<div ng-if="!btx.message && btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.message && !btx.note.body && addressbook[btx.addressTo]" class="wallet-details__tx-message ellipsis">
|
||||
{{addressbook[btx.addressTo].name || addressbook[btx.addressTo]}}
|
||||
</div>
|
||||
<div ng-if="!btx.message && !btx.note.body && !addressbook[btx.addressTo]" translate>Sent</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="btx.action == 'moved'" class="ellipsis">
|
||||
<div ng-if="btx.note.body" class="wallet-details__tx-message ellipsis">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" class="wallet-details__tx-message ellipsis" translate>Moved</div>
|
||||
</div>
|
||||
<span class="label tu warning radius" ng-if="btx.action == 'invalid'" translate>Invalid</span>
|
||||
</div>
|
||||
|
||||
<div class="wallet-details__tx-title" ng-if="isUnconfirmed(btx)">
|
||||
<div class="ellipsis" style="color: #B4B4B4;">
|
||||
<span ng-if="btx.action == 'sent' || btx.action == 'moved'">
|
||||
{{addressbook[btx.addressTo].name || addressbook[btx.addressTo] || 'Sending'|translate}}
|
||||
</span>
|
||||
<span ng-if="btx.action == 'received'" translate>Receiving</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="item-note text-right wallet-details__tx-amount">
|
||||
<span class="wallet-details__tx-amount" ng-class="{'wallet-details__tx-amount--recent': btx.recent, 'wallet-details__tx-amount--received': btx.action == 'received', 'wallet-details__tx-amount--sent': btx.action == 'sent'}">
|
||||
<span ng-if="btx.action == 'sent'">–</span>
|
||||
<span class="size-12" ng-if="btx.action == 'invalid'" translate>
|
||||
(possible double spend)
|
||||
</span>
|
||||
<span ng-if="btx.action != 'invalid'">
|
||||
{{btx.amountStr}}
|
||||
</span>
|
||||
</span>
|
||||
<div>
|
||||
<time class="wallet-details__tx-time" ng-if="btx.time && createdWithinPastDay(btx.time)">{{btx.time * 1000 | amTimeAgo}}</time>
|
||||
<time class="wallet-details__tx-time" ng-if="btx.time && !createdWithinPastDay(btx.time)">
|
||||
{{btx.time * 1000 | amDateFormat:'MMM D, YYYY'}}
|
||||
</time>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<span ng-include="'views/includes/walletHistory.html'"></span>
|
||||
</div>
|
||||
</div>
|
||||
<ion-infinite-scroll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue