diff --git a/lab3/Administrator.html b/lab3/Administrator.html index d5eb4a6..a3e11da 100644 --- a/lab3/Administrator.html +++ b/lab3/Administrator.html @@ -40,21 +40,20 @@

Панель администратора

- - Добавить товар (страница) + Добавить товар
-

Таблица данных

+

Таблица данных

+ -
Товар ЦенаАкция Количество Сумма
@@ -87,6 +86,11 @@
+
+ + +
showUpdateModal(item), () => location.assign(`page-edit.html?id=${item.id}`), () => removeLine(item.id), ), @@ -35,17 +33,17 @@ async function drawLinesTable() { }); } -async function addLine(item, price, count, image) { +async function addLine(item, price, stock, count, image) { console.info("Try to add item"); - const data = await createLine(item, price, count, image); + const data = await createLine(item, price, stock, count, image); console.info("Added"); console.info(data); drawLinesTable(); } -async function editLine(id, item, price, count, image) { +async function editLine(id, item, price, stock, count, image) { console.info("Try to update item"); - const data = await updateLine(id, item, price, count, image); + const data = await updateLine(id, item, price, stock, count, image); console.info("Updated"); console.info(data); drawLinesTable(); @@ -88,7 +86,6 @@ export function linesForm() { drawItemsSelect(); drawLinesTable(); cntrls.image.addEventListener("change", () => updateImagePreview()); - cntrls.button.addEventListener("click", () => showUpdateModal(null)); cntrls.form.addEventListener("submit", async (event) => { console.info("Form onSubmit"); event.preventDefault(); @@ -107,6 +104,7 @@ export function linesForm() { await addLine( cntrls.itemsType.value, cntrls.price.value, + cntrls.stock.value, cntrls.count.value, imageBase64, ); @@ -115,11 +113,11 @@ export function linesForm() { currentId, cntrls.itemsType.value, cntrls.price.value, + cntrls,stock.value, cntrls.count.value, imageBase64, ); } - hideUpdateModal(); }); } @@ -135,6 +133,7 @@ export async function linesPageForm() { const line = await getLine(currentId); cntrls.itemsType.value = line.itemsId; cntrls.price.value = line.price; + cntrls.stock.value = line.stock; cntrls.count.value = line.count; cntrls.imagePreview.src = line.image ? line.image : imagePlaceholder; } catch { @@ -159,6 +158,7 @@ export async function linesPageForm() { await addLine( cntrls.itemsType.value, cntrls.price.value, + cntrls.stock.value, cntrls.count.value, imageBase64, ); @@ -167,6 +167,7 @@ export async function linesPageForm() { currentId, cntrls.itemsType.value, cntrls.price.value, + cntrls.stock.value, cntrls.count.value, imageBase64, ); diff --git a/lab3/page-edit.html b/lab3/page-edit.html index 2cf2e14..e4add88 100644 --- a/lab3/page-edit.html +++ b/lab3/page-edit.html @@ -55,6 +55,11 @@
+
+ + +
diff --git a/Отчёты/Отчёт 2.docx b/Отчёты/Отчёт 2.docx index df5e666..d42abeb 100644 Binary files a/Отчёты/Отчёт 2.docx and b/Отчёты/Отчёт 2.docx differ