search modal

This commit is contained in:
Javier 2016-05-17 11:09:22 -03:00
commit 6dfd124535
3 changed files with 100 additions and 32 deletions

View file

@ -0,0 +1,68 @@
<ion-modal-view>
<ion-header-bar>
<h1 class="title" translate>Search Transactions</h1>
<a class="m5t" ng-click="modal.hide(); index.cancelSearch()">
<span class="text-close">{{'Close'|translate}}</span>
</a>
</ion-header-bar>
<ion-content>
<div class="row searchBar searchLabel">
<i class="fi-magnifying-glass size-14"></i>
<form>
<input name="search" type="search" ng-model="search" ng-init="search = ''" ng-change="index.updateSearchInput(search)"
placeholder="{{'Search transactions' | translate}}">
</input>
</form>
</div>
<div ng-repeat="btx in index.txHistorySearchResults track by btx.txid"
ng-click="home.openTxModal(btx)"
class="row collapse last-transactions-content">
<div class="large-6 medium-6 small-6 columns size-14">
<div class="m10r left">
<img src="img/icon-receive-history.svg" alt="sync" width="40" ng-show="btx.action == 'received'">
<img src="img/icon-sent-history.svg" alt="sync" width="40" ng-show="btx.action == 'sent'">
<img src="img/icon-moved.svg" alt="sync" width="40" ng-show="btx.action == 'moved'">
</div>
<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>
</span>
<span ng-show="btx.action == 'moved'" translate>Moved</span>
<span class="label tu warning radius" ng-show="btx.action == 'invalid'" translate>Invalid</span>
</div>
</div>
<div class="large-5 medium-5 small-5 columns 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>
<div class="size-12 text-gray">
<time ng-if="btx.time">{{btx.time * 1000 | amTimeAgo}}</time>
<span translate class="text-warning"
ng-show="!btx.time && (!btx.confirmations || btx.confirmations == 0)">
Unconfirmed
</span>
</div>
</div>
<div class="large-1 medium-1 small-1 columns text-right m10t">
<i class="icon-arrow-right3 size-18"></i>
</div>
</div>
</ion-content>
</ion-modal-view>

View file

@ -178,7 +178,7 @@
</div>
<div class="oh pr" ng-show="index.txHistory[0] || index.txProgress > 5">
<h4 class="title" ng-click="index.startSearch(); search=''" ng-show="!index.isSearching">
<h4 class="title" ng-click="index.startSearch(); openModal()">
<span translate>Activity</span>
<i class="dib m5l size-16 pointer fi-magnifying-glass"></i>
</h4>
@ -201,7 +201,7 @@
</div>
</div>
<div ng-if="index.txHistory[0] && index.updatingTxHistory && index.newTx" class="row collapse last-transactions-content animated fadeInDown">
<div ng-if="index.txHistory[0] && index.updatingTxHistory && index.newTx" class="row collapse last-transactions-content animated fadeInDown">
<div class="large-6 medium-6 small-6 columns size-14">
<div class="m10r left">
<img src="img/icon-new.svg" width="40">
@ -215,25 +215,9 @@
</div>
</div>
<div ng-show="index.isSearching" class="row searchBar">
<div class="small-11 columns">
<div class="searchLabel">
<i class="fi-magnifying-glass size-14"></i>
<form>
<input name="search"
type="search"
ng-change="index.updateSearchInput(search)"
placeholder="{{'Search transactions' | translate}}"
ng-model="search">
</input>
</form>
</div>
</div>
<div class="small-1 columns">
<a ng-click="index.cancelSearch()" translate>Cancel</a>
</div>
</div>
<div ng-repeat="btx in index.txHistorySearchResults track by btx.txid"
<div class="row"></div>
<div ng-repeat="btx in index.txHistory track by btx.txid"
ng-click="home.openTxModal(btx)"
class="row collapse last-transactions-content">
<div class="large-6 medium-6 small-6 columns size-14">

View file

@ -1,11 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid;
var isChromeApp = platformInfo.isChromeApp;
var isChromeApp = platformInfo.isChromeApp;
var self = this;
window.ignoreMobilePause = false;
@ -287,7 +287,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$modalInstance.close(addr);
});
}
}
});
};
};
@ -431,7 +431,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var client = profileService.focusedClient;
$scope.error = null;
$scope.loading = true;
fingerprintService.check(client, function(err) {
if (err) {
$scope.loading = false;
@ -451,7 +451,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
if (err) {
$scope.loading = false;
$scope.error = err;
return;
return;
}
if (signedTxp.status == 'accepted') {
@ -955,7 +955,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
txp.sendMax = true;
txp.inputs = self.sendMaxInfo.inputs;
txp.fee = self.sendMaxInfo.fee;
}else {
} else {
txp.amount = amount;
}
@ -988,7 +988,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
});
}, 100);
};
};
this.confirmTx = function(txp) {
var client = profileService.focusedClient;
@ -1018,11 +1018,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
if (err) {
$scope.$emit('Local/TxProposalAction');
return self.setSendError(
err.message ?
err.message :
gettext('The payment was created but could not be completed. Please try again from home screen'));
err.message ?
err.message :
gettext('The payment was created but could not be completed. Please try again from home screen'));
}
if (signedTxp.status == 'accepted') {
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction'));
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
@ -1049,6 +1049,22 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
});
};
$ionicModal.fromTemplateUrl('views/modals/searchTransactions.html', {
scope: $scope,
focusFirstInput: true,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
this.setForm = function(to, amount, comment) {
var form = $scope.sendForm;
if (to) {