3863-feat(client.defaulter&claim): change socialName to name #933
|
@ -28,7 +28,7 @@ describe('Client defaulter path', () => {
|
||||||
const salesPersonName =
|
const salesPersonName =
|
||||||
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
||||||
|
|
||||||
expect(clientName).toEqual('Batman');
|
expect(clientName).toEqual('Ororo Munroe');
|
||||||
expect(salesPersonName).toEqual('salesPersonNick');
|
expect(salesPersonName).toEqual('salesPersonNick');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ module.exports = Self => {
|
||||||
http: {source: 'query'}
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'client',
|
arg: 'clientName',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The worker name',
|
description: 'The worker name',
|
||||||
http: {source: 'query'}
|
http: {source: 'query'}
|
||||||
|
@ -94,11 +94,11 @@ module.exports = Self => {
|
||||||
? {'cl.id': value}
|
? {'cl.id': value}
|
||||||
: {
|
: {
|
||||||
or: [
|
or: [
|
||||||
{'cl.socialName': {like: `%${value}%`}}
|
{'cl.clientName': {like: `%${value}%`}}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
case 'client':
|
case 'clientName':
|
||||||
return {'cl.socialName': {like: `%${value}%`}};
|
return {'cl.clientName': {like: `%${value}%`}};
|
||||||
case 'clientFk':
|
case 'clientFk':
|
||||||
return {'cl.clientFk': value};
|
return {'cl.clientFk': value};
|
||||||
case 'id':
|
case 'id':
|
||||||
|
@ -128,7 +128,7 @@ module.exports = Self => {
|
||||||
SELECT
|
SELECT
|
||||||
cl.id,
|
cl.id,
|
||||||
cl.clientFk,
|
cl.clientFk,
|
||||||
c.socialName,
|
c.name AS clientName,
|
||||||
cl.workerFk,
|
cl.workerFk,
|
||||||
u.name AS workerName,
|
u.name AS workerName,
|
||||||
cs.description,
|
cs.description,
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe('claim filter()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
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.length).toEqual(1);
|
||||||
expect(result[0].id).toEqual(4);
|
expect(result[0].id).toEqual(4);
|
||||||
|
|
|
@ -10,16 +10,16 @@
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th field="id" shrink>
|
<th field="clientFk" shrink>
|
||||||
<span translate>Id</span>
|
<span translate>Id</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="clientFk">
|
<th field="clientName">
|
||||||
<span translate>Client</span>
|
<span translate>Client</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="created" center shrink-date>
|
<th field="created" center shrink-date>
|
||||||
<span translate>Created</span>
|
<span translate>Created</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="salesPersonFk">
|
<th field="workerFk">
|
||||||
<span translate>Worker</span>
|
<span translate>Worker</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="claimStateFk">
|
<th field="claimStateFk">
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<span
|
<span
|
||||||
vn-click-stop="clientDescriptor.show($event, claim.clientFk)"
|
vn-click-stop="clientDescriptor.show($event, claim.clientFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::claim.socialName}}
|
{{::claim.clientName}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td center shrink-date>{{::claim.created | date:'dd/MM/yyyy'}}</td>
|
<td center shrink-date>{{::claim.created | date:'dd/MM/yyyy'}}</td>
|
||||||
|
|
|
@ -11,11 +11,11 @@ class Controller extends Section {
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
field: 'clientFk',
|
field: 'clientName',
|
||||||
autocomplete: {
|
autocomplete: {
|
||||||
url: 'Clients',
|
url: 'Clients',
|
||||||
showField: 'socialName',
|
showField: 'name',
|
||||||
valueField: 'socialName'
|
valueField: 'name'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -46,21 +46,12 @@ class Controller extends Section {
|
||||||
|
|
||||||
exprBuilder(param, value) {
|
exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
case 'clientName':
|
||||||
|
return {'cl.clientName': {like: `%${value}%`}};
|
||||||
case 'clientFk':
|
case 'clientFk':
|
||||||
return {['cl.socialName']: value};
|
|
||||||
case 'id':
|
|
||||||
case 'claimStateFk':
|
case 'claimStateFk':
|
||||||
case 'priority':
|
case 'workerFk':
|
||||||
return {[`cl.${param}`]: value};
|
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]}};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
vn-one
|
vn-one
|
||||||
label="Client"
|
label="Client"
|
||||||
ng-model="filter.client">
|
ng-model="filter.clientName">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
|
@ -56,7 +56,7 @@ module.exports = Self => {
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT c.id clientFk,
|
DISTINCT c.id clientFk,
|
||||||
c.socialName clientName,
|
c.name clientName,
|
||||||
c.salesPersonFk,
|
c.salesPersonFk,
|
||||||
u.nickname salesPersonName,
|
u.nickname salesPersonName,
|
||||||
d.amount,
|
d.amount,
|
||||||
|
|
|
@ -47,12 +47,12 @@ describe('defaulter filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
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 result = await models.Defaulter.filter(ctx, null, options);
|
||||||
const firstRow = result[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.clientName).toEqual('Spider man');
|
expect(firstRow.clientName).toEqual('Petter Parker');
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
model="model">
|
model="model">
|
||||||
</vn-multi-check>
|
</vn-multi-check>
|
||||||
</th>
|
</th>
|
||||||
<th field="clientName">
|
<th field="clientFk">
|
||||||
<span translate>Client</span>
|
<span translate>Client</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="salesPersonFk">
|
<th field="salesPersonFk">
|
||||||
|
|
|
@ -13,11 +13,11 @@ export default class Controller extends Section {
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
field: 'clientName',
|
field: 'clientFk',
|
||||||
autocomplete: {
|
autocomplete: {
|
||||||
url: 'Clients',
|
url: 'Clients',
|
||||||
showField: 'socialName',
|
showField: 'name',
|
||||||
valueField: 'socialName'
|
valueField: 'id'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ export default class Controller extends Section {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'creditInsurance':
|
case 'creditInsurance':
|
||||||
case 'amount':
|
case 'amount':
|
||||||
case 'clientName':
|
case 'clientFk':
|
||||||
case 'workerFk':
|
case 'workerFk':
|
||||||
case 'salesPersonFk':
|
case 'salesPersonFk':
|
||||||
return {[`d.${param}`]: value};
|
return {[`d.${param}`]: value};
|
||||||
|
|
|
@ -104,15 +104,15 @@ describe('client defaulter', () => {
|
||||||
|
|
||||||
describe('exprBuilder()', () => {
|
describe('exprBuilder()', () => {
|
||||||
it('should search by sales person', () => {
|
it('should search by sales person', () => {
|
||||||
let expr = controller.exprBuilder('salesPersonFk', '5');
|
const expr = controller.exprBuilder('salesPersonFk', '5');
|
||||||
|
|
||||||
expect(expr).toEqual({'d.salesPersonFk': '5'});
|
expect(expr).toEqual({'d.salesPersonFk': '5'});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search by client name', () => {
|
it('should search by client', () => {
|
||||||
let expr = controller.exprBuilder('clientName', '1foo');
|
const expr = controller.exprBuilder('clientFk', '5');
|
||||||
|
|
||||||
expect(expr).toEqual({'d.clientName': '1foo'});
|
expect(expr).toEqual({'d.clientFk': '5'});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue