process/gibdd: fill selectRegionRegistration & selectTownRegistration
This commit is contained in:
parent
ff02f652ff
commit
35fd102746
@ -220,6 +220,7 @@ query GetRegions {
|
||||
label: evo_name
|
||||
value: evo_regionid
|
||||
evo_fias_id
|
||||
evo_businessunit_evolution
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,6 +238,7 @@ query GetTowns($regionId: Uuid!) {
|
||||
evo_fias_id
|
||||
label: evo_name
|
||||
value: evo_townid
|
||||
evo_businessunit_evolution
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ export type GetImportProgramQuery = { __typename?: 'Query', importProgram: { __t
|
||||
export type GetRegionsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', evo_fias_id: string | null, label: string | null, value: string | null } | null> | null };
|
||||
export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', evo_fias_id: string | null, evo_businessunit_evolution: boolean | null, label: string | null, value: string | null } | null> | null };
|
||||
|
||||
export type GetRegionQueryVariables = Exact<{
|
||||
regionId: Scalars['Uuid'];
|
||||
@ -257,7 +257,7 @@ export type GetTownsQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetTownsQuery = { __typename?: 'Query', evo_towns: Array<{ __typename?: 'evo_town', evo_fias_id: string | null, label: string | null, value: string | null } | null> | null };
|
||||
export type GetTownsQuery = { __typename?: 'Query', evo_towns: Array<{ __typename?: 'evo_town', evo_fias_id: string | null, evo_businessunit_evolution: boolean | null, label: string | null, value: string | null } | null> | null };
|
||||
|
||||
export type GetGpsBrandsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
@ -510,9 +510,9 @@ export const GetProductDocument = {"kind":"Document","definitions":[{"kind":"Ope
|
||||
export const GetSubsidiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidies"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidies"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_type"}}]}}]}}]} as unknown as DocumentNode<GetSubsidiesQuery, GetSubsidiesQueryVariables>;
|
||||
export const GetSubsidyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidy"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_subsidy_summ"}}]}}]}}]} as unknown as DocumentNode<GetSubsidyQuery, GetSubsidyQueryVariables>;
|
||||
export const GetImportProgramDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetImportProgram"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"importProgram"},"name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode<GetImportProgramQuery, GetImportProgramQueryVariables>;
|
||||
export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}}]}}]}}]} as unknown as DocumentNode<GetRegionsQuery, GetRegionsQueryVariables>;
|
||||
export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode<GetRegionsQuery, GetRegionsQueryVariables>;
|
||||
export const GetRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_oktmo"}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRegionQuery, GetRegionQueryVariables>;
|
||||
export const GetTownsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTowns"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_towns"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_townid"}}]}}]}}]} as unknown as DocumentNode<GetTownsQuery, GetTownsQueryVariables>;
|
||||
export const GetTownsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTowns"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_towns"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode<GetTownsQuery, GetTownsQueryVariables>;
|
||||
export const GetGpsBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_brandid"}}]}}]}}]} as unknown as DocumentNode<GetGpsBrandsQuery, GetGpsBrandsQueryVariables>;
|
||||
export const GetLeaseObjectTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypesQuery, GetLeaseObjectTypesQueryVariables>;
|
||||
export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypeQuery, GetLeaseObjectTypeQueryVariables>;
|
||||
|
||||
@ -339,8 +339,8 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectRegionRegistration').getValue(),
|
||||
async (regionId) => {
|
||||
() => $calculation.$values.getValues(['regionRegistration', 'objectRegistration']),
|
||||
async ({ regionRegistration: regionId, objectRegistration }) => {
|
||||
if (!regionId) {
|
||||
$calculation.element('selectTownRegistration').resetOptions();
|
||||
|
||||
@ -353,7 +353,12 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
variables: { regionId },
|
||||
});
|
||||
|
||||
$calculation.element('selectTownRegistration').setOptions(normalizeOptions(evo_towns));
|
||||
if (objectRegistration === 100_000_001) {
|
||||
const towns = evo_towns?.filter((x) => x?.evo_businessunit_evolution === true);
|
||||
$calculation.element('selectTownRegistration').setOptions(normalizeOptions(towns));
|
||||
} else {
|
||||
$calculation.element('selectTownRegistration').setOptions(normalizeOptions(evo_towns));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@ -362,7 +367,7 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
async ({ lead: leadid, opportunity: opportunityid }) => {
|
||||
if (!leadid && !opportunityid) {
|
||||
$calculation.element('selectLegalClientRegion').resetValue().unblock();
|
||||
$calculation.element('selectLegalClientTown').resetValue().unblock();
|
||||
$calculation.element('selectRegionRegistration').resetValue().unblock();
|
||||
|
||||
return;
|
||||
}
|
||||
@ -406,8 +411,10 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
|
||||
if (region) {
|
||||
$calculation.element('selectLegalClientRegion').setValue(region.value).block();
|
||||
$calculation.element('selectRegionRegistration').setValue(region.value).block();
|
||||
} else {
|
||||
$calculation.element('selectLegalClientRegion').resetValue().unblock();
|
||||
$calculation.element('selectRegionRegistration').resetValue().unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -464,11 +471,32 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
const town = evo_towns?.find((x) => x?.evo_fias_id === evo_city_fias_id);
|
||||
if (town) {
|
||||
$calculation.element('selectLegalClientTown').setValue(town.value).block();
|
||||
$calculation.element('selectTownRegistration').setValue(town.value).block();
|
||||
} else {
|
||||
$calculation.element('selectLegalClientTown').resetValue().unblock();
|
||||
$calculation.element('selectTownRegistration').resetValue().unblock();
|
||||
}
|
||||
} else {
|
||||
$calculation.element('selectLegalClientTown').resetValue().unblock();
|
||||
$calculation.element('selectTownRegistration').resetValue().unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('radioObjectRegistration').getValue(),
|
||||
async (objectRegistration) => {
|
||||
const {
|
||||
data: { evo_regions },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetRegionsDocument,
|
||||
});
|
||||
|
||||
if (objectRegistration === 100_000_001) {
|
||||
const regions = evo_regions?.filter((x) => x?.evo_businessunit_evolution === true);
|
||||
$calculation.element('selectRegionRegistration').setOptions(normalizeOptions(regions));
|
||||
} else {
|
||||
$calculation.element('selectRegionRegistration').setOptions(normalizeOptions(evo_regions));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user