Show budget, pt. 1
This commit is contained in:
@@ -73,6 +73,6 @@ INSERT INTO Transaction (id, amount, account_id, category_id, date, description,
|
||||
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES (NULL, -1.50, 1, 3, '2019-10-01', 'Transaction28', null); Commit;
|
||||
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES (NULL, -1.50, 1, 1, '2019-10-01', 'Transaction29', null); Commit;
|
||||
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES (NULL, -1.50, 1, 3, '2019-10-01', 'Transaction30', null); Commit;
|
||||
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES (NULL, 1.90, 2, 5, CURRENT_TIMESTAMP()+1, 'LAST Transaction', null); Commit;
|
||||
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES (NULL, -14.95, 1, 5, CURRENT_TIMESTAMP()+1, 'LAST Transaction', null); Commit;
|
||||
|
||||
--SCRIPT TO 'h2export.sql';
|
||||
@@ -104,6 +104,25 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
||||
|
||||
$scope.checkCategory = function() {
|
||||
|
||||
// get current expense level for category
|
||||
$scope.transaction.category.percentage = 0;
|
||||
|
||||
// https://stackoverflow.com/a/30119263
|
||||
var budgetInfo = $resource('/api/categories/search/expenseLevelYear', { accountId: $scope.account.id, categoryId: $scope.transaction.category.id }, {'getText': {
|
||||
transformResponse: function(data, headersGetter, status) {
|
||||
return {value: data};
|
||||
}}}).getText();
|
||||
budgetInfo.$promise.then(function(data) {
|
||||
$scope.transaction.category.percentage = parseFloat(budgetInfo.value) + 5;
|
||||
// console.log(budgetInfo.value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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') {
|
||||
$scope.transaction.creditor = $scope.userinfo._links.self.href;
|
||||
|
||||
@@ -84,6 +84,10 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="budgetArea">
|
||||
Budget: <span class="budgetCalculation"><span ng-bind="transaction.category.budget"></span> <span ng-bind="transaction.category.percentage"></span></span>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table class="listing">
|
||||
<tr>
|
||||
|
||||
@@ -15,6 +15,17 @@ label {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.budgetArea {
|
||||
font-family: "Yanone Kaffeesatz", sans-serif;
|
||||
color: #eee;
|
||||
margin-top: .5em;
|
||||
}
|
||||
|
||||
.budgetCalculation {
|
||||
font-family: "Open Sans", sans-serif;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-body label {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user