Skip to content

Commit 677c081

Browse files
full
1 parent 757447e commit 677c081

29 files changed

+603
-134
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"cSpell.words": [
33
"officedocument",
44
"openxmlformats",
5+
"Respresent",
56
"wordprocessingml"
67
]
78
}

client/enums/Links.enum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ export enum Links {
22
MAIN_PAGE = "/",
33
REDACT = '/redact',
44
VARIOUS = '/various',
5-
SETTINGS = '/settings'
5+
RESULT = '/result'
66
}
77

client/public/img/delete.png

1.75 KB
Loading

client/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Routes, Route, useLocation } from 'react-router-dom'
33
import Layout from './Layout'
44

55
import MainPage from '@pages/Main.page'
6-
import SettingsPage from '@pages/Settings.page'
6+
import ResultPage from '@pages/Result.page'
77
import RedactorPage from '@pages/Redactor.page'
88
import VariousPage from '@pages/Various.page'
99

@@ -25,7 +25,7 @@ const App:FC = () => {
2525
<Routes>
2626
<Route path='/' element={<Layout />}>
2727
<Route index path='/' element={<MainPage />}/>
28-
<Route path='settings' element={<SettingsPage />}/>
28+
<Route path='result' element={<ResultPage />}/>
2929
<Route path='redact' element={<RedactorPage />}/>
3030
<Route path='various' element={<VariousPage />} />
3131
</Route>

client/src/components/Form.tsx

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,66 @@ import { FC, useEffect, useCallback } from 'react';
22
import "../sass/various_page.scss"
33

44
import { useAppDispatch } from '@slices-my/store';
5-
import { addVariousInfo } from '@slices-my/various_info.slice';
5+
import { addVariousInfo, addIsValid } from '@slices-my/various_info.slice';
66

77
import { useSelector } from 'react-redux';
88
import { RootState } from '@slices-my/store';
99

10+
import { useNavigate } from 'react-router-dom';
11+
1012
import { useForm, FormProvider } from 'react-hook-form';
1113
import { VariousInfo } from '@types-my/Form.type';
14+
import { Links } from '@enums/Links.enum';
1215

1316
import FIO from '@components/form_parts/FIO';
14-
import Fraction from '@components/form_parts/Fraction';
17+
import deleteIcon from '/img/delete.png'
18+
19+
20+
interface Props {
21+
id: number,
22+
onDelete: (id: number) => void,
23+
num: number
24+
}
25+
26+
const Form: FC<Props> = ({ id, onDelete, num }) => {
1527

16-
const Form: FC = () => {
28+
const navigate = useNavigate()
29+
30+
const general_info = useSelector((state: RootState) => state.general_info.general_info)
1731
const dispatch = useAppDispatch();
1832
const isClick = useSelector((state: RootState) => state.various_info.isClick);
1933

2034
const methods = useForm<VariousInfo>({ mode: 'onBlur' });
2135
const { handleSubmit, formState: { isValid } } = methods;
2236

2337
const onSubmit = useCallback((data: VariousInfo) => {
24-
console.log(data);
2538
dispatch(addVariousInfo(Array(data)));
26-
}, [dispatch]);
39+
navigate(Links.RESULT)
40+
}, [dispatch]);
41+
42+
2743

2844
useEffect(() => {
2945
if (isClick > 0) {
30-
alert(1)
31-
handleSubmit((data: VariousInfo) => onSubmit(data))();
46+
dispatch(addIsValid(isValid))
47+
handleSubmit((data: VariousInfo) => onSubmit(data))();
3248
}
33-
}, [isClick, handleSubmit, onSubmit]);
49+
}, [isClick, handleSubmit, onSubmit]);
50+
51+
52+
53+
54+
55+
3456
return (
3557
<>
58+
<span className='number_form'>
59+
#{num}
60+
<img onClick={() => onDelete(id)} id='delete_icon' width={36} src={deleteIcon} alt="Удалить участника" />
61+
</span>
3662
<FormProvider {...methods}>
37-
<form >
38-
<h2>Информация о каждом участнике</h2>
63+
<form className='various'>
3964
<FIO />
40-
<Fraction />
4165
</form>
4266
</FormProvider>
4367
</>
Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
1-
import { FC } from 'react';
1+
import React, { FC } from 'react';
22

33

4-
const OptionsMouthComponent:FC = () => {
4+
const OptionsMouthComponent: FC = () => {
5+
const defaultValue = localStorage.getItem('mouth') || ''
6+
7+
8+
const options = [
9+
{ value: "января", label: "Январь" },
10+
{ value: "февраля", label: "Февраль" },
11+
{ value: "марта", label: "Март" },
12+
{ value: "апреля", label: "Апрель" },
13+
{ value: "мая", label: "Май" },
14+
{ value: "июня", label: "Июнь" },
15+
{ value: "июля", label: "Июль" },
16+
{ value: "августа", label: "Август" },
17+
{ value: "сентября", label: "Сентябрь" },
18+
{ value: "октября", label: "Октябрь" },
19+
{ value: "ноября", label: "Ноябрь" },
20+
{ value: "декабря", label: "Декабрь" },
21+
];
22+
523
return (
624
<>
7-
<option value="января">Январь</option>
8-
<option value="февраля">Февраль</option>
9-
<option value="марта">Март</option>
10-
<option value="апреля">Апрель</option>
11-
<option value="мая">Май</option>
12-
<option value="июня">Июнь</option>
13-
<option value="июля">Июль</option>
14-
<option value="августа">Август</option>
15-
<option value="сентября">Сентябрь</option>
16-
<option value="октября">Октябрь</option>
17-
<option value="ноября">Ноябрь</option>
18-
<option value="декабря">Декабрь</option>
25+
{options.map((option, index) => (
26+
<option
27+
key={index}
28+
value={option.value}
29+
selected={option.value === defaultValue}
30+
>
31+
{option.label}
32+
</option>
33+
))}
1934
</>
20-
)
21-
}
35+
);
36+
};
2237

2338
export default OptionsMouthComponent;

client/src/components/form_parts/Address.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ import { AddressPartType } from "@types-my/Form.type"
88

99
const Address:FC = () => {
1010
const { register, formState: { errors } } = useFormContext<AddressPartType>();
11+
12+
const ls = localStorage.getItem('address') || ''
1113
return (
1214
<div id='address'>
1315
<div className="part_row_inputs">
1416
<label htmlFor="address">Адрес</label>
1517
<textarea
16-
placeholder='Белгородская область город Белгород проспект Славы 31/2'
18+
defaultValue={ls}
19+
placeholder='Белгородская область, город Белгород, проспект Славы 31/2'
1720
id='address'
1821
{...register("address", {
1922
required: "Это поле обязательное",

client/src/components/form_parts/Area.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { AreaPartType } from "@types-my/Form.type"
88

99
const Area:FC = () => {
1010
const { register, watch, setValue, formState: { errors } } = useFormContext<AreaPartType>();
11-
11+
const ls = localStorage.getItem('area') || ''
1212
const area_value = watch('area');
1313

1414
useEffect(()=> {
@@ -23,6 +23,7 @@ const { register, watch, setValue, formState: { errors } } = useFormContext<Area
2323
<div className="part_row_inputs">
2424
<label htmlFor="area_input">Площадь</label>
2525
<input
26+
defaultValue={ls}
2627
id='area_input'
2728
placeholder='10000'
2829
type="number"

client/src/components/form_parts/CadastralNumber.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ import { CadastralNumberPartType } from "@types-my/Form.type"
99
const CadastralNumber:FC = () => {
1010
const { register, watch, setValue, formState: { errors } } = useFormContext<CadastralNumberPartType>();
1111

12+
13+
const ls_1 = localStorage.getItem('c_1') || ''
14+
const ls_2 = localStorage.getItem('c_2') || ''
15+
const ls_3 = localStorage.getItem('c_3') || ''
16+
const ls_4 = localStorage.getItem('c_y') || ''
17+
18+
1219
const c_1 = watch('cadastral_number_1');
1320
const c_2 = watch('cadastral_number_2');
1421
const c_3 = watch('cadastral_number_3');
@@ -38,6 +45,7 @@ useEffect(()=> {
3845
<div className="part_row_inputs">
3946
<label>Кадастровый номер</label>
4047
<input
48+
defaultValue={ls_1}
4149
placeholder='XX'
4250
id='c_1'
4351
type="number"
@@ -53,6 +61,7 @@ useEffect(()=> {
5361

5462

5563
<input
64+
defaultValue={ls_2}
5665
id='c_2'
5766
placeholder='XX'
5867
type="number"
@@ -68,6 +77,7 @@ useEffect(()=> {
6877

6978

7079
<input
80+
defaultValue={ls_3}
7181
placeholder='XXXXXXX'
7282
id="c_3"
7383
type="number"
@@ -83,6 +93,7 @@ useEffect(()=> {
8393

8494

8595
<input
96+
defaultValue={ls_4}
8697
placeholder='X'
8798
id='c_y'
8899
type="number"

client/src/components/form_parts/Date.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const Date:FC = () => {
1111

1212
const { register, watch, setValue, formState: { errors } } = useFormContext<DatePartType>();
1313

14+
const ls_1 = localStorage.getItem('day') || ''
15+
const ls_2 = localStorage.getItem('year') || ''
1416

1517
const day_value = watch('day');
1618
const year_value = watch('year');
@@ -39,6 +41,7 @@ const Date:FC = () => {
3941
placeholder='1'
4042
id='day_input'
4143
type="number"
44+
defaultValue={ls_1}
4245
{...register('day', {
4346
required: "Это поле обязательное",
4447
max: {
@@ -59,6 +62,7 @@ const Date:FC = () => {
5962
</select>
6063
<label htmlFor="year_input">Год</label>
6164
<input
65+
defaultValue={ls_2}
6266
placeholder='2020'
6367
id='year_input'
6468
type="number"

0 commit comments

Comments
 (0)