2023-02-03 08:30:24 +03:00

26 lines
1011 B
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 { autorun } from 'mobx';
import type { ReactionsContext } from 'process/types';
export default function validationReactions({ store }: ReactionsContext) {
const { $calculation } = store;
/* eslint-disable max-len */
/**
* Если model содержит данные и по связи Модель-Комплектация в CRM у данной модели есть связанные активные записи Комплектаций,
* то configuration становится обязательным для заполнения, иначе configuration не обязателен для заполнения
*/
/* eslint-enable */
autorun(
() => {
const selectConfiguration = $calculation.element('selectConfiguration');
selectConfiguration.validate({
invalid: selectConfiguration.getOptions()?.length > 0 && !selectConfiguration.getValue(),
message: 'Не заполнено поле',
});
},
{
delay: 10,
}
);
}