diff --git a/src/main/resources/static/js/controllers.js b/src/main/resources/static/js/controllers.js index e54902f..f676512 100644 --- a/src/main/resources/static/js/controllers.js +++ b/src/main/resources/static/js/controllers.js @@ -18,8 +18,6 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location' }; if (typeof $scope.categories !== 'undefined') { - // TODO default-Kategorie sollte per Account einstellbar sein - console.log('DID IT!'); $scope.transaction.category = $scope.categories[0]; } @@ -60,12 +58,18 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location' $scope.postTransaction = function() { + var amount = $scope.transaction.amount.replace(',', '.'); + + if (amount.charAt(0) !== '+' && amount.charAt(0) !== '-') { + amount = '-' + amount; + } + // via Resource (might be moved into a service) var Transaction = $resource('/transactions'); var newTransaction = new Transaction({ "account" : $scope.account._links.self.href, - "amount" : $scope.transaction.amount, + "amount" : amount, "date" : $scope.transaction.date, "description" : $scope.transaction.description, "category" : $scope.transaction.category._links.self.href, diff --git a/src/main/resources/static/partials/transaction-list.html b/src/main/resources/static/partials/transaction-list.html index 02e7f78..ace1ef4 100644 --- a/src/main/resources/static/partials/transaction-list.html +++ b/src/main/resources/static/partials/transaction-list.html @@ -2,10 +2,11 @@
-
+
- Betrag: + Betrag:
+ The value is not a valid value!
Kategorie:
- +