salix/modules/client/front/main/index.js

36 lines
899 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}
: {name: {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 'salesPersonFk':
return {[param]: value};
}
}
}
ngModule.vnComponent('vnClient', {
controller: Client,
template: require('./index.html')
});