improved withdrawal handling

This commit is contained in:
2016-07-30 23:14:25 +02:00
parent 23e4891a64
commit df8edf4607
4 changed files with 23 additions and 6 deletions
+19 -3
View File
@@ -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;