This commit is contained in:
Вячеслав Иванов 2023-11-03 11:54:36 +04:00
parent dbddd39349
commit c986ccca9f
5 changed files with 136 additions and 19 deletions

84
lab2/page-edit.html Normal file
View File

@ -0,0 +1,84 @@
<!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/logo.png" alt="logo" width="128">
</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="stock.html">Акции</a>
<a class="nav-link" href="contacts.html">Контакты</a>
</div>
</div>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="btn custom-btn" href="personalAccountLogin.html">Войти</a>
<a class="btn btn-warning" href="basket.html">Корзина</a>
</div>
</div>
</div>
</nav>
</header>
<main class="container-fluid p-2">
<h1 class="text-warning text-center font-weight-bold">Добавление товара</h1>
<div class="text-center">
<img id="image-preview" src="https://via.placeholder.com/200" class="rounded rounded-circle"
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>
<a href="Administrator.html" class="btn btn-secondary">Назад</a>
<button type="submit" class="btn btn-primary">Сохранить</button>
</form>
</main>
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
Автор, 2022
</footer>
<script type="module">
import validation from "./js/validation";
import { linesPageForm } from "./js/lines"
document.addEventListener('DOMContentLoaded', () => {
validation();
linesPageForm();
});
</script>
</body>
</html>

View File

@ -84,8 +84,8 @@
</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>
<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>

File diff suppressed because one or more lines are too long

View File

@ -126,7 +126,7 @@ export function linesForm() {
export async function linesPageForm() {
console.info("linesPageForm");
drawItemsSelect();
const goBack = () => location.assign("/page4.html");
const goBack = () => location.assign("/Administrator.html");
cntrls.image.addEventListener("change", () => updateImagePreview());
const urlParams = new URLSearchParams(location.search);
const currentId = urlParams.get("id");

View File

@ -65,3 +65,10 @@ header nav a:hover {
footer {
background-color: #D9D9D9;
}
#image-preview {
max-width: 100%;
max-height: 200px; /* Максимальная высота изображения (по вашему усмотрению) */
width: auto; /* Ширина будет автоматически подстраиваться под максимальный размер */
height: auto; /* Высота будет автоматически подстраиваться под максимальный размер */
}