This commit is contained in:
Anna 2024-01-12 11:45:16 +04:00
parent 08ebcc2112
commit 0c83632fe6
29 changed files with 6503 additions and 0 deletions

20
lab3/.eslintrc.json Normal file
View File

@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": "airbnb-base",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"quotes": "off",
"indent": "off",
"no-console": "off",
"no-use-before-define": "off",
"no-alert": "off",
"no-restricted-globals": "off",
"quote-props": "off"
}
}

45
lab3/.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db
# Ignore dist
dist/

120
lab3/Administrator.html Normal file
View File

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Моя страница</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" />
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="page99.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid text-center p-2">
<h1 class="text-center font-weight-bold">Панель администратора</h1>
<div class="btn-group" role="group">
<a class="btn" href="/page-edit.html">Добавить товар</a>
</div>
<div>
<h2 class="text-center font-weight-bold" style="padding-top: 19px;">Таблица данных</h2>
<table id="items-table" class="table table-striped">
<thead>
<th scope="col"></th>
<th scope="col" class="w-25">Товар</th>
<th scope="col" class="w-25">Цена</th>
<!-- <th scope="col" class="w-10">Акция</th> -->
<th scope="col" class="w-25">Количество</th>
<th scope="col" class="w-25">Сумма</th>
<th scope="col"></th>
<th scope="col"></th>
<!-- <th scope="col" class="w-25">Сумма></th> -->
</thead>
<tbody></tbody>
</table>
</div>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Все права защищены © 2023-2024
</footer>
<div id="items-update" class="modal fade" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog">
<form id="items-form" class="needs-validation" novalidate>
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="items-update-title"></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="text-center">
<img id="image-preview" src="https://via.placeholder.com/200" class="rounded rounded-circle"
alt="placeholder">
</div>
<input id="items-line-id" type="number" hidden>
<div class="mb-2">
<label for="item" class="form-label">Товары</label>
<select id="item" class="form-select" name="selected" required>
</select>
</div>
<div class="mb-2">
<label class="form-label" for="price">Цена</label>
<input id="price" name="price" class="form-control" type="number" value="99.00" min="99.00"
step="1.00" required>
</div>
<div class="mb-2">
<label class="form-label" for="count">Количество</label>
<input id="count" name="count" class="form-control" type="number" value="0" min="1" step="1"
required>
</div>
<div class="mb-2">
<label class="form-label" for="image">Изображение</label>
<input id="image" type="file" name="image" class="form-control" accept="image/*">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="submit" class="btn btn-primary">Сохранить</button>
</div>
</div>
</form>
</div>
</div>
<script type="module">
import validation from "./js/validation";
import { linesForm } from "./js/lines";
document.addEventListener('DOMContentLoaded', () => {
validation();
linesForm();
});
</script>
</body>
</html>

BIN
lab3/Images/Tokki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
lab3/Images/album.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
lab3/Images/btc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

161
lab3/basket.html Normal file
View File

@ -0,0 +1,161 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Корзина</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container">
<div class="d-flex justify-content-center align-items-center">
<h1 class="text font-weight-bold">Корзина</h1>
</div>
<div class="row">
<div class="col-10">
<div class="card rounded-3 mb-4">
<div class="card-body p-4">
<div class="row d-flex justify-content-between align-items-center">
<div class="col-md-2 col-lg-2 col-xl-2">
<img src="Images/album.jpg" class="img-fluid rounded-3" alt="Koreans">
</div>
<div class="col-md-3 col-lg-3 col-xl-3">
<p class="lead fw-normal mb-2">Название альбома</p>
<p><span class="text-muted">Описание</span></p>
</div>
<div class="col-md-3 col-lg-3 col-xl-2 d-flex">
<button class="btn-link px-2"
onclick="this.parentNode.querySelector('input[type=number]').stepDown()">
<i class="fas fa-minus"></i>
</button>
<input id="form1" min="0" name="quantity" value="2" type="number"
class="form-control form-control-sm text-center"/>
<button class="btn-link px-2"
onclick="this.parentNode.querySelector('input[type=number]').stepUp()">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="col-md-3 col-lg-2 col-xl-2 offset-lg-1">
<h5 class="mb-0">Цена ₽</h5>
</div>
<div class="col-md-1 col-lg-1 col-xl-1 text-end">
<a href="#!" class="text-black"><i class="far fa-circle-xmark"></i></a>
</div>
</div>
</div>
</div>
<div class="card rounded-3 mb-4">
<div class="card-body p-4">
<div class="row d-flex justify-content-between align-items-center">
<div class="col-md-2 col-lg-2 col-xl-2">
<img src="Images/album.jpg" class="img-fluid rounded-3" alt="Koreans">
</div>
<div class="col-md-3 col-lg-3 col-xl-3">
<p class="lead fw-normal mb-2">Название альбома</p>
<p><span class="text-muted">Описание</span></p>
</div>
<div class="col-md-3 col-lg-3 col-xl-2 d-flex">
<button class="btn-link px-2"
onclick="this.parentNode.querySelector('input[type=number]').stepDown()">
<i class="fas fa-minus"></i>
</button>
<input id="form1" min="0" name="quantity" value="2" type="number"
class="form-control form-control-sm text-center" />
<button class="btn-link px-2"
onclick="this.parentNode.querySelector('input[type=number]').stepUp()">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="col-md-3 col-lg-2 col-xl-2 offset-lg-1">
<h5 class="mb-0">Цена ₽</h5>
</div>
<div class="col-md-1 col-lg-1 col-xl-1 text-end">
<a href="#!" class="text-black"><i class="far fa-circle-xmark"></i></a>
</div>
</div>
</div>
</div>
<div class="card rounded-3 mb-4">
<div class="card-body p-4">
<div class="row d-flex justify-content-between align-items-center">
<div class="col-md-2 col-lg-2 col-xl-2">
<img src="Images/album.jpg" class="img-fluid rounded-3" alt="Koreans">
</div>
<div class="col-md-3 col-lg-3 col-xl-3">
<p class="lead fw-normal mb-2">Название альбома</p>
<p><span class="text-muted">Описание</span></p>
</div>
<div class="col-md-3 col-lg-3 col-xl-2 d-flex">
<button class="btn-link px-2"
onclick="this.parentNode.querySelector('input[type=number]').stepDown()">
<i class="fas fa-minus"></i>
</button>
<input id="form1" min="0" name="quantity" value="2" type="number"
class="form-control form-control-sm text-center" />
<button class="btn-link px-2"
onclick="this.parentNode.querySelector('input[type=number]').stepUp()">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="col-md-3 col-lg-2 col-xl-2 offset-lg-1">
<h5 class="mb-0">Цена ₽</h5>
</div>
<div class="col-md-1 col-lg-1 col-xl-1 text-end">
<a href="#!" class="text-black"><i class="far fa-circle-xmark"></i></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="d-flex justify-content-start align-items-center">
<div class="text-dark font-weight-bold" style="font-size: 24px;">
К оплате: </div>
<div class="text-end" style="color: #767479; font-size: 24px;">
</div>
</div>
<a class="btn btn" style="margin-left: 25px; margin-bottom: 10px;" href="makingAnOrder.html">Оплата</a>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

71
lab3/company.html Normal file
View File

@ -0,0 +1,71 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Tokki</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link active" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 50;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<div class="d-flex justify-content-center align-items-center">
<h1 class="text font-weight-bold">О компании</h1>
</div>
<div class="container">
<div class="row">
<h2 class="font-weight-bold" style="font-size: 35px; margin-left: 10px; margin-top: 10px;">Наши преимущества:</h2>
<ul>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> привозим официально и напрямую из Южной Кореи</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> качественная упаковка и обслуживание</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> быстрая отправка</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> быстрая доставка (в среднем 8 дней по России)</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> удобная оплата через сайт</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> большой ассортимент в наличии в Ульяновске</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> никаких доплат из-за веса, количества, выбора версии и т.д.</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> после оплаты заказа на эл. почту Вам приходит чек, подтверждающий Вашу покупку</li>
<li class="font-weight-bold" style="font-size: 20px; margin-left: 10px; margin-top: 10px;"> работаем почти 8 лет</li>
</ul>
<p></p>
<p></p>
<p></p>
<p style="font-size: 25px; text-align: center; margin-left: 10px; margin-top: 10px;">За время работы магазина, мы уже продали более 60 000 альбомов.</p>
<p style="font-size: 25px; text-align: center; margin-left: 10px; margin-top: 10px;">Также у нас есть физический магазин в Ульяновске, где весь товар можно увидеть в живую!</p>
<p style="font-size: 25px; text-align: center; margin-left: 10px; margin-top: 10px;">Адрес магазина: Ульяновск, ул. Северный Венец 32. Время работы: каждый день с 13:00 до 21:00</p>
</div>
</div>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

50
lab3/data.json Normal file

File diff suppressed because one or more lines are too long

58
lab3/delivery.html Normal file
View File

@ -0,0 +1,58 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Tokki</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link active" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<div class="d-flex justify-content-center align-items-center">
<h1 class="text font-weight-bold">Доставка</h1>
</div>
<div class="container">
<div class="row">
<h2 class="font-weight-bold" style="font-size: 35px; margin-left: 10px; margin-top: 10px;">Вы можете получить заказ:</h2>
<h2 class="font-weight-bold" style="font-size: 35px; margin-left: 10px; margin-top: 10px;">Самовывозом</h2>
<p style="font-size: 25px; margin-left: 10px; margin-top: 10px;">Вы всегда сможете забрать заказ самостоятельно в Ульяновске в нашем магазине по адресу Северный Венец 32. Время работы 13-21. Когда заказ будет собран и завезен в магазин, Вам на эл. почту придет письмо со статусом заказа "готов к выдаче" (проверяйте папку спам), после этого его можно забирать.</p>
<h2 class="font-weight-bold" style="font-size: 35px; margin-left: 10px; margin-top: 10px;">Доставкой Почты России</h2>
<p style="font-size: 25px; margin-left: 10px; margin-top: 10px;">Почта России - пересылка заказа осуществляется до вашего почтового отделения, получение бандероли в отделении Почты России по извещению. Срок доставки зависит от отдаленности вашего региона от Ульяновска. Примерные сроки доставки по РФ около 7-11 дней</p>
</div>
</div>
</div>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

58
lab3/index.html Normal file
View File

@ -0,0 +1,58 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Tokki</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
<script type="module" src="./js/catalog/catalog.js" defer></script>
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link active" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container main_pannel">
<div class="d-flex justify-content-center align-items-center">
<h1 class="text font-weight-bold">Каталог</h1>
</div>
<div class="container">
<div class="row" id="catalog">
<img class="mx-auto pb-5" src="Images/btc.png" alt="banner" width="300">
</div>
</div>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
feel like cinderella naega byeonhae
</footer>
</body>
</html>

View File

@ -0,0 +1,33 @@
import { getAllItemTypes, getAllLines } from "../lines-rest-api.js";
import { indexPageCatalog } from "../lines-ui.js";
import { getProductItem } from "./getProductItem.js";
// Проверка, есть ли вообще на странице каталога место,
// где будут отображаться карточки
if (indexPageCatalog) {
drawCatalog();
}
async function drawCatalog() {
try {
// Получаю все типы
const itemTypes = await getAllItemTypes();
// Получаю все товары
const lines = await getAllLines();
// Бегу по товарам через for
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
// Получаею его тип
const itemType = itemTypes.find(it => it.id === +line.itemsId);
// console.log(itemType);
// добавление в каталог карточек товара через функцию
indexPageCatalog.innerHTML += getProductItem(line.image, itemType.name, line.price);
}
} catch (err) {
console.log(err);
}
}

View File

@ -0,0 +1,19 @@
export function getProductItem(image, name, price) {
return `
<div class="col-lg-3 col-md-4 col-sm-6 col-12 mb-4">
<div class="product d-flex flex-column h-100">
<div class="image_al">
<img src="${image}" alt="Product Image" class="img-fluid">
</div>
<div class="info">
<h3 class="card-title mb-2">${name}</h3>
<!-- <p class="card-text">Описание товара</p> -->
<div class="info-price">
<span class="price"><strong>${price}$</strong></span>
<button class="add-to-cart"><i class="fas fa-basket-shopping"></i></button>
</div>
</div>
</div>
</div>
`;
}

85
lab3/js/lines-rest-api.js Normal file
View File

@ -0,0 +1,85 @@
const serverUrl = "http://localhost:8081";
function createLineObject(item, price, count, image) {
return {
itemsId: item,
price: parseFloat(price).toFixed(2),
count,
sum: parseFloat(price * count).toFixed(2),
image,
};
}
export async function getAllItemTypes() {
const response = await fetch(`${serverUrl}/items`);
if (!response.ok) {
throw response.statusText;
}
return response.json();
}
export async function getAllLines() {
const response = await fetch(`${serverUrl}/lines?_expand=items`);
if (!response.ok) {
throw response.statusText;
}
return response.json();
}
export async function getLine(id) {
const response = await fetch(`${serverUrl}/lines/${id}?_expand=items`);
if (!response.ok) {
throw response.statusText;
}
return response.json();
}
export async function createLine(item, price, count, image) {
const itemObject = createLineObject(item, price, count, image);
const options = {
method: "POST",
body: JSON.stringify(itemObject),
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
};
const response = await fetch(`${serverUrl}/lines`, options);
if (!response.ok) {
throw response.statusText;
}
return response.json();
}
export async function updateLine(id, item, price, count, image) {
const itemObject = createLineObject(item, price, count, image);
const options = {
method: "PUT",
body: JSON.stringify(itemObject),
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
};
const response = await fetch(`${serverUrl}/lines/${id}`, options);
if (!response.ok) {
throw response.statusText;
}
return response.json();
}
export async function deleteLine(id) {
const options = {
method: "DELETE",
};
const response = await fetch(`${serverUrl}/lines/${id}`, options);
if (!response.ok) {
throw response.statusText;
}
return response.json();
}

60
lab3/js/lines-ui.js Normal file
View File

@ -0,0 +1,60 @@
export const cntrls = {
button: document.getElementById("items-add"),
table: document.querySelector("#items-table tbody"),
form: document.getElementById("items-form"),
lineId: document.getElementById("items-line-id"),
itemsType: document.getElementById("item"),
price: document.getElementById("price"),
count: document.getElementById("count"),
image: document.getElementById("image"),
imagePreview: document.getElementById("image-preview"),
};
export const indexPageCatalog = document.querySelector('#catalog');
export const imagePlaceholder = "https://via.placeholder.com/200";
export function createItemsOption(name, value = "", isSelected = false) {
const option = document.createElement("option");
option.value = value || "";
option.selected = isSelected;
option.text = name;
return option;
}
function createTableAnchor(icon, callback) {
const i = document.createElement("i");
i.classList.add("fa-solid", icon, "text-dark");
const a = document.createElement("a");
a.href = "#";
a.appendChild(i);
a.onclick = (event) => {
event.preventDefault();
event.stopPropagation();
callback();
};
const td = document.createElement("td");
td.appendChild(a);
return td;
}
function createTableColumn(value) {
const td = document.createElement("td");
td.textContent = value;
return td;
}
export function createTableRow(item, index, editCallback, deleteCallback) {
const rowNumber = document.createElement("th");
rowNumber.scope = "row";
rowNumber.textContent = index + 1;
const row = document.createElement("tr");
row.id = `line-${item.id}`;
row.appendChild(rowNumber);
row.appendChild(createTableColumn(item.items.name));
row.appendChild(createTableColumn(parseFloat(item.price).toFixed(2)));
row.appendChild(createTableColumn(item.count));
row.appendChild(createTableColumn(parseFloat(item.sum).toFixed(2)));
row.appendChild(createTableAnchor("fa-paw", editCallback));
row.appendChild(createTableAnchor("fa-circle-xmark", deleteCallback));
return row;
}

172
lab3/js/lines.js Normal file
View File

@ -0,0 +1,172 @@
import {
createLine, deleteLine, getAllItemTypes, getAllLines, getLine, updateLine,
} from "./lines-rest-api";
import {
cntrls, createItemsOption, createTableRow, imagePlaceholder,
} from "./lines-ui";
async function drawItemsSelect() {
const data = await getAllItemTypes();
cntrls.itemsType.innerHTML = "";
cntrls.itemsType.appendChild(createItemsOption("Выберите значение", "", true));
data.forEach((item) => {
cntrls.itemsType.appendChild(createItemsOption(item.name, item.id));
});
}
async function drawLinesTable() {
console.info("Try to load data");
if (!cntrls.table) {
return;
}
const data = await getAllLines();
cntrls.table.innerHTML = "";
data.forEach((item, index) => {
cntrls.table.appendChild(
createTableRow(
item,
index,
() => location.assign(`page-edit.html?id=${item.id}`),
() => removeLine(item.id),
),
);
});
}
async function addLine(item, price, count, image) {
console.info("Try to add item");
const data = await createLine(item, price, count, image);
console.info("Added");
console.info(data);
drawLinesTable();
}
async function editLine(id, item, price, count, image) {
console.info("Try to update item");
const data = await updateLine(id, item, price, count, image);
console.info("Updated");
console.info(data);
drawLinesTable();
}
async function removeLine(id) {
if (!confirm("Do you really want to remove this item?")) {
console.info("Canceled");
return;
}
console.info("Try to remove item");
const data = await deleteLine(id);
console.info(data);
drawLinesTable();
}
async function readFile(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);
});
}
async function updateImagePreview() {
const file = cntrls.image.files[0];
const fileContent = await readFile(file);
console.info("base64 ", fileContent);
cntrls.imagePreview.src = fileContent;
}
export function linesForm() {
console.info("linesForm");
drawItemsSelect();
drawLinesTable();
cntrls.image.addEventListener("change", () => updateImagePreview());
cntrls.form.addEventListener("submit", async (event) => {
console.info("Form onSubmit");
event.preventDefault();
event.stopPropagation();
if (!cntrls.form.checkValidity()) {
return;
}
let imageBase64 = "";
if (cntrls.imagePreview.src !== imagePlaceholder) {
const result = await fetch(cntrls.imagePreview.src);
const blob = await result.blob();
imageBase64 = await readFile(blob);
}
const currentId = cntrls.lineId.value;
if (!currentId) {
await addLine(
cntrls.itemsType.value,+
cntrls.price.value,+
cntrls.count.value,+
imageBase64,
);
} else {
await editLine(
currentId,
cntrls.itemsType.value,
cntrls.price.value,
cntrls.count.value,
imageBase64,
);
}
});
}
export async function linesPageForm() {
console.info("linesPageForm");
drawItemsSelect();
const goBack = () => location.assign("/Administrator.html");
cntrls.image.addEventListener("change", () => updateImagePreview());
const urlParams = new URLSearchParams(location.search);
const currentId = urlParams.get("id");
if (currentId) {
try {
const line = await getLine(currentId);
cntrls.itemsType.value = line.itemsId;
cntrls.price.value = line.price;
cntrls.count.value = line.count;
cntrls.imagePreview.src = line.image ? line.image : imagePlaceholder;
} catch {
goBack();
}
}
cntrls.form.addEventListener("submit", async (event) => {
console.info("Form onSubmit");
event.preventDefault();
event.stopPropagation();
if (!cntrls.form.checkValidity()) {
return;
}
let imageBase64 = "";
if (cntrls.imagePreview.src !== imagePlaceholder) {
const result = await fetch(cntrls.imagePreview.src);
const blob = await result.blob();
imageBase64 = await readFile(blob);
}
if (!currentId) {
await addLine(
cntrls.itemsType.value,
cntrls.price.value,
cntrls.count.value,
imageBase64,
);
} else {
await editLine(
currentId,
cntrls.itemsType.value,
cntrls.price.value,
cntrls.count.value,
imageBase64,
);
}
goBack();
});
}

16
lab3/js/validation.js Normal file
View File

@ -0,0 +1,16 @@
function validation() {
const forms = document.querySelectorAll("form.needs-validation");
for (let i = 0; i < forms.length; i += 1) {
const form = forms[i];
form.addEventListener("submit", (event) => {
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add("was-validated");
});
}
}
export default validation;

14
lab3/jsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"target": "ES2020",
"jsx": "preserve",
"strictNullChecks": true,
"strictFunctionTypes": true
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}

194
lab3/makingAnOrder.html Normal file
View File

@ -0,0 +1,194 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Оформление заказа</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<section class="h-100">
<div class="mask d-flex align-items-center h-100 gradient-custom-3">
<div class="container h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-9 col-lg-7 col-xl-6">
<div class="card" style="border-radius: 15px; border-color:#767479;">
<div class="card-body p-5">
<h2 class="text-uppercase text-center mb-5">Оформление заказа</h2>
<form>
<div class="form-outline mb-4">
<input type="text" id="form3Example1cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example1cg">Ваше имя</label>
</div>
<div class="form-outline mb-4">
<input type="tel" id="form3Example5cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example5cg">Электронная почта</label>
</div>
<label class="form-check-label" for="creditCard">Вариант получения</label>
<div class="form-check mb-4">
<input class="form-check-input" type="radio" name="deliveryMethod" id="selfPickup" value="selfPickup">
<label class="form-check-label" for="selfPickup">Самовывоз</label>
</div>
<div class="form-check mb-4">
<input class="form-check-input" type="radio" name="deliveryMethod" id="delivery" value="delivery">
<label class="form-check-label" for="delivery">Доставка</label>
</div>
<div class="form-outline mb-4" id="deliveryAddress" style="display: none;">
<input type="text" id="form3ExampleAddress" class="form-control form-control-lg" />
<label class="form-label" for="form3ExampleAddress">Ваш адрес доставки</label>
<div id="deliveryTimeOptions">
<select class="form-select" id="timeSlotSelect" name="timeSlot">
<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>
</select>
<label for="timeSlotSelect">Выберите время доставки:</label>
</div>
</div>
<label class="form-check-label" for="creditCard">Вариант оплаты</label>
<div class="form-check mb-4">
<input class="form-check-input" type="radio" name="paymentMethod" id="cash" value="cash">
<label class="form-check-label" for="cash">Наличные</label>
</div>
<div class="form-check mb-4">
<input class="form-check-input" type="radio" name="paymentMethod" id="creditCard" value="creditCard">
<label class="form-check-label" for="creditCard">Оплата картой</label>
</div>
<div class="form-outline mb-4" id="creditCardDetails" style="display: none;">
<div class="row mb-4">
<div class="col">
<div class="form-outline">
<input type="text" id="formNameOnCard" class="form-control" />
<label class="form-label" for="formNameOnCard">Имя держателя карты</label>
</div>
</div>
<div class="col">
<div class="form-outline">
<input type="text" id="formCardNumber" class="form-control" />
<label class="form-label" for="formCardNumber">Номер карты</label>
</div>
</div>
</div>
<div class="row mb-4">
<div class="col-3">
<div class="form-outline">
<input type="text" id="formExpiration" class="form-control" />
<label class="form-label" for="formExpiration">Срок действия</label>
</div>
</div>
<div class="col-3">
<div class="form-outline">
<input type="text" id="formCVV" class="form-control" />
<label class="form-label" for="formCVV">CVV</label>
</div>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<button class="btn btn" type="button" id="saveButton">Оформить</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$('input[type=radio][name=deliveryMethod]').change(function() {
if (this.value === 'delivery') {
$('#deliveryAddress').show();
$('#deliveryTimeOptions').show();
} else {
$('#deliveryAddress').hide();
$('#deliveryTimeOptions').hide();
}
});
$('input[type=radio][name=paymentMethod]').change(function() {
if (this.value === 'creditCard') {
$('#creditCardDetails').show();
} else {
$('#creditCardDetails').hide();
}
});
});
</script>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

4700
lab3/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

26
lab3/package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "int-prog",
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "vite",
"serve": "http-server -p 3000 ./dist/",
"build": "vite build",
"rest": "json-server --watch data.json -p 8081",
"dev": "npm-run-all --parallel rest start",
"prod": "npm-run-all build --parallel serve rest"
},
"dependencies": {
"bootstrap": "5.3.2",
"@fortawesome/fontawesome-free": "6.4.2"
},
"devDependencies": {
"vite": "4.4.9",
"eslint": "8.50.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.28.1",
"http-server": "14.1.1",
"json-server": "0.17.4",
"npm-run-all": "4.1.5"
}
}

87
lab3/page-edit.html Normal file
View File

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="ru" class="h-100">
<head>
<meta charset="utf-8">
<title>Моя страница</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" />
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<h1 class="text-center font-weight-bold">Добавление товара</h1>
<div class="text-center">
<img id="image-preview" src="https://via.placeholder.com/200" class="rounded rounded-end"
alt="placeholder">
</div>
<form id="items-form" class="needs-validation" novalidate>
<div class="mb-2">
<label for="item" class="form-label">Товары</label>
<select id="item" class="form-select" name="selected" required>
</select>
</div>
<div class="mb-2">
<label class="form-label" for="price">Цена</label>
<input id="price" name="price" class="form-control" type="number" value="0.00" min="1000.00" step="0.50"
required>
</div>
<div class="mb-2">
<label class="form-label" for="count">Количество</label>
<input id="count" name="count" class="form-control" type="number" value="0" min="1" step="1" required>
</div>
<div class="mb-2">
<label class="form-label" for="image">Изображение</label>
<input id="image" type="file" name="image" class="form-control" accept="image/*">
</div>
<div class="container-fluid text-center p-2">
<a href="Administrator.html" class="btn">Назад</a>
<button type="submit" class="btn">Сохранить</button>
</div>
</form>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
<script type="module">
import validation from "./js/validation";
import { linesPageForm } from "./js/lines"
document.addEventListener('DOMContentLoaded', () => {
validation();
linesPageForm();
});
</script>
</body>
</html>

98
lab3/personalAccount.html Normal file
View File

@ -0,0 +1,98 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Личный кабинет</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<section class="h-100">
<div class="mask d-flex align-items-center h-100 gradient-custom-3">
<div class="container h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-9 col-lg-7 col-xl-6">
<div class="card" style="border-radius: 15px; border-color:#767479;">
<div class="card-body p-5">
<h2 class="text-uppercase text-center mb-5">Личный кабинет</h2>
<form>
<div class="form-outline mb-4">
<input type="text" id="form3Example1cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example1cg">Ваше имя</label>
</div>
<div class="form-outline mb-4">
<input type="text" id="form3Example1cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example1cg">Ваша фамилия</label>
</div>
<div class="form-outline mb-4">
<input type="email" id="form3Example3cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example3cg">Ваш адрес электронной почты</label>
</div>
<div class="form-outline mb-4">
<input type="date" id="form3Example4cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example4cg">Дата рождения</label>
</div>
<div class="form-outline mb-2">
<input type="tel" id="form3Example5cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example5cg">Номер телефона</label>
</div>
<div class="d-flex justify-content-center">
<button class="btn btn" type="button" id="saveButton">Сохранить</button>
</div>
<div class="d-flex justify-content-center">
<a class="btn btn" type="button" href="index.html">Выйти</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

View File

@ -0,0 +1,91 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Личный кабинет - Вход</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<section class="h-100">
<div class="mask d-flex align-items-center h-100 gradient-custom-3">
<div class="container h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-9 col-lg-7 col-xl-6">
<div class="card" style="border-radius: 15px; border-color:#767479;">
<div class="card-body p-5">
<h2 class="text-uppercase text-center mb-5">Войти</h2>
<form>
<div class="form-outline mb-4">
<input type="email" id="form3Example3cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example3cg">Ваш адрес электронной почты</label>
</div>
<div class="form-outline mb-4">
<input type="password" id="form3Example4cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example4cg">Пароль</label>
</div>
<div class="form-check d-flex justify-content-center mb-2">
<input class="form-check-input me-2" type="checkbox" value="" id="form2Example3cg" />
<label class="form-check-label me-2" for="form2Example3g">Запомнить меня</label>
</div>
<p class="text-center text-muted mb-0">Забыли пароль? <a href="recoveryPassword.html"
class="fw-bold text-body"><u>Восстановление пароля</u></a></p>
<div class="d-flex justify-content-center">
<a class="btn btn-block text-body mb-0" href="personalAccount.html">Вход</a>
</div>
<p class="text-center text-muted mb-0">У вас нет аккаунта? <a href="personalAccountRegister.html"
class="fw-bold text-body"><u>Регистрация</u></a></p>
<p class="text-center"><a class="fw-bold text-body" href="Administrator.html">Администратор</a></p>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

View File

@ -0,0 +1,99 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Личный кабинет - Регистрация</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<section class="h-100">
<div class="mask d-flex align-items-center h-100 gradient-custom-3">
<div class="container h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-9 col-lg-7 col-xl-6">
<div class="card" style="border-radius: 15px; border-color:#767479;">
<div class="card-body p-5">
<h2 class="text-uppercase text-center mb-5">Создать учетную запись</h2>
<form>
<div class="form-outline mb-4">
<input type="text" id="form3Example1cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example1cg">Ваше имя</label>
</div>
<div class="form-outline mb-4">
<input type="email" id="form3Example3cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example3cg">Ваш адрес электронной почты</label>
</div>
<div class="form-outline mb-4">
<input type="password" id="form3Example4cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example4cg">Пароль</label>
</div>
<div class="form-outline mb-4">
<input type="password" id="form3Example4cdg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example4cdg">Повторите свой пароль</label>
</div>
<div class="form-check d-flex justify-content-center mb-5">
<input class="form-check-input me-2" type="checkbox" value="" id="form2Example3cg" />
<label class="form-check-label" for="form2Example3g">
Я согласен со всеми утверждениями в <a href="#!" class="text-body"><u>Условиях обслуживания</u></a>
</label>
</div>
<div class="d-flex justify-content-center">
<button type="button"
class="btn btn-block text-body mb-0">Регистрация</button>
</div>
<p class="text-center text-muted mb-0">У вас уже есть учетная запись? <a href="personalAccountLogin.html"
class="fw-bold text-body"><u>Войдите здесь</u></a></p>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

View File

@ -0,0 +1,81 @@
<html lang="ru" class="h-100">
<head>
<meta charset="UTF-8">
<title>Личный кабинет - Восстановление пароля</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./style.css">
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="Images/Tokki.png" alt="logo" width="90">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-start" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="index.html">Каталог</a>
<a class="nav-link" href="company.html">О компании</a>
<a class="nav-link" href="delivery.html">Доставка</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link" href="personalAccountLogin.html">Войти</a>
<a class="nav-link" style="padding-right: 90;" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<section class="h-100">
<div class="mask d-flex align-items-center h-100 gradient-custom-3">
<div class="container h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-9 col-lg-7 col-xl-6">
<div class="card" style="border-radius: 15px; border-color:#767479;">
<div class="card-body p-5">
<h2 class="text-uppercase text-center mb-5">Восстановление пароля</h2>
<h4 class="text-black text-center mb-5">Введите свой адрес электронной почты, и мы вышлем вам электронное письмо с инструкциями по сбросу вашего пароля</h4>
<form>
<div class="form-outline mb-4">
<input type="email" id="form3Example3cg" class="form-control form-control-lg" />
<label class="form-label" for="form3Example3cg">Ваш адрес электронной почты</label>
</div>
<div class="d-flex justify-content-center">
<button type="button"
class="btn btn-block text-body mb-0">Сбросить пароль</button>
</div>
<p class="text-center text-muted mb-0"><a href="personalAccountLogin.html"
class="fw-bold text-body"><u>Войти</u></a></p>
<p class="text-center text-muted mb-0"><a href="personalAccountRegister.html"
class="fw-bold text-body"><u>Регистрация</u></a></p>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Tokki © 2023-2024
</footer>
</body>
</html>

122
lab3/style.css Normal file
View File

@ -0,0 +1,122 @@
header nav {
background-color: #ffeaf7;
}
@media (min-width: 768px) {
header nav {
height: 110px;
}
}
header nav a:hover {
text-decoration: underline;
}
.navbar-brand img {
margin-left: 235px;
}
@media (max-width: 576px) {
.navbar-brand img {
margin-left: 25px;
}
}
@media (min-width: 577px) and (max-width: 992px) {
.navbar-brand img {
margin-left: 25px
}
}
@media (min-width: 993px) and (max-width: 1200px) {
.navbar-brand img {
margin-left: 150px;
}
}
@media (min-width: 1201px) {
.navbar-brand img {
margin-left: 235px;
}
}
.navbar-banner img {
margin-left: 10px;
width: 50%;
object-fit: cover;
object-position: bottom;
}
.product {
margin-bottom: 30px;
padding-right: 5px;
padding-left: 5px;
height: 100%;
}
.image_al {
margin-bottom: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.image_al img {
width: 300px;
height: 300px;
object-fit: cover;
border-radius: 7px;
}
.info-price {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
}
.add-to-cart {
border: none;
width: 35px;
height: 35px;
display: flex;
align-items: center;
justify-content: center;
background-color: #767479;
color: #ffffff;
}
.btn-warning {
height: 35px;
width: 176px;
border-radius: 8px;
margin-right: 10px;
margin-top: 10px;
}
.btn {
height: 35px;
width: 176px;
border-radius: 8px;
margin-right: 10px;
margin-top: 10px;
background-color: #767479;
color: #ffffff !important;
}
.btn:hover {
background-color: #bababa !important;
}
footer {
background-color: #ffeaf7;
}
#image-preview {
max-width: 100%;
max-height: 200px;
width: auto;
height: auto;
}

23
lab3/vite.config.js Normal file
View File

@ -0,0 +1,23 @@
import { resolve } from "path";
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from "vite";
export default defineConfig({
build: {
sourcemap: true,
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
company: resolve(__dirname, "company.html"),
personalAccountLogin: resolve(__dirname, "personalAccountLogin.html"),
personalAccountRegister: resolve(__dirname, "personalAccountRegister.html"),
personalAccount: resolve(__dirname, "personalAccount.html"),
recoveryPassword: resolve(__dirname, "recoveryPassword.html"),
basket: resolve(__dirname, "basket.html"),
makingAnOrder: resolve(__dirname, "makingAnOrder.html"),
administrator: resolve(__dirname, "administrator.html"),
},
},
},
});

Binary file not shown.