diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index 385cfb9e8..05a47c53a 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -1,3 +1,4 @@ +'use client' import Link from "next/link"; import { Button } from "@common/components/ui"; diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 2f2c72546..b0bcb9708 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -93,7 +93,7 @@ export default function Home() {
- +
diff --git a/apps/wr/components/lib/type/zod/fcltReg/controlZod.ts b/apps/wr/components/lib/type/zod/fcltReg/controlZod.ts index 52e2d8181..9c49e56cd 100644 --- a/apps/wr/components/lib/type/zod/fcltReg/controlZod.ts +++ b/apps/wr/components/lib/type/zod/fcltReg/controlZod.ts @@ -1,7 +1,7 @@ import { z } from "zod"; -const rainZod = { +export const rainZod = { instlCmptnDt: z.date(), instlCst: z.number(), pntfColKnd: z.string(), @@ -20,7 +20,7 @@ const rainZod = { } -const rainDefZod= { +export const rainDefZod= { instlCmptnDt: new Date(), instlCst: 0, pntfColKnd: "", @@ -37,7 +37,7 @@ const rainDefZod= { grntchBdstCertNo: "", grntchBdstCertGrd: "", } -const bdstZod ={ +export const bdstZod ={ ctpvCd: z.string(), // 시도 sggCd: z.string(), // 시군구 daddr: z.string(), // 위치 @@ -51,7 +51,7 @@ const bdstZod ={ bdstNm: z.string(), } -const bdstDefZod={ +export const bdstDefZod={ ctpvCd: '', // 시도 sggCd: '', // 시군구 daddr: '', // 위치 @@ -65,9 +65,3 @@ const bdstDefZod={ bdstNm: '', } -export const rainForm = z.object({ - ...rainZod, - ...bdstZod -}); -export const rainDefault= {...rainDefZod,bdstDefZod}; - \ No newline at end of file diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/component.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/component.tsx index cbc099cb9..3dafc0878 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/component.tsx @@ -1,32 +1,166 @@ -import { FormField, FormUi } from "@common/business_components"; +import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { FormField, FormUi, SelectBox } from "@common/business_components"; import { Input } from "@common/components"; +export default function BdstReg(form: any) { + const { code } = useWrStore((state) => { + return state; + }); -export default function BdstReg(form:any){ - - - - - return( - <> -
-
- ( - - +
+
+ ( + + { + field.onChange(val); + }} + value={field.value} + /> + + )} + /> +
+
+ ( + + { + field.onChange(val); + }} + value={field.value} + /> + + )} + /> +
+
+ ( + + field.onChange(e.target.value ? new Date(e.target.value) : undefined)} - value={field.value ? field?.value.toString().split('T')[0] : ""} + placeholder="1,000,000" + type="text" + {...field} /> - - )} - /> -
-
- - ) -} \ No newline at end of file +
+ )} + /> + + +
+
+ + ( + + + + )} + /> + + +
+ ( + + { + field.onChange(val); + }} + value={field.value} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + { + field.onChange(val); + }} + value={field.value} + /> + + )} + /> +
+
+
+ + ); +} diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx index 49ca89fc2..6139ab5b5 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx @@ -9,21 +9,26 @@ import { FormUi } from "@common/business_components"; import { useWrStore } from "@/app/store"; import { selectClass, type rainRuseBd, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { useEffect } from "react"; -import { rainDefault, rainForm } from "@/components/lib/type/zod/fcltReg/controlZod"; +import { bdstDefZod, bdstZod, rainDefZod, rainZod } from "@/components/lib/type/zod/fcltReg/controlZod"; +import BdstReg from "../bdstReg/component"; -const formSchema = rainForm; +export function RainRegForm({data,isModal}:{data:rainRuseBd[], isModal:boolean} ) { + + console.log(isModal) + const formSchema = isModal + ? z.object({ ...rainZod, ...bdstZod }) + : z.object(rainZod) -console.log(formSchema) -export function RainRegForm({data}:{data:rainRuseBd[]} ) { const { rain ,code} = useWrStore((state) => state); const {rainFcltCd } = code useEffect(() => { if (data && data.length > 0) { console.log(data) - const selectedOption = rainFcltCd.find(item => item.val === String(data[0].pntfColKnd)); + const selectedOption = rainFcltCd.find(item => item.val === String(data[0]?.pntfColKnd ?? "")); const formData = { ...data[0], - pntfColKnd: selectedOption ? selectedOption.val : "" + pntfColKnd: selectedOption ? selectedOption.val : "", + instlCmptnDt: data[0]?.instlCmptnDt ? new Date(data[0].instlCmptnDt) : undefined }; form.reset(formData); } @@ -31,24 +36,8 @@ export function RainRegForm({data}:{data:rainRuseBd[]} ) { const form = useForm>({ resolver: zodResolver(formSchema), - defaultValues: rainDefault - // { - // instlCmptnDt: new Date(), - // instlCst: 0, - // pntfColKnd: "", - // pntfColArea: 0, - // filtrTrtmfctYn: "N", - // filtrTrtmfctCpct: "", - // filtrTrtmfctPrs: "", - // instlCstSprtYn: "", - // instlCstSprtAmt: "", - // grntchCstSprtYn: "", - // grntchCstSprtCst: "", - // grntchBdstCertYn: "", - // grntchBdstCertYr: "", - // grntchBdstCertNo: "", - // grntchBdstCertGrd: "", - // }, + defaultValues: isModal ? {...rainDefZod, ...bdstDefZod} : {...rainDefZod} + }); // form 값이 변경될 때마다 로그 출력 @@ -117,7 +106,9 @@ export function RainRegForm({data}:{data:rainRuseBd[]} ) { )} /> - + + + {isModal? :<>}

빗물이용시설 정보 diff --git a/apps/wr/components/ui/modal/bdstReg/component.tsx b/apps/wr/components/ui/modal/bdstReg/component.tsx index 13ab4df08..e505242ae 100644 --- a/apps/wr/components/ui/modal/bdstReg/component.tsx +++ b/apps/wr/components/ui/modal/bdstReg/component.tsx @@ -62,7 +62,7 @@ export function BdstReg(){

- +
diff --git a/packages/common/business_components/src/ui/alert_dialog_ui/index.tsx b/packages/common/business_components/src/ui/dialog_ui/index.tsx similarity index 100% rename from packages/common/business_components/src/ui/alert_dialog_ui/index.tsx rename to packages/common/business_components/src/ui/dialog_ui/index.tsx diff --git a/packages/common/business_components/src/ui/main_content_div/index.tsx b/packages/common/business_components/src/ui/main_content_div/index.tsx index d1e818196..1432f472e 100644 --- a/packages/common/business_components/src/ui/main_content_div/index.tsx +++ b/packages/common/business_components/src/ui/main_content_div/index.tsx @@ -2,7 +2,7 @@ export default function MainDiv(props: {children: React.ReactNode}) { return ( -
+
{props.children}
) diff --git a/packages/common/business_components/src/ui/select/index.tsx b/packages/common/business_components/src/ui/select/index.tsx index 1f1294666..c7fbc5ef0 100644 --- a/packages/common/business_components/src/ui/select/index.tsx +++ b/packages/common/business_components/src/ui/select/index.tsx @@ -5,7 +5,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ". /** 차트 기본 스타일 */ interface SelectBox1 { text:string, - val:string + val:string|number } const SelectBox = React.forwardRef< diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index d22a5835d..b8c2706bc 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -22,10 +22,11 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa return ( <> {headName ?
- {headName} +

{headName}

: <>} - - +
+
+ {children ? <>{children} : {headlist?.map((head) => ( {head.title} @@ -41,8 +42,9 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa ))} -
- {total <= 0 ? <> : } + + {total <= 0 ? <> : } +
); } diff --git a/packages/common/business_components/src/ui/title/index.tsx b/packages/common/business_components/src/ui/title/index.tsx index aaa9d74fd..5b6d9bff4 100644 --- a/packages/common/business_components/src/ui/title/index.tsx +++ b/packages/common/business_components/src/ui/title/index.tsx @@ -2,7 +2,9 @@ function Title(props: {title: string}) { return ( -

{props.title}

+

+ {props.title} +

) }