Merge pull request '6220-addressFilter' (!1886) from 6220-addressFilter into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1886 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
6ff7edfada
|
@ -107,17 +107,29 @@ module.exports = Self => {
|
|||
return {or: [
|
||||
{'c.phone': {like: `%${value}%`}},
|
||||
{'c.mobile': {like: `%${value}%`}},
|
||||
{'a.phone': {like: `%${value}%`}},
|
||||
]};
|
||||
case 'zoneFk':
|
||||
param = 'a.postalCode';
|
||||
return {[param]: {inq: postalCode}};
|
||||
return {'a.postalCode': {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 'salesPersonFk':
|
||||
case 'fi':
|
||||
case 'socialName':
|
||||
case 'city':
|
||||
case 'postcode':
|
||||
case 'provinceFk':
|
||||
case 'email':
|
||||
param = `c.${param}`;
|
||||
return {[param]: {like: `%${value}%`}};
|
||||
|
@ -134,24 +146,29 @@ module.exports = Self => {
|
|||
c.fi,
|
||||
c.socialName,
|
||||
c.phone,
|
||||
a.phone,
|
||||
c.mobile,
|
||||
c.city,
|
||||
a.city,
|
||||
c.postcode,
|
||||
a.postalCode,
|
||||
c.email,
|
||||
c.isActive,
|
||||
c.isFreezed,
|
||||
p.id AS provinceFk,
|
||||
p.id AS provinceClientFk,
|
||||
a.provinceFk AS provinceAddressFk,
|
||||
p.name AS province,
|
||||
u.id AS salesPersonFk,
|
||||
u.name AS salesPerson
|
||||
FROM client c
|
||||
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
||||
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('GROUP BY c.id');
|
||||
stmt.merge(conn.makePagination(filter));
|
||||
|
||||
const clientsIndex = stmts.push(stmt) - 1;
|
||||
|
|
Loading…
Reference in New Issue