summaryrefslogtreecommitdiff
path: root/lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx')
-rw-r--r--lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx105
1 files changed, 82 insertions, 23 deletions
diff --git a/lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx b/lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx
index 023bcfba..765b0279 100644
--- a/lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx
+++ b/lib/vendor-regular-registrations/table/vendor-regular-registrations-table-columns.tsx
@@ -10,9 +10,12 @@ import type { VendorRegularRegistration } from "@/config/vendorRegularRegistrati
import { DocumentStatusDialog } from "@/components/vendor-regular-registrations/document-status-dialog"
import { Button } from "@/components/ui/button"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
-import { Eye, FileText, Ellipsis } from "lucide-react"
+import { Eye, FileText, Ellipsis, Shield, Package } from "lucide-react"
import { toast } from "sonner"
import { useState } from "react"
+import { SafetyQualificationUpdateSheet } from "./safety-qualification-update-sheet"
+import { MajorItemsUpdateSheet } from "../major-items-update-sheet"
+
const statusLabels = {
audit_pass: "실사통과",
@@ -20,6 +23,7 @@ const statusLabels = {
cp_review: "CP검토",
cp_finished: "CP완료",
approval_ready: "조건충족",
+ registration_requested: "등록요청됨",
in_review: "정규등록검토",
pending_approval: "장기미등록",
}
@@ -30,6 +34,7 @@ const statusColors = {
cp_review: "bg-yellow-100 text-yellow-800",
cp_finished: "bg-purple-100 text-purple-800",
approval_ready: "bg-emerald-100 text-emerald-800",
+ registration_requested: "bg-indigo-100 text-indigo-800",
in_review: "bg-orange-100 text-orange-800",
pending_approval: "bg-red-100 text-red-800",
}
@@ -159,22 +164,58 @@ export function getColumns(): ColumnDef<VendorRegularRegistration>[] {
},
{
id: "documentStatus",
- header: "문서/자료 접수 현황",
+ header: "진행현황",
cell: ({ row }) => {
const DocumentStatusCell = () => {
const [documentDialogOpen, setDocumentDialogOpen] = useState(false)
const registration = row.original
+
+ // 문서 현황 계산 (국가별 요구사항 적용)
+ const isForeign = registration.country !== 'KR'
+ const requiredDocs = isForeign ? 4 : 3 // 외자: 4개(통장사본 포함), 내자: 3개(통장사본 제외)
+ const submittedDocs = Object.values(registration.documentSubmissions).filter(Boolean).length
+ const incompleteDocs = requiredDocs - submittedDocs
+
+ // 기본계약 현황 계산
+ const totalContracts = registration.basicContracts?.length || 0
+ const completedContracts = registration.basicContracts?.filter(c => c.status === "COMPLETED").length || 0
+ const incompleteContracts = totalContracts - completedContracts
+
+ // 안전적격성 평가 현황
+ const safetyCompleted = !!registration.safetyQualificationContent
+
+ // 추가정보 현황
+ const additionalInfoCompleted = registration.additionalInfo
+
+ // 전체 미완료 항목 계산
+ const totalIncomplete =
+ (incompleteDocs > 0 ? 1 : 0) +
+ (incompleteContracts > 0 ? 1 : 0) +
+ (!safetyCompleted ? 1 : 0) +
+ (!additionalInfoCompleted ? 1 : 0)
+
+ const isAllComplete = totalIncomplete === 0
return (
<>
- <Button
- variant="ghost"
- size="sm"
- onClick={() => setDocumentDialogOpen(true)}
- >
- <Eye className="w-4 h-4" />
- 현황보기
- </Button>
+ <div className="space-y-1">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => setDocumentDialogOpen(true)}
+ className="h-auto p-1 text-left justify-start"
+ >
+ <div className="space-y-0.5">
+ {isAllComplete ? (
+ <div className="text-xs text-green-600 font-medium">모든 항목 완료</div>
+ ) : (
+ <div className="text-xs text-orange-600 font-medium">
+ 총 {totalIncomplete}건 미완료
+ </div>
+ )}
+ </div>
+ </Button>
+ </div>
<DocumentStatusDialog
open={documentDialogOpen}
onOpenChange={setDocumentDialogOpen}
@@ -222,7 +263,8 @@ export function getColumns(): ColumnDef<VendorRegularRegistration>[] {
id: "actions",
cell: ({ row }) => {
const ActionsDropdownCell = () => {
- const [documentDialogOpen, setDocumentDialogOpen] = useState(false)
+ const [safetyQualificationSheetOpen, setSafetyQualificationSheetOpen] = useState(false)
+ const [majorItemsSheetOpen, setMajorItemsSheetOpen] = useState(false)
const registration = row.original
return (
@@ -239,26 +281,43 @@ export function getColumns(): ColumnDef<VendorRegularRegistration>[] {
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-[160px]">
<DropdownMenuItem
- onClick={() => setDocumentDialogOpen(true)}
+ onClick={() => setSafetyQualificationSheetOpen(true)}
>
- <Eye className="mr-2 h-4 w-4" />
- 현황보기
+ <Shield className="mr-2 h-4 w-4" />
+ 안전적격성 평가
</DropdownMenuItem>
<DropdownMenuItem
- onClick={() => {
- toast.info("정규업체 등록 요청 기능은 준비 중입니다.")
- }}
+ onClick={() => setMajorItemsSheetOpen(true)}
>
- <FileText className="mr-2 h-4 w-4" />
- 등록요청
+ <Package className="mr-2 h-4 w-4" />
+ 주요품목 등록
</DropdownMenuItem>
+
</DropdownMenuContent>
</DropdownMenu>
- <DocumentStatusDialog
- open={documentDialogOpen}
- onOpenChange={setDocumentDialogOpen}
- registration={registration}
+ <SafetyQualificationUpdateSheet
+ open={safetyQualificationSheetOpen}
+ onOpenChange={setSafetyQualificationSheetOpen}
+ registrationId={registration.id}
+ vendorName={registration.companyName}
+ currentContent={registration.safetyQualificationContent}
+ onSuccess={() => {
+ // 페이지 새로고침 또는 데이터 리페치
+ window.location.reload()
+ }}
+ />
+ <MajorItemsUpdateSheet
+ open={majorItemsSheetOpen}
+ onOpenChange={setMajorItemsSheetOpen}
+ registrationId={registration.id}
+ vendorName={registration.companyName}
+ currentItems={registration.majorItems}
+ onSuccess={() => {
+ // 페이지 새로고침 또는 데이터 리페치
+ window.location.reload()
+ }}
/>
+
</>
)
}