import ngModule from '../../module'; import ModuleMain from 'salix/components/module-main'; export default class Roadmap extends ModuleMain { constructor($element, $) { super($element, $); this.include = { relation: 'supplier', scope: { fields: ['nickname'] } }; } $postLink() { const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = Date.vnNew(); to.setHours(23, 59, 59, 999); this.filterParams = { from: from, to: to }; this.$.model.addFilter({where: { and: [ {etd: {gte: from}}, {etd: {lte: to}} ] }}); } exprBuilder(param, value) { switch (param) { case 'search': return /^\d+$/.test(value) ? {id: value} : {name: {like: `%${value}%`}}; case 'from': return {etd: {gte: value}}; case 'to': return {etd: {lte: value}}; case 'supplierFk': case 'price': return {[param]: value}; case 'tractorPlate': case 'trailerPlate': case 'phone': case 'driverName': return {[param]: {like: `%${value}%`}}; } } } ngModule.vnComponent('vnRoadmap', { controller: Roadmap, template: require('./index.html') });