selectDealerPerson: show inn/kpp

This commit is contained in:
Chika 2022-11-02 20:28:47 +03:00
parent 60af0f86e7
commit 3d93f02a1e
2 changed files with 19 additions and 9 deletions

View File

@ -267,6 +267,13 @@ export type GetRewardSummQueryVariables = Exact<{
export type GetRewardSummQuery = { __typename?: 'Query', evo_reward_condition?: { __typename?: 'evo_reward_condition', evo_reward_summ?: any | null } | null };
export type GetRewardConditionQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
export type GetRewardConditionQuery = { __typename?: 'Query', evo_reward_condition?: { __typename?: 'evo_reward_condition', evo_reward_summ?: any | null, evo_reduce_reward?: boolean | null, evo_min_reward_summ?: any | null } | null };
export type GetAgentAccountIdFromLeadQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
@ -302,13 +309,6 @@ export type GetAgentQueryVariables = Exact<{
export type GetAgentQuery = { __typename?: 'Query', agent?: { __typename?: 'account', label?: string | null, value?: any | null } | null };
export type GetRewardConditionQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
export type GetRewardConditionQuery = { __typename?: 'Query', evo_reward_condition?: { __typename?: 'evo_reward_condition', evo_reward_summ?: any | null, evo_reduce_reward?: boolean | null, evo_min_reward_summ?: any | null, evo_calc_reward_rules?: number | null } | null };
export type GetRewardWithoutOtherAgentQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
@ -321,7 +321,7 @@ export type GetDealerPersonQueryVariables = Exact<{
}>;
export type GetDealerPersonQuery = { __typename?: 'Query', salon_providers?: Array<{ __typename?: 'account', label?: string | null, value?: any | null } | null> | null };
export type GetDealerPersonQuery = { __typename?: 'Query', salon_providers?: Array<{ __typename?: 'account', evo_inn?: string | null, evo_kpp?: string | null, label?: string | null, value?: any | null } | null> | null };
export type GetBrokerAccountIdFromDealerQueryVariables = Exact<{
dealerId: Scalars['Uuid'];

View File

@ -5,6 +5,7 @@ import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
import { reaction } from 'mobx';
import { sift } from 'radash';
import type RootStore from 'stores/root';
import { normalizeOptions } from 'tools/entity';
import * as createReactions from '../lib/create-reactions';
@ -27,6 +28,8 @@ export function commonReactions(store: RootStore, apolloClient: ApolloClient<obj
salon_providers(statecode: 0, salonaccountid: $dealerId) {
label: name
value: accountid
evo_inn
evo_kpp
}
}
`;
@ -54,7 +57,14 @@ export function commonReactions(store: RootStore, apolloClient: ApolloClient<obj
});
if (salon_providers?.length) {
$calculation.element('selectDealerPerson').setOptions(normalizeOptions(salon_providers));
$calculation.element('selectDealerPerson').setOptions(
normalizeOptions(
salon_providers.map((dp) => ({
...dp,
label: `${dp?.label} ${sift([dp?.evo_inn, dp?.evo_kpp]).join(' | ')}`,
}))
)
);
if (!$process.has('LoadKP')) {
$calculation.element('selectDealerPerson').setValue(salon_providers[0]?.value);