show inn in selectDealerPerson

This commit is contained in:
vchikalkin 2021-07-20 13:50:50 +03:00
parent b967c76501
commit aeb549be6b
3 changed files with 19 additions and 11 deletions

View File

@ -45,6 +45,7 @@ export const mainOptionsQuery = gql`
name
evo_broker_accountid
evo_kpp
evo_inn
}
selectDealerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $dealer_person_accountid

View File

@ -567,7 +567,7 @@ export default [
CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $salonaccountid: Uuid!) {
account: salon_providers(
selectDealerPerson: salon_providers(
statecode: $statecode
salonaccountid: $salonaccountid
) {
@ -575,27 +575,27 @@ export default [
name
evo_broker_accountid
evo_kpp
evo_inn
}
}
`,
toOptions: ['account'],
toOptions: ['selectDealerPerson'],
variables: {
salonaccountid: dealerId,
statecode: 0,
},
}).then(({ entities }) => {
// @ts-ignore
const dealerPersons = entities.selectDealerPerson;
if (
entities.account &&
Array.isArray(entities.account) &&
entities.account.length > 0
dealerPersons &&
Array.isArray(dealerPersons) &&
dealerPersons.length > 0
) {
calculationStore.setOptions(
'selectDealerPerson',
entities.account,
);
calculationStore.setOptions('selectDealerPerson', dealerPersons);
calculationStore.setValue(
'dealerPerson',
entities.account[0].accountid,
dealerPersons[0].accountid,
);
calculationStore.setStatus(
'selectDealerPerson',

View File

@ -7,7 +7,14 @@ const propsMap: TEntities<{
getName?: (entity: TCRMEntity, targetName: string) => string | undefined;
}> = {
account: {
getName: account => `${account.name} ${account.evo_kpp || ''}`,
getName: (account, targetName) => {
if (['selectDealerPerson'].includes(targetName)) {
return `
${account.name}
${account.evo_inn || '-'} / ${account.evo_kpp || '-'}`;
}
return `${account.name} ${account.evo_kpp || ''}`;
},
value: 'accountid',
},
lead: {