move/hide sections & elements | fix paths

This commit is contained in:
Chika 2020-11-26 18:21:30 +03:00
parent 79642e7c71
commit 2e2038ae92
8 changed files with 287 additions and 306 deletions

View File

@ -4,7 +4,7 @@ import React from 'react';
import { controlsList } from './infoList';
const Results = props => (
<Background {...props} px="16px">
<Background {...props}>
{renderGroups({ groups: controlsList })}
</Background>
);

View File

@ -3,28 +3,65 @@ import Label from 'client/Elements/Label';
import { ElementType } from 'core/types/Calculation/Store/elements';
import Button from 'client/Elements/Button';
import InputNumber from 'client/Elements/InputNumber';
import Select from 'client/Elements/Select';
export const controlsList: IGroup[] = [
{
title: 'Выбор Интереса/ЛС',
blocks: [
{
// blockTitle: '',
elements: [
//TODO Custom search
{
title: 'Выбор Интереса',
Component: Select,
props: {
name: 'selectLead',
valueName: 'lead',
showSearch: true,
},
},
//TODO Custom search
{
title: 'Лизинговая сделка',
Component: Select,
props: {
name: 'selectOpportunity',
valueName: 'opportunity',
showSearch: true,
},
},
//TODO Custom search
{
title: 'Выбор Предложения',
Component: Select,
props: {
name: 'selectQuote',
valueName: 'quote',
showSearch: true,
},
},
],
},
// {
// elements: [
// {
// title: 'Пересчет без пересмотра',
// Component: Switch,
// props: {
// name: 'cbxRecalcWithRevision',
// valueName: 'recalcWithRevision',
// },
// },
// ],
// },
],
},
{
blocks: [
{
elements: [
{
title: 'Интерес: ',
Component: Label,
props: {
name: 'lblLead',
computedValueName: 'leadName',
},
},
{
title: 'Лизинговая сделка: ',
Component: Label,
props: {
name: 'lblOpportunity',
computedValueName: 'opportunityName',
},
},
{
type: ElementType.Button,
Component: Button,

View File

@ -6,7 +6,6 @@ import { calculationResults } from './resultsList';
const Results = props => (
<Background {...props}>
<Box my="8px" />
<Flex flexDirection="column">
{renderGroups({ groups: calculationResults })}
</Flex>

View File

@ -1,12 +1,11 @@
import { renderGroups } from 'client/Containers/Calculation/lib/renderSections';
import Background from 'client/Elements/Background';
import { Box, Flex } from 'client/UIKit/grid';
import { Flex } from 'client/UIKit/grid';
import React from 'react';
import { resultsTable } from './resultsTableList';
const Results = props => (
<Background {...props}>
<Box my="8px" />
<Flex flexDirection="column">{renderGroups({ groups: resultsTable })}</Flex>
</Background>
);

View File

@ -18,276 +18,215 @@ import { ISection } from 'core/types/Calculation/components';
import { ElementType } from 'core/types/Calculation/Store/elements';
const sections: ISection[] = [
{
title: 'Интерес/ЛС',
groups: [
{
title: 'Поиск интереса в CRM',
blocks: [
{
// blockTitle: '',
elements: [
//TODO Custom search
{
title: 'Выбор Интереса',
Component: Select,
props: {
name: 'selectLead',
valueName: 'lead',
showSearch: true,
},
},
],
},
{
elements: [
//TODO Custom search
{
title: 'Лизинговая сделка',
Component: Select,
props: {
name: 'selectOpportunity',
valueName: 'opportunity',
showSearch: true,
},
},
],
},
{
elements: [
//TODO Custom search
{
title: 'Выбор Предложения',
Component: Select,
props: {
name: 'selectQuote',
valueName: 'quote',
showSearch: true,
},
},
],
},
// {
// elements: [
// {
// title: 'Пересчет без пересмотра',
// Component: Switch,
// props: {
// name: 'cbxRecalcWithRevision',
// valueName: 'recalcWithRevision',
// },
// },
// ],
// },
],
},
// {
// title: 'Интерес/ЛС',
// groups: [
// {
// title: 'Создание нового интереса в CRM',
// blocks: [
// {
// elements: [
// {
// title: 'Канал привлечения',
// Component: Select,
// props: {
// name: 'selectChannel',
// valueName: 'channel',
// showSearch: true,
// },
// },
// {
// title: 'Новый контрагент',
// Component: Input,
// props: {
// name: 'tbxNewClient',
// valueName: 'newClient',
// },
// },
// {
// title: 'Существующий контрагент',
// Component: Select,
// props: {
// name: 'selectAccount',
// valueName: 'account',
// showSearch: true,
// },
// },
// {
// title: 'ИНН',
// Component: Input,
// props: {
// validation: {
// errorMessage: 'Некорректный ИНН',
// validator: validateInn,
// },
// name: 'tbxINN',
// valueName: 'INN',
// },
// },
// {
// title: 'КПП',
// Component: Input,
// props: {
// validation: {
// errorMessage: 'Некорректный КПП',
// validator: validateKpp,
// },
// name: 'tbxKPP',
// valueName: 'KPP',
// },
// },
// ],
// },
// {
// elements: [
// {
// title: 'Контактное лицо контрагента',
// Component: Select,
// props: {
// name: 'selectContactClient',
// valueName: 'contactClient',
// showSearch: true,
// },
// },
// {
// title: 'Контактное лицо',
// Component: Input,
// props: {
// name: 'tbxContact',
// valueName: 'contact',
// },
// },
// {
// title: 'Пол контактного лица',
// Component: Radio,
// props: {
// name: 'radioContactGender',
// valueName: 'contactGender',
// style: 'button',
// },
// },
{
title: 'Создание нового интереса в CRM',
blocks: [
{
elements: [
{
title: 'Канал привлечения',
Component: Select,
props: {
name: 'selectChannel',
valueName: 'channel',
showSearch: true,
},
},
{
title: 'Новый контрагент',
Component: Input,
props: {
name: 'tbxNewClient',
valueName: 'newClient',
},
},
{
title: 'Существующий контрагент',
Component: Select,
props: {
name: 'selectAccount',
valueName: 'account',
showSearch: true,
},
},
{
title: 'ИНН',
Component: Input,
props: {
validation: {
errorMessage: 'Некорректный ИНН',
validator: validateInn,
},
name: 'tbxINN',
valueName: 'INN',
},
},
{
title: 'КПП',
Component: Input,
props: {
validation: {
errorMessage: 'Некорректный КПП',
validator: validateKpp,
},
name: 'tbxKPP',
valueName: 'KPP',
},
},
],
},
{
elements: [
{
title: 'Контактное лицо контрагента',
Component: Select,
props: {
name: 'selectContactClient',
valueName: 'contactClient',
showSearch: true,
},
},
{
title: 'Контактное лицо',
Component: Input,
props: {
name: 'tbxContact',
valueName: 'contact',
},
},
{
title: 'Пол контактного лица',
Component: Radio,
props: {
name: 'radioContactGender',
valueName: 'contactGender',
style: 'button',
},
},
// {
// title: 'Телефон',
// Component: Input,
// props: {
// type: 'tel',
// name: 'tbxPhoneNumber',
// valueName: 'phoneNumber',
// validation: {
// errorMessage: 'Некорректный номер телефона',
// validator: validatePhone,
// },
// //TODO: mask + 7(999) 999 99 99
// },
// },
// {
// title: 'E-mail',
// Component: Input,
// props: {
// type: 'email',
// name: 'tbxEmailAddress',
// valueName: 'emailAddress',
// //TODO email mask
// validation: {
// errorMessage: 'Некорректный E-mail',
// validator: validateEmail,
// },
// },
// },
// ],
// },
{
title: 'Телефон',
Component: Input,
props: {
type: 'tel',
name: 'tbxPhoneNumber',
valueName: 'phoneNumber',
validation: {
errorMessage: 'Некорректный номер телефона',
validator: validatePhone,
},
//TODO: mask + 7(999) 999 99 99
},
},
{
title: 'E-mail',
Component: Input,
props: {
type: 'email',
name: 'tbxEmailAddress',
valueName: 'emailAddress',
//TODO email mask
validation: {
errorMessage: 'Некорректный E-mail',
validator: validateEmail,
},
},
},
],
},
// {
// elements: [
// {
// title: 'Поставщик',
// Component: Select,
// props: {
// name: 'selectSupplier',
// valueName: 'supplier',
// showSearch: true,
// },
// },
// {
// title: 'Финотдел',
// Component: Select,
// props: {
// name: 'selectFinDepartment',
// valueName: 'finDepartment',
// showSearch: false,
// },
// },
// {
// title: 'Брокер',
// Component: Select,
// props: {
// name: 'selectBroker',
// valueName: 'broker',
// showSearch: false,
// },
// },
{
elements: [
{
title: 'Поставщик',
Component: Select,
props: {
name: 'selectSupplier',
valueName: 'supplier',
showSearch: true,
},
},
{
title: 'Финотдел',
Component: Select,
props: {
name: 'selectFinDepartment',
valueName: 'finDepartment',
showSearch: false,
},
},
{
title: 'Брокер',
Component: Select,
props: {
name: 'selectBroker',
valueName: 'broker',
showSearch: false,
},
},
// {
// title: 'Агент',
// Component: Select,
// props: {
// name: 'selectAgent',
// valueName: 'agent',
// showSearch: true,
// },
// },
// {
// title: 'Двойной агент',
// Component: Select,
// props: {
// name: 'selectDoubleAgent',
// valueName: 'doubleAgent',
// showSearch: true,
// },
// },
// ],
// },
{
title: 'Агент',
Component: Select,
props: {
name: 'selectAgent',
valueName: 'agent',
showSearch: true,
},
},
{
title: 'Двойной агент',
Component: Select,
props: {
name: 'selectDoubleAgent',
valueName: 'doubleAgent',
showSearch: true,
},
},
],
},
// {
// elements: [
// {
// title: 'Комментарий к интересу',
// Component: TextArea,
// props: {
// name: 'tbxCommentLead',
// valueName: 'commentLead',
// },
// },
// ],
// layout: {
// newLine: true,
// },
// },
{
elements: [
{
title: 'Комментарий к интересу',
Component: TextArea,
props: {
name: 'tbxCommentLead',
valueName: 'commentLead',
},
},
],
layout: {
newLine: true,
},
},
{
elements: [
{
type: ElementType.Button,
Component: Button,
props: {
type: 'primary',
size: 'large',
name: 'btnCreateLead',
text: 'Создать интерес',
actionName: 'createLead',
},
},
],
layout: {
newLine: true,
},
},
],
},
],
},
// {
// elements: [
// {
// type: ElementType.Button,
// Component: Button,
// props: {
// type: 'primary',
// size: 'large',
// name: 'btnCreateLead',
// text: 'Создать интерес',
// actionName: 'createLead',
// },
// },
// ],
// layout: {
// newLine: true,
// },
// },
// ],
// },
// ],
// },
{
title: 'Лизинг',
groups: [
@ -1374,14 +1313,6 @@ const sections: ISection[] = [
valueName: 'insNSIB',
},
},
{
title: 'Карта техпомощи',
Component: Select,
props: {
name: 'selectTechnicalCard',
valueName: 'technicalCard',
},
},
{
title: 'Программа средства контроля',
Component: Radio,
@ -1391,14 +1322,6 @@ const sections: ISection[] = [
style: 'button',
},
},
{
title: 'Телематика',
Component: Select,
props: {
name: 'selectTelematic',
valueName: 'telematic',
},
},
{
title: 'Маяк',
Component: Select,
@ -1407,6 +1330,22 @@ const sections: ISection[] = [
valueName: 'tracker',
},
},
// {
// title: 'Телематика',
// Component: Select,
// props: {
// name: 'selectTelematic',
// valueName: 'telematic',
// },
// },
// {
// title: 'Карта техпомощи',
// Component: Select,
// props: {
// name: 'selectTechnicalCard',
// valueName: 'technicalCard',
// },
// },
],
},
],

View File

@ -81,6 +81,7 @@ export const renderGroups = ({ groups }) => {
style={{
margin: '16px 0',
color: colors.primaryColor,
fontSize: '0.95rem',
}}
>
{blocksTitle}

View File

@ -1,8 +1,8 @@
import styled, { css } from 'styled-components';
import mq from 'UIKit/mq';
import mq from './mq';
import { BOX_STYLED_SYSTEM, TEXT_STYLED_SYSTEM, Text } from './grid';
import typographyStyle from './lib/typographyStyle';
import colors from 'src/components/UIKit/colors';
import colors from './colors';
export const WITH_COUNTER = css`
content: attr(data-counter);

View File

@ -1,7 +1,13 @@
import { css } from 'styled-components';
import mq from 'src/components/UIKit/mq';
import mq from 'client/UIKit/mq';
const TYPOGRAPHY_BPS = [320, 'tablet', 'desktop1280', 'desktop1440', 'desktop1680'];
const TYPOGRAPHY_BPS = [
320,
'tablet',
'desktop1280',
'desktop1440',
'desktop1680',
];
const getTypographyStyle = fontSize => `font-size: ${fontSize}px;`;
const typographyArray = arr =>
@ -31,7 +37,7 @@ const typographyArrayToCSS = (arr, lh) =>
},
css`
line-height: ${lh};
`
`,
);
const typographyStyle = (fontSizeArray, lineHeight) =>
typographyArrayToCSS(typographyArray(fontSizeArray), lineHeight);