open tx modal from home

This commit is contained in:
Javier 2016-09-20 13:56:54 -03:00
commit 64b879fcd3
4 changed files with 52 additions and 31 deletions

View file

@ -1,5 +1,5 @@
<ion-modal-view ng-controller="txDetailsController" ng-init="init()" id="tx-details"> <ion-modal-view ng-controller="txDetailsController" ng-init="init()" id="tx-details">
<ion-header-bar align-title="center" class="bar-royal" ng-style="{'background-color':color}"> <ion-header-bar align-title="center" class="bar-royal" ng-style="{'background-color': color}">
<button class="button button-clear" ng-click="cancel()"> <button class="button button-clear" ng-click="cancel()">
{{'Close' | translate}} {{'Close' | translate}}
</button> </button>
@ -9,10 +9,10 @@
</ion-header-bar> </ion-header-bar>
<ion-content> <ion-content>
<div class="header-modal text-center" ng-init="showRate = false"> <div class="header-modal text-center" ng-if="!loadingTxInfo" ng-init="showRate = false">
<div ng-show="btx.action != 'invalid'"> <div ng-show="btx.action != 'invalid'">
<i class="icon big-icon-svg" ng-if="color"> <i class="icon big-icon-svg">
<img src="img/icon-wallet.svg" ng-style="{'background-color': color}" class="bg"/> <img src="img/icon-wallet.svg" ng-style="{'background-color': color}" class="bg"/>
</i> </i>
@ -30,30 +30,30 @@
</div> </div>
</div> </div>
<div ng-show="btx.action == 'sent'"> <div ng-show="btx.action == 'sent'">
<span translate>Sent from</span> {{wallet.credentials.walletName}} <span translate>Sent from</span> {{wallet.credentials.walletName}}
<div class="padding-vertical"> <div class="padding-vertical">
<i class="icon ion-ios-arrow-thin-down size-24"></i> <i class="icon ion-ios-arrow-thin-down size-24"></i>
</div>
</div> </div>
</div>
<div ng-show="btx.action == 'received'"> <div ng-show="btx.action == 'received'">
<div class="padding-vertical"> <div class="padding-vertical">
<i class="icon ion-ios-arrow-thin-up size-24"></i> <i class="icon ion-ios-arrow-thin-up size-24"></i>
</div>
<span translate>Received Funds</span>
</div> </div>
<span translate>Received Funds</span>
</div>
<div ng-show="btx.action == 'moved'"> <div ng-show="btx.action == 'moved'">
<span translate>Moved Funds</span> <span translate>Moved Funds</span>
</div> </div>
<div ng-show="btx.action == 'invalid'"> <div ng-show="btx.action == 'invalid'">
- -
</div> </div>
</div> </div>
<div class="list"> <div class="list" ng-if="!loadingTxInfo">
<div class="item item-icon-left" ng-show="btx.action == 'sent'"> <div class="item item-icon-left" ng-show="btx.action == 'sent'">
<i class="icon ion-social-bitcoin-outline"></i> <i class="icon ion-social-bitcoin-outline"></i>
<div ng-if="!btx.hasMultiplesOutputs && btx.addressTo && btx.addressTo != 'N/A'" copy-to-clipboard="btx.addressTo"> <div ng-if="!btx.hasMultiplesOutputs && btx.addressTo && btx.addressTo != 'N/A'" copy-to-clipboard="btx.addressTo">
@ -75,14 +75,22 @@
</div> </div>
<div class="item"> <div class="item">
<div translate>Created by</div> <div ng-if="btx.action == 'received'">
<span>{{btx.creatorName}}</span> <span translate>Date</span>
<span class="item-note"> <span class="item-note">
<time>{{ btx.createdOn * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}}</time> <time>{{ btx.time * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}}</time>
</span> </span>
</div>
<div ng-if="btx.action == 'sent'">
<div translate>Created by</div>
<span>{{btx.creatorName}}</span>
<span class="item-note">
<time>{{ btx.createdOn * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}}</time>
</span>
</div>
</div> </div>
<div class="item" ng-show="btx.action != 'received'" copy-to-clipboard="btx.feeStr"> <div class="item" ng-if="btx.action != 'received' && btx.feeLevel" copy-to-clipboard="btx.feeStr">
<div translate>Fee</div> <div translate>Fee</div>
<span class="enable_text_select">{{btx.feeLevel}} ({{btx.feeStr}})</span> <span class="enable_text_select">{{btx.feeLevel}} ({{btx.feeStr}})</span>
<span class="right"> <span class="right">

View file

@ -1,26 +1,37 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $scope, $filter, $stateParams, walletService, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) { angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $scope, $filter, $stateParams, ongoingProcess, walletService, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) {
var self = $scope.self; var self = $scope.self;
var wallet = profileService.getWallet($stateParams.walletId || $scope.walletId); var wallet = profileService.getWallet($stateParams.walletId || $scope.walletId);
var config = configService.getSync(); var config = configService.getSync();
var configWallet = config.wallet; var configWallet = config.wallet;
var walletSettings = configWallet.settings; var walletSettings = configWallet.settings;
$scope.title = gettextCatalog.getString('Transaction');
$scope.loadingTxInfo = false;
$scope.init = function() { $scope.init = function() {
$scope.loadingTxInfo = true;
ongoingProcess.set('loadingTxInfo', true);
findTx($scope.txid, function(err, tx) { findTx($scope.txid, function(err, tx) {
ongoingProcess.set('loadingTxInfo', false);
$scope.loadingTxInfo = false;
if (err) { if (err) {
$log.error(err); $log.error(err);
return; popupService.showAlert(gettextCatalog.getString('Error'), err);
return $scope.cancel();
} }
console.log('TX FOUND', tx);
if (!tx) {
$log.warn('No tx found');
popupService.showAlert(gettextCatalog.getString('Transaction not found'), null);
return $scope.cancel();
}
$scope.btx = lodash.cloneDeep(tx); $scope.btx = lodash.cloneDeep(tx);
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode; $scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
$scope.color = wallet.color; $scope.color = wallet.color;
$scope.copayerId = wallet.credentials.copayerId; $scope.copayerId = wallet.credentials.copayerId;
$scope.isShared = wallet.credentials.n > 1; $scope.isShared = wallet.credentials.n > 1;
// $scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName;
// $scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName;
$scope.btx.feeLevel = walletSettings.feeLevel; $scope.btx.feeLevel = walletSettings.feeLevel;
if ($scope.btx.action != 'invalid') { if ($scope.btx.action != 'invalid') {
@ -46,8 +57,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
txid: txid txid: txid
}); });
if (tx) return cb(null, tx); return cb(null, tx);
else return cb();
}); });
}; };
@ -148,5 +158,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.cancel = function() { $scope.cancel = function() {
$scope.txDetailsModal.hide(); $scope.txDetailsModal.hide();
$timeout(function() {
$scope.txDetailsModal.remove();
}, 10);
}; };
}); });

View file

@ -17,7 +17,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}); });
$scope.openTxModal = function(n) { $scope.openTxModal = function(n) {
console.log(n);
$scope.txid = n.txid; $scope.txid = n.txid;
$scope.walletId = n.walletId; $scope.walletId = n.walletId;
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', { $ionicModal.fromTemplateUrl('views/modals/tx-details.html', {

View file

@ -32,6 +32,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
'sweepingWallet': gettext('Sweeping Wallet...'), 'sweepingWallet': gettext('Sweeping Wallet...'),
'validatingWallet': gettext('Validating wallet integrity...'), 'validatingWallet': gettext('Validating wallet integrity...'),
'validatingWords': gettext('Validating recovery phrase...'), 'validatingWords': gettext('Validating recovery phrase...'),
'loadingTxInfo': gettext('Loading transaction info...'),
}; };
root.clear = function() { root.clear = function() {