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

28 lines
783 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';
2020-03-13 19:33:12 +00:00
export default class Travel extends ModuleMain {
fetchParams($params) {
if (!Object.entries($params).length)
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
const shippedFrom = new Date();
shippedFrom.setHours(0, 0, 0, 0);
const shippedTo = new Date(shippedFrom.getTime());
shippedTo.setDate(shippedTo.getDate() + $params.scopeDays);
shippedTo.setHours(23, 59, 59, 999);
Object.assign($params, {shippedFrom, shippedTo});
}
return $params;
}
}
2019-11-10 10:08:44 +00:00
ngModule.vnComponent('vnTravel', {
controller: Travel,
template: require('./index.html')
});