diff options
Diffstat (limited to 'lib/rfq-last/table')
| -rw-r--r-- | lib/rfq-last/table/create-general-rfq-dialog.tsx | 32 | ||||
| -rw-r--r-- | lib/rfq-last/table/rfq-filter-sheet.tsx | 16 | ||||
| -rw-r--r-- | lib/rfq-last/table/rfq-items-dialog.tsx | 45 | ||||
| -rw-r--r-- | lib/rfq-last/table/rfq-table.tsx | 17 |
4 files changed, 78 insertions, 32 deletions
diff --git a/lib/rfq-last/table/create-general-rfq-dialog.tsx b/lib/rfq-last/table/create-general-rfq-dialog.tsx index 023c9f2a..1d369648 100644 --- a/lib/rfq-last/table/create-general-rfq-dialog.tsx +++ b/lib/rfq-last/table/create-general-rfq-dialog.tsx @@ -57,6 +57,7 @@ import { toast } from "sonner" import { ScrollArea } from "@/components/ui/scroll-area" import { Separator } from "@/components/ui/separator" import { createGeneralRfqAction, getPUsersForFilter, previewGeneralRfqCode } from "../service" +import { ProjectSelector } from "@/components/ProjectSelector" // 아이템 스키마 const itemSchema = z.object({ @@ -75,6 +76,7 @@ const createGeneralRfqSchema = z.object({ required_error: "제출마감일을 선택해주세요", }), picUserId: z.number().min(1, "견적담당자를 선택해주세요"), + projectId: z.number().optional(), remark: z.string().optional(), items: z.array(itemSchema).min(1, "최소 하나의 자재를 추가해주세요"), }) @@ -114,6 +116,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp rfqTitle: "", dueDate: undefined, picUserId: userId || undefined, + projectId: undefined, remark: "", items: [ { @@ -223,6 +226,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp rfqTitle: "", dueDate: undefined, picUserId: userId || undefined, + projectId: undefined, remark: "", items: [ { @@ -261,8 +265,15 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp rfqTitle: data.rfqTitle, dueDate: data.dueDate, picUserId: data.picUserId, + projectId: data.projectId, remark: data.remark || "", - items: data.items, + items: data.items as Array<{ + itemCode: string; + itemName: string; + quantity: number; + uom: string; + remark?: string; + }>, createdBy: userId, updatedBy: userId, }) @@ -433,6 +444,25 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp )} /> + {/* 프로젝트 선택 */} + <FormField + control={form.control} + name="projectId" + render={({ field }) => ( + <FormItem className="flex flex-col"> + <FormLabel>프로젝트</FormLabel> + <FormControl> + <ProjectSelector + selectedProjectId={field.value} + onProjectSelect={(project) => field.onChange(project.id)} + placeholder="프로젝트 선택 (선택사항)..." + /> + </FormControl> + <FormMessage /> + </FormItem> + )} + /> + {/* 구매 담당자 - 검색 가능한 셀렉터로 변경 */} <FormField control={form.control} diff --git a/lib/rfq-last/table/rfq-filter-sheet.tsx b/lib/rfq-last/table/rfq-filter-sheet.tsx index b88c5d2a..c0b6c0e2 100644 --- a/lib/rfq-last/table/rfq-filter-sheet.tsx +++ b/lib/rfq-last/table/rfq-filter-sheet.tsx @@ -405,11 +405,11 @@ export function RfqFilterSheet({ name="rfqCode" render={({ field }) => ( <FormItem> - <FormLabel>RFQ 코드</FormLabel> + <FormLabel>견적 No.</FormLabel> <FormControl> <div className="relative"> <Input - placeholder="RFQ 코드 입력" + placeholder="견적 No. 입력" {...field} disabled={isPending} className={cn(field.value && "pr-8", "bg-white")} @@ -433,13 +433,13 @@ export function RfqFilterSheet({ )} /> - {/* 상태 */} + {/* 견적상태 */} <FormField control={form.control} name="status" render={({ field }) => ( <FormItem> - <FormLabel>상태</FormLabel> + <FormLabel>견적상태</FormLabel> <Select value={field.value} onValueChange={field.onChange} @@ -448,7 +448,7 @@ export function RfqFilterSheet({ <FormControl> <SelectTrigger className={cn(field.value && "pr-8", "bg-white")}> <div className="flex w-full justify-between"> - <SelectValue placeholder="상태 선택" /> + <SelectValue placeholder="견적상태 선택" /> {field.value && ( <Button type="button" @@ -535,7 +535,7 @@ export function RfqFilterSheet({ name="projectCode" render={({ field }) => ( <FormItem> - <FormLabel>프로젝트 코드</FormLabel> + <FormLabel>프로젝트</FormLabel> <FormControl> <div className="relative"> <Input @@ -571,11 +571,11 @@ export function RfqFilterSheet({ name="rfqType" render={({ field }) => ( <FormItem> - <FormLabel>견적 유형</FormLabel> + <FormLabel>견적 종류</FormLabel> <FormControl> <div className="relative"> <Input - placeholder="견적 유형 입력" + placeholder="견적 종류 입력" {...field} disabled={isPending} className={cn(field.value && "pr-8", "bg-white")} diff --git a/lib/rfq-last/table/rfq-items-dialog.tsx b/lib/rfq-last/table/rfq-items-dialog.tsx index eb6c05b1..466bcbd6 100644 --- a/lib/rfq-last/table/rfq-items-dialog.tsx +++ b/lib/rfq-last/table/rfq-items-dialog.tsx @@ -168,17 +168,6 @@ export function RfqItemsDialog({ isOpen, onClose, rfqData }: RfqItemsDialogProps return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i] } - // 수량 포맷팅 - const formatQuantity = (quantity: number | null, uom: string | null) => { - if (!quantity) return "-" - return `${quantity.toLocaleString()}${uom ? ` ${uom}` : ""}` - } - - // 중량 포맷팅 - const formatWeight = (weight: number | null, uom: string | null) => { - if (!weight) return "-" - return `${weight.toLocaleString()} ${uom || "KG"}` - } return ( <Dialog open={isOpen} onOpenChange={onClose}> @@ -227,8 +216,10 @@ export function RfqItemsDialog({ isOpen, onClose, rfqData }: RfqItemsDialogProps <TableHead className="w-[60px]">구분</TableHead> <TableHead className="w-[120px]">자재코드</TableHead> <TableHead>자재명</TableHead> - <TableHead className="w-[100px]">수량</TableHead> - <TableHead className="w-[100px]">중량</TableHead> + <TableHead className="w-[80px]">수량</TableHead> + <TableHead className="w-[60px]">수량단위</TableHead> + <TableHead className="w-[80px]">중량</TableHead> + <TableHead className="w-[60px]">중량단위</TableHead> <TableHead className="w-[100px]">납기일</TableHead> <TableHead className="w-[100px]">PR번호</TableHead> <TableHead className="w-[120px]">사양/설계문서</TableHead> @@ -247,6 +238,10 @@ export function RfqItemsDialog({ isOpen, onClose, rfqData }: RfqItemsDialogProps <TableCell><Skeleton className="h-8 w-full" /></TableCell> <TableCell><Skeleton className="h-8 w-full" /></TableCell> <TableCell><Skeleton className="h-8 w-full" /></TableCell> + <TableCell><Skeleton className="h-8 w-full" /></TableCell> + <TableCell><Skeleton className="h-8 w-full" /></TableCell> + <TableCell><Skeleton className="h-8 w-full" /></TableCell> + <TableCell><Skeleton className="h-8 w-full" /></TableCell> </TableRow> ))} </TableBody> @@ -263,8 +258,10 @@ export function RfqItemsDialog({ isOpen, onClose, rfqData }: RfqItemsDialogProps <TableHead className="w-[60px]">구분</TableHead> <TableHead className="w-[120px]">자재코드</TableHead> <TableHead>자재명</TableHead> - <TableHead className="w-[100px]">수량</TableHead> - <TableHead className="w-[100px]">중량</TableHead> + <TableHead className="w-[80px]">수량</TableHead> + <TableHead className="w-[60px]">수량단위</TableHead> + <TableHead className="w-[80px]">중량</TableHead> + <TableHead className="w-[60px]">중량단위</TableHead> <TableHead className="w-[100px]">납기일</TableHead> <TableHead className="w-[100px]">PR번호</TableHead> <TableHead className="w-[100px]">PR 아이템 번호</TableHead> @@ -315,12 +312,22 @@ export function RfqItemsDialog({ isOpen, onClose, rfqData }: RfqItemsDialogProps </TableCell> <TableCell> <span className="text-sm font-medium"> - {formatQuantity(item.quantity, item.uom)} + {item.quantity ? item.quantity.toLocaleString() : "-"} </span> </TableCell> <TableCell> - <span className="text-sm"> - {formatWeight(item.grossWeight, item.gwUom)} + <span className="text-sm text-muted-foreground"> + {item.uom || "-"} + </span> + </TableCell> + <TableCell> + <span className="text-sm font-medium"> + {item.grossWeight ? item.grossWeight.toLocaleString() : "-"} + </span> + </TableCell> + <TableCell> + <span className="text-sm text-muted-foreground"> + {item.gwUom || "-"} </span> </TableCell> <TableCell> @@ -393,7 +400,7 @@ export function RfqItemsDialog({ isOpen, onClose, rfqData }: RfqItemsDialogProps <TableCell> <div className="text-xs"> {[ - item.projectDef && `DEF: ${item.projectDef}`, + item.projectDef && `${item.projectDef}`, item.projectSc && `SC: ${item.projectSc}`, item.projectKl && `KL: ${item.projectKl}`, item.projectLc && `LC: ${item.projectLc}`, diff --git a/lib/rfq-last/table/rfq-table.tsx b/lib/rfq-last/table/rfq-table.tsx index 974662d9..09bf5af4 100644 --- a/lib/rfq-last/table/rfq-table.tsx +++ b/lib/rfq-last/table/rfq-table.tsx @@ -239,17 +239,17 @@ export function RfqTable({ }, [rfqCategory, setRowAction, router]); const filterFields: DataTableFilterField<RfqsLastView>[] = [ - { id: "rfqCode", label: "RFQ 코드" }, + { id: "rfqCode", label: "견적 No." }, { id: "projectName", label: "프로젝트명" }, { id: "itemName", label: "자재명" }, { id: "status", label: "상태" }, ]; const advancedFilterFields: DataTableAdvancedFilterField<RfqsLastView>[] = [ - { id: "rfqCode", label: "RFQ 코드", type: "text" }, + { id: "rfqCode", label: "견적 No.", type: "text" }, { id: "status", - label: "상태", + label: "견적상태", type: "select", options: [ { label: "RFQ 생성", value: "RFQ 생성" }, @@ -272,7 +272,16 @@ export function RfqTable({ { id: "dueDate", label: "마감일", type: "date" }, { id: "rfqSendDate", label: "발송일", type: "date" }, ...(rfqCategory === "general" ? [ - { id: "rfqType", label: "견적 유형", type: "text" }, + { + id: "rfqType", + label: "견적 유형", + type: "select", + options: [ + { label: "단가계약", value: "단가계약" }, + { label: "매각계약", value: "매각계약" }, + { label: "일반계약", value: "일반계약" }, + ] + }, { id: "rfqTitle", label: "견적 제목", type: "text" }, ] as DataTableAdvancedFilterField<RfqsLastView>[] : []), ...(rfqCategory === "itb" ? [ |
