improved withdrawal handling
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.tilman</groupId>
|
||||
<artifactId>next-transactions</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<version>1.5.1</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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,8 +103,22 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
||||
}
|
||||
|
||||
$scope.checkCategory = function() {
|
||||
var radioButtons = document.getElementsByName('expenseBy');
|
||||
|
||||
// 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() {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<div class="col-md-offset-4 col-md-4 col-xs-12">
|
||||
|
||||
<div ng-show="lastSubmission" class="lastSubmission col-xs-offset-1 alert alert-info" role="alert">
|
||||
<div ng-show="lastSubmission" class="lastSubmission alert alert-info" role="alert">
|
||||
{{lastSubmission.date | date:'dd.MM.yyyy'}}
|
||||
<span ng-class="{ 'color-green': lastSubmission.amount.charAt(0) == '+', 'color-red': lastSubmission.amount.charAt(0) == '-' }">{{lastSubmission.amount}} €</span>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user