diff --git a/apps/web/process/elt/lib/helper.ts b/apps/web/process/elt/lib/helper.ts index 2661274..87922d4 100644 --- a/apps/web/process/elt/lib/helper.ts +++ b/apps/web/process/elt/lib/helper.ts @@ -6,7 +6,7 @@ export default function helper({ apolloClient, store, }: Pick) { - const { $calculation } = store; + const { $calculation, $tables } = store; return { async init() { @@ -29,6 +29,16 @@ export default function helper({ ({ evo_leasingobject_type } = data); } + const kaskoCompanyIds = $tables.insurance + .row('kasko') + .getOptions('insuranceCompany') + .map((x) => x.value); + + const osagoCompanyIds = $tables.insurance + .row('osago') + .getOptions('insuranceCompany') + .map((x) => x.value); + return { kasko: (accounts ?.filter((x) => @@ -38,6 +48,7 @@ export default function helper({ ? Boolean(x.evo_id_elt_smr) : Boolean(x?.evo_id_elt) ) + .filter((x) => x?.value && kaskoCompanyIds.includes(x?.value)) .map((x) => ({ id: evo_leasingobject_type?.evo_id && @@ -56,6 +67,7 @@ export default function helper({ })) || []) as Row[], osago: (accounts ?.filter((x) => x?.evo_type_ins_policy?.includes(100_000_001) && x?.evo_id_elt_osago) + .filter((x) => x?.value && osagoCompanyIds.includes(x.value)) .map((x) => ({ id: x?.evo_id_elt_osago, key: x?.value, diff --git a/apps/web/process/elt/reactions/common.ts b/apps/web/process/elt/reactions/common.ts index 8e7f5db..e3e4870 100644 --- a/apps/web/process/elt/reactions/common.ts +++ b/apps/web/process/elt/reactions/common.ts @@ -12,6 +12,9 @@ export default function reactions(context: ProcessContext) { disposableReaction( () => $process.has('ELT') || $process.has('LoadKP'), () => ({ + kasko: { + options: $tables.insurance.row('kasko').getOptions('insuranceCompany'), + }, values: $calculation.$values.getValues([ 'objectRegistration', 'townRegistration', @@ -57,6 +60,9 @@ export default function reactions(context: ProcessContext) { disposableReaction( () => $process.has('ELT') || $process.has('LoadKP'), () => ({ + osago: { + options: $tables.insurance.row('osago').getOptions('insuranceCompany'), + }, values: $calculation.$values.getValues([ 'legalClientRegion', 'legalClientTown',