diff --git a/src/main/resources/static/js/controllers.js b/src/main/resources/static/js/controllers.js index 6cbdae9..8c83250 100644 --- a/src/main/resources/static/js/controllers.js +++ b/src/main/resources/static/js/controllers.js @@ -234,8 +234,9 @@ transactionControllers.controller('TransactionListCtrl', [ '$http', '$scope', '$ } }); - modalInstance.result.then(function(selectedItem) { - $scope.selected = selectedItem; + modalInstance.result.then(function(transaction) { + $scope.lastSubmission = undefined; + $scope.refreshList(); }, function () { $log.info('Modal dismissed at: ' + new Date()); }); @@ -267,21 +268,21 @@ transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$resource', ' } } - // FIXME can't wait for the promise since most transactions return HTTP 404 for the creditor - if (transaction.creditor.name != undefined) { + transaction.creditor.$promise.then(function(data) { $scope.transaction.creditor = $scope.transaction.creditor._links.user.href; - console.log('creditor: ' + transaction.creditor.name); - } - else { + }, + function(error) { // transactions without a creditor return a HTTP 404 error $scope.transaction.creditor = ""; - } + }); }); }); $scope.ok = function () { + // set URI for category and save via PUT request $scope.transaction.category = $scope.transaction.category._links.self.href; $scope.transaction.$update(function() {}); + $uibModalInstance.close($scope.transaction); }; @@ -290,10 +291,10 @@ transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$resource', ' }; // TODO still used? - $scope.deleteTransaction = function(transaction) { + $scope.deleteTransaction = function() { // TODO auf return code reagieren - $resource(transaction._links.self.href).remove().$promise.then(function() { - $location.path('/'); + $resource($scope.transaction._links.self.href).remove().$promise.then(function() { + $uibModalInstance.close(); }); } } ]); diff --git a/src/main/resources/static/partials/transaction-list.html b/src/main/resources/static/partials/transaction-list.html index d281ae5..9ff9cf6 100644 --- a/src/main/resources/static/partials/transaction-list.html +++ b/src/main/resources/static/partials/transaction-list.html @@ -167,10 +167,15 @@
-{{transaction | json}}
+