refactor call tx modal

This commit is contained in:
Javier 2016-09-20 16:21:05 -03:00
commit 1cfd4c733f
8 changed files with 90 additions and 77 deletions

View file

@ -1,10 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('activityController',
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
var self = this;
function($timeout, $scope, $log, $ionicModal, lodash, profileService, walletService, ongoingProcess, popupService, gettextCatalog) {
$scope.init = function() {
$scope.fetchingNotifications = true;
profileService.getNotifications(50, function(err, n) {
@ -19,4 +16,32 @@ angular.module('copayApp.controllers').controller('activityController',
}, 1);
});
}
$scope.openTxModal = function(n) {
var wallet = profileService.getWallet(n.walletId);
ongoingProcess.set('loadingTxInfo', true);
walletService.getTx(wallet, n.txid, function(err, tx) {
ongoingProcess.set('loadingTxInfo', false);
if (err) {
$log.error(err);
return popupService.showAlert(gettextCatalog.getString('Error'), err);
}
if (!tx) {
$log.warn('No tx found');
return popupService.showAlert(gettextCatalog.getString('Transaction not found'), null);
}
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope
}).then(function(modal) {
$scope.txDetailsModal = modal;
$scope.txDetailsModal.show();
});
});
};
});