ticket.index filter by date if no filters were entered
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-07-12 12:20:55 +02:00
parent 29744c52f3
commit c4fcaeb908
1 changed files with 9 additions and 24 deletions

View File

@ -18,31 +18,7 @@ export default class Controller {
this.$.balanceCreateDialog.show();
}, name: 'Payment on account...', always: true}
];
if (!$stateParams.q) {
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
};
}
}
/* getScopeDays() {
this.$http.get(`/api/TicketConfigs/findOne`).then(res => {
if (res.data) {
this.filter = {
scopeDays: parseInt(res.data.scopeDays)
};
}
});
} */
setBalanceCreateDialog() {
let data = this.$.tickets;
@ -79,6 +55,15 @@ 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);