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 {
|
2022-04-06 10:29:00 +00:00
|
|
|
exprBuilder(param, value) {
|
2020-03-13 19:33:12 +00:00
|
|
|
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':
|
2022-04-05 13:21:20 +00:00
|
|
|
case 'provinceFk':
|
2020-03-13 19:33:12 +00:00
|
|
|
case 'salesPersonFk':
|
|
|
|
return {[param]: value};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-10 10:08:44 +00:00
|
|
|
|
|
|
|
ngModule.vnComponent('vnClient', {
|
|
|
|
controller: Client,
|
|
|
|
template: require('./index.html')
|
|
|
|
});
|