Merge branch 'master' of github.com:cycojesus/ledgerrb
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
commit
045f3d6bb9
3 changed files with 40 additions and 29 deletions
|
@ -2,7 +2,6 @@ var app = angular.module( 'app', [ 'ui.router',
|
||||||
'nvd3ChartDirectives',
|
'nvd3ChartDirectives',
|
||||||
'angularMoment',
|
'angularMoment',
|
||||||
'chieffancypants.loadingBar',
|
'chieffancypants.loadingBar',
|
||||||
'ngTable',
|
|
||||||
'angular-underscore',
|
'angular-underscore',
|
||||||
'ngMaterial'
|
'ngMaterial'
|
||||||
] );
|
] );
|
||||||
|
|
|
@ -56,17 +56,6 @@ app.controller( 'BalanceCtrl',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.tableParams = new ngTableParams( {
|
|
||||||
page: 1, // show first page
|
|
||||||
count: 999 // count per page
|
|
||||||
}, {
|
|
||||||
counts: [], // hide page counts control
|
|
||||||
total: 1 //, // value less than count hide pagination
|
|
||||||
// getData: function($defer, params) {
|
|
||||||
// $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
||||||
// }
|
|
||||||
} );
|
|
||||||
|
|
||||||
$scope.filter_data = function() {
|
$scope.filter_data = function() {
|
||||||
_($scope.balance.buckets).each( function( bucket ) {
|
_($scope.balance.buckets).each( function( bucket ) {
|
||||||
bucket.data = [];
|
bucket.data = [];
|
||||||
|
@ -91,11 +80,24 @@ app.controller( 'BalanceCtrl',
|
||||||
} );
|
} );
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
var Bucket = function( categories ) {
|
||||||
|
var _this = this;
|
||||||
|
this.categories = categories;
|
||||||
|
this.score_threshold = 0;
|
||||||
|
this.orderBy = 'amount';
|
||||||
|
this.orderDesc = false;
|
||||||
|
this.order_by = function( field ) {
|
||||||
|
if ( _this.orderBy == field ) {
|
||||||
|
_this.orderDesc = !_this.orderDesc;
|
||||||
|
} else {
|
||||||
|
_this.orderBy = field;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
$scope.balance = {
|
$scope.balance = {
|
||||||
buckets: [ { categories: 'Expenses',
|
buckets: [ new Bucket( 'Expenses' ),
|
||||||
score_threshold: 0 },
|
new Bucket( 'Income' ) ],
|
||||||
{ categories: 'Income',
|
|
||||||
score_threshold: 0 } ],
|
|
||||||
details: {}
|
details: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,19 +55,29 @@
|
||||||
</nvd3-pie-chart>
|
</nvd3-pie-chart>
|
||||||
</material-content>
|
</material-content>
|
||||||
<material-content>
|
<material-content>
|
||||||
<table data-ng-table="tableParams" class="table">
|
<table class="table">
|
||||||
<tr data-ng-repeat="account in bucket.data"
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><material-buton data-ng-click="bucket.order_by( 'account' )">account</material-buton></th>
|
||||||
|
<th><material-buton data-ng-click="bucket.order_by( 'amount' )">amount</material-buton></th>
|
||||||
|
<th><material-buton data-ng-click="bucket.order_by( 'score' )">score</material-buton></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr data-ng-repeat="account in bucket.data | orderBy:bucket.orderBy:bucket.orderDesc"
|
||||||
data-ng-class="{'even': $even, 'odd': $odd}"
|
data-ng-class="{'even': $even, 'odd': $odd}"
|
||||||
style="border-left:10px solid {{coloring_score( account.score )}};border-right:10px solid {{coloring_score( account.score )}}">
|
style="border-left:10px solid {{coloring_score( account.score )}};border-right:10px solid {{coloring_score( account.score )}}">
|
||||||
<td data-title="'Account'"
|
<td style="border-bottom:1px solid {{coloring_score( account.score )}}">
|
||||||
style="border-bottom:1px solid {{coloring_score( score_account( account.account ) )}}">
|
|
||||||
{{account.account}}
|
{{account.account}}
|
||||||
</td>
|
</td>
|
||||||
<td data-title="'Amount'"
|
<td style="text-align:right;border-bottom:1px solid {{coloring_score( account.score )}}">
|
||||||
style="text-align:right;border-bottom:1px solid {{coloring_score( score_account( account.account ) )}}">
|
|
||||||
{{account.amount | number:2}} €
|
{{account.amount | number:2}} €
|
||||||
</td>
|
</td>
|
||||||
|
<td style="text-align:right;border-bottom:1px solid {{coloring_score( account.score )}}">
|
||||||
|
{{account.score}}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</material-content>
|
</material-content>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue