From fccb00d15466cd0b2d861163663a5070c768ff77 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 2 Sep 2025 09:52:21 +0000 Subject: (대표님) OCR 박진석프로 요청 대응, rfq 변경된 요구사항 구현 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rfq-last/validations.ts | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 lib/rfq-last/validations.ts (limited to 'lib/rfq-last/validations.ts') diff --git a/lib/rfq-last/validations.ts b/lib/rfq-last/validations.ts new file mode 100644 index 00000000..09fd2f6f --- /dev/null +++ b/lib/rfq-last/validations.ts @@ -0,0 +1,65 @@ +// lib/rfq/validation.ts + +import { + createSearchParamsCache, + parseAsArrayOf, + parseAsInteger, + parseAsString, + parseAsStringEnum, + } from "nuqs/server"; + import * as z from "zod"; + + import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers"; + + // RFQ 상태 옵션 + export const RFQ_STATUS_OPTIONS = [ + { value: "RFQ 생성", label: "RFQ 생성" }, + { value: "구매담당지정", label: "구매담당지정" }, + { value: "견적요청문서 확정", label: "견적요청문서 확정" }, + { value: "Short List 확정", label: "Short List 확정" }, + { value: "TBE 완료", label: "TBE 완료" }, + { value: "RFQ 발송", label: "RFQ 발송" }, + { value: "견적접수", label: "견적접수" }, + { value: "최종업체선정", label: "최종업체선정" }, + ]; + + // 시리즈 옵션 + export const SERIES_OPTIONS = [ + { value: "SS", label: "시리즈 통합" }, + { value: "II", label: "품목 통합" }, + { value: "", label: "통합 없음" }, + ]; + + // RFQ 카테고리 (탭 구분용) + export const RFQ_CATEGORY_OPTIONS = [ + { value: "all", label: "전체" }, + { value: "general", label: "일반견적" }, + { value: "itb", label: "ITB" }, + { value: "rfq", label: "RFQ" }, + ]; + + // ============= 메인 검색 파라미터 스키마 ============= + + export const searchParamsRfqCache = createSearchParamsCache({ + flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault([]), + page: parseAsInteger.withDefault(1), + perPage: parseAsInteger.withDefault(10), + sort: getSortingStateParser().withDefault([ + { id: "createdAt", desc: true }, + ]), + + filters: getFiltersStateParser().withDefault([]), + joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), + + // 검색 + search: parseAsString.withDefault(""), + + // RFQ 카테고리 (전체/일반견적/ITB/RFQ) + rfqCategory: parseAsStringEnum(["all", "general", "itb", "rfq"]).withDefault("all"), + }); + + // ============= 타입 정의 ============= + + export type GetRfqsSchema = Awaited< + ReturnType + >; \ No newline at end of file -- cgit v1.2.3