mirror of
https://github.com/gwenhael-le-moine/ledgerrb.git
synced 2025-01-26 07:58:10 +01:00
add 'future' period
This commit is contained in:
parent
890974cb38
commit
7f8f165279
2 changed files with 17 additions and 7 deletions
|
@ -68,14 +68,24 @@ app.controller( 'BalanceCtrl',
|
|||
} );
|
||||
|
||||
var retrieve_data = function () {
|
||||
$scope.from_date = new Date( $scope.dates_salaries[ $scope.period_offset ] );
|
||||
$scope.to_date = ( $scope.period_offset < $scope.dates_salaries.length - 1 ) ? new Date( $scope.dates_salaries[ $scope.period_offset + 1 ] ) : moment( $scope.from_date ).add( 1, 'month' ).toDate();
|
||||
var from, to, period;
|
||||
|
||||
var from = moment( $scope.from_date );
|
||||
var to = moment( $scope.to_date );
|
||||
if ( $scope.period_offset === $scope.dates_salaries.length ) {
|
||||
$scope.from_date = moment( _($scope.dates_salaries).last() ).add( 1, 'month' ).toDate();
|
||||
|
||||
var period = 'from ' + from.year() + '-' + ( from.month() + 1 ) + '-' + from.date();
|
||||
period += ' to ' + to.year() + '-' + ( to.month() + 1 ) + '-' + to.date();
|
||||
from = moment( $scope.from_date );
|
||||
|
||||
period = 'from ' + from.year() + '-' + ( from.month() + 1 ) + '-' + from.date();
|
||||
} else {
|
||||
$scope.from_date = new Date( $scope.dates_salaries[ $scope.period_offset ] );
|
||||
$scope.to_date = ( $scope.period_offset < $scope.dates_salaries.length - 1 ) ? new Date( $scope.dates_salaries[ $scope.period_offset + 1 ] ) : moment( $scope.from_date ).add( 1, 'month' ).toDate();
|
||||
|
||||
from = moment( $scope.from_date );
|
||||
to = moment( $scope.to_date );
|
||||
|
||||
period = 'from ' + from.year() + '-' + ( from.month() + 1 ) + '-' + from.date();
|
||||
period += ' to ' + to.year() + '-' + ( to.month() + 1 ) + '-' + to.date();
|
||||
}
|
||||
|
||||
$scope.balance = {
|
||||
buckets: [ {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
data-ng-class="{'disabled': period_offset == dates_salaries.length - 1}">Now</material-button>
|
||||
<material-button class="material-theme-green"
|
||||
data-ng-click="after()"
|
||||
data-ng-class="{'disabled': period_offset == dates_salaries.length - 1}">next</material-button>
|
||||
data-ng-class="{'disabled': period_offset == dates_salaries.length}">next</material-button>
|
||||
</div>
|
||||
<material-toolbar>
|
||||
<h2 class="balance" data-ng-class="{'negative': balance.buckets[1].total - balance.buckets[0].total < 0, 'positive': balance.buckets[1].total - balance.buckets[0].total > 0}">
|
||||
|
|
Loading…
Add table
Reference in a new issue