Опубликовано через кнопку
This commit is contained in:
parent
87693f77bd
commit
be0a8e51f3
50
index.html
50
index.html
@ -257,7 +257,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="tab-analysis" class="hidden">
|
<div id="tab-analysis" class="hidden">
|
||||||
<h3>Выявленные замечания</h3>
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
|
||||||
|
<h3>Выявленные замечания</h3>
|
||||||
|
<button class="btn btn-primary" onclick="openAddRemarkModal()">+ Добавить замечание</button>
|
||||||
|
</div>
|
||||||
<div id="remarks-list" style="margin-top: 16px;"></div>
|
<div id="remarks-list" style="margin-top: 16px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -576,7 +579,9 @@
|
|||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ remarks: check.remarks })
|
body: JSON.stringify({ remarks: check.remarks })
|
||||||
});
|
});
|
||||||
loadCheckDetail(currentCheckId);
|
renderRemarks(check.remarks);
|
||||||
|
renderReport(check);
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,7 +593,9 @@
|
|||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ remarks: check.remarks })
|
body: JSON.stringify({ remarks: check.remarks })
|
||||||
});
|
});
|
||||||
loadCheckDetail(currentCheckId);
|
renderRemarks(check.remarks);
|
||||||
|
renderReport(check);
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("btn-copy-response").addEventListener("click", () => {
|
document.getElementById("btn-copy-response").addEventListener("click", () => {
|
||||||
@ -664,8 +671,45 @@
|
|||||||
|
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
document.getElementById("modal-add-remark").classList.add("hidden");
|
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();
|
load();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user