35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
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);
|
||
});
|
||
}
|