import ngModule from '../module'; import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { showFilterDialog(travel) { this.activeTravel = travel; this.travelFilterParams = {}; this.travelFilter = { include: [ { relation: 'agency', scope: { fields: ['name'] } }, { relation: 'warehouseIn', scope: { fields: ['name'] } }, { relation: 'warehouseOut', scope: { fields: ['name'] } } ] }; this.$.filterDialog.show(); } selectTravel(id) { this.entry.travelFk = id; this.$.filterDialog.hide(); } filter() { const filter = this.travelFilter; const params = this.travelFilterParams; const where = {}; for (let key in params) { const value = params[key]; if (!value) continue; switch (key) { case 'agencyFk': case 'warehouseInFk': case 'warehouseOutFk': case 'shipped': case 'landed': where[key] = value; } } filter.where = where; this.$.travelsModel.applyFilter(filter); } } ngModule.vnComponent('vnEntryBasicData', { template: require('./index.html'), bindings: { entry: '<' }, controller: Controller });