From f2fafe555b65f9207c2c6e216b7d7b2ff83af866 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 3 Nov 2025 10:15:45 +0000 Subject: (최겸) 구매 PQ/실사 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/site-visit/shi-attendees-dialog.tsx | 79 ++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 12 deletions(-) (limited to 'lib/site-visit/shi-attendees-dialog.tsx') diff --git a/lib/site-visit/shi-attendees-dialog.tsx b/lib/site-visit/shi-attendees-dialog.tsx index 3d7d94a1..b2c915f1 100644 --- a/lib/site-visit/shi-attendees-dialog.tsx +++ b/lib/site-visit/shi-attendees-dialog.tsx @@ -94,6 +94,26 @@ export function ShiAttendeesDialog({ onOpenChange, selectedRequest, }: ShiAttendeesDialogProps) { + // 기존 구조 감지 및 alert 표시 + // React.useEffect(() => { + // if (isOpen && selectedRequest?.shiAttendees) { + // const hasOldStructure = Object.values(selectedRequest.shiAttendees as Record).some( + // (value) => { + // if (value && typeof value === 'object' && 'checked' in value && value.checked) { + // const attendeeData = value as any; + // // 기존 구조 확인: count가 있고 attendees가 없는 경우 + // return attendeeData.count !== undefined && (!attendeeData.attendees || !Array.isArray(attendeeData.attendees)); + // } + // return false; + // } + // ); + + // if (hasOldStructure) { + // alert('이 데이터는 이전 히스토리로, 참석자 정보가 부정확할 수 있습니다.'); + // } + // } + // }, [isOpen, selectedRequest]); + return ( @@ -108,7 +128,15 @@ export function ShiAttendeesDialog({
{Object.entries(selectedRequest.shiAttendees as Record).map(([key, value]) => { if (value && typeof value === 'object' && 'checked' in value && value.checked) { - const attendee = value as { checked: boolean; count: number; details?: string } + // 새로운 구조 확인: { checked, attendees: [{ name, department, email }] } + const attendeeData = value as { + checked: boolean; + attendees?: Array<{ name: string; department?: string; email?: string }>; + // 호환성을 위한 기존 구조도 확인 + count?: number; + details?: string; + } + const departmentLabels: Record = { technicalSales: "기술영업", design: "설계", @@ -119,19 +147,46 @@ export function ShiAttendeesDialog({ other: "기타" } - return ( -
-
-

{departmentLabels[key] || key}

- {attendee.count}명 + // 새로운 구조인 경우 (attendees 배열) + if (attendeeData.attendees && Array.isArray(attendeeData.attendees) && attendeeData.attendees.length > 0) { + return ( +
+
+

{departmentLabels[key] || key}

+ {attendeeData.attendees.length}명 +
+
+ {attendeeData.attendees.map((attendee, index) => ( +
+
{attendee.name}
+ {attendee.department && ( +
부서: {attendee.department}
+ )} + {attendee.email && ( +
이메일: {attendee.email}
+ )} +
+ ))} +
- {attendee.details && ( -
- 참석자 정보: {attendee.details} + ) + } + // 기존 구조인 경우 (호환성 유지) + else if (attendeeData.count !== undefined) { + return ( +
+
+

{departmentLabels[key] || key}

+ {attendeeData.count}명
- )} -
- ) + {attendeeData.details && ( +
+ 참석자 정보: {attendeeData.details} +
+ )} +
+ ) + } } return null })} -- cgit v1.2.3