diff --git a/e2e/paths/02-client/21_defaulter.spec.js b/e2e/paths/02-client/21_defaulter.spec.js index d51f2113f..c7640d028 100644 --- a/e2e/paths/02-client/21_defaulter.spec.js +++ b/e2e/paths/02-client/21_defaulter.spec.js @@ -28,7 +28,7 @@ describe('Client defaulter path', () => { const salesPersonName = await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText'); - expect(clientName).toEqual('Batman'); + expect(clientName).toEqual('Ororo Munroe'); expect(salesPersonName).toEqual('salesPersonNick'); }); diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js index 17e07d67c..e86830200 100644 --- a/modules/claim/back/methods/claim/filter.js +++ b/modules/claim/back/methods/claim/filter.js @@ -27,7 +27,7 @@ module.exports = Self => { http: {source: 'query'} }, { - arg: 'client', + arg: 'clientName', type: 'string', description: 'The worker name', http: {source: 'query'} @@ -94,11 +94,11 @@ module.exports = Self => { ? {'cl.id': value} : { or: [ - {'cl.socialName': {like: `%${value}%`}} + {'cl.clientName': {like: `%${value}%`}} ] }; - case 'client': - return {'cl.socialName': {like: `%${value}%`}}; + case 'clientName': + return {'cl.clientName': {like: `%${value}%`}}; case 'clientFk': return {'cl.clientFk': value}; case 'id': @@ -128,7 +128,7 @@ module.exports = Self => { SELECT cl.id, cl.clientFk, - c.socialName, + c.name AS clientName, cl.workerFk, u.name AS workerName, cs.description, diff --git a/modules/claim/back/methods/claim/specs/filter.spec.js b/modules/claim/back/methods/claim/specs/filter.spec.js index c54318e45..b26afe8c4 100644 --- a/modules/claim/back/methods/claim/specs/filter.spec.js +++ b/modules/claim/back/methods/claim/specs/filter.spec.js @@ -25,7 +25,7 @@ describe('claim filter()', () => { try { const options = {transaction: tx}; - const result = await app.models.Claim.filter({args: {filter: {}, search: 'Iron man'}}, null, options); + const result = await app.models.Claim.filter({args: {filter: {}, search: 'Tony Stark'}}, null, options); expect(result.length).toEqual(1); expect(result[0].id).toEqual(4); diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index 341d6eb2f..102e27245 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -10,16 +10,16 @@ - - - diff --git a/modules/claim/front/index/index.js b/modules/claim/front/index/index.js index bf0cb25c0..084618e16 100644 --- a/modules/claim/front/index/index.js +++ b/modules/claim/front/index/index.js @@ -11,11 +11,11 @@ class Controller extends Section { }, columns: [ { - field: 'clientFk', + field: 'clientName', autocomplete: { url: 'Clients', - showField: 'socialName', - valueField: 'socialName' + showField: 'name', + valueField: 'name' } }, { @@ -46,21 +46,12 @@ class Controller extends Section { exprBuilder(param, value) { switch (param) { + case 'clientName': + return {'cl.clientName': {like: `%${value}%`}}; case 'clientFk': - return {['cl.socialName']: value}; - case 'id': case 'claimStateFk': - case 'priority': + case 'workerFk': return {[`cl.${param}`]: value}; - case 'salesPersonFk': - case 'attenderFk': - return {'cl.workerFk': value}; - case 'created': - value.setHours(0, 0, 0, 0); - to = new Date(value); - to.setHours(23, 59, 59, 999); - - return {'cl.created': {between: [value, to]}}; } } diff --git a/modules/claim/front/search-panel/index.html b/modules/claim/front/search-panel/index.html index 22faf9ec4..d522763a1 100644 --- a/modules/claim/front/search-panel/index.html +++ b/modules/claim/front/search-panel/index.html @@ -18,7 +18,7 @@ + ng-model="filter.clientName"> diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 813d63d3f..ec38c0821 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -56,7 +56,7 @@ module.exports = Self => { FROM ( SELECT DISTINCT c.id clientFk, - c.socialName clientName, + c.name clientName, c.salesPersonFk, u.nickname salesPersonName, d.amount, diff --git a/modules/client/back/methods/defaulter/specs/filter.spec.js b/modules/client/back/methods/defaulter/specs/filter.spec.js index ca14d1e43..0a970823e 100644 --- a/modules/client/back/methods/defaulter/specs/filter.spec.js +++ b/modules/client/back/methods/defaulter/specs/filter.spec.js @@ -47,12 +47,12 @@ describe('defaulter filter()', () => { try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 'spider'}}; + const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 'Petter Parker'}}; const result = await models.Defaulter.filter(ctx, null, options); const firstRow = result[0]; - expect(firstRow.clientName).toEqual('Spider man'); + expect(firstRow.clientName).toEqual('Petter Parker'); await tx.rollback(); } catch (e) { diff --git a/modules/client/front/defaulter/index.html b/modules/client/front/defaulter/index.html index 59f7b7d67..92664079c 100644 --- a/modules/client/front/defaulter/index.html +++ b/modules/client/front/defaulter/index.html @@ -49,7 +49,7 @@ model="model"> -
+ Id + Client Created + Worker @@ -40,7 +40,7 @@ - {{::claim.socialName}} + {{::claim.clientName}} {{::claim.created | date:'dd/MM/yyyy'}} + Client diff --git a/modules/client/front/defaulter/index.js b/modules/client/front/defaulter/index.js index 82719bef0..80f510bf2 100644 --- a/modules/client/front/defaulter/index.js +++ b/modules/client/front/defaulter/index.js @@ -13,11 +13,11 @@ export default class Controller extends Section { }, columns: [ { - field: 'clientName', + field: 'clientFk', autocomplete: { url: 'Clients', - showField: 'socialName', - valueField: 'socialName' + showField: 'name', + valueField: 'id' } }, { @@ -114,7 +114,7 @@ export default class Controller extends Section { switch (param) { case 'creditInsurance': case 'amount': - case 'clientName': + case 'clientFk': case 'workerFk': case 'salesPersonFk': return {[`d.${param}`]: value}; diff --git a/modules/client/front/defaulter/index.spec.js b/modules/client/front/defaulter/index.spec.js index d7d1a684d..5801fa1f8 100644 --- a/modules/client/front/defaulter/index.spec.js +++ b/modules/client/front/defaulter/index.spec.js @@ -104,15 +104,15 @@ describe('client defaulter', () => { describe('exprBuilder()', () => { it('should search by sales person', () => { - let expr = controller.exprBuilder('salesPersonFk', '5'); + const expr = controller.exprBuilder('salesPersonFk', '5'); expect(expr).toEqual({'d.salesPersonFk': '5'}); }); - it('should search by client name', () => { - let expr = controller.exprBuilder('clientName', '1foo'); + it('should search by client', () => { + const expr = controller.exprBuilder('clientFk', '5'); - expect(expr).toEqual({'d.clientName': '1foo'}); + expect(expr).toEqual({'d.clientFk': '5'}); }); }); });