improved withdrawal handling
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user