diff --git a/package.json b/package.json index 9b51613..ef1e73d 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "lodash": "^4.17.20", "mobx": "^5.15.6", "mobx-react": "^6.3.0", + "mobx-react-lite": "^2.2.2", "morgan": "^1.10.0", "mssql": "^6.2.1", "nodemon": "^2.0.4", diff --git a/src/client/Containers/Calculation/Sections/list.js b/src/client/Containers/Calculation/Sections/list.js index f203e5e..1f21cde 100644 --- a/src/client/Containers/Calculation/Sections/list.js +++ b/src/client/Containers/Calculation/Sections/list.js @@ -1359,19 +1359,34 @@ export default [ isTable: true, Component: Table, props: { - name: 'fruitTable', + name: 'tableInsurance', features: { canDeleteRow: true, }, columns: [ { - name: 'fruit', - title: 'Fruit', + name: 'policyType', + title: 'Тип полиса', Component: Select, }, { - name: 'number', - title: 'Number', + name: 'insuranceCompany', + title: 'Страховщик', + Component: Select, + }, + { + name: 'insured', + title: 'Страхователь', + Component: Select, + }, + { + name: 'cost', + title: 'Стоимость полиса', + Component: InputNumber, + }, + { + name: 'insuranceTerm', + title: 'Срок страхования', Component: InputNumber, }, ], diff --git a/src/client/hocs/withStore.js b/src/client/hocs/withStore.js index add003e..c3981aa 100644 --- a/src/client/hocs/withStore.js +++ b/src/client/hocs/withStore.js @@ -2,7 +2,7 @@ import { useOptions } from 'client/hooks/useOptions'; import { useStatus, useTableStatus } from 'client/hooks/useStatus'; import { useStoreValue, useTableValue } from 'client/hooks/useValue'; import { useValidation } from 'client/hooks/useValidation'; -import { observer, useObserver } from 'mobx-react'; +import { observer, useObserver } from 'mobx-react-lite'; import React from 'react'; import { useStores } from 'client/hooks/useStores'; import { useTableOptions } from 'client/hooks/useOptions'; diff --git a/src/core/config/initialTables.ts b/src/core/config/initialTables.ts index 7c3703d..f75291d 100644 --- a/src/core/config/initialTables.ts +++ b/src/core/config/initialTables.ts @@ -1,20 +1,28 @@ import { IStoreTable } from './../types/tables'; const initialTables: IStoreTable = { - fruitTable: { + tableInsurance: { values: [ { - fruit: 'apple', - number: '5', + policyType: 'osago', + insuranceCompany: 'РЕСО', + insured: 'МЫ', + cost: 5555, + insuranceTerm: 12, }, { - fruit: 'orange', - number: '10', + policyType: 'kasko', + insuranceCompany: 'ВСК', + insured: 'ОНИ', + cost: 151515, + insuranceTerm: 36, }, ], options: { - fruit: [ - { name: 'Apple', value: 'apple' }, - { name: 'Grusha', value: 'grusha' }, + policyType: [ + { name: 'ОСАГО', value: 'osago' }, + { name: 'КАСКО', value: 'kasko' }, + { name: 'ДГО', value: 'dgo' }, + { name: 'НС', value: 'nc' }, ], }, }, diff --git a/src/core/types/tables.ts b/src/core/types/tables.ts index 0d92e9f..a88ee5e 100644 --- a/src/core/types/tables.ts +++ b/src/core/types/tables.ts @@ -1,6 +1,11 @@ import { Status } from './statuses'; -export type TableNames = 'fruitTable'; -export type TableValuesNames = 'fruit' | 'number'; +export type TableNames = 'tableInsurance'; +export type TableValuesNames = + | 'policyType' + | 'insuranceCompany' + | 'insured' + | 'cost' + | 'insuranceTerm'; export type TableTargets = 'values' | 'options' | 'statuses' | 'filters'; export type TTableValues = {