diff --git a/pom.xml b/pom.xml index 39b2987..12ca792 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.tilman next-transactions - 1.5.0 + 1.5.1 org.springframework.boot diff --git a/src/main/resources/data-h2.sql b/src/main/resources/data-h2.sql index 5307ff1..b278ad1 100644 --- a/src/main/resources/data-h2.sql +++ b/src/main/resources/data-h2.sql @@ -5,7 +5,8 @@ INSERT INTO Category (id, name, account_id, position) VALUES (null, 'Essen - Lebensmittel', 1, 2), (null, 'Einnahmen - Gehalt', 1, 1), (null, 'Essen - Arbeit', 1, 3), - (null, 'Private Entnahme', 1, 4), + (null, 'Wohnen - Haushalt', 1, 4), + (null, 'Private Entnahme', 1, 5), (null, 'Einnahmen - Gehalt', 2, 1), (null, 'Technik - Server und Hosting', 2, 2); diff --git a/src/main/resources/static/app/controllers.js b/src/main/resources/static/app/controllers.js index 87bdb74..3141cea 100644 --- a/src/main/resources/static/app/controllers.js +++ b/src/main/resources/static/app/controllers.js @@ -84,6 +84,8 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara } } + $scope.checkCategory(); + // get recent transactions var transactions = $resource('/api/transactions/search/forAccount', { accountId: $scope.account.id, size: $scope.pageSize, sort: 'date,desc' }).get(); transactions.$promise.then(function(data) { @@ -101,9 +103,23 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara } $scope.checkCategory = function() { - var radioButtons = document.getElementsByName('expenseBy'); - var userLabels = document.getElementsByClassName('userLabel'); - } + + // if this is selected to be a withdrawal, preselect the current user and disable "no creditor" radio button + if ($scope.transaction.category.name === 'Private Entnahme') { + var userLabels = document.getElementsByClassName('userLabel'); + + for (i = 0; i < userLabels.length; i++) { + if (userLabels[i].innerHTML.indexOf($scope.userinfo.name) >= 0) { + userLabels[i].getElementsByTagName('INPUT')[0].checked = true; + } + } + document.getElementById('noCreditorRadioButton').disabled = true; + } + else { + document.getElementById('noCreditorRadioButton').disabled = false; + document.getElementById('noCreditorRadioButton').checked = true; + } + } $scope.initList = function() { $scope.pageSize = 20; diff --git a/src/main/resources/static/app/transaction-list.html b/src/main/resources/static/app/transaction-list.html index 83b1b34..0fc3a04 100644 --- a/src/main/resources/static/app/transaction-list.html +++ b/src/main/resources/static/app/transaction-list.html @@ -10,7 +10,7 @@
-