diff --git a/frontend/static/js/todos.js b/frontend/static/js/todos.js index 101a9e2..1e7bb48 100644 --- a/frontend/static/js/todos.js +++ b/frontend/static/js/todos.js @@ -254,11 +254,13 @@ function todosApp() { // 8시간 초과 시 경고 if (totalMinutes > 480) { // 8시간 = 480분 - const confirm = window.confirm( - `⚠️ 경고: ${selectedDate}의 총 작업시간이 ${totalHours}시간이 됩니다.\n` + - `8시간을 초과했습니다. 계속 진행하시겠습니까?` - ); - if (!confirm) return; + const choice = await this.showOverworkWarning(selectedDate, totalHours); + if (choice === 'cancel') return; + if (choice === 'change') { + // 모달을 닫지 않고 사용자가 다시 선택할 수 있도록 함 + return; + } + // choice === 'continue'인 경우 계속 진행 } // 날짜만 사용하여 해당 날짜의 시작 시간으로 설정 @@ -615,6 +617,83 @@ function todosApp() { // 특정 할일의 메모 목록 가져오기 getTodoMemos(todoId) { return this.todoMemos[todoId] || []; + }, + + // 8시간 초과 경고 모달 표시 + showOverworkWarning(selectedDate, totalHours) { + return new Promise((resolve) => { + // 기존 경고 모달이 있으면 제거 + const existingModal = document.getElementById('overwork-warning-modal'); + if (existingModal) { + existingModal.remove(); + } + + // 모달 HTML 생성 + const modalHTML = ` +
+
+
+
+
+ +
+
+

⚠️ 과로 경고

+

하루 권장 작업시간을 초과했습니다

+
+
+
+ +
+
+

+ ${selectedDate}의 총 작업시간이 + ${totalHours}시간이 됩니다. +

+

+ + 건강한 작업을 위해 하루 8시간 이내로 계획하는 것을 권장합니다. +

+
+ +
+ + + +
+
+
+
+ `; + + // 모달을 body에 추가 + document.body.insertAdjacentHTML('beforeend', modalHTML); + + // 전역 함수로 resolve 설정 + window.resolveOverworkWarning = (choice) => { + const modal = document.getElementById('overwork-warning-modal'); + if (modal) { + modal.remove(); + } + delete window.resolveOverworkWarning; + resolve(choice); + }; + }); } }; }