fix transactions search modal
This commit is contained in:
parent
d43062870f
commit
b23c1c7910
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue