From be0a8e51f343159ae678bad9102c230cdd7d2930 Mon Sep 17 00:00:00 2001 From: MeruertYes Date: Mon, 24 Aug 2026 05:21:22 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=83=D0=B1=D0=BB=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=BE=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7?= =?UTF-8?q?=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index cfa3685..3288eba 100644 --- a/index.html +++ b/index.html @@ -257,7 +257,10 @@ @@ -576,7 +579,9 @@ headers: { "Content-Type": "application/json" }, body: JSON.stringify({ remarks: check.remarks }) }); - loadCheckDetail(currentCheckId); + renderRemarks(check.remarks); + renderReport(check); + load(); } } @@ -588,7 +593,9 @@ headers: { "Content-Type": "application/json" }, body: JSON.stringify({ remarks: check.remarks }) }); - loadCheckDetail(currentCheckId); + renderRemarks(check.remarks); + renderReport(check); + load(); } document.getElementById("btn-copy-response").addEventListener("click", () => { @@ -664,8 +671,45 @@ function closeModal() { document.getElementById("modal-add-remark").classList.add("hidden"); + document.getElementById("add-remark-form").reset(); } + function openAddRemarkModal() { + document.getElementById("modal-add-remark").classList.remove("hidden"); + } + + document.getElementById("add-remark-form").addEventListener("submit", async (e) => { + e.preventDefault(); + const formData = new FormData(e.target); + const data = Object.fromEntries(formData.entries()); + + const check = await (await fetch(`/api/checks/${currentCheckId}`)).json(); + const newRemark = { + id: Date.now(), + category: data.category, + type: data.type || "Ручное", + document: data.document || "Общее", + text: data.text, + recommendation: data.recommendation || "", + confirmed: true, + page: null + }; + + check.remarks = check.remarks || []; + check.remarks.push(newRemark); + + await fetch(`/api/checks/${currentCheckId}`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ remarks: check.remarks }) + }); + + closeModal(); + renderRemarks(check.remarks); + renderReport(check); + load(); + }); + load();