From d916a180a256a5ae79b7bbb3652894b101936cbb Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 19 Apr 2024 11:57:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BD=D0=B5=D1=81=D1=82=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D1=83=D0=BC=D0=BE=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA?= =?UTF-8?q?=D0=B5=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B:=20?= =?UTF-8?q?=20=D0=B2=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B5=20=D0=A1?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D1=85=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B2=20=D1=81=D1=82=D1=80=D0=BE=D1=83=D0=B5=20SafeFinance=20?= =?UTF-8?q?=D1=83=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D1=82=D1=8C:=20?= =?UTF-8?q?=D0=A1=D1=82=D1=80=D0=B0=D1=85=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8=D1=8F=20=3D=20=D0=93=D0=A1?= =?UTF-8?q?=D0=9A=20=D0=AE=D0=93=D0=9E=D0=A0=D0=98=D0=AF=20=D0=9F=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D1=89=D0=B8=D0=BA=20=3D=20=D0=9B?= =?UTF-8?q?=D0=94=20=D0=B2=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B5=20?= =?UTF-8?q?=D0=A0=D0=B8=D1=81=D0=BA=20SafeFinance=20=D0=B2=D1=8B=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D1=8F=D1=82=D1=8C=20=D0=B2=D1=81=D0=B5=20=D1=80?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE?= =?UTF-8?q?=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/process/fingap/reactions/index.ts | 1 + apps/web/process/fingap/reactions/init.ts | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 apps/web/process/fingap/reactions/init.ts diff --git a/apps/web/process/fingap/reactions/index.ts b/apps/web/process/fingap/reactions/index.ts index c8077ba..af23c4e 100644 --- a/apps/web/process/fingap/reactions/index.ts +++ b/apps/web/process/fingap/reactions/index.ts @@ -1 +1,2 @@ export { default as common } from './common'; +export { default as init } from './init'; diff --git a/apps/web/process/fingap/reactions/init.ts b/apps/web/process/fingap/reactions/init.ts new file mode 100644 index 0000000..2eaacef --- /dev/null +++ b/apps/web/process/fingap/reactions/init.ts @@ -0,0 +1,33 @@ +import type { ProcessContext } from '@/process/types'; +import { when } from 'mobx'; + +export default function reactions({ store }: ProcessContext) { + const { $tables } = store; + + /** + * Устанавливаем СК фингап по умолчанию при загрузке страницы + */ + when(() => { + const finGAPInsuranceCompanies = $tables.insurance.row('fingap').getOptions('insuranceCompany'); + if (finGAPInsuranceCompanies.length) { + $tables.insurance + .row('fingap') + .setValue('insuranceCompany', finGAPInsuranceCompanies[0]?.value); + } + + return Boolean(finGAPInsuranceCompanies.length); + }); + + /** + * Устанавливаем все риски ФинГАП по умолчанию при загрузке страницы + */ + when(() => { + const { risks } = $tables.fingap; + + if (risks.length) { + $tables.fingap.setSelectedKeys(risks.map((x) => x.key)); + } + + return Boolean(risks.length); + }); +}