/* eslint-disable object-curly-newline */ import { Container, Head } from 'Components/Layout/Element'; import { observer } from 'mobx-react-lite'; import type { ComponentProps } from 'react'; import { useStore } from 'stores/hooks'; import Link from 'ui/elements/Link'; import Tooltip from 'ui/elements/Tooltip'; import buildReadonly from '../../builders/build-readonly'; import components from '../elements-components'; import elementsProps from '../elements-props'; import titles from '../elements-titles'; import types from '../elements-types'; import map from '../map'; import type { RenderProps } from './types'; const defaultLinkProps: ComponentProps = { text: 'Открыть в CRM', type: 'link', }; const overrideRender: Partial> = { selectLead: { render: () => { const elementName = 'selectLead'; const title = titles.selectLead; const valueName = map.selectLead; const Component = components.selectLead; const props = elementsProps.selectLead; const { builder } = types.selectLead(); const Element = builder(Component, { elementName, valueName, }); const LinkComponent = buildReadonly(Link, { elementName: 'linkLeadUrl', valueName: 'leadUrl', }); return ( } /> ); }, }, selectOpportunity: { render: () => { const elementName = 'selectOpportunity'; const title = titles.selectOpportunity; const valueName = map.selectOpportunity; const Component = components.selectOpportunity; const props = elementsProps.selectOpportunity; const { builder } = types.selectOpportunity(); const Element = builder(Component, { elementName, valueName, }); const LinkComponent = buildReadonly(Link, { elementName: 'linkOpportunityUrl', valueName: 'opportunityUrl', }); return ( } /> ); }, }, selectQuote: { render: () => { const elementName = 'selectQuote'; const title = titles.selectQuote; const valueName = map.selectQuote; const Component = components.selectQuote; const props = elementsProps.selectQuote; const { builder } = types.selectQuote(); const Element = builder(Component, { elementName, valueName, }); const LinkComponent = buildReadonly(Link, { elementName: 'linkQuoteUrl', valueName: 'quoteUrl', }); return ( } /> ); }, }, tbxVehicleTaxInYear: { render: () => { const elementName = 'tbxVehicleTaxInYear'; const title = titles.tbxVehicleTaxInYear; const valueName = map.tbxVehicleTaxInYear; const Component = components.tbxVehicleTaxInYear; const props = elementsProps.tbxVehicleTaxInYear; const { builder } = types.tbxVehicleTaxInYear(); const Element = builder(Component, { elementName, valueName, }); return ( ); }, }, selectHighSeasonStart: { render: () => { const elementName = 'selectHighSeasonStart'; const title = titles.selectHighSeasonStart; const valueName = map.selectHighSeasonStart; const Component = components.selectHighSeasonStart; const props = elementsProps.selectHighSeasonStart; const { builder } = types.selectHighSeasonStart(); const Element = builder(Component, { elementName, valueName, }); return ( ); }, }, selectSeasonType: { render: () => { const elementName = 'selectSeasonType'; const valueName = map.selectSeasonType; const Component = components.selectSeasonType; const props = elementsProps.selectSeasonType; const { builder } = types.selectSeasonType(); const Element = builder(Component, { elementName, valueName, }); const Title = observer(() => { const { $calculation } = useStore(); const graphType = $calculation.element('radioGraphType').getValue(); switch (graphType) { case 100_000_001: { return Тип дегрессии; } case 100_000_003: { return Тип сезонности; } default: { return {titles.selectSeasonType}; } } }); return ( } /> ); }, }, }; export default overrideRender;