diff --git a/apps/web/Components/Calculation/addons/irr-addon.tsx b/apps/web/Components/Calculation/addons/irr-addon.tsx
new file mode 100644
index 0000000..23ffc2d
--- /dev/null
+++ b/apps/web/Components/Calculation/addons/irr-addon.tsx
@@ -0,0 +1,31 @@
+import { useStore } from '@/stores/hooks';
+import { observer } from 'mobx-react-lite';
+import styled from 'styled-components';
+import { LoadingOutlined } from 'ui/elements/icons';
+
+const TextAddon = styled.span`
+ font-size: 14px;
+`;
+
+const formatter = Intl.NumberFormat('ru', {
+ minimumFractionDigits: 2,
+}).format;
+
+export const IRRAddon = observer(() => {
+ const { $calculation, $process } = useStore();
+
+ if ($process.has('Tarif')) {
+ return (
+
+
+ {' Подбирается тариф...'}
+
+ );
+ }
+
+ const tarif = $calculation.element('selectTarif').getValue();
+ if (!tarif) return Тариф не найден;
+
+ const { min, max } = $calculation.$values.getValue('irrInfo');
+ return {`${formatter(min)}% - ${formatter(max)}%`};
+});
diff --git a/apps/web/Components/Calculation/addons/loader-addon.tsx b/apps/web/Components/Calculation/addons/loader-addon.tsx
deleted file mode 100644
index f4a6ea7..0000000
--- a/apps/web/Components/Calculation/addons/loader-addon.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import styled from 'styled-components';
-import { LoadingOutlined } from 'ui/elements/icons';
-
-const TextAddon = styled.span`
- font-size: 14px;
-`;
-
-export function LoaderAddon() {
- return (
-
-
- {' идет загрузка тарифов...'}
-
- );
-}
diff --git a/apps/web/Components/Calculation/config/elements-render/override.tsx b/apps/web/Components/Calculation/config/elements-render/override.tsx
index c1e2166..cf2576b 100644
--- a/apps/web/Components/Calculation/config/elements-render/override.tsx
+++ b/apps/web/Components/Calculation/config/elements-render/override.tsx
@@ -1,4 +1,4 @@
-import { LoaderAddon } from '../../addons/loader-addon';
+import { IRRAddon } from '../../addons/irr-addon';
import { ProductAddon } from '../../addons/product-addon';
import { buildLink } from '../../builders';
import components from '../elements-components';
@@ -12,7 +12,6 @@ import { useErrors, useStore } from '@/stores/hooks';
import { useIsFetching } from '@tanstack/react-query';
import { observer } from 'mobx-react-lite';
import type { ComponentProps } from 'react';
-import styled from 'styled-components';
import { Link, Tooltip } from 'ui/elements';
import { LoadingOutlined } from 'ui/elements/icons';
@@ -23,14 +22,6 @@ const defaultLinkProps: ComponentProps = {
type: 'link',
};
-const formatter = Intl.NumberFormat('ru', {
- minimumFractionDigits: 2,
-}).format;
-
-const TextAddon = styled.span`
- font-size: 14px;
-`;
-
const overrideRender: Partial> = {
btnCalculate: {
render: () => {
@@ -340,18 +331,12 @@ const overrideRender: Partial> = {
});
const RenderedComponent = observer(() => {
- const { $calculation, $process } = useStore();
+ const { $calculation } = useStore();
const { min, max } = $calculation.$values.getValue('irrInfo');
- const addon = {`${formatter(min)}% - ${formatter(max)}%`};
-
return (
- : addon}
- />
+ } />
0 ? min : undefined} max={max > 0 ? max : undefined} />
);
diff --git a/apps/web/process/configurator/validation.ts b/apps/web/process/configurator/validation.ts
index 5a44392..5c6adf7 100644
--- a/apps/web/process/configurator/validation.ts
+++ b/apps/web/process/configurator/validation.ts
@@ -77,7 +77,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
if (!tarifId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
- message: 'Тариф не выбран',
+ message: 'Не заполнено поле',
path: ['selectTarif'],
});
}