import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; export default class Route extends ModuleMain { $postLink() { const to = Date.vnNew(); to.setDate(to.getDate() + 1); to.setHours(0, 0, 0, 0); const from = Date.vnNew(); from.setDate(from.getDate()); from.setHours(0, 0, 0, 0); this.filterParams = {from, to}; this.$.model.applyFilter(null, this.filterParams); } fetchParams($params) { const hasEntries = Object.entries($params).length; if (!hasEntries) $params.scopeDays = 1; if (typeof $params.scopeDays === 'number') { const from = Date.vnNew(); 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}); } return $params; } } ngModule.vnComponent('vnRoute', { controller: Route, template: require('./index.html') });