From ec69c8a8d0efde30709296a561d4f8b7358a8a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=88=98=ED=98=84?= Date: Tue, 24 Jun 2025 13:56:41 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=84=EA=B0=80=EB=A7=A4=ED=95=91=20?= =?UTF-8?q?=ED=8D=BC=EB=B8=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/modal-household-visit.html | 169 ++++++++++-------- .../resources/sql/schema/04_create-view.sql | 2 +- 2 files changed, 94 insertions(+), 77 deletions(-) diff --git a/admin/src/main/resources/templates/researcher/modal/modal-household-visit.html b/admin/src/main/resources/templates/researcher/modal/modal-household-visit.html index e25a6557..79e832fb 100644 --- a/admin/src/main/resources/templates/researcher/modal/modal-household-visit.html +++ b/admin/src/main/resources/templates/researcher/modal/modal-household-visit.html @@ -15,71 +15,64 @@
- - - - - + + + + + + +
방문일 -
-
-
- - - 달력 - - + + + + + + + - - - - - - + + + + - - - - - - -
방문일 + + 관리분야 +
+
+
- -
관리분야 - -
내용 -
-
- +
내용 +
+
+ +
- -
답례품 전달 -
- -
-
- -
-
-
-
- +
답례품 전달 +
+ +
+
+ +
+
+
+
+ +
-
@@ -97,9 +90,12 @@ }); const showHouseholdModal2 = (seq) => { - document.querySelector(".modal02").ui.open(); - //initFlatpickr(); + const modal = document.querySelector(".modal02"); + modal.ui.open(); + setTimeout(() => { + initFlatpickr(); // Flatpickr 초기화 통합 + }, 0); ajaxUtil._ajaxMethod( '/api/researcher/visitHousehold/'+seq, null, @@ -161,27 +157,48 @@ visitDatePicker = null; } - // 1. input 요소가 실제로 존재하는지 확인 + // 입력 요소 확인 const input = document.getElementById('visitDate'); if (!input) { console.warn('#visitDate input not found!'); return; } - // 2. input에 값이 있으면 flatpickr와 동기화 + // 현재 값 가져오기 const currentVal = input.value; - // 3. flatpickr 초기화 - visitDatePicker = flatpickr(input, { - dateFormat: 'Y-m-d', - defaultDate: currentVal || null, // 현재 값으로 초기 선택 날짜 설정 - enableTime: false, - clickOpens: true, - onChange: function (selectedDates, dateStr, instance) { - console.log('날짜 선택됨:', dateStr); - input.value = dateStr; // 수동으로 input 값 동기화 - }, - }); + // Flatpickr 초기화 + try { + visitDatePicker = flatpickr(input, { + dateFormat: 'Y-m-d', + defaultDate: currentVal || null, + enableTime: false, + clickOpens: true, + onReady: function () { + console.log('Flatpickr 초기화 완료'); + }, + onChange: function (selectedDates, dateStr, instance) { + console.log('날짜 선택됨:', dateStr); + input.value = dateStr; // 입력 필드 동기화 + }, + onOpen: function () { + console.log('Flatpickr 캘린더 열림'); + }, + onClose: function () { + console.log('Flatpickr 캘린더 닫힘'); + } + }); + + // 입력 필드 클릭 이벤트 추가 (보조) + input.addEventListener('click', () => { + console.log('visitDate 입력 필드 클릭됨'); + if (visitDatePicker) { + visitDatePicker.open(); // 수동으로 캘린더 열기 + } + }); + } catch (error) { + console.error('Flatpickr 초기화 실패:', error); + } }; const updateHouseholdVisit = () => { diff --git a/core/src/main/resources/sql/schema/04_create-view.sql b/core/src/main/resources/sql/schema/04_create-view.sql index 3e903776..99168975 100644 --- a/core/src/main/resources/sql/schema/04_create-view.sql +++ b/core/src/main/resources/sql/schema/04_create-view.sql @@ -80,5 +80,5 @@ SELECT a.name AS researcher_name, a.phone AS researcher_phone FROM researcher_has_household rhh - JOIN admin a ON rhh.admin_seq = a.seq + JOIN admin a ON rhh.admin_seq = a.seq and a.account_disabled = false WHERE rhh.is_deleted = false; \ No newline at end of file