36 lines
896 B
JavaScript
36 lines
896 B
JavaScript
import ngModule from '../module';
|
|
import ModuleMain from 'salix/components/module-main';
|
|
|
|
export default class Travel extends ModuleMain {
|
|
constructor() {
|
|
super();
|
|
|
|
this.filterParams = {
|
|
scopeDays: 1
|
|
};
|
|
}
|
|
|
|
fetchParams($params) {
|
|
if (!Object.entries($params).length)
|
|
$params.scopeDays = 1;
|
|
|
|
if (typeof $params.scopeDays === 'number') {
|
|
const shippedFrom = Date.vnNew();
|
|
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;
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnTravel', {
|
|
controller: Travel,
|
|
template: require('./index.html')
|
|
});
|