стадия депрессии
This commit is contained in:
parent
790320eaee
commit
056bab6b14
20
lab5/.eslintrc.cjs
Normal file
20
lab5/.eslintrc.cjs
Normal file
@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: { browser: true, es2020: true },
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react/jsx-runtime',
|
||||
'plugin:react-hooks/recommended',
|
||||
],
|
||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
|
||||
settings: { react: { version: '18.2' } },
|
||||
plugins: ['react-refresh'],
|
||||
rules: {
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
},
|
||||
}
|
24
lab5/.gitignore
vendored
Normal file
24
lab5/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
8
lab5/README.md
Normal file
8
lab5/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# React + Vite
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
126
lab5/data.json
Normal file
126
lab5/data.json
Normal file
File diff suppressed because one or more lines are too long
13
lab5/index.html
Normal file
13
lab5/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/logo.png" href="src/Images/logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Каталог</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="h-100 d-flex flex-column"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
</html>
|
15
lab5/jsconfig.json
Normal file
15
lab5/jsconfig.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2020",
|
||||
"jsx": "react",
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/node_modules/*"
|
||||
]
|
||||
}
|
5
lab5/json-server.json
Normal file
5
lab5/json-server.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"static": "./node_modules/json-server/public",
|
||||
"port": 8081,
|
||||
"watch": "true"
|
||||
}
|
5953
lab5/package-lock.json
generated
Normal file
5953
lab5/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
38
lab5/package.json
Normal file
38
lab5/package.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "lec4",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
||||
"rest": "json-server data.json",
|
||||
"vite": "vite",
|
||||
"dev": "npm-run-all --parallel rest vite",
|
||||
"prod": "npm-run-all lint 'vite build' --parallel rest 'vite preview'"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.18.0",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"axios": "^1.6.1",
|
||||
"bootstrap": "^5.3.2",
|
||||
"react-bootstrap": "^2.9.1",
|
||||
"react-bootstrap-icons": "^1.10.3",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dom": "^18.2.15",
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"json-server": "^0.17.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"vite": "^4.4.5"
|
||||
}
|
||||
}
|
1
lab5/public/vite.svg
Normal file
1
lab5/public/vite.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
25
lab5/src/App.jsx
Normal file
25
lab5/src/App.jsx
Normal file
@ -0,0 +1,25 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Container } from 'react-bootstrap';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
import { Outlet } from 'react-router-dom';
|
||||
import Footer from './components/footer/Footer.jsx';
|
||||
import Navigation from './components/navigation/Navigation.jsx';
|
||||
|
||||
const App = ({ routes }) => {
|
||||
return (
|
||||
<div className="d-flex flex-column min-vh-100">
|
||||
<Navigation routes={routes}></Navigation>
|
||||
<Container className="flex-grow-1 p-2" as="main" fluid>
|
||||
<Outlet />
|
||||
</Container>
|
||||
<Footer />
|
||||
<Toaster position='top-center' reverseOrder={true} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
App.propTypes = {
|
||||
routes: PropTypes.array,
|
||||
};
|
||||
|
||||
export default App;
|
BIN
lab5/src/Images/200.png
Normal file
BIN
lab5/src/Images/200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
lab5/src/Images/logo.png
Normal file
BIN
lab5/src/Images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
lab5/src/Images/pizza.png
Normal file
BIN
lab5/src/Images/pizza.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 669 KiB |
BIN
lab5/src/Images/stock.png
Normal file
BIN
lab5/src/Images/stock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
1
lab5/src/assets/react.svg
Normal file
1
lab5/src/assets/react.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
After Width: | Height: | Size: 4.0 KiB |
40
lab5/src/components/api/ApiClient.js
Normal file
40
lab5/src/components/api/ApiClient.js
Normal file
@ -0,0 +1,40 @@
|
||||
import axios from 'axios';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
export class HttpError extends Error {
|
||||
constructor(message = '') {
|
||||
super(message);
|
||||
this.name = 'HttpError';
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
toast.error(message, { id: 'HttpError' });
|
||||
}
|
||||
}
|
||||
|
||||
function responseHandler(response) {
|
||||
if (response.status === 200 || response.status === 201) {
|
||||
const data = response?.data;
|
||||
if (!data) {
|
||||
throw new HttpError('API Error. No data!');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
throw new HttpError(`API Error! Invalid status code ${response.status}!`);
|
||||
}
|
||||
|
||||
function responseErrorHandler(error) {
|
||||
if (error === null) {
|
||||
throw new Error('Unrecoverable error!! Error is null!');
|
||||
}
|
||||
toast.error(error.message, { id: 'AxiosError' });
|
||||
return Promise.reject(error.message);
|
||||
}
|
||||
|
||||
export const ApiClient = axios.create({
|
||||
baseURL: 'http://localhost:8081/',
|
||||
timeout: '3000',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
ApiClient.interceptors.response.use(responseHandler, responseErrorHandler);
|
29
lab5/src/components/api/ApiService.js
Normal file
29
lab5/src/components/api/ApiService.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { ApiClient } from './ApiClient';
|
||||
|
||||
class ApiService {
|
||||
constructor(url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
async getAll(expand) {
|
||||
return ApiClient.get(`${this.url}${expand || ''}`);
|
||||
}
|
||||
|
||||
async get(id, expand) {
|
||||
return ApiClient.get(`${this.url}/${id}${expand || ''}`);
|
||||
}
|
||||
|
||||
async create(body) {
|
||||
return ApiClient.post(this.url, body);
|
||||
}
|
||||
|
||||
async update(id, body) {
|
||||
return ApiClient.put(`${this.url}/${id}`, body);
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
return ApiClient.delete(`${this.url}/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export default ApiService;
|
41
lab5/src/components/card/BasketCard.jsx
Normal file
41
lab5/src/components/card/BasketCard.jsx
Normal file
@ -0,0 +1,41 @@
|
||||
import { useState } from 'react';
|
||||
import { Card, Col, Row, Form } from 'react-bootstrap';
|
||||
|
||||
const BasketCard = () => {
|
||||
const [quantity, setQuantity] = useState(2);
|
||||
|
||||
const handleQuantityChange = (event) => {
|
||||
setQuantity(event.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card className="rounded-3 mb-4">
|
||||
<Card.Body className="p-4">
|
||||
<Row className="d-flex justify-content-between align-items-center">
|
||||
<Col md={2} lg={2} xl={2}>
|
||||
<img src="./src/Images/pizza.png" className="img-fluid rounded-3" alt="Cotton T-shirt" />
|
||||
</Col>
|
||||
<Col md={3} lg={3} xl={3}>
|
||||
<p className="lead fw-normal mb-2">Название пиццы</p>
|
||||
</Col>
|
||||
<Col md={3} lg={3} xl={2} className="d-flex align-items-center">
|
||||
<Form.Control
|
||||
id="form1"
|
||||
min="0"
|
||||
name="quantity"
|
||||
value={quantity}
|
||||
type="number"
|
||||
className="form-control form-control-sm text-center"
|
||||
onChange={handleQuantityChange}
|
||||
/>
|
||||
</Col>
|
||||
<Col md={3} lg={2} xl={2} offset-lg={1}>
|
||||
<h5 className="mb-0">Цена ₽</h5>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default BasketCard;
|
20
lab5/src/components/card/ProductCard.jsx
Normal file
20
lab5/src/components/card/ProductCard.jsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { Col, Card, Button } from 'react-bootstrap';
|
||||
|
||||
const ProductCard = () => {
|
||||
return (
|
||||
<Col lg={3} md={4} sm={6} xs={12} className="mb-4">
|
||||
<Card>
|
||||
<Card.Img src="./src/Images/pizza.png" alt="Product Image" className="card-img-top" />
|
||||
<Card.Body>
|
||||
<Card.Title>Название</Card.Title>
|
||||
</Card.Body>
|
||||
<Card.Footer>
|
||||
<div className="text-warning font-weight-bold">Цена ₽</div>
|
||||
<Button variant="warning">В корзину</Button>
|
||||
</Card.Footer>
|
||||
</Card>
|
||||
</Col>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProductCard;
|
21
lab5/src/components/card/StockCard.jsx
Normal file
21
lab5/src/components/card/StockCard.jsx
Normal file
@ -0,0 +1,21 @@
|
||||
import { Col, Card } from 'react-bootstrap';
|
||||
|
||||
const StockCard = () => {
|
||||
return (
|
||||
<Col lg={4} md={6} sm={12} className="mb-4">
|
||||
<Card>
|
||||
<Card.Img src="./src/Images/stock.png" alt="Stock Image" className="card-img-top" />
|
||||
<Card.Body>
|
||||
<Card.Title>Дарим кибер-призы</Card.Title>
|
||||
<Card.Text>
|
||||
Вот так ачивка! Закажите Кибер-комбо и получите доступ к играм от MY.GAMES, а еще кокосовый батончик и
|
||||
шоколадное печенье «Cyber» от Bite. А также станьте автоматическим участником розыгрыша игровых ключей и
|
||||
больших пицц 29 июня.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
);
|
||||
};
|
||||
|
||||
export default StockCard;
|
4
lab5/src/components/footer/Footer.css
Normal file
4
lab5/src/components/footer/Footer.css
Normal file
@ -0,0 +1,4 @@
|
||||
.my-footer {
|
||||
background-color: #D9D9D9;
|
||||
height: 32px;
|
||||
}
|
11
lab5/src/components/footer/Footer.jsx
Normal file
11
lab5/src/components/footer/Footer.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import './Footer.css';
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer className="my-footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
||||
Все права защищены © 2023-2024
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
||||
export default Footer;
|
23
lab5/src/components/input/Input.jsx
Normal file
23
lab5/src/components/input/Input.jsx
Normal file
@ -0,0 +1,23 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Form } from 'react-bootstrap';
|
||||
|
||||
const Input = ({
|
||||
name, label, value, onChange, className, ...rest
|
||||
}) => {
|
||||
return (
|
||||
<Form.Group className={`mb-2 ${className || ''}`} controlId={name}>
|
||||
<Form.Label>{label}</Form.Label>
|
||||
<Form.Control name={name || ''} value={value || ''} onChange={onChange} {...rest} />
|
||||
</Form.Group>
|
||||
);
|
||||
};
|
||||
|
||||
Input.propTypes = {
|
||||
name: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Input;
|
29
lab5/src/components/input/Select.jsx
Normal file
29
lab5/src/components/input/Select.jsx
Normal file
@ -0,0 +1,29 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Form } from 'react-bootstrap';
|
||||
|
||||
const Select = ({
|
||||
values, name, label, value, onChange, className, ...rest
|
||||
}) => {
|
||||
return (
|
||||
<Form.Group className={`mb-2 ${className || ''}`} controlId={name}>
|
||||
<Form.Label className='form-label'>{label}</Form.Label>
|
||||
<Form.Select name={name || ''} value={value || ''} onChange={onChange} {...rest}>
|
||||
<option value=''>Выберите значение</option>
|
||||
{
|
||||
values.map((type) => <option key={type.id} value={type.id}>{type.name}</option>)
|
||||
}
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
);
|
||||
};
|
||||
|
||||
Select.propTypes = {
|
||||
values: PropTypes.array,
|
||||
name: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Select;
|
48
lab5/src/components/lines/form/LinesForm.jsx
Normal file
48
lab5/src/components/lines/form/LinesForm.jsx
Normal file
@ -0,0 +1,48 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Form } from 'react-bootstrap';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import useLinesItemForm from '../hooks/LinesItemFormHook';
|
||||
import LinesItemForm from './LinesItemForm.jsx';
|
||||
|
||||
const LinesForm = ({ id }) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const {
|
||||
item,
|
||||
validated,
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
} = useLinesItemForm(id);
|
||||
|
||||
const onBack = () => {
|
||||
navigate(-1);
|
||||
};
|
||||
|
||||
const onSubmit = async (event) => {
|
||||
if (await handleSubmit(event)) {
|
||||
onBack();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form className='m-0 p-2' noValidate validated={validated} onSubmit={onSubmit}>
|
||||
<LinesItemForm item={item} handleChange={handleChange} />
|
||||
<Form.Group className='row justify-content-center m-0 mt-3'>
|
||||
<Button className='col-5 col-lg-2 m-0 me-2' variant='secondary' onClick={() => onBack()}>
|
||||
Назад
|
||||
</Button>
|
||||
<Button className='col-5 col-lg-2 m-0 ms-2' type='submit' variant='primary'>
|
||||
Сохранить
|
||||
</Button>
|
||||
</Form.Group>
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
LinesForm.propTypes = {
|
||||
id: PropTypes.string,
|
||||
};
|
||||
|
||||
export default LinesForm;
|
3
lab5/src/components/lines/form/LinesItemForm.css
Normal file
3
lab5/src/components/lines/form/LinesItemForm.css
Normal file
@ -0,0 +1,3 @@
|
||||
#image-preview {
|
||||
width: 200px;
|
||||
}
|
36
lab5/src/components/lines/form/LinesItemForm.jsx
Normal file
36
lab5/src/components/lines/form/LinesItemForm.jsx
Normal file
@ -0,0 +1,36 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import imgPlaceholder from '../../../Images/200.png';
|
||||
import Input from '../../input/Input.jsx';
|
||||
import Select from '../../input/Select.jsx';
|
||||
import useTypes from '../../types/hooks/TypesHook';
|
||||
import './LinesItemForm.css';
|
||||
|
||||
const LinesItemForm = ({ item, handleChange }) => {
|
||||
const { types } = useTypes();
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='text-center'>
|
||||
<img id='image-preview' className='rounded' alt='placeholder'
|
||||
src={item.image || imgPlaceholder} />
|
||||
</div>
|
||||
<Select values={types} name='typeId' label='Товары' value={item.typeId} onChange={handleChange}
|
||||
required />
|
||||
<Input name='price' label='Цена' value={item.price} onChange={handleChange}
|
||||
type='number' min='1000.0' step='0.50' required />
|
||||
<Input name='stock' label='Акция' value={item.stock} onChange={handleChange}
|
||||
type='number' min='0' step='1' />
|
||||
<Input name='count' label='Количество' value={item.count} onChange={handleChange}
|
||||
type='number' min='1' step='1' required />
|
||||
<Input name='image' label='Изображение' onChange={handleChange}
|
||||
type='file' accept='image/*' />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
LinesItemForm.propTypes = {
|
||||
item: PropTypes.object,
|
||||
handleChange: PropTypes.func,
|
||||
};
|
||||
|
||||
export default LinesItemForm;
|
34
lab5/src/components/lines/hooks/LinesDeleteModalHook.js
Normal file
34
lab5/src/components/lines/hooks/LinesDeleteModalHook.js
Normal file
@ -0,0 +1,34 @@
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import useModal from '../../modal/ModalHook';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
|
||||
const useLinesDeleteModal = (linesChangeHandle) => {
|
||||
const { isModalShow, showModal, hideModal } = useModal();
|
||||
const [currentId, setCurrentId] = useState(0);
|
||||
|
||||
const showModalDialog = (id) => {
|
||||
showModal();
|
||||
setCurrentId(id);
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
hideModal();
|
||||
};
|
||||
|
||||
const onDelete = async () => {
|
||||
await LinesApiService.delete(currentId);
|
||||
linesChangeHandle();
|
||||
toast.success('Элемент успешно удален', { id: 'LinesTable' });
|
||||
onClose();
|
||||
};
|
||||
|
||||
return {
|
||||
isDeleteModalShow: isModalShow,
|
||||
showDeleteModal: showModalDialog,
|
||||
handleDeleteConfirm: onDelete,
|
||||
handleDeleteCancel: onClose,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesDeleteModal;
|
28
lab5/src/components/lines/hooks/LinesFilterHook.js
Normal file
28
lab5/src/components/lines/hooks/LinesFilterHook.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import useTypes from '../../types/hooks/TypesHook';
|
||||
|
||||
const useTypeFilter = () => {
|
||||
const filterName = 'type';
|
||||
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
|
||||
const { types } = useTypes();
|
||||
|
||||
const handleFilterChange = (event) => {
|
||||
const type = event.target.value;
|
||||
if (type) {
|
||||
searchParams.set(filterName, event.target.value);
|
||||
} else {
|
||||
searchParams.delete(filterName);
|
||||
}
|
||||
setSearchParams(searchParams);
|
||||
};
|
||||
|
||||
return {
|
||||
types,
|
||||
currentFilter: searchParams.get(filterName) || '',
|
||||
handleFilterChange,
|
||||
};
|
||||
};
|
||||
|
||||
export default useTypeFilter;
|
45
lab5/src/components/lines/hooks/LinesFormModalHook.js
Normal file
45
lab5/src/components/lines/hooks/LinesFormModalHook.js
Normal file
@ -0,0 +1,45 @@
|
||||
import { useState } from 'react';
|
||||
import useModal from '../../modal/ModalHook';
|
||||
import useLinesItemForm from './LinesItemFormHook';
|
||||
|
||||
const useLinesFormModal = (linesChangeHandle) => {
|
||||
const { isModalShow, showModal, hideModal } = useModal();
|
||||
const [currentId, setCurrentId] = useState(0);
|
||||
|
||||
const {
|
||||
item,
|
||||
validated,
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
resetValidity,
|
||||
} = useLinesItemForm(currentId, linesChangeHandle);
|
||||
|
||||
const showModalDialog = (id) => {
|
||||
setCurrentId(id);
|
||||
resetValidity();
|
||||
showModal();
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
setCurrentId(-1);
|
||||
hideModal();
|
||||
};
|
||||
|
||||
const onSubmit = async (event) => {
|
||||
if (await handleSubmit(event)) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
isFormModalShow: isModalShow,
|
||||
isFormValidated: validated,
|
||||
showFormModal: showModalDialog,
|
||||
currentItem: item,
|
||||
handleItemChange: handleChange,
|
||||
handleFormSubmit: onSubmit,
|
||||
handleFormClose: onClose,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesFormModal;
|
29
lab5/src/components/lines/hooks/LinesHook.js
Normal file
29
lab5/src/components/lines/hooks/LinesHook.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
|
||||
const useLines = (typeFilter) => {
|
||||
const [linesRefresh, setLinesRefresh] = useState(false);
|
||||
const [lines, setLines] = useState([]);
|
||||
const handleLinesChange = () => setLinesRefresh(!linesRefresh);
|
||||
|
||||
const getLines = async () => {
|
||||
let expand = '?_expand=type';
|
||||
if (typeFilter) {
|
||||
expand = `${expand}&typeId=${typeFilter}`;
|
||||
}
|
||||
const data = await LinesApiService.getAll(expand);
|
||||
setLines(data ?? []);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getLines();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [linesRefresh, typeFilter]);
|
||||
|
||||
return {
|
||||
lines,
|
||||
handleLinesChange,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLines;
|
89
lab5/src/components/lines/hooks/LinesItemFormHook.js
Normal file
89
lab5/src/components/lines/hooks/LinesItemFormHook.js
Normal file
@ -0,0 +1,89 @@
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import getBase64FromFile from '../../utils/Base64';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
import useLinesItem from './LinesItemHook';
|
||||
|
||||
const useLinesItemForm = (id, linesChangeHandle) => {
|
||||
const { item, setItem } = useLinesItem(id);
|
||||
|
||||
const [validated, setValidated] = useState(false);
|
||||
|
||||
const resetValidity = () => {
|
||||
setValidated(false);
|
||||
};
|
||||
|
||||
const getLineObject = (formData) => {
|
||||
const typeId = parseInt(formData.typeId, 10);
|
||||
const price = parseFloat(formData.price).toFixed(2);
|
||||
const stock = formData.stock !== '' ? parseInt(formData.stock, 10) : null;
|
||||
const count = parseInt(formData.count, 10);
|
||||
let sum;
|
||||
if (stock !== null) {
|
||||
sum = parseFloat((price * ((100 - stock) / 100)) * count).toFixed(2);
|
||||
} else {
|
||||
sum = parseFloat(price * count).toFixed(2);
|
||||
}
|
||||
|
||||
const image = formData.image.startsWith('data:image') ? formData.image : '';
|
||||
return {
|
||||
typeId: typeId.toString(),
|
||||
price: price.toString(),
|
||||
stock: stock !== null ? stock.toString() : '',
|
||||
count: count.toString(),
|
||||
sum: sum.toString(),
|
||||
image,
|
||||
};
|
||||
};
|
||||
|
||||
const handleImageChange = async (event) => {
|
||||
const { files } = event.target;
|
||||
const file = await getBase64FromFile(files.item(0));
|
||||
setItem({
|
||||
...item,
|
||||
image: file,
|
||||
});
|
||||
};
|
||||
|
||||
const handleChange = (event) => {
|
||||
if (event.target.type === 'file') {
|
||||
handleImageChange(event);
|
||||
return;
|
||||
}
|
||||
const inputName = event.target.name;
|
||||
const inputValue = event.target.type === 'checkbox' ? event.target.checked : event.target.value;
|
||||
setItem({
|
||||
...item,
|
||||
[inputName]: inputValue,
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
const form = event.currentTarget;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const body = getLineObject(item);
|
||||
if (form.checkValidity()) {
|
||||
if (id === undefined) {
|
||||
await LinesApiService.create(body);
|
||||
} else {
|
||||
await LinesApiService.update(id, body);
|
||||
}
|
||||
if (linesChangeHandle) linesChangeHandle();
|
||||
toast.success('Элемент успешно сохранен', { id: 'LinesTable' });
|
||||
return true;
|
||||
}
|
||||
setValidated(true);
|
||||
return false;
|
||||
};
|
||||
|
||||
return {
|
||||
item,
|
||||
validated,
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
resetValidity,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesItemForm;
|
35
lab5/src/components/lines/hooks/LinesItemHook.js
Normal file
35
lab5/src/components/lines/hooks/LinesItemHook.js
Normal file
@ -0,0 +1,35 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import LinesApiService from '../service/LinesApiService';
|
||||
|
||||
const useLinesItem = (id) => {
|
||||
const emptyItem = {
|
||||
id: '',
|
||||
typeId: '',
|
||||
price: '0',
|
||||
stock: '',
|
||||
count: '0',
|
||||
image: '',
|
||||
};
|
||||
const [item, setItem] = useState({ ...emptyItem });
|
||||
|
||||
const getItem = async (itemId = undefined) => {
|
||||
if (itemId && itemId > 0) {
|
||||
const data = await LinesApiService.get(itemId);
|
||||
setItem(data);
|
||||
} else {
|
||||
setItem({ ...emptyItem });
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getItem(id);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [id]);
|
||||
|
||||
return {
|
||||
item,
|
||||
setItem,
|
||||
};
|
||||
};
|
||||
|
||||
export default useLinesItem;
|
5
lab5/src/components/lines/service/LinesApiService.js
Normal file
5
lab5/src/components/lines/service/LinesApiService.js
Normal file
@ -0,0 +1,5 @@
|
||||
import ApiService from '../../api/ApiService';
|
||||
|
||||
const LinesApiService = new ApiService('lines');
|
||||
|
||||
export default LinesApiService;
|
61
lab5/src/components/lines/table/Lines.jsx
Normal file
61
lab5/src/components/lines/table/Lines.jsx
Normal file
@ -0,0 +1,61 @@
|
||||
import { Button, ButtonGroup } from 'react-bootstrap';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import Select from '../../input/Select.jsx';
|
||||
import ModalConfirm from '../../modal/ModalConfirm.jsx';
|
||||
import useLinesDeleteModal from '../hooks/LinesDeleteModalHook';
|
||||
import useTypeFilter from '../hooks/LinesFilterHook';
|
||||
import useLines from '../hooks/LinesHook';
|
||||
import LinesTable from './LinesTable.jsx';
|
||||
import LinesTableRow from './LinesTableRow.jsx';
|
||||
|
||||
const Lines = () => {
|
||||
const { types, currentFilter, handleFilterChange } = useTypeFilter();
|
||||
const { lines, handleLinesChange } = useLines(currentFilter);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const {
|
||||
isDeleteModalShow,
|
||||
showDeleteModal,
|
||||
handleDeleteConfirm,
|
||||
handleDeleteCancel,
|
||||
} = useLinesDeleteModal(handleLinesChange);
|
||||
|
||||
const showEditPage = (id) => {
|
||||
navigate(`/pageEdit/${id}`);
|
||||
};
|
||||
|
||||
const handleDelete = (id) => {
|
||||
showDeleteModal(id);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1 className="text-warning text-center font-weight-bold">Панель администратора</h1>
|
||||
<div className="text-center">
|
||||
<ButtonGroup>
|
||||
<Button as={Link} to='/pageEdit' variant='warning'>
|
||||
Добавить товар
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
<Select className='mt-2' values={types} label='Фильтр по товарам'
|
||||
value={currentFilter} onChange={handleFilterChange} />
|
||||
<h2 className="text-warning text-center font-weight-bold mt-2">Таблица данных</h2>
|
||||
<LinesTable>
|
||||
{
|
||||
lines.map((line, index) =>
|
||||
<LinesTableRow key={line.id}
|
||||
index={index} line={line}
|
||||
onDelete={() => handleDelete(line.id)}
|
||||
onEditInPage={() => showEditPage(line.id)}
|
||||
/>)
|
||||
}
|
||||
</LinesTable>
|
||||
<ModalConfirm show={isDeleteModalShow}
|
||||
onConfirm={handleDeleteConfirm} onClose={handleDeleteCancel}
|
||||
title='Удаление' message='Удалить элемент?' />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Lines;
|
30
lab5/src/components/lines/table/LinesTable.jsx
Normal file
30
lab5/src/components/lines/table/LinesTable.jsx
Normal file
@ -0,0 +1,30 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Table } from 'react-bootstrap';
|
||||
|
||||
const LinesTable = ({ children }) => {
|
||||
return (
|
||||
<Table className='mt-2' striped responsive>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">№</th>
|
||||
<th scope="col" className="w-25">Товар</th>
|
||||
<th scope="col" className="w-25">Цена</th>
|
||||
<th scope="col" className="w-10">Акция</th>
|
||||
<th scope="col" className="w-25">Количество</th>
|
||||
<th scope="col" className="w-25">Сумма</th>
|
||||
<th scope="col"></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{children}
|
||||
</tbody >
|
||||
</Table >
|
||||
);
|
||||
};
|
||||
|
||||
LinesTable.propTypes = {
|
||||
children: PropTypes.node,
|
||||
};
|
||||
|
||||
export default LinesTable;
|
33
lab5/src/components/lines/table/LinesTableRow.jsx
Normal file
33
lab5/src/components/lines/table/LinesTableRow.jsx
Normal file
@ -0,0 +1,33 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { PencilSquare, Trash3 } from 'react-bootstrap-icons';
|
||||
|
||||
const LinesTableRow = ({
|
||||
index, line, onDelete, onEditInPage,
|
||||
}) => {
|
||||
const handleAnchorClick = (event, action) => {
|
||||
event.preventDefault();
|
||||
action();
|
||||
};
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<th scope="row">{index + 1}</th>
|
||||
<td>{line.type.name}</td>
|
||||
<td>{parseFloat(line.price).toFixed(2)}</td>
|
||||
<td>{line.stock}</td>
|
||||
<td>{line.count}</td>
|
||||
<td>{parseFloat(line.sum).toFixed(2)}</td>
|
||||
<td><a href="#" onClick={(event) => handleAnchorClick(event, onEditInPage)}><PencilSquare /></a></td>
|
||||
<td><a href="#" onClick={(event) => handleAnchorClick(event, onDelete)}><Trash3 /></a></td>
|
||||
</tr>
|
||||
);
|
||||
};
|
||||
|
||||
LinesTableRow.propTypes = {
|
||||
index: PropTypes.number,
|
||||
line: PropTypes.object,
|
||||
onDelete: PropTypes.func,
|
||||
onEditInPage: PropTypes.func,
|
||||
};
|
||||
|
||||
export default LinesTableRow;
|
3
lab5/src/components/modal/Modal.css
Normal file
3
lab5/src/components/modal/Modal.css
Normal file
@ -0,0 +1,3 @@
|
||||
.modal-title {
|
||||
font-size: 1.2rem;
|
||||
}
|
42
lab5/src/components/modal/ModalConfirm.jsx
Normal file
42
lab5/src/components/modal/ModalConfirm.jsx
Normal file
@ -0,0 +1,42 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Modal } from 'react-bootstrap';
|
||||
import { createPortal } from 'react-dom';
|
||||
import './Modal.css';
|
||||
|
||||
const ModalConfirm = ({
|
||||
show, title, message, onConfirm, onClose,
|
||||
}) => {
|
||||
return createPortal(
|
||||
<Modal show={show} backdrop='static' onHide={() => onClose()}>
|
||||
<Modal.Header className='pt-2 pb-2 ps-3 pe-3' closeButton>
|
||||
<Modal.Title>{title}</Modal.Title>
|
||||
</Modal.Header>
|
||||
|
||||
<Modal.Body>
|
||||
{message}
|
||||
</Modal.Body>
|
||||
|
||||
<Modal.Footer className='m-0 pt-2 pb-2 ps-3 pe-3 row justify-content-center'>
|
||||
<Button variant='secondary' className='col-5 m-0 me-2'
|
||||
onClick={() => onClose()}>
|
||||
Нет
|
||||
</Button>
|
||||
<Button variant='primary' className='col-5 m-0 ms-2'
|
||||
onClick={() => onConfirm()}>
|
||||
Да
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>,
|
||||
document.body,
|
||||
);
|
||||
};
|
||||
|
||||
ModalConfirm.propTypes = {
|
||||
show: PropTypes.bool,
|
||||
title: PropTypes.string,
|
||||
message: PropTypes.string,
|
||||
onConfirm: PropTypes.func,
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
|
||||
export default ModalConfirm;
|
43
lab5/src/components/modal/ModalForm.jsx
Normal file
43
lab5/src/components/modal/ModalForm.jsx
Normal file
@ -0,0 +1,43 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Form, Modal } from 'react-bootstrap';
|
||||
import { createPortal } from 'react-dom';
|
||||
import './Modal.css';
|
||||
|
||||
const ModalForm = ({
|
||||
show, title, validated, onSubmit, onClose, children,
|
||||
}) => {
|
||||
return createPortal(
|
||||
<Modal show={show} backdrop='static' onHide={() => onClose()}>
|
||||
<Modal.Header className='pt-2 pb-2 ps-3 pe-3' closeButton>
|
||||
<Modal.Title>{title}</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Form className='m-0' noValidate validated={validated} onSubmit={onSubmit}>
|
||||
<Modal.Body>
|
||||
{children}
|
||||
</Modal.Body>
|
||||
|
||||
<Modal.Footer className='m-0 pt-2 pb-2 ps-3 pe-3 row justify-content-center'>
|
||||
<Button variant='secondary' className='col-5 m-0 me-2'
|
||||
onClick={() => onClose()}>
|
||||
Отмена
|
||||
</Button>
|
||||
<Button variant='primary' className='col-5 m-0 ms-2' type='submit'>
|
||||
Сохранить
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Form>
|
||||
</Modal>,
|
||||
document.body,
|
||||
);
|
||||
};
|
||||
|
||||
ModalForm.propTypes = {
|
||||
show: PropTypes.bool,
|
||||
title: PropTypes.string,
|
||||
validated: PropTypes.bool,
|
||||
onSubmit: PropTypes.func,
|
||||
onClose: PropTypes.func,
|
||||
children: PropTypes.node,
|
||||
};
|
||||
|
||||
export default ModalForm;
|
21
lab5/src/components/modal/ModalHook.js
Normal file
21
lab5/src/components/modal/ModalHook.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
const useModal = () => {
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
|
||||
const showModalDialog = () => {
|
||||
setShowModal(true);
|
||||
};
|
||||
|
||||
const hideModalDialog = () => {
|
||||
setShowModal(false);
|
||||
};
|
||||
|
||||
return {
|
||||
isModalShow: showModal,
|
||||
showModal: showModalDialog,
|
||||
hideModal: hideModalDialog,
|
||||
};
|
||||
};
|
||||
|
||||
export default useModal;
|
31
lab5/src/components/navigation/Navigation.css
Normal file
31
lab5/src/components/navigation/Navigation.css
Normal file
@ -0,0 +1,31 @@
|
||||
.my-navbar {
|
||||
background-color: #D9D9D9;
|
||||
}
|
||||
|
||||
.my-navbar .nav-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.my-navbar img {
|
||||
margin-left: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 577px) and (max-width: 992px) {
|
||||
.my-navbar img {
|
||||
margin-left: 25px
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 993px) and (max-width: 1200px) {
|
||||
.my-navbar img {
|
||||
margin-left: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1201px) {
|
||||
.my-navbar img {
|
||||
margin-left: 235px;
|
||||
}
|
||||
}
|
45
lab5/src/components/navigation/Navigation.jsx
Normal file
45
lab5/src/components/navigation/Navigation.jsx
Normal file
@ -0,0 +1,45 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Container, Nav, Navbar, Button } from 'react-bootstrap';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import Image from 'react-bootstrap/Image';
|
||||
import './Navigation.css';
|
||||
|
||||
const Navigation = ({ routes }) => {
|
||||
const location = useLocation();
|
||||
const indexPageLink = routes.find((route) => route.index === true);
|
||||
const pages = routes.filter((route) => Object.prototype.hasOwnProperty.call(route, 'title'));
|
||||
|
||||
return (
|
||||
<Navbar expand='md' className='my-navbar'>
|
||||
<Container fluid>
|
||||
<Navbar.Brand as={Link} to={indexPageLink?.path ?? '/'}>
|
||||
<Image src="./src/Images/logo.png" width="128" alt="Logo" />
|
||||
</Navbar.Brand>
|
||||
<Navbar.Toggle aria-controls='main-navbar' />
|
||||
<Navbar.Collapse id='main-navbar'>
|
||||
<Nav className='me-auto link' activeKey={location.pathname}>
|
||||
{pages.map((page) => (
|
||||
<Nav.Link as={Link} key={page.path} eventKey={page.path} to={page.path ?? '/'}>
|
||||
{page.title}
|
||||
</Nav.Link>
|
||||
))}
|
||||
</Nav>
|
||||
<Nav>
|
||||
<Button className="custom-btn" as={Link} to="/personalAccountLogin">
|
||||
Войти
|
||||
</Button>
|
||||
<Button variant="warning" as={Link} to="/Basket">
|
||||
Корзина
|
||||
</Button>
|
||||
</Nav>
|
||||
</Navbar.Collapse>
|
||||
</Container>
|
||||
</Navbar>
|
||||
);
|
||||
};
|
||||
|
||||
Navigation.propTypes = {
|
||||
routes: PropTypes.array,
|
||||
};
|
||||
|
||||
export default Navigation;
|
21
lab5/src/components/types/hooks/TypesHook.js
Normal file
21
lab5/src/components/types/hooks/TypesHook.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import TypesApiService from '../service/TypesApiService';
|
||||
|
||||
const useTypes = () => {
|
||||
const [types, setTypes] = useState([]);
|
||||
|
||||
const getTypes = async () => {
|
||||
const data = await TypesApiService.getAll();
|
||||
setTypes(data ?? []);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getTypes();
|
||||
}, []);
|
||||
|
||||
return {
|
||||
types,
|
||||
};
|
||||
};
|
||||
|
||||
export default useTypes;
|
5
lab5/src/components/types/service/TypesApiService.js
Normal file
5
lab5/src/components/types/service/TypesApiService.js
Normal file
@ -0,0 +1,5 @@
|
||||
import ApiService from '../../api/ApiService';
|
||||
|
||||
const TypesApiService = new ApiService('types');
|
||||
|
||||
export default TypesApiService;
|
15
lab5/src/components/utils/Base64.js
Normal file
15
lab5/src/components/utils/Base64.js
Normal file
@ -0,0 +1,15 @@
|
||||
const getBase64FromFile = async (file) => {
|
||||
const reader = new FileReader();
|
||||
return new Promise((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
const fileContent = reader.result;
|
||||
resolve(fileContent);
|
||||
};
|
||||
reader.onerror = () => {
|
||||
reject(new Error('Oops, something went wrong with the file reader.'));
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
};
|
||||
|
||||
export default getBase64FromFile;
|
18
lab5/src/index.css
Normal file
18
lab5/src/index.css
Normal file
@ -0,0 +1,18 @@
|
||||
.btn {
|
||||
height: 35px;
|
||||
width: 176px;
|
||||
border-radius: 8px;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.custom-btn {
|
||||
color: black;
|
||||
border: none;
|
||||
background-color: #FFA800;
|
||||
}
|
||||
|
||||
.btn.custom-btn:hover {
|
||||
color: black;
|
||||
background-color: #FFA800 !important;
|
||||
}
|
84
lab5/src/main.jsx
Normal file
84
lab5/src/main.jsx
Normal file
@ -0,0 +1,84 @@
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
|
||||
import App from './App.jsx';
|
||||
import './index.css';
|
||||
import ErrorPage from './pages/ErrorPage.jsx';
|
||||
import Index from './pages/Index.jsx';
|
||||
import Stock from './pages/Stock.jsx';
|
||||
import Contacts from './pages/Contacts.jsx';
|
||||
import PersonalAccountLogin from './pages/PersonalAccountLogin.jsx';
|
||||
import PersonalAccount from './pages/PersonalAccount.jsx';
|
||||
import PersonalAccountRegister from './pages/PersonalAccountRegister.jsx';
|
||||
import PasswordRecovery from './pages/PasswordRecovery.jsx';
|
||||
import Administrator from './pages/Administrator.jsx';
|
||||
import Basket from './pages/Basket.jsx';
|
||||
import MakingAnOrder from './pages/MakingAnOrder.jsx';
|
||||
import PageEdit from './pages/PageEdit.jsx';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
index: true,
|
||||
path: '/',
|
||||
element: <Index />,
|
||||
title: 'Каталог',
|
||||
},
|
||||
{
|
||||
path: '/stock',
|
||||
element: <Stock />,
|
||||
title: 'Акции',
|
||||
},
|
||||
{
|
||||
path: '/contacts',
|
||||
element: <Contacts />,
|
||||
title: 'Контакты',
|
||||
},
|
||||
{
|
||||
path: '/personalAccountLogin',
|
||||
element: <PersonalAccountLogin />,
|
||||
},
|
||||
{
|
||||
path: '/personalAccount',
|
||||
element: <PersonalAccount />,
|
||||
},
|
||||
{
|
||||
path: '/personalAccountRegister',
|
||||
element: <PersonalAccountRegister/>,
|
||||
},
|
||||
{
|
||||
path: '/PasswordRecovery',
|
||||
element: <PasswordRecovery/>,
|
||||
},
|
||||
{
|
||||
path: '/Administrator',
|
||||
element: <Administrator/>,
|
||||
},
|
||||
{
|
||||
path: '/Basket',
|
||||
element: <Basket/>,
|
||||
},
|
||||
{
|
||||
path: '/MakingAnOrder',
|
||||
element: <MakingAnOrder/>,
|
||||
},
|
||||
{
|
||||
path: '/PageEdit/:id?',
|
||||
element: <PageEdit/>,
|
||||
},
|
||||
];
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: '/',
|
||||
element: <App routes={routes} />,
|
||||
children: routes,
|
||||
errorElement: <ErrorPage />,
|
||||
},
|
||||
]);
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<RouterProvider router={router} />
|
||||
</React.StrictMode>,
|
||||
);
|
9
lab5/src/pages/Administrator.jsx
Normal file
9
lab5/src/pages/Administrator.jsx
Normal file
@ -0,0 +1,9 @@
|
||||
import Lines from '../components/lines/table/Lines.jsx';
|
||||
|
||||
const Administrator = () => {
|
||||
return (
|
||||
<Lines />
|
||||
);
|
||||
};
|
||||
|
||||
export default Administrator;
|
32
lab5/src/pages/Basket.jsx
Normal file
32
lab5/src/pages/Basket.jsx
Normal file
@ -0,0 +1,32 @@
|
||||
import { Container, Row, Col } from 'react-bootstrap';
|
||||
import BasketCard from '../components/card/BasketCard';
|
||||
|
||||
const Basket = () => {
|
||||
return (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col className="d-flex justify-content-center align-items-center">
|
||||
<h1 className="text-warning font-weight-bold">Корзина</h1>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col xs={10}>
|
||||
<BasketCard />
|
||||
<BasketCard />
|
||||
<BasketCard />
|
||||
</Col>
|
||||
</Row>
|
||||
<div className="d-flex justify-content-start align-items-center">
|
||||
<div className="text-dark font-weight-bold" style={{ fontSize: '24px' }}>
|
||||
Сумма заказа:
|
||||
</div>
|
||||
<div className="text-end" style={{ color: '#F7D22D', fontSize: '24px' }}>
|
||||
Сумма ₽
|
||||
</div>
|
||||
</div>
|
||||
<a className="btn btn-warning" style={{ marginLeft: '25px', marginBottom: '10px' }} href="makingAnOrder">К оплате</a>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default Basket;
|
36
lab5/src/pages/Contacts.jsx
Normal file
36
lab5/src/pages/Contacts.jsx
Normal file
@ -0,0 +1,36 @@
|
||||
import { Container, Row, Col } from 'react-bootstrap';
|
||||
|
||||
const Contacts = () => {
|
||||
return (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col className="d-flex justify-content-center align-items-center">
|
||||
<h1 className="text-warning font-weight-bold">Контакты</h1>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col className="d-flex justify-content-center">
|
||||
<iframe
|
||||
src="https://yandex.ru/map-widget/v1/?um=constructor%3A0643c92cbdf3809080e5dfb2804b473ea00af31cfabe6fee08676c59d8675f01&source=constructor"
|
||||
className="img-fluid"
|
||||
style={{ width: '100%', height: '720px' }}
|
||||
title="Yandex Map"
|
||||
></iframe>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col>
|
||||
<a href="tel:71112223344" className="text-warning font-weight-bold" style={{ fontSize: '35px', marginLeft: '10px', marginTop: '10px' }}>
|
||||
7 111 222 33 44
|
||||
</a>
|
||||
<h2 className="font-weight-bold" style={{ fontSize: '35px', marginLeft: '10px', marginTop: '10px' }}>
|
||||
ул. Северный венец 32
|
||||
</h2>
|
||||
<p style={{ fontSize: '25px', marginLeft: '10px', marginTop: '10px' }}>Доставка и самовывоз 10:00 — 23:00</p>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default Contacts;
|
20
lab5/src/pages/ErrorPage.jsx
Normal file
20
lab5/src/pages/ErrorPage.jsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { Alert, Button, Container } from 'react-bootstrap';
|
||||
import { useNavigate, useRouteError } from 'react-router-dom';
|
||||
|
||||
const ErrorPage = () => {
|
||||
const navigate = useNavigate();
|
||||
const error = useRouteError();
|
||||
|
||||
return (
|
||||
<Container fluid className='m-0 p-3 row justify-content-center'>
|
||||
<Alert className='col-12 col-lg-6' variant='danger'>
|
||||
{error?.message ?? 'Страница не найдена'}
|
||||
</Alert>
|
||||
<div className='w-100'></div>
|
||||
<Button className='col-12 col-lg-6' variant='primary'
|
||||
onClick={() => navigate(-1)}>Назад</Button>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default ErrorPage;
|
42
lab5/src/pages/Index.jsx
Normal file
42
lab5/src/pages/Index.jsx
Normal file
@ -0,0 +1,42 @@
|
||||
import { Container, Row, Col } from 'react-bootstrap';
|
||||
import ProductCard from '../components/card/ProductCard';
|
||||
|
||||
const Index = () => {
|
||||
return (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col className="d-flex justify-content-center align-items-center">
|
||||
<h1 className="text-warning font-weight-bold">Каталог</h1>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
<ProductCard />
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default Index;
|
194
lab5/src/pages/MakingAnOrder.jsx
Normal file
194
lab5/src/pages/MakingAnOrder.jsx
Normal file
@ -0,0 +1,194 @@
|
||||
import { useState } from 'react';
|
||||
import { Container, Row, Col, Card, Form, Button } from 'react-bootstrap';
|
||||
|
||||
const MakingAnOrder = () => {
|
||||
const [deliveryMethod, setDeliveryMethod] = useState('selfPickup');
|
||||
const [paymentMethod, setPaymentMethod] = useState('cash');
|
||||
|
||||
const handleDeliveryMethodChange = (e) => {
|
||||
setDeliveryMethod(e.target.value);
|
||||
};
|
||||
|
||||
const handlePaymentMethodChange = (e) => {
|
||||
setPaymentMethod(e.target.value);
|
||||
};
|
||||
|
||||
const [validated, setValidated] = useState(false);
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Container className="h-100">
|
||||
<Row className="d-flex justify-content-center align-items-center h-100">
|
||||
<Col xs={12} md={9} lg={7} xl={6}>
|
||||
<Card style={{ borderRadius: '15px', borderColor: 'gold' }}>
|
||||
<Card.Body className="p-5">
|
||||
<h2 className="text-uppercase text-center mb-5">Оформление заказа</h2>
|
||||
|
||||
<Form noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-4" controlId="name">
|
||||
<Form.Label htmlFor="name">Ваше имя</Form.Label>
|
||||
<Form.Control type="text" required />
|
||||
<Form.Control.Feedback>Имя заполнено</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Имя не заполнено</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-2">
|
||||
<Form.Label htmlFor="form3Example5cg">Номер телефона</Form.Label>
|
||||
<Form.Control type="tel" id="form3Example5cg" required />
|
||||
<Form.Control.Feedback>Номер телефона заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Номер телефона не заполнен</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Label>Вариант получения</Form.Label>
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="Самовывоз"
|
||||
id="selfPickup"
|
||||
name="deliveryMethod"
|
||||
value="selfPickup"
|
||||
checked={deliveryMethod === 'selfPickup'}
|
||||
onChange={handleDeliveryMethodChange}
|
||||
/>
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="Доставка"
|
||||
id="delivery"
|
||||
name="deliveryMethod"
|
||||
value="delivery"
|
||||
checked={deliveryMethod === 'delivery'}
|
||||
onChange={handleDeliveryMethodChange}
|
||||
/>
|
||||
</Form.Group>
|
||||
|
||||
{deliveryMethod === 'delivery' && (
|
||||
<div>
|
||||
<Form.Group className="mb-4" controlId="adress">
|
||||
<Form.Label>Ваш адрес доставки</Form.Label>
|
||||
<Form.Control type="text" required/>
|
||||
<Form.Control.Feedback>Адрес заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Адрес не заполнен</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Label>Выберите время доставки:</Form.Label>
|
||||
<Form.Select>
|
||||
<option value="10:00-10:30">10:00-10:30</option>
|
||||
<option value="10:30-11:00">10:30-11:00</option>
|
||||
<option value="11:00-11:30">11:00-11:30</option>
|
||||
<option value="11:30-12:00">11:30-12:00</option>
|
||||
<option value="12:00-12:30">12:00-12:30</option>
|
||||
<option value="12:30-13:00">12:30-13:00</option>
|
||||
<option value="13:00-13:30">13:00-13:30</option>
|
||||
<option value="13:30-14:00">13:30-14:00</option>
|
||||
<option value="14:00-14:30">14:00-14:30</option>
|
||||
<option value="14:30-15:00">14:30-15:00</option>
|
||||
<option value="15:00-15:30">15:00-15:30</option>
|
||||
<option value="15:30-16:00">15:30-16:00</option>
|
||||
<option value="16:00-16:30">16:00-16:30</option>
|
||||
<option value="16:30-17:00">16:30-17:00</option>
|
||||
<option value="17:00-17:30">17:00-17:30</option>
|
||||
<option value="17:30-18:00">17:30-18:00</option>
|
||||
<option value="18:00-18:30">18:00-18:30</option>
|
||||
<option value="18:30-19:00">18:30-19:00</option>
|
||||
<option value="19:00-19:30">19:00-19:30</option>
|
||||
<option value="19:30-20:00">19:30-20:00</option>
|
||||
<option value="20:00-20:30">20:00-20:30</option>
|
||||
<option value="20:30-21:00">20:30-21:00</option>
|
||||
<option value="21:00-21:30">21:00-21:30</option>
|
||||
<option value="21:30-22:00">21:30-22:00</option>
|
||||
<option value="22:00-22:30">22:00-22:30</option>
|
||||
<option value="22:30-23:00">22:30-23:00</option>
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Label>Вариант оплаты</Form.Label>
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="Наличные"
|
||||
id="cash"
|
||||
name="paymentMethod"
|
||||
value="cash"
|
||||
checked={paymentMethod === 'cash'}
|
||||
onChange={handlePaymentMethodChange}
|
||||
/>
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="Оплата картой"
|
||||
id="creditCard"
|
||||
name="paymentMethod"
|
||||
value="creditCard"
|
||||
checked={paymentMethod === 'creditCard'}
|
||||
onChange={handlePaymentMethodChange}
|
||||
/>
|
||||
</Form.Group>
|
||||
|
||||
{paymentMethod === 'creditCard' && (
|
||||
<div>
|
||||
<Row className="mb-4">
|
||||
<Col>
|
||||
<Form.Group className="mb-2" controlId="formNameOnCard">
|
||||
<Form.Label>Имя держателя карты</Form.Label>
|
||||
<Form.Control type="text" required />
|
||||
<Form.Control.Feedback>Имя заполнено</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Имя не заполнено</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
</Col>
|
||||
<Col>
|
||||
<Form.Group className="mb-2" controlId="formCardNumber">
|
||||
<Form.Label>Номер карты</Form.Label>
|
||||
<Form.Control type="text" pattern="[0-9]{16}" required />
|
||||
<Form.Control.Feedback>Номер карты заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Введите правильный номер карты</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row className="mb-4">
|
||||
<Col>
|
||||
<Form.Group className="mb-2" controlId="formExpiration">
|
||||
<Form.Label>Срок действия</Form.Label>
|
||||
<Form.Control type="text" pattern="\d{2}/\d{2}" required />
|
||||
<Form.Control.Feedback>Срок действия заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Введите правильный срок действия</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
</Col>
|
||||
<Col>
|
||||
<Form.Group className="mb-2" controlId="formCVV">
|
||||
<Form.Label>CVV</Form.Label>
|
||||
<Form.Control type="text" pattern="\d{3}" required />
|
||||
<Form.Control.Feedback>CVV заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Введите правильный CVV</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button variant="warning" type="submit" id="saveButton">
|
||||
Оформить
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default MakingAnOrder;
|
179
lab5/src/pages/PageEdit.jsx
Normal file
179
lab5/src/pages/PageEdit.jsx
Normal file
@ -0,0 +1,179 @@
|
||||
//import { useState } from 'react';
|
||||
//import { Container, Col, Row, Form, Button } from 'react-bootstrap';
|
||||
|
||||
import { useParams } from 'react-router-dom';
|
||||
import LinesForm from '../components/lines/form/LinesForm.jsx';
|
||||
|
||||
const PageEdit = () => {
|
||||
/*const [validated, setValidated] = useState(false);
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
const [selectedItem, setSelectedItem] = useState('');
|
||||
const [price, setPrice] = useState(0.00);
|
||||
const [stock, setStock] = useState(0);
|
||||
const [count, setCount] = useState(0);
|
||||
const [imagePreview, setImagePreview] = useState('https://via.placeholder.com/200');
|
||||
|
||||
const handleItemChange = (e) => {
|
||||
setSelectedItem(e.target.value);
|
||||
};
|
||||
|
||||
const handlePriceChange = (e) => {
|
||||
setPrice(parseFloat(e.target.value));
|
||||
};
|
||||
|
||||
const handleStockChange = (e) => {
|
||||
setStock(parseInt(e.target.value, 10));
|
||||
};
|
||||
|
||||
const handleCountChange = (e) => {
|
||||
setCount(parseInt(e.target.value, 10));
|
||||
};
|
||||
|
||||
const handleImageChange = (e) => {
|
||||
const file = e.target.files[0];
|
||||
|
||||
if (file) {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onloadend = () => {
|
||||
const img = new Image();
|
||||
img.src = reader.result;
|
||||
|
||||
img.onload = () => {
|
||||
const canvas = document.createElement('canvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
const maxWidth = 200;
|
||||
const maxHeight = 200;
|
||||
let width = img.width;
|
||||
let height = img.height;
|
||||
|
||||
if (width > height) {
|
||||
if (width > maxWidth) {
|
||||
height *= maxWidth / width;
|
||||
width = maxWidth;
|
||||
}
|
||||
} else {
|
||||
if (height > maxHeight) {
|
||||
width *= maxHeight / height;
|
||||
height = maxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
ctx.drawImage(img, 0, 0, width, height);
|
||||
|
||||
setImagePreview(canvas.toDataURL('image/png'));
|
||||
};
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Container fluid className="p-2">
|
||||
<h1 className="text-warning text-center font-weight-bold">Добавление товара</h1>
|
||||
<Row className="text-center">
|
||||
<Col>
|
||||
<img id="image-preview" src={imagePreview} className="rounded rounded-circle" alt="placeholder" />
|
||||
</Col>
|
||||
</Row>
|
||||
<Form
|
||||
id="items-form"
|
||||
className="needs-validation"
|
||||
noValidate
|
||||
validated={validated}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<Form.Group controlId="item" className="mb-2">
|
||||
<Form.Label>Товары</Form.Label>
|
||||
<Form.Control
|
||||
as="select"
|
||||
name="selected"
|
||||
onChange={handleItemChange}
|
||||
value={selectedItem}
|
||||
required
|
||||
>
|
||||
</Form.Control>
|
||||
<Form.Control.Feedback type="invalid">Пожалуйста, выберите товар.</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
<Form.Group controlId="price" className="mb-2">
|
||||
<Form.Label>Цена</Form.Label>
|
||||
<Form.Control
|
||||
type="number"
|
||||
name="price"
|
||||
value={price}
|
||||
min="1000.00"
|
||||
step="0.50"
|
||||
onChange={handlePriceChange}
|
||||
required
|
||||
/>
|
||||
<Form.Control.Feedback type="invalid">Пожалуйста, введите цену.</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
<Form.Group controlId="stock" className="mb-2">
|
||||
<Form.Label>Акция</Form.Label>
|
||||
<Form.Control
|
||||
type="number"
|
||||
name="price"
|
||||
value={stock}
|
||||
min="0"
|
||||
step="1"
|
||||
onChange={handleStockChange}
|
||||
required
|
||||
/>
|
||||
<Form.Control.Feedback type="invalid">Пожалуйста, введите акцию.</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
<Form.Group controlId="count" className="mb-2">
|
||||
<Form.Label>Количество</Form.Label>
|
||||
<Form.Control
|
||||
type="number"
|
||||
name="count"
|
||||
value={count}
|
||||
min="1"
|
||||
step="1"
|
||||
onChange={handleCountChange}
|
||||
required
|
||||
/>
|
||||
<Form.Control.Feedback type="invalid">Пожалуйста, введите количество.</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
<Form.Group controlId="image" className="mb-2">
|
||||
<Form.Label>Изображение</Form.Label>
|
||||
<Form.Control
|
||||
type="file"
|
||||
name="image"
|
||||
accept="image/*"
|
||||
onChange={handleImageChange}
|
||||
/>
|
||||
<Form.Control.Feedback type="invalid">Пожалуйста, выберите изображение.</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
<Row className="mb-2">
|
||||
<Col>
|
||||
<Button href="Administrator" className="btn btn-secondary">Назад</Button>
|
||||
<Button type="submit" className="btn btn-primary">Сохранить</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
</Form>
|
||||
</Container>
|
||||
);*/
|
||||
|
||||
const { id } = useParams();
|
||||
|
||||
return (
|
||||
<LinesForm id={id} />
|
||||
);
|
||||
};
|
||||
|
||||
export default PageEdit;
|
61
lab5/src/pages/PasswordRecovery.jsx
Normal file
61
lab5/src/pages/PasswordRecovery.jsx
Normal file
@ -0,0 +1,61 @@
|
||||
import { Container, Row, Col, Card, Form, Button } from 'react-bootstrap';
|
||||
import { useState } from 'react';
|
||||
|
||||
const PasswordRecovery = () => {
|
||||
const [validated, setValidated] = useState(false);
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Container className="h-100">
|
||||
<Row className="d-flex justify-content-center align-items-center h-100">
|
||||
<Col xs={12} md={9} lg={7} xl={6}>
|
||||
<Card style={{ borderRadius: '15px', borderColor: 'gold' }}>
|
||||
<Card.Body className="p-5">
|
||||
<h2 className="text-uppercase text-center mb-5">Восстановление пароля</h2>
|
||||
<h4 className="text-black text-center mb-5">
|
||||
Введите свой адрес электронной почты, и мы вышлем вам электронное письмо с инструкциями по сбросу вашего пароля
|
||||
</h4>
|
||||
<Form noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Label htmlFor="form3Example3cg">Ваш адрес электронной почты</Form.Label>
|
||||
<Form.Control type="email" id="form3Example3cg" required />
|
||||
<Form.Control.Feedback>Email заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Email не заполнен</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button type="submit" className="btn-block btn-warning text-body mb-0">
|
||||
Сбросить пароль
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<p className="text-center text-muted mb-0">
|
||||
<a href="personalAccountLogin" className="fw-bold text-body">
|
||||
<u>Войти</u>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p className="text-center text-muted mb-0">
|
||||
<a href="personalAccountRegister" className="fw-bold text-body">
|
||||
<u>Регистрация</u>
|
||||
</a>
|
||||
</p>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default PasswordRecovery;
|
105
lab5/src/pages/PersonalAccount.jsx
Normal file
105
lab5/src/pages/PersonalAccount.jsx
Normal file
@ -0,0 +1,105 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
/* eslint-disable object-curly-newline */
|
||||
/* eslint-disable linebreak-style */
|
||||
import { useState } from 'react';
|
||||
import { Container, Row, Col, Card, Form, Button } from 'react-bootstrap';
|
||||
|
||||
const PersonalAccount = () => {
|
||||
const [validated, setValidated] = useState(false);
|
||||
const [formData, setFormData] = useState({
|
||||
lastname: '',
|
||||
firstname: '',
|
||||
email: '',
|
||||
date: '',
|
||||
tel: '',
|
||||
});
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (form.checkValidity() !== false) {
|
||||
console.log(formData);
|
||||
}
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
const handleChange = (event) => {
|
||||
const inputName = event.target.name;
|
||||
const inputValue = event.target.type === 'checkbox' ? event.target.checked : event.target.value;
|
||||
setFormData({
|
||||
...formData,
|
||||
[inputName]: inputValue,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Container className="h-100">
|
||||
<Row className="justify-content-center align-items-center h-100">
|
||||
<Col xs={12} md={9} lg={7} xl={6}>
|
||||
<Card style={{ borderRadius: '15px', borderColor: 'gold' }}>
|
||||
<Card.Body className="p-5">
|
||||
<h2 className="text-uppercase text-center mb-5">Личный кабинет</h2>
|
||||
|
||||
<Form noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className='mb-2' controlId='firstname'>
|
||||
<Form.Label>Имя</Form.Label>
|
||||
<Form.Control type='text' name='firstname' required
|
||||
value={formData.firstname} onChange={handleChange} />
|
||||
<Form.Control.Feedback>Имя заполнено</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type='invalid'>Имя не заполнено</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className='mb-4' controlId='lastname'>
|
||||
<Form.Label>Фамилия</Form.Label>
|
||||
<Form.Control type='text' name='lastname' required
|
||||
value={formData.lastname} onChange={handleChange} />
|
||||
<Form.Control.Feedback>Фамилия заполнена</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type='invalid'>Фамилия не заполнена</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className='mb-4' controlId='email'>
|
||||
<Form.Label>Ваш адрес электронной почты</Form.Label>
|
||||
<Form.Control type='email' name='email' placeholder='name@example.ru' required
|
||||
value={formData.email} onChange={handleChange} />
|
||||
<Form.Control.Feedback>E-mail заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type='invalid'>E-mail не заполнен</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Label htmlFor="form3Example4cg">Дата рождения</Form.Label>
|
||||
<Form.Control type="date" id="form3Example4cg" required
|
||||
value={formData.date} onChange={handleChange} />
|
||||
<Form.Control.Feedback>Дата рождения заполнена</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Дата рождения не заполнена</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-2">
|
||||
<Form.Label htmlFor="form3Example5cg">Номер телефона</Form.Label>
|
||||
<Form.Control type="tel" id="form3Example5cg" required
|
||||
value={formData.tel} onChange={handleChange} />
|
||||
<Form.Control.Feedback>Номер телефона заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Номер телефона не заполнен</Form.Control.Feedback>
|
||||
</Form.Group>
|
||||
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button variant="warning" type="submit" id="saveButton">
|
||||
Сохранить
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="d-flex justify-content-center mt-2">
|
||||
<a className="btn btn-outline-danger" type="button" href="/">
|
||||
Выйти
|
||||
</a>
|
||||
</div>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default PersonalAccount;
|
78
lab5/src/pages/PersonalAccountLogin.jsx
Normal file
78
lab5/src/pages/PersonalAccountLogin.jsx
Normal file
@ -0,0 +1,78 @@
|
||||
import { Container, Row, Col, Card, Form, Button } from 'react-bootstrap';
|
||||
import { useState } from 'react';
|
||||
|
||||
const PersonalAccountLogin = () => {
|
||||
const [validated, setValidated] = useState(false);
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Row className="d-flex justify-content-center align-items-center h-100">
|
||||
<Col xs={12} md={9} lg={7} xl={6}>
|
||||
<Card style={{ borderRadius: '15px', borderColor: 'gold' }}>
|
||||
<Card.Body className="p-5">
|
||||
<h2 className="text-uppercase text-center mb-5">Войти</h2>
|
||||
|
||||
<Form noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Control type="email" id="form3Example3cg" required />
|
||||
<Form.Control.Feedback>Email заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Email не заполнен</Form.Control.Feedback>
|
||||
<Form.Label htmlFor="form3Example3cg">Ваш адрес электронной почты</Form.Label>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Control type="password" id="form3Example4cg" size="lg" required />
|
||||
<Form.Control.Feedback>Пароль заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Пароль не заполнен</Form.Control.Feedback>
|
||||
<Form.Label htmlFor="form3Example4cg">Пароль</Form.Label>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-2" controlId="form2Example3cg">
|
||||
<Form.Check type="checkbox" label="Запомнить меня" />
|
||||
</Form.Group>
|
||||
|
||||
<p className="text-center text-muted mb-0">
|
||||
Забыли пароль?{' '}
|
||||
<a href="PasswordRecovery" className="fw-bold text-body">
|
||||
<u>Восстановление пароля</u>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button variant="submit" className="btn-block btn-warning text-body mb-0" href="PersonalAccount">
|
||||
Вход
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<p className="text-center text-muted mb-0">
|
||||
У вас нет аккаунта?{' '}
|
||||
<a href="personalAccountRegister" className="fw-bold text-body">
|
||||
<u>Регистрация</u>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p className="text-center">
|
||||
<a className="fw-bold text-body" href="Administrator">
|
||||
Администратор
|
||||
</a>
|
||||
</p>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default PersonalAccountLogin;
|
86
lab5/src/pages/PersonalAccountRegister.jsx
Normal file
86
lab5/src/pages/PersonalAccountRegister.jsx
Normal file
@ -0,0 +1,86 @@
|
||||
import { Container, Row, Col, Card, Form, Button } from 'react-bootstrap';
|
||||
import { useState } from 'react';
|
||||
|
||||
const PersonalAccountRegister = () => {
|
||||
const [validated, setValidated] = useState(false);
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
const form = event.currentTarget;
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
setValidated(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Container className="h-100">
|
||||
<Row className="justify-content-center align-items-center h-100">
|
||||
<Col xs={12} md={9} lg={7} xl={6}>
|
||||
<Card style={{ borderRadius: '15px', borderColor: 'gold' }}>
|
||||
<Card.Body className="p-5">
|
||||
<h2 className="text-uppercase text-center mb-5">Создать учетную запись</h2>
|
||||
|
||||
<Form noValidate validated={validated} onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-4" controlId="name">
|
||||
<Form.Control type="text" required />
|
||||
<Form.Control.Feedback>Имя заполнено</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Имя не заполнено</Form.Control.Feedback>
|
||||
<Form.Label htmlFor="name">Ваше имя</Form.Label>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Control type="email" id="form3Example3cg" required />
|
||||
<Form.Control.Feedback>Email заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Email не заполнен</Form.Control.Feedback>
|
||||
<Form.Label htmlFor="form3Example3cg">Ваш адрес электронной почты</Form.Label>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-4">
|
||||
<Form.Control type="password" id="form3Example4cg" size="lg" required />
|
||||
<Form.Control.Feedback>Пароль заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Пароль не заполнен</Form.Control.Feedback>
|
||||
<Form.Label htmlFor="form3Example4cg">Пароль</Form.Label>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group controlId="formRepeatPassword" className="mb-4">
|
||||
<Form.Control type="password"required/>
|
||||
<Form.Control.Feedback>Пароль заполнен</Form.Control.Feedback>
|
||||
<Form.Control.Feedback type="invalid">Пароль не заполнен</Form.Control.Feedback>
|
||||
<Form.Label>Повторите свой пароль</Form.Label>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group controlId="formCheckbox" className="d-flex justify-content-center mb-5">
|
||||
<Form.Check type="checkbox" label={
|
||||
<span>
|
||||
Я согласен со всеми утверждениями в{' '}
|
||||
<a href="#!" className="text-body">
|
||||
<u>Условиях обслуживания</u>
|
||||
</a>
|
||||
</span>
|
||||
} />
|
||||
</Form.Group>
|
||||
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button variant="success" type="button" className="btn-block btn-warning text-body mb-0" href="PersonalAccount">
|
||||
Регистрация
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<p className="text-center text-muted mb-0">
|
||||
У вас уже есть учетная запись?{' '}
|
||||
<a href="personalAccountLogin" className="fw-bold text-body">
|
||||
<u>Войдите здесь</u>
|
||||
</a>
|
||||
</p>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default PersonalAccountRegister;
|
37
lab5/src/pages/Stock.jsx
Normal file
37
lab5/src/pages/Stock.jsx
Normal file
@ -0,0 +1,37 @@
|
||||
import { Container, Row, Col } from 'react-bootstrap';
|
||||
import StockCard from '../components/card/StockCard';
|
||||
|
||||
const Stock = () => {
|
||||
return (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col className="d-flex justify-content-center align-items-center">
|
||||
<h1 className="text-warning font-weight-bold">Акции</h1>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
<StockCard />
|
||||
</Row>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default Stock;
|
13
lab5/vite.config.js
Normal file
13
lab5/vite.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
chunkSizeWarningLimit: 1024,
|
||||
emptyOutDir: true,
|
||||
},
|
||||
});
|
BIN
Отчёты/Отчёт 5.docx
Normal file
BIN
Отчёты/Отчёт 5.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user