37 lines
970 B
JavaScript
37 lines
970 B
JavaScript
import ngModule from '../module';
|
|
import ModuleMain from 'salix/components/module-main';
|
|
|
|
export default class Client extends ModuleMain {
|
|
exprBuilder(param, value) {
|
|
switch (param) {
|
|
case 'search':
|
|
return /^\d+$/.test(value)
|
|
? {id: value}
|
|
: {or: [{name: {like: `%${value}%`}}, {socialName: {like: `%${value}%`}}]};
|
|
case 'phone':
|
|
return {
|
|
or: [
|
|
{phone: value},
|
|
{mobile: value}
|
|
]
|
|
};
|
|
case 'name':
|
|
case 'socialName':
|
|
case 'city':
|
|
case 'email':
|
|
return {[param]: {like: `%${value}%`}};
|
|
case 'id':
|
|
case 'fi':
|
|
case 'postcode':
|
|
case 'provinceFk':
|
|
case 'salesPersonFk':
|
|
return {[param]: value};
|
|
}
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnClient', {
|
|
controller: Client,
|
|
template: require('./index.html')
|
|
});
|