From b0f8638df225a9e0f69c96106b964d429a53e593 Mon Sep 17 00:00:00 2001 From: bicochan Date: Fri, 4 Apr 2025 16:24:57 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=82=AC=EC=9D=B4=ED=8A=B8=20=EB=B0=98?= =?UTF-8?q?=EC=98=81=20api=20=EB=82=A0=EC=A7=9C=20payload=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entities/posting/model/posting-interface.ts | 4 ++-- .../src/entities/posting/ui/posting-dialog.tsx | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/cs/src/entities/posting/model/posting-interface.ts b/apps/cs/src/entities/posting/model/posting-interface.ts index 0c9d65a51..c314d2f30 100644 --- a/apps/cs/src/entities/posting/model/posting-interface.ts +++ b/apps/cs/src/entities/posting/model/posting-interface.ts @@ -19,8 +19,8 @@ export const postSchema = z.object({ pstgTypeCd: z.string(), pstgTypeNm: z.string(), pstgTrgtNo: z.number(), - pstgBgngDt: z.string(), - pstgEndDt: z.string(), + pstgBgngDt: z.string().optional(), + pstgEndDt: z.string().optional(), pstgPrdSeCd: z.string(), pstgPrdSeNm: z.string(), delYn: z.string(), diff --git a/apps/cs/src/entities/posting/ui/posting-dialog.tsx b/apps/cs/src/entities/posting/ui/posting-dialog.tsx index df07e2182..d7c0b60ca 100644 --- a/apps/cs/src/entities/posting/ui/posting-dialog.tsx +++ b/apps/cs/src/entities/posting/ui/posting-dialog.tsx @@ -90,6 +90,9 @@ function PostingDialog({ postingType, postingTargets }: PostingDialogProps) { name: "pstg", }); + const isFormValid = + fields.length && fields.every((field) => field.pstgPrdSeCd !== ""); + const isAllSelected = siteList && selectedRows.length === siteList.content.length; @@ -164,19 +167,28 @@ function PostingDialog({ postingType, postingTargets }: PostingDialogProps) { replace([]); setSelectedRows([]); } else { - setSelectedRows(siteList?.content.map((_, i) => i) ?? []); replace([]); + setSelectedRows(siteList?.content.map((_, i) => i) ?? []); siteList?.content.forEach((_, i) => handleAppendFields(i)); } }; const handlePeriodCodeChange = (siteId: string) => (value: string) => { + const from = dayjs().format("YYYY-MM-DD 00:00:00"); + const to = dayjs().add(Number(value), "day").format("YYYY-MM-DD 23:59:59"); + setRememberPeriodCode((prev) => ({ ...prev, [siteId]: value, })); + setRememberPeriodDate((prev) => ({ + ...prev, + [siteId]: { from, to }, + })); handleUpdateFields(siteId)({ pstgPrdSeCd: value, + pstgBgngDt: from, + pstgEndDt: to, }); }; @@ -288,7 +300,7 @@ function PostingDialog({ postingType, postingTargets }: PostingDialogProps) { -