salix/front/core/components/worker-autocomplete/index.js

29 lines
855 B
JavaScript
Raw Normal View History

import ngModule from '../../module';
import Autocomplete from '../autocomplete';
export default class WorkerAutocomplete extends Autocomplete {
constructor(...args) {
super(...args);
Object.assign(this, {
label: 'Worker',
url: 'Workers/search',
fields: ['id', 'name', 'nickname'],
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
});