Add database-backed manual order grid with automatic cell saving

This commit is contained in:
2026-10-22 18:33:59 +09:00
parent 399e91518c
commit 827cb3b0a8
18 changed files with 1124 additions and 11 deletions
+6 -2
View File
@@ -30,7 +30,7 @@ async function settingsErrorMessage(response) {
async function readHistoryResponse(response) {
const data = await response.json().catch(() => ({}));
if (!response.ok) {
throw new Error(typeof data.detail === 'string' ? data.detail : '내역 처리를 확인하지 못했습니다. 새로고침해주세요.');
throw new Error(typeof data.detail === 'string' ? data.detail : data.detail?.message || '내역 처리를 확인하지 못했습니다. 새로고침해주세요.');
}
return data;
}
@@ -1750,7 +1750,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (data.status === 'success') {
if (!url.includes('submit')) {
alert(data.message);
} else if (data.timestamp) {
} else if (data.timestamp && !data.history_saved) {
const histData = {
timestamp: data.timestamp,
customer_name: submitPayload.customer_name,
@@ -1766,6 +1766,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
}).catch(error => alert('발주는 완료됐지만 수동발주내역 저장을 확인하지 못했습니다. ' + error.message));
}
if (data.history_saved && typeof loadManualHistory === 'function') loadManualHistory();
// Copy the same text that is written to the sheet remarks/comparison field.
if (data.clipboard_text) {
@@ -1784,6 +1785,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (url.includes('submit')) {
const iframe = document.querySelector('#manual-tab iframe');
if (iframe) iframe.src = iframe.src;
window.manualGrid?.refresh().catch(error => alert(error.message));
}
} else {
alert("Error: " + data.detail);
@@ -1803,6 +1805,7 @@ document.addEventListener('DOMContentLoaded', () => {
document.getElementById('btn-submit-ellen').addEventListener('click', () => submitOrder('/api/order/submit', true));
document.getElementById('btn-download-sheet').addEventListener('click', () => {
if (window.manualGrid) { window.manualGrid.download().catch(error => alert(error.message)); return; }
if (!confirm("수동발주로 입력한 자료는 엑셀 파일로 저장되며, 입력된 수동발주 내용은 사라집니다.\n진행하시겠습니까?")) return;
const btn = document.getElementById('btn-download-sheet');
@@ -2334,6 +2337,7 @@ document.addEventListener('DOMContentLoaded', () => {
window.loadManualHistory();
const iframe = document.querySelector('#manual-tab iframe');
if (iframe) iframe.src = iframe.src;
window.manualGrid?.refresh().catch(error => alert(error.message));
})
.catch(error => {
alert(error.message || "삭제 중 오류가 발생했습니다.");