diff --git a/apps/web/process/add-product/reactions.ts b/apps/web/process/add-product/reactions.ts index 7af6f15..7d26923 100644 --- a/apps/web/process/add-product/reactions.ts +++ b/apps/web/process/add-product/reactions.ts @@ -212,8 +212,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) { ); reaction( - () => $calculation.$values.getValues(['recalcWithRevision', 'leaseObjectType']), - async ({ recalcWithRevision, leaseObjectType: leaseObjectTypeId }) => { + () => $calculation.$values.getValues(['recalcWithRevision', 'leaseObjectType', 'engineType']), + async ({ recalcWithRevision, leaseObjectType: leaseObjectTypeId, engineType }) => { if (recalcWithRevision === false) { $calculation .element('selectRequirementTelematic') @@ -223,6 +223,12 @@ export default function reactions({ store, apolloClient }: ProcessContext) { ) ); + if (engineType === 100_000_003) { + $calculation.element('selectRequirementTelematic').setValue(100_000_003).block(); + } else { + $calculation.element('selectRequirementTelematic').unblock(); + } + if (leaseObjectTypeId) { const { data: { evo_leasingobject_type }, @@ -262,8 +268,14 @@ export default function reactions({ store, apolloClient }: ProcessContext) { 'requirementTelematic', 'recalcWithRevision', 'leaseObjectType', + 'engineType', ]), - async ({ requirementTelematic, recalcWithRevision, leaseObjectType: leaseObjectTypeId }) => { + async ({ + requirementTelematic, + recalcWithRevision, + leaseObjectType: leaseObjectTypeId, + engineType, + }) => { const currentDate = dayjs().utc(false).toISOString(); const { data: { evo_addproduct_types: trackerTypes }, @@ -294,6 +306,13 @@ export default function reactions({ store, apolloClient }: ProcessContext) { ); } + if (engineType === 100_000_003) { + filteredTelematicTypes = telematicTypes?.filter( + (x) => + x?.evo_controls_program?.includes(100_000_003) && x.label?.toLowerCase().includes('аво') + ); + } + if (leaseObjectTypeId) { const { data: { evo_leasingobject_type },