From d55bc64eb42f3b3072a0df4697946e6399cb1e4e Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 4 Nov 2025 13:39:00 +0900 Subject: (김준회) dolce: 이유란프로 B4 스테이지(일정) 관련 요구사항 반영 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema/vendorDocu.ts | 37 ++++++++++ lib/vendor-document-list/import-service.ts | 15 ++++ .../ship/enhanced-doc-table-columns.tsx | 84 ++++++++++++++++++++++ .../ship/enhanced-documents-table.tsx | 8 +-- 4 files changed, 140 insertions(+), 4 deletions(-) diff --git a/db/schema/vendorDocu.ts b/db/schema/vendorDocu.ts index 304fe5ae..bfa43849 100644 --- a/db/schema/vendorDocu.ts +++ b/db/schema/vendorDocu.ts @@ -873,6 +873,12 @@ export const simplifiedDocumentsView = pgView("simplified_documents_view", { secondStagePlanDate: date("second_stage_plan_date"), secondStageActualDate: date("second_stage_actual_date"), + // 세 번째 스테이지 날짜 정보 (B4 문서의 SHI → GTT) + thirdStageId: integer("third_stage_id"), + thirdStageName: varchar("third_stage_name", { length: 100 }), + thirdStagePlanDate: date("third_stage_plan_date"), + thirdStageActualDate: date("third_stage_actual_date"), + // 전체 스테이지 목록 allStages: json("all_stages").$type | null>> + b4FilterType?: 'all' | 'gtt_deliverable' | 'shi_input' } // 날짜 표시 컴포넌트 (간단 버전) @@ -51,6 +52,7 @@ const DateDisplay = ({ date, isSelected = false }: { date: string | null, isSele export function getSimplifiedDocumentColumns({ setRowAction, + b4FilterType = 'all', }: GetColumnsProps): ColumnDef[] { const columns: ColumnDef[] = [ @@ -258,6 +260,49 @@ export function getSimplifiedDocumentColumns({ ], }, + // 3차 스테이지 그룹 (SHI → GTT) + { + id: "thirdStageGroup", + header: ({ table }) => { + // 첫 번째 행의 thirdStageName을 그룹 헤더로 사용 + const firstRow = table.getRowModel().rows[0]?.original + const stageName = firstRow?.thirdStageName || "SHI → GTT" + return ( +
+ {stageName} +
+ ) + }, + columns: [ + { + accessorKey: "thirdStagePlanDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + return + }, + enableResizing: true, + meta: { + excelHeader: "Third Planned Date" + }, + }, + { + accessorKey: "thirdStageActualDate", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + return + }, + enableResizing: true, + meta: { + excelHeader: "Third Actual Date" + }, + }, + ], + }, + // 첨부파일 수 { accessorKey: "attachmentCount", @@ -341,6 +386,22 @@ export function getSimplifiedDocumentColumns({ // }, ] + // b4FilterType에 따라 스테이지 컬럼 필터링 + if (b4FilterType === 'gtt_deliverable') { + // GTT Deliverables: GTT → SHI 스테이지만 (firstStageGroup, secondStageGroup) + return columns.filter(col => { + const id = 'id' in col ? col.id : null + return id !== 'thirdStageGroup' + }) + } else if (b4FilterType === 'shi_input') { + // SHI Input Document: SHI → GTT 스테이지만 (thirdStageGroup) + return columns.filter(col => { + const id = 'id' in col ? col.id : null + return id !== 'firstStageGroup' && id !== 'secondStageGroup' + }) + } + + // All: 모든 컬럼 표시 return columns } @@ -471,6 +532,29 @@ function SecondStageActualDateCell({ row }: { row: any }) { ); } +function ThirdStagePlanDateCell({ row }: { row: any }) { + const { selectedDocumentId } = React.useContext(DocumentSelectionContext); + const isSelected = selectedDocumentId === row.original.documentId; + + return ; +} + +function ThirdStageActualDateCell({ row }: { row: any }) { + const { selectedDocumentId } = React.useContext(DocumentSelectionContext); + const isSelected = selectedDocumentId === row.original.documentId; + const date = row.original.thirdStageActualDate; + + return ( +
+ + {date && ✓ 완료} +
+ ); +} + function AttachmentCountCell({ count, documentId }: { count: number, documentId: number }) { const { selectedDocumentId } = React.useContext(DocumentSelectionContext); const isSelected = selectedDocumentId === documentId; diff --git a/lib/vendor-document-list/ship/enhanced-documents-table.tsx b/lib/vendor-document-list/ship/enhanced-documents-table.tsx index 13f8f8d4..d92f16dd 100644 --- a/lib/vendor-document-list/ship/enhanced-documents-table.tsx +++ b/lib/vendor-document-list/ship/enhanced-documents-table.tsx @@ -100,10 +100,10 @@ export function SimplifiedDocumentsTable({ } }, [data, onDataLoaded]) - // 🔥 컬럼 메모이제이션 최적화 + // 🔥 컬럼 메모이제이션 최적화 (b4FilterType에 따라 동적 변경) const columns = React.useMemo( - () => getSimplifiedDocumentColumns({}), - [] + () => getSimplifiedDocumentColumns({ b4FilterType }), + [b4FilterType] ) // 🔥 필터 필드들을 메모이제이션 @@ -391,7 +391,7 @@ export function SimplifiedDocumentsTable({ className="gap-2" > - GTT Deliverable + GTT Deliverables {b4Stats.gttDeliverableCount} -- cgit v1.2.3