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

36 lines
943 B
JavaScript
Raw Normal View History

2019-11-10 10:08:44 +00:00
import ngModule from '../module';
import ModuleMain from 'salix/components/module-main';
2020-03-13 19:33:12 +00:00
export default class Client extends ModuleMain {
exprBuilder(param, value) {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {id: value}
2020-10-26 07:13:13 +00:00
: {or: [{name: {like: `%${value}%`}}, {socialName: {like: `%${value}%`}}]};
2020-03-13 19:33:12 +00:00
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};
}
}
}
2019-11-10 10:08:44 +00:00
ngModule.vnComponent('vnClient', {
controller: Client,
template: require('./index.html')
});