2019-11-10 10:08:44 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import ModuleMain from 'salix/components/module-main';
|
|
|
|
|
|
|
|
export default class Route extends ModuleMain {
|
2021-02-02 09:26:10 +00:00
|
|
|
$postLink() {
|
2023-01-16 14:18:24 +00:00
|
|
|
const to = Date.vnNew();
|
2021-02-02 09:26:10 +00:00
|
|
|
to.setDate(to.getDate() + 1);
|
|
|
|
to.setHours(0, 0, 0, 0);
|
2019-11-10 10:08:44 +00:00
|
|
|
|
2023-01-16 14:18:24 +00:00
|
|
|
const from = Date.vnNew();
|
2021-02-02 09:26:10 +00:00
|
|
|
from.setDate(from.getDate());
|
|
|
|
from.setHours(0, 0, 0, 0);
|
|
|
|
|
|
|
|
this.filterParams = {from, to};
|
|
|
|
this.$.model.applyFilter(null, this.filterParams);
|
2021-01-20 12:19:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fetchParams($params) {
|
2021-01-28 13:14:14 +00:00
|
|
|
const hasEntries = Object.entries($params).length;
|
|
|
|
if (!hasEntries)
|
2021-01-20 12:19:28 +00:00
|
|
|
$params.scopeDays = 1;
|
|
|
|
|
|
|
|
if (typeof $params.scopeDays === 'number') {
|
2023-01-16 14:18:24 +00:00
|
|
|
const from = Date.vnNew();
|
2021-01-20 12:19:28 +00:00
|
|
|
from.setHours(0, 0, 0, 0);
|
|
|
|
|
|
|
|
const to = new Date(from.getTime());
|
|
|
|
to.setDate(to.getDate() + $params.scopeDays);
|
|
|
|
to.setHours(23, 59, 59, 999);
|
|
|
|
|
|
|
|
Object.assign($params, {from, to});
|
|
|
|
}
|
2019-11-10 10:08:44 +00:00
|
|
|
|
2021-01-20 12:19:28 +00:00
|
|
|
return $params;
|
2019-11-10 10:08:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.vnComponent('vnRoute', {
|
|
|
|
controller: Route,
|
|
|
|
template: require('./index.html')
|
|
|
|
});
|