При изменении Продукта selectProduct необходимо в поле "Расчет от"
* radioCalcType фильтровать значения согласно списку * в поле "Доступные Методы расчета в калькуляторе" evo_calculation_method в selectProduct
This commit is contained in:
parent
ff465ae65e
commit
aa711a3e37
@ -139,7 +139,7 @@ export type GetProduct_ProcessConfiguratorQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetProduct_ProcessConfiguratorQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null };
|
||||
export type GetProduct_ProcessConfiguratorQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array<number> | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null };
|
||||
|
||||
export type GetSubsidy_ProcessConfiguratorQueryVariables = Exact<{
|
||||
subsidyId: Scalars['Uuid'];
|
||||
|
||||
@ -24,6 +24,7 @@ const QUERY_GET_PRODUCT = gql`
|
||||
evo_leasingobject_types {
|
||||
evo_leasingobject_typeid
|
||||
}
|
||||
evo_calculation_method
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -349,4 +350,42 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
$calculation.element('selectSeasonType').setOptions(filteredSeasonTypesOptions);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* При изменении Продукта selectProduct необходимо в поле "Расчет от"
|
||||
* radioCalcType фильтровать значения согласно списку
|
||||
* в поле "Доступные Методы расчета в калькуляторе" evo_calculation_method в selectProduct
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.element('selectProduct').getValue(),
|
||||
async (productId) => {
|
||||
if (!productId) {
|
||||
$calculation.element('radioCalcType').resetOptions();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetProduct_ProcessConfiguratorQuery,
|
||||
CRMTypes.GetProduct_ProcessConfiguratorQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_PRODUCT,
|
||||
variables: {
|
||||
productId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_baseproduct?.evo_calculation_method) {
|
||||
const filteredCalcTypeOptions = $calculation
|
||||
.element('radioCalcType')
|
||||
.getOptions()
|
||||
.filter((calcType) => evo_baseproduct.evo_calculation_method?.includes(calcType.value));
|
||||
$calculation.element('radioCalcType').setOptions(filteredCalcTypeOptions);
|
||||
} else {
|
||||
$calculation.element('radioCalcType').resetOptions();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user