"use client" import * as React from "react" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, } from "@/components/ui/dialog" import { Button } from "@/components/ui/button" import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { RfqWithAll } from "../types" /** * 아이템 구조 예시 * - API 응답에서 quantity가 "string" 형태이므로, * 숫자로 사용하실 거라면 parse 과정이 필요할 수 있습니다. */ export interface RfqItem { id: number itemCode: string itemName: string quantity: string description: string uom: string } /** * 첨부파일 구조 예시 */ export interface RfqAttachment { id: number fileName: string filePath: string vendorId: number | null evaluationId: number | null } /** * 다이얼로그 내에서만 사용할 단순 아이템 구조 (예: 임시/기본값 표출용) */ export interface DefaultItem { id?: number itemCode: string description?: string | null quantity?: number | null uom?: string | null } /** * RfqsItemsDialog 컴포넌트 Prop 타입 */ export interface RfqsItemsDialogProps { open: boolean onOpenChange: (open: boolean) => void rfq: RfqWithAll defaultItems?: DefaultItem[] } export function RfqsItemsDialog({ open, onOpenChange, rfq, }: RfqsItemsDialogProps) { return ( Items for RFQ {rfq?.rfqCode} Below is the list of items for this RFQ.
{rfq && rfq.items.length === 0 && (

No items found.

)} {rfq && rfq.items.length > 0 && ( {/* 필요에 따라 TableCaption 등을 추가해도 좋습니다. */} Item Code Item Code Description Qty UoM {rfq.items.map((it, idx) => ( {it.itemCode || "No Code"} {it.itemName || "No Name"} {it.description || "-"} {it.quantity ?? 1} {it.uom ?? "each"} ))}
)}
) }