import ngModule from '../../module'; import Autocomplete from '../autocomplete'; export default class WorkerAutocomplete extends Autocomplete { constructor(...args) { super(...args); } $onInit() { super.$onInit(); let url = 'Workers/search'; if (this.departments) { const parameter = encodeURIComponent(JSON.stringify(this.departments)); url = `Workers/search?departmentCodes=${parameter}`; } Object.assign(this, { label: 'Worker', url, searchFunction: function({$search}) { return {and: [ {'active': {neq: false}}, {or: [ {'name': $search}, {'nickname': {like: '%' + $search + '%'}}, {'code': {like: $search + '%'}} ]} ]}; }, }); } } ngModule.vnComponent('vnWorkerAutocomplete', { slotTemplate: require('./index.html'), controller: WorkerAutocomplete, bindings: { departments: '