salix/modules/route/front/main/index.js

36 lines
828 B
JavaScript
Raw Normal View History

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-01-20 12:19:28 +00:00
constructor() {
super();
2019-11-10 10:08:44 +00:00
2021-01-20 12:19:28 +00:00
this.filterParams = {
scopeDays: 1
};
}
fetchParams($params) {
if (!Object.entries($params).length)
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
const from = new Date();
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')
});