From 969c25b56f6d29d7ffa4bc2ce04c5fb4e5846b34 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 14 Aug 2025 11:54:47 +0000
Subject: (대표님) 정규벤더등록, 벤더문서관리, 벤더데이터입력, 첨부파일관리
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/enhanced-documents-table.tsx             | 90 +++++++++++++---------
 1 file changed, 53 insertions(+), 37 deletions(-)

(limited to 'lib/vendor-document-list/table/enhanced-documents-table.tsx')

diff --git a/lib/vendor-document-list/table/enhanced-documents-table.tsx b/lib/vendor-document-list/table/enhanced-documents-table.tsx
index cb49f796..7e20892e 100644
--- a/lib/vendor-document-list/table/enhanced-documents-table.tsx
+++ b/lib/vendor-document-list/table/enhanced-documents-table.tsx
@@ -26,6 +26,8 @@ import {
   Settings,
   Filter
 } from "lucide-react"
+import { useTranslation } from "@/i18n/client"
+import { useParams } from "next/navigation"
 import { getUpdatedEnhancedColumns } from "./enhanced-doc-table-columns"
 import { ExpandableDataTable } from "@/components/data-table/expandable-data-table"
 import { toast } from "sonner"
@@ -48,7 +50,7 @@ interface FinalIntegratedDocumentsTableProps {
 }
 
 // ✅ Drawing Kind 옵션 정의
-const DRAWING_KIND_OPTIONS = [
+const DRAWING_KIND_KEYS = [
   { value: "all", label: "전체 문서" },
   { value: "B3", label: "B3: Vendor" },
   { value: "B4", label: "B4: GTT" },
@@ -63,6 +65,20 @@ export function EnhancedDocumentsTable({
   initialDrawingKind = "all"
 }: FinalIntegratedDocumentsTableProps) {
   const [{ data, pageCount, total }] = React.use(promises)
+  
+  // URL에서 언어 파라미터 가져오기
+  const params = useParams()
+  const lng = (params?.lng as string) || 'ko'
+  const { t } = useTranslation(lng, 'engineering')
+  console.log(t, 't')
+
+  // ✅ Drawing Kind 옵션 동적 생성
+  const DRAWING_KIND_OPTIONS = React.useMemo(() => 
+    DRAWING_KIND_KEYS.map(item => ({
+      value: item.value,
+      label: t(`documentList.drawingKindOptions.${item.value}`)
+    }))
+  , [t])
 
   // ✅ Drawing Kind 필터 상태 추가
   const [drawingKindFilter, setDrawingKindFilter] = React.useState<string>(initialDrawingKind)
@@ -267,13 +283,13 @@ export function EnhancedDocumentsTable({
           .filter(Boolean)
         
         if (stageIds.length > 0) {
-          toast.success(`${stageIds.length}개 항목이 승인되었습니다.`)
+          toast.success(t('documentList.messages.approvalSuccess', { count: stageIds.length }))
         }
       } else if (action === 'bulk_upload') {
-        toast.info("일괄 업로드 기능은 준비 중입니다.")
+        toast.info(t('documentList.messages.bulkUploadPending'))
       }
     } catch (error) {
-      toast.error("일괄 작업 중 오류가 발생했습니다.")
+      toast.error(t('documentList.messages.bulkActionError'))
     }
   }
 
@@ -318,17 +334,17 @@ export function EnhancedDocumentsTable({
   const advancedFilterFields: DataTableAdvancedFilterField<EnhancedDocument>[] = [
     {
       id: "docNumber",
-      label: "문서번호",
+      label: t('documentList.filters.documentNumber'),
       type: "text",
     },
     {
       id: "title",
-      label: "문서제목",
+      label: t('documentList.filters.documentTitle'),
       type: "text",
     },
     {
       id: "drawingKind",
-      label: "문서종류",
+      label: t('documentList.filters.documentType'),
       type: "select",
       options: [
         { label: "B3", value: "B3" },
@@ -338,43 +354,43 @@ export function EnhancedDocumentsTable({
     },
     {
       id: "currentStageStatus",
-      label: "스테이지 상태",
+      label: t('documentList.filters.stageStatus'),
       type: "select",
       options: [
-        { label: "계획됨", value: "PLANNED" },
-        { label: "진행중", value: "IN_PROGRESS" },
-        { label: "제출됨", value: "SUBMITTED" },
-        { label: "승인됨", value: "APPROVED" },
-        { label: "완료됨", value: "COMPLETED" },
+        { label: t('documentList.statusOptions.planned'), value: "PLANNED" },
+        { label: t('documentList.statusOptions.inProgress'), value: "IN_PROGRESS" },
+        { label: t('documentList.statusOptions.submitted'), value: "SUBMITTED" },
+        { label: t('documentList.statusOptions.approved'), value: "APPROVED" },
+        { label: t('documentList.statusOptions.completed'), value: "COMPLETED" },
       ],
     },
     {
       id: "currentStagePriority",
-      label: "우선순위",
+      label: t('documentList.filters.priority'),
       type: "select",
       options: [
-        { label: "높음", value: "HIGH" },
-        { label: "보통", value: "MEDIUM" },
-        { label: "낮음", value: "LOW" },
+        { label: t('documentList.priorityOptions.high'), value: "HIGH" },
+        { label: t('documentList.priorityOptions.medium'), value: "MEDIUM" },
+        { label: t('documentList.priorityOptions.low'), value: "LOW" },
       ],
     },
     {
       id: "isOverdue",
-      label: "지연 여부",
+      label: t('documentList.filters.overdueStatus'),
       type: "select",
       options: [
-        { label: "지연됨", value: "true" },
-        { label: "정상", value: "false" },
+        { label: t('documentList.overdueOptions.overdue'), value: "true" },
+        { label: t('documentList.overdueOptions.normal'), value: "false" },
       ],
     },
     {
       id: "currentStageAssigneeName",
-      label: "담당자",
+      label: t('documentList.filters.assignee'),
       type: "text",
     },
     {
       id: "createdAt",
-      label: "생성일",
+      label: t('documentList.filters.createdDate'),
       type: "date",
     },
   ]
@@ -405,48 +421,48 @@ export function EnhancedDocumentsTable({
         <Card className="cursor-pointer hover:shadow-md transition-shadow" onClick={() => setQuickFilter('all')}>
           <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
             <CardTitle className="text-sm font-medium">
-              {drawingKindFilter === "all" ? "전체 문서" : `${DRAWING_KIND_OPTIONS.find(o => o.value === drawingKindFilter)?.label} 문서`}
+              {drawingKindFilter === "all" ? t('documentList.dashboard.totalDocuments') : `${DRAWING_KIND_OPTIONS.find(o => o.value === drawingKindFilter)?.label}`}
             </CardTitle>
             <TrendingUp className="h-4 w-4 text-muted-foreground" />
           </CardHeader>
           <CardContent>
             <div className="text-2xl font-bold">{stats.total}</div>
             <p className="text-xs text-muted-foreground">
-              총 {total}개 중 {stats.total}개 표시
+              {t('documentList.dashboard.totalCount', { total, shown: stats.total })}
             </p>
           </CardContent>
         </Card>
         
         <Card className="cursor-pointer hover:shadow-md transition-shadow" onClick={() => setQuickFilter('overdue')}>
           <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
-            <CardTitle className="text-sm font-medium">지연 문서</CardTitle>
+            <CardTitle className="text-sm font-medium">{t('documentList.dashboard.overdueDocuments')}</CardTitle>
             <AlertTriangle className="h-4 w-4 text-red-500" />
           </CardHeader>
           <CardContent>
             <div className="text-2xl font-bold text-red-600">{stats.overdue}</div>
-            <p className="text-xs text-muted-foreground">즉시 확인 필요</p>
+            <p className="text-xs text-muted-foreground">{t('documentList.dashboard.checkImmediately')}</p>
           </CardContent>
         </Card>
         
         <Card className="cursor-pointer hover:shadow-md transition-shadow" onClick={() => setQuickFilter('due_soon')}>
           <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
-            <CardTitle className="text-sm font-medium">마감 임박</CardTitle>
+            <CardTitle className="text-sm font-medium">{t('documentList.dashboard.dueSoonDocuments')}</CardTitle>
             <Clock className="h-4 w-4 text-orange-500" />
           </CardHeader>
           <CardContent>
             <div className="text-2xl font-bold text-orange-600">{stats.dueSoon}</div>
-            <p className="text-xs text-muted-foreground">3일 이내 마감</p>
+            <p className="text-xs text-muted-foreground">{t('documentList.dashboard.dueInDays')}</p>
           </CardContent>
         </Card>
         
         <Card>
           <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
-            <CardTitle className="text-sm font-medium">평균 진행률</CardTitle>
+            <CardTitle className="text-sm font-medium">{t('documentList.dashboard.averageProgress')}</CardTitle>
             <Target className="h-4 w-4 text-green-500" />
           </CardHeader>
           <CardContent>
             <div className="text-2xl font-bold text-green-600">{stats.avgProgress}%</div>
-            <p className="text-xs text-muted-foreground">전체 프로젝트 진행도</p>
+            <p className="text-xs text-muted-foreground">{t('documentList.dashboard.overallProgress')}</p>
           </CardContent>
         </Card>
       </div>
@@ -460,7 +476,7 @@ export function EnhancedDocumentsTable({
             className="cursor-pointer hover:bg-primary hover:text-primary-foreground whitespace-nowrap"
             onClick={() => setQuickFilter('all')}
           >
-            전체 ({stats.total})
+            {t('documentList.quickFilters.all')} ({stats.total})
           </Badge>
           <Badge 
             variant={quickFilter === 'overdue' ? 'destructive' : 'outline'}
@@ -468,7 +484,7 @@ export function EnhancedDocumentsTable({
             onClick={() => setQuickFilter('overdue')}
           >
             <AlertTriangle className="w-3 h-3 mr-1" />
-            지연 ({stats.overdue})
+            {t('documentList.quickFilters.overdue')} ({stats.overdue})
           </Badge>
           <Badge 
             variant={quickFilter === 'due_soon' ? 'default' : 'outline'}
@@ -476,7 +492,7 @@ export function EnhancedDocumentsTable({
             onClick={() => setQuickFilter('due_soon')}
           >
             <Clock className="w-3 h-3 mr-1" />
-            마감임박 ({stats.dueSoon})
+            {t('documentList.quickFilters.dueSoon')} ({stats.dueSoon})
           </Badge>
           <Badge 
             variant={quickFilter === 'in_progress' ? 'default' : 'outline'}
@@ -484,7 +500,7 @@ export function EnhancedDocumentsTable({
             onClick={() => setQuickFilter('in_progress')}
           >
             <Users className="w-3 h-3 mr-1" />
-            진행중 ({stats.inProgress})
+            {t('documentList.quickFilters.inProgress')} ({stats.inProgress})
           </Badge>
           <Badge 
             variant={quickFilter === 'high_priority' ? 'destructive' : 'outline'}
@@ -492,7 +508,7 @@ export function EnhancedDocumentsTable({
             onClick={() => setQuickFilter('high_priority')}
           >
             <Target className="w-3 h-3 mr-1" />
-            높은우선순위 ({stats.highPriority})
+            {t('documentList.quickFilters.highPriority')} ({stats.highPriority})
           </Badge>
         </div>
 
@@ -500,7 +516,7 @@ export function EnhancedDocumentsTable({
         <div className="flex items-center gap-2 flex-shrink-0">
           <Select value={drawingKindFilter} onValueChange={setDrawingKindFilter}>
             <SelectTrigger className="w-[140px]">
-              <SelectValue placeholder="문서 종류" />
+              <SelectValue placeholder={t('documentList.filters.selectDocumentType')} />
             </SelectTrigger>
             <SelectContent>
               {DRAWING_KIND_OPTIONS.map(option => (
@@ -520,7 +536,7 @@ export function EnhancedDocumentsTable({
           {drawingKindFilter === "B4" && (
             <div className="flex items-center gap-1 text-blue-600 bg-blue-50 px-2 py-1 rounded text-xs">
               <Settings className="h-3 w-3" />
-              <span className="hidden sm:inline">상세정보 확장가능</span>
+              <span className="hidden sm:inline">{t('documentList.ui.expandedInfoAvailable')}</span>
             </div>
           )}
         </div>
-- 
cgit v1.2.3

