This commit is contained in:
GokaPek 2023-11-24 15:09:59 +04:00
parent ad67a856ae
commit f6b0ab5c1b
8 changed files with 3461 additions and 3831 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -54,14 +54,15 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="btn-group mt-2" role="group"> <div class="btn-group mt-2" role="group">
<button id="items-add" class="btn btn-info">Add-Dialog</button> <button id="items-add" class="btn btn-info">Add book</button>
<a class="btn btn-success" href="/page-edit.html">Add-Page</a>
</div> </div>
<form class="form-inlinecustom-search mx-auto mt-2"> <form class="form-inlinecustom-search mx-auto mt-2">
<main class="container-fluid">
<div class="scroll-panel-favour"> <div class="scroll-panel-favour">
<main class="container-fluid p-2">
<div>
<table id="items-table" class="table table-striped"> <table id="items-table" class="table table-striped">
<tbody>
<thead> <thead>
<tr> <tr>
<th scope="col">#</th> <th scope="col">#</th>
@ -70,9 +71,10 @@
<th scope="col">Author</th> <th scope="col">Author</th>
<th scope="col">ISBN</th> <th scope="col">ISBN</th>
<th scope="col">Price</th> <th scope="col">Price</th>
<th scope="col">Image</th>
</tr> </tr>
</thead> </thead>
<tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -88,10 +90,9 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h1 class="modal-title fs-5" id="items-update-title"></h1> <h1 class="modal-title fs-5" id="items-update-title"></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body modal-dialog-scrollable">
<div class="text-center"> <div class="text-center">
<img id="image-preview" src="https://via.placeholder.com/200" <img id="image-preview" src="https://via.placeholder.com/200"
class="rounded rounded-square" alt="placeholder"> class="rounded rounded-square" alt="placeholder">
@ -110,8 +111,8 @@
placeholder="Name" required /> placeholder="Name" required />
</div> </div>
<div class="mb-2"> <div class="mb-2">
<input id="author" name="author" class="form-control" type="text" <input id="author" name="author" class="form-control" type="text" placeholder="Author"
placeholder="Author" required /> required />
</div> </div>
<div class="mb-2"> <div class="mb-2">
<label class="form-label" for="price">Price</label> <label class="form-label" for="price">Price</label>
@ -141,7 +142,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row mt-4">
<footer class="footer fixed-bottom w-100"> <footer class="footer fixed-bottom w-100">
<div class="container"> <div class="container">
<img class="logos ml-0" src="png/logos.png" alt="Логотип" /> <img class="logos ml-0" src="png/logos.png" alt="Логотип" />

View File

@ -39,6 +39,10 @@ header{
color: white; color: white;
background-color: rgba(255, 0, 0, 0); background-color: rgba(255, 0, 0, 0);
} }
.modal-dialog-scrollable {
max-height: calc(85vh - 60px);
overflow-y: auto;
}
#profile { #profile {
width: 40px; width: 40px;
height: 40px; height: 40px;
@ -51,6 +55,15 @@ header{
height: 400px; height: 400px;
border-radius: 17% / 60%; border-radius: 17% / 60%;
} }
.modal-dialog img {
width: 200px;
height: 200px;
object-fit: cover;
}
.small-image {
max-width: 200px;
max-height: 100px;
}
#small-car{ #small-car{
width: 80%; width: 80%;
background: #c03000; background: #c03000;
@ -103,7 +116,7 @@ header{
max-width: 100px; max-width: 100px;
} }
.scroll-panel-favour { .scroll-panel-favour {
height: 400px; height: 500px;
background-color: white; background-color: white;
overflow-y: scroll; overflow-y: scroll;
} }

File diff suppressed because one or more lines are too long

View File

@ -66,7 +66,11 @@ function createTableColumn(value) {
td.textContent = value; td.textContent = value;
return td; return td;
} }
function createTableColumnImg(value) {
const td = document.createElement('td');
td.appendChild(value);
return td;
}
// функция создает строку таблицы // функция создает строку таблицы
// <tr> // <tr>
// <th scope="row">index + 1</th> // <th scope="row">index + 1</th>
@ -96,11 +100,20 @@ export function createTableRow(item, index, editCallback, editPageCallback, dele
row.appendChild(createTableColumn(item.author)); row.appendChild(createTableColumn(item.author));
row.appendChild(createTableColumn(item.isbn)); row.appendChild(createTableColumn(item.isbn));
row.appendChild(createTableColumn(parseFloat(item.price).toFixed(2))); row.appendChild(createTableColumn(parseFloat(item.price).toFixed(2)));
// Добавляем картинку в таблицу
const img = document.createElement('img');
img.src = item.image;
img.classList.add('small-image');
row.appendChild(createTableColumnImg(img));
// редактировать в модальном окне // редактировать в модальном окне
row.appendChild(createTableAnchor('fa-pencil', editCallback)); row.appendChild(createTableAnchor('fa-pencil', editCallback));
// редактировать на странице page-edit // редактировать на странице page-edit
row.appendChild(createTableAnchor('fa-pen-to-square', editPageCallback)); //row.appendChild(createTableAnchor('fa-pen-to-square', editPageCallback));
// удаление // удаление
row.appendChild(createTableAnchor('fa-trash', deleteCallback)); row.appendChild(createTableAnchor('fa-trash', deleteCallback));
return row; return row;
} }