apply default filters
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-07-12 12:56:00 +02:00
parent 6b9286d1b0
commit eefa4b9f5b
1 changed files with 14 additions and 10 deletions

View File

@ -18,6 +18,20 @@ export default class Controller {
this.$.balanceCreateDialog.show();
}, name: 'Payment on account...', always: true}
];
if (!$stateParams.q)
this.setDefaultFilter();
}
setDefaultFilter() {
const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(23, 59, 59, 999);
this.filter = {from: today, to: tomorrow};
}
setBalanceCreateDialog() {
@ -55,17 +69,7 @@ export default class Controller {
this.scopeDays = params.scopeDays;
this.buildFilterDates();
params = Object.assign(params, {from: this.today, to: this.daysOnward});
} else if (!params.from && !params.to) {
const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(23, 59, 59, 999);
params = Object.assign(params, {from: today, to: tomorrow});
}
this.$.model.applyFilter(null, params);
} else
this.$.model.clear();