budget is broken, disable it

This commit is contained in:
Gwenhael Le Moine 2015-08-04 21:29:58 +02:00
parent 0e7725db56
commit aaadc4c741
2 changed files with 53 additions and 53 deletions

View file

@ -156,18 +156,18 @@ app.controller( 'DashboardCtrl',
period += ' to ' + to.year() + '-' + ( to.month() + 1 ) + '-' + to.date();
}
API.budget( { period: period,
categories: 'Expenses' } )
.then( function( response ) {
$scope.budget = response.data;
// API.budget( { period: period,
// categories: 'Expenses' } )
// .then( function( response ) {
// $scope.budget = response.data;
$scope.total_budget = _.chain($scope.budget)
.pluck( 'amount' )
.reduce( function( acc, amount ) { return acc + amount; },
0 )
.value();
$scope.total_unbudgeted = _($scope.budget).findWhere( { percentage: -1 } ).amount;
} );
// $scope.total_budget = _.chain($scope.budget)
// .pluck( 'amount' )
// .reduce( function( acc, amount ) { return acc + amount; },
// 0 )
// .value();
// $scope.total_unbudgeted = _($scope.budget).findWhere( { percentage: -1 } ).amount;
// } );
_($scope.balance.buckets).each( function( bucket ) {
API.balance( { period: period,

View file

@ -79,46 +79,46 @@
</md-card>
</md-content>
</md-card>
<md-card flex="48" layout="column">
<table class="table">
<thead>
<tr>
<th style="width: 11%">Account</th>
<th style="width: 3%">Spent</th>
<th style="width: 3%">Budgeted</th>
<th style="width: 3%">Percentage</th>
<th>Progress</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="account in budget"
data-ng-class="{'even': $even, 'odd': $odd}">
<td>
{{account.account}}
</td>
<td style="text-align: right;">
{{account.amount | number:2}}{{account.currency}}
</td>
<td style="text-align: right;">
<span data-ng-if="account.percentage >= 0">{{account.budget | number:2}}{{account.currency}}</span>
<span data-ng-if="account.percentage < 0">
{{balance.buckets[1].raw_total - total_budget | number:2}}{{account.currency}}
</span>
</td>
<td style="text-align: right;">
<span data-ng-if="account.percentage >= 0">{{account.percentage | number:2}}%</span>
<span data-ng-if="account.percentage < 0">
{{( account.amount / ( balance.buckets[1].raw_total - total_budget ) ) * 100 | number:2}}%
</span>
</td>
<td>
<md-progress-linear
ng-class="{'md-warn': account.percentage > 100, 'md-warn md-hue-3': account.account == '(unbudgeted)' }"
md-mode="determinate"
value="{{account.percentage}}"></md-progress-linear>
</td>
</tr>
</tbody>
</table>
</md-card>
<!-- <md-card flex="48" layout="column">
<table class="table">
<thead>
<tr>
<th style="width: 11%">Account</th>
<th style="width: 3%">Spent</th>
<th style="width: 3%">Budgeted</th>
<th style="width: 3%">Percentage</th>
<th>Progress</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="account in budget"
data-ng-class="{'even': $even, 'odd': $odd}">
<td>
{{account.account}}
</td>
<td style="text-align: right;">
{{account.amount | number:2}}{{account.currency}}
</td>
<td style="text-align: right;">
<span data-ng-if="account.percentage >= 0">{{account.budget | number:2}}{{account.currency}}</span>
<span data-ng-if="account.percentage < 0">
{{balance.buckets[1].raw_total - total_budget | number:2}}{{account.currency}}
</span>
</td>
<td style="text-align: right;">
<span data-ng-if="account.percentage >= 0">{{account.percentage | number:2}}%</span>
<span data-ng-if="account.percentage < 0">
{{( account.amount / ( balance.buckets[1].raw_total - total_budget ) ) * 100 | number:2}}%
</span>
</td>
<td>
<md-progress-linear
ng-class="{'md-warn': account.percentage > 100, 'md-warn md-hue-3': account.account == '(unbudgeted)' }"
md-mode="determinate"
value="{{account.percentage}}"></md-progress-linear>
</td>
</tr>
</tbody>
</table>
</md-card> -->
</md-content>