summaryrefslogtreecommitdiff
path: root/lib/rfq-last/table
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rfq-last/table')
-rw-r--r--lib/rfq-last/table/create-general-rfq-dialog.tsx67
-rw-r--r--lib/rfq-last/table/rfq-table-columns.tsx4
2 files changed, 14 insertions, 57 deletions
diff --git a/lib/rfq-last/table/create-general-rfq-dialog.tsx b/lib/rfq-last/table/create-general-rfq-dialog.tsx
index 2c69f4b7..f7515787 100644
--- a/lib/rfq-last/table/create-general-rfq-dialog.tsx
+++ b/lib/rfq-last/table/create-general-rfq-dialog.tsx
@@ -70,22 +70,13 @@ const itemSchema = z.object({
// 일반견적 생성 폼 스키마
const createGeneralRfqSchema = z.object({
rfqType: z.string().min(1, "견적 종류를 선택해주세요"),
- customRfqType: z.string().optional(),
rfqTitle: z.string().min(1, "견적명을 입력해주세요"),
dueDate: z.date({
- required_error: "마감일을 선택해주세요",
+ required_error: "제출마감일을 선택해주세요",
}),
- picUserId: z.number().min(1, "구매 담당자를 선택해주세요"),
+ picUserId: z.number().min(1, "견적담당자를 선택해주세요"),
remark: z.string().optional(),
items: z.array(itemSchema).min(1, "최소 하나의 아이템을 추가해주세요"),
-}).refine((data) => {
- if (data.rfqType === "기타") {
- return data.customRfqType && data.customRfqType.trim().length > 0
- }
- return true
-}, {
- message: "견적 종류를 직접 입력해주세요",
- path: ["customRfqType"],
})
type CreateGeneralRfqFormValues = z.infer<typeof createGeneralRfqSchema>
@@ -120,7 +111,6 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
resolver: zodResolver(createGeneralRfqSchema),
defaultValues: {
rfqType: "",
- customRfqType: "",
rfqTitle: "",
dueDate: undefined,
picUserId: userId || undefined,
@@ -142,12 +132,9 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
name: "items",
})
- // 견적 종류 변경 시 customRfqType 필드 초기화
+ // 견적 종류 변경
const handleRfqTypeChange = (value: string) => {
form.setValue("rfqType", value)
- if (value !== "기타") {
- form.setValue("customRfqType", "")
- }
}
// RFQ 코드 미리보기 생성
@@ -233,7 +220,6 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
if (!newOpen) {
form.reset({
rfqType: "",
- customRfqType: "",
rfqTitle: "",
dueDate: undefined,
picUserId: userId || undefined,
@@ -269,12 +255,9 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
setIsLoading(true)
try {
- // 견적 종류가 "기타"인 경우 customRfqType 사용
- const finalRfqType = data.rfqType === "기타" ? data.customRfqType || "기타" : data.rfqType
-
// 서버 액션 호출
const result = await createGeneralRfqAction({
- rfqType: finalRfqType,
+ rfqType: data.rfqType,
rfqTitle: data.rfqTitle,
dueDate: data.dueDate,
picUserId: data.picUserId,
@@ -325,7 +308,6 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
})
}
- const isCustomRfqType = form.watch("rfqType") === "기타"
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
@@ -360,7 +342,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
control={form.control}
name="rfqType"
render={({ field }) => (
- <FormItem>
+ <FormItem className="flex flex-col">
<FormLabel>
견적 종류 <span className="text-red-500">*</span>
</FormLabel>
@@ -371,50 +353,25 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
</SelectTrigger>
</FormControl>
<SelectContent>
- <SelectItem value="정기견적">정기견적</SelectItem>
- <SelectItem value="긴급견적">긴급견적</SelectItem>
<SelectItem value="단가계약">단가계약</SelectItem>
- <SelectItem value="기술견적">기술견적</SelectItem>
- <SelectItem value="예산견적">예산견적</SelectItem>
- <SelectItem value="기타">기타</SelectItem>
+ <SelectItem value="매각계약">매각계약</SelectItem>
+ <SelectItem value="일반계약">일반계약</SelectItem>
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
-
- {/* 기타 견적 종류 입력 필드 */}
- {isCustomRfqType && (
- <FormField
- control={form.control}
- name="customRfqType"
- render={({ field }) => (
- <FormItem>
- <FormLabel>
- 견적 종류 직접 입력 <span className="text-red-500">*</span>
- </FormLabel>
- <FormControl>
- <Input
- placeholder="견적 종류를 입력해주세요"
- {...field}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- )}
</div>
- {/* 마감일 */}
+ {/* 제출마감일 */}
<FormField
control={form.control}
name="dueDate"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>
- 마감일 <span className="text-red-500">*</span>
+ 제출마감일 <span className="text-red-500">*</span>
</FormLabel>
<Popover>
<PopoverTrigger asChild>
@@ -429,7 +386,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
{field.value ? (
format(field.value, "yyyy-MM-dd")
) : (
- <span>마감일을 선택하세요</span>
+ <span>제출마감일을 선택하세요 (미선택 시 생성일 +7일)</span>
)}
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
</Button>
@@ -483,7 +440,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>
- 구매 담당자 <span className="text-red-500">*</span>
+ 견적담당자 <span className="text-red-500">*</span>
</FormLabel>
<FormControl>
<Popover open={userPopoverOpen} onOpenChange={setUserPopoverOpen}>
@@ -503,7 +460,7 @@ export function CreateGeneralRfqDialog({ onSuccess }: CreateGeneralRfqDialogProp
) : (
<>
<span className="truncate mr-1 flex-grow text-left">
- {selectedUser ? selectedUser.name : "구매 담당자를 선택하세요"}
+ {selectedUser ? selectedUser.name : "견적담당자를 선택하세요"}
</span>
<ChevronsUpDown className="h-4 w-4 opacity-50 flex-shrink-0" />
</>
diff --git a/lib/rfq-last/table/rfq-table-columns.tsx b/lib/rfq-last/table/rfq-table-columns.tsx
index eaf00660..fc7f4415 100644
--- a/lib/rfq-last/table/rfq-table-columns.tsx
+++ b/lib/rfq-last/table/rfq-table-columns.tsx
@@ -501,8 +501,8 @@ export function getRfqColumns({
cell: ({ row }) => {
const series = row.original.series;
if (!series) return "-";
- const label = series === "SS" ? "시리즈 통합" : series === "II" ? "품목 통합" : series;
- return <Badge variant="outline">{label}</Badge>;
+ // const label = series === "SS" ? "시리즈 통합" : series === "II" ? "품목 통합" : series;
+ return <Badge variant="outline">{series}</Badge>;
},
size: 100,
},