2024-04-20 10:26:00 +03:00

35 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
.setValue('insured', 100_000_001);
}
return Boolean(finGAPInsuranceCompanies.length);
});
/**
* Устанавливаем все риски ФинГАП по умолчанию при загрузке страницы
*/
when(() => {
const { risks } = $tables.fingap;
if (risks.length) {
$tables.fingap.setSelectedKeys(risks.map((x) => x.key));
}
return Boolean(risks.length);
});
}