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();