diff --git a/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx b/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx
index 03b3d0e..fc2f226 100644
--- a/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx
+++ b/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx
@@ -1,9 +1,28 @@
+import Alert from 'Elements/Alert';
import Table from 'Elements/Table';
import { toJS } from 'mobx';
import { observer } from 'mobx-react-lite';
import { useStore } from 'stores/hooks';
+import styled from 'styled-components';
+import { Flex } from 'UIKit/grid';
import { columns } from './config';
+const Grid = styled(Flex)`
+ flex-direction: column;
+`;
+
+const Validation = observer(() => {
+ const store = useStore();
+
+ const messages = store.$tables.fingap.validation.getMessages();
+
+ if (messages?.length) {
+ return ;
+ }
+
+ return null;
+});
+
const FinGAPTable = observer(() => {
const { $tables } = useStore();
const { fingap } = $tables;
@@ -38,4 +57,11 @@ const FinGAPTable = observer(() => {
);
});
-export default FinGAPTable;
+export default function () {
+ return (
+
+
+
+
+ );
+}
diff --git a/process/calculate/reactions/validation.ts b/process/calculate/reactions/validation.ts
index f3b3989..e6ed9f7 100644
--- a/process/calculate/reactions/validation.ts
+++ b/process/calculate/reactions/validation.ts
@@ -9,8 +9,9 @@ export default function validationReactions(store: RootStore, apolloClient: Apol
const hasElementsErrors = $calculation.$validation.hasErrors;
const hasPaymentsErrors = $tables.payments.validation.hasErrors;
const hasInsuranceErrors = $tables.insurance.validation.hasErrors;
+ const hasFingapErrors = $tables.fingap.validation.hasErrors;
- return hasElementsErrors || hasPaymentsErrors || hasInsuranceErrors;
+ return hasElementsErrors || hasPaymentsErrors || hasInsuranceErrors || hasFingapErrors;
},
(hasErrors) => {
if (hasErrors) {
diff --git a/process/fingap/reactions.ts b/process/fingap/reactions/common.ts
similarity index 97%
rename from process/fingap/reactions.ts
rename to process/fingap/reactions/common.ts
index e2548f2..acb1451 100644
--- a/process/fingap/reactions.ts
+++ b/process/fingap/reactions/common.ts
@@ -10,7 +10,7 @@ import type { Risk } from 'Components/Calculation/Form/Insurance/FinGAPTable/typ
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
-import { comparer, reaction } from 'mobx';
+import { comparer, reaction, toJS } from 'mobx';
import type RootStore from 'stores/root';
dayjs.extend(utc);
@@ -122,7 +122,7 @@ export default function commonReactions(
reaction(
() => {
const finGAPInsuranceCompany = $tables.insurance.getRowValue('fingap', 'insuranceCompany');
- const paymentsValues = $tables.payments.values;
+ const paymentsValues = toJS($tables.payments.values);
const plPriceRub = $calculation.$values.getValue('plPriceRub');
const discountRub = $calculation.$values.getValue('discountRub');
const firstPaymentRub = $calculation.getElementValue('tbxFirstPaymentRub');
@@ -145,6 +145,7 @@ export default function commonReactions(
firstPaymentRub,
leasingPeriod,
}) => {
+ if ($tables.fingap.validation.hasErrors) return;
if (!finGAPInsuranceCompany) return;
const {
diff --git a/process/fingap/reactions/index.js b/process/fingap/reactions/index.js
new file mode 100644
index 0000000..cc8d68a
--- /dev/null
+++ b/process/fingap/reactions/index.js
@@ -0,0 +1,2 @@
+export { default as common } from './common';
+export { default as validation } from './validation';
diff --git a/process/fingap/reactions/validation.ts b/process/fingap/reactions/validation.ts
new file mode 100644
index 0000000..aa76f91
--- /dev/null
+++ b/process/fingap/reactions/validation.ts
@@ -0,0 +1,37 @@
+import type { ApolloClient } from '@apollo/client';
+import type { QueryClient } from '@tanstack/react-query';
+import { reaction } from 'mobx';
+import type RootStore from 'stores/root';
+
+export default function validationReactions(
+ store: RootStore,
+ apolloClient: ApolloClient