6220-addressFilter #1886
|
@ -107,17 +107,29 @@ module.exports = Self => {
|
||||||
return {or: [
|
return {or: [
|
||||||
{'c.phone': {like: `%${value}%`}},
|
{'c.phone': {like: `%${value}%`}},
|
||||||
{'c.mobile': {like: `%${value}%`}},
|
{'c.mobile': {like: `%${value}%`}},
|
||||||
|
{'a.phone': {like: `%${value}%`}},
|
||||||
]};
|
]};
|
||||||
case 'zoneFk':
|
case 'zoneFk':
|
||||||
param = 'a.postalCode';
|
return {'a.postalCode': {inq: postalCode}};
|
||||||
return {[param]: {inq: postalCode}};
|
case 'city':
|
||||||
|
return {or: [
|
||||||
|
{'c.city': {like: `%${value}%`}},
|
||||||
|
{'a.city': {like: `%${value}%`}}
|
||||||
|
]};
|
||||||
|
case 'postcode':
|
||||||
|
return {or: [
|
||||||
|
{'c.postcode': value},
|
||||||
|
{'a.postalCode': value}
|
||||||
|
]};
|
||||||
|
case 'provinceFk':
|
||||||
|
return {or: [
|
||||||
|
{'p.id': value},
|
||||||
|
{'a.provinceFk': value}
|
||||||
|
|||||||
|
]};
|
||||||
case 'name':
|
case 'name':
|
||||||
case 'salesPersonFk':
|
case 'salesPersonFk':
|
||||||
case 'fi':
|
case 'fi':
|
||||||
case 'socialName':
|
case 'socialName':
|
||||||
case 'city':
|
|
||||||
case 'postcode':
|
|
||||||
case 'provinceFk':
|
|
||||||
case 'email':
|
case 'email':
|
||||||
param = `c.${param}`;
|
param = `c.${param}`;
|
||||||
return {[param]: {like: `%${value}%`}};
|
return {[param]: {like: `%${value}%`}};
|
||||||
|
@ -134,24 +146,29 @@ module.exports = Self => {
|
||||||
c.fi,
|
c.fi,
|
||||||
c.socialName,
|
c.socialName,
|
||||||
c.phone,
|
c.phone,
|
||||||
|
a.phone,
|
||||||
c.mobile,
|
c.mobile,
|
||||||
c.city,
|
c.city,
|
||||||
|
a.city,
|
||||||
c.postcode,
|
c.postcode,
|
||||||
|
a.postalCode,
|
||||||
c.email,
|
c.email,
|
||||||
c.isActive,
|
c.isActive,
|
||||||
jgallego
commented
provinceClientFk provinceClientFk
|
|||||||
c.isFreezed,
|
c.isFreezed,
|
||||||
jgallego
commented
provinceAddressFk provinceAddressFk
|
|||||||
p.id AS provinceFk,
|
p.id AS provinceClientFk,
|
||||||
|
a.provinceFk AS provinceAddressFk,
|
||||||
p.name AS province,
|
p.name AS province,
|
||||||
u.id AS salesPersonFk,
|
u.id AS salesPersonFk,
|
||||||
u.name AS salesPerson
|
u.name AS salesPerson
|
||||||
FROM client c
|
FROM client c
|
||||||
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
||||||
LEFT JOIN province p ON p.id = c.provinceFk
|
LEFT JOIN province p ON p.id = c.provinceFk
|
||||||
JOIN vn.address a ON a.clientFk = c.id
|
JOIN address a ON a.clientFk = c.id
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
stmt.merge(conn.makeWhere(filter.where));
|
stmt.merge(conn.makeWhere(filter.where));
|
||||||
|
stmt.merge('GROUP BY c.id');
|
||||||
stmt.merge(conn.makePagination(filter));
|
stmt.merge(conn.makePagination(filter));
|
||||||
|
|
||||||
const clientsIndex = stmts.push(stmt) - 1;
|
const clientsIndex = stmts.push(stmt) - 1;
|
||||||
|
|
Loading…
Reference in New Issue
açò esta provat?
Si, funciona