diff --git a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx index 23badd2c4..daeb64f67 100644 --- a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx +++ b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx @@ -22,8 +22,8 @@ const headMakeColSpan = (upHeadList: TableUpperProps[]) => { export default function Home() { - const { building } = useWrStore((state) => state); - const nodeList = headMakeColSpan(building.upHeadList); + const { rain } = useWrStore((state) => state); + const nodeList = headMakeColSpan(rain.upHeadList); const total = 100; @@ -50,7 +50,7 @@ export default function Home() {
- + {nodeList}
diff --git a/apps/wr/components/ui/IteratreForm.tsx b/apps/wr/components/ui/IteratreForm.tsx index 410923547..9d35d865e 100644 --- a/apps/wr/components/ui/IteratreForm.tsx +++ b/apps/wr/components/ui/IteratreForm.tsx @@ -1,22 +1,38 @@ -import { FormControl, FormField, FormItem, FormLabel, FormMessage, SelectBox } from "@common/business_components"; +import { FileUpload, FormControl, FormField, FormItem, FormLabel, FormMessage, SelectBox } from "@common/business_components"; +import { DatePicker } from "@common/components"; import { Input } from "@common/components"; -type typeOfForm ={ +export type typeOfForm ={ labelName: string; type: string; - selectvlaue?: { text: string; val: string }[]; - placeholder:any + placeholder:any; formName: string; + selectValue:selectValue|undefined; +} +type onSelectValue = (val:string) => void; +export type selectValue ={ + label:string, + value:{ text: string; val: string }[], + fun:onSelectValue } -type onSelectValue = (val:string) => void; +export function IteraterFrom(formData:typeOfForm[],form:any , formClass:string ){ - -export function IteraterFrom(formData:typeOfForm[],form:any , formClass:string , onSelectValue:onSelectValue ){ - - return ( + const formItem =(data:typeOfForm,field:any)=>{ + let tag + if(data.type==='select'){ + tag= (data.selectValue ? {...form} : null) + }else if(data.type==='date'){ + tag =() + }else{ + tag=() + } + return tag; + } + + return ( <> {formData.map((data: typeOfForm, index) => ( {data.labelName} - {data.selectvlaue == undefined ? ( - - ) : ( - - )} + {formItem(data,field)} diff --git a/apps/wr/components/ui/rainReuseInsertForm.tsx b/apps/wr/components/ui/rainReuseInsertForm.tsx index 8a95d07e5..2625f2aea 100644 --- a/apps/wr/components/ui/rainReuseInsertForm.tsx +++ b/apps/wr/components/ui/rainReuseInsertForm.tsx @@ -15,22 +15,19 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { IteraterFrom } from "./IteratreForm"; +import { FormUi } from "@common/business_components"; +import { useWrStore } from "@/app/store"; const formSchema = z.object({ username: z.string().min(2).max(50), facilityName: z.string().min(2).max(50), }); -type typeOfForm = { - labelName: string; - type: string; - selectvlaue?: { text: string; val: string }[]; - formName: string; -}; export function RainReuseFaciltyInsertForm() { - const total = 100; - + const { rain } = useWrStore((state) => state); + console.log( "building selectHomeWater" + rain.selectHomeWater) + const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { @@ -44,118 +41,12 @@ export function RainReuseFaciltyInsertForm() { // ✅ This will be type-safe and validated. console.log(values); } - const selectYNValue = [ - { text: "Y", val: "1" }, - { text: "N", val: "2" }, - ]; - - let homeWaterData = [ - { - labelName: "종류", - type: "input", - selectvlaue: undefined, - formName: "homeWaterData 1", - placeholder:'ooo' - }, - { - labelName: "면적(m³)", - type: "input", - selectvlaue: undefined, - formName: "homeWaterData 2", - placeholder:'1,000,000' - }, - ]; - let filtrTrtmfct = [ - { - labelName: "유무", - type: "input", - selectvlaue: undefined, - formName: "filtrTrtmfct 1", - placeholder:'Y' - }, - { - labelName: "용량", - type: "input", - selectvlaue: undefined, - formName: "filtrTrtmfct 2", - placeholder:100000 - - }, - { - labelName: "처리공정", - type: "input", - selectvlaue: undefined, - formName: "filtrTrtmfct 3", - placeholder:'원수취수' - }, - ]; - let instlCst = [ - { - labelName: "지원여부", - type: "input", - selectvlaue: undefined, - formName: "instlCst 1", - placeholder:'Y' - }, - { - labelName: "지원여부(원)", - type: "input", - selectvlaue: undefined, - formName: "instlCst 2", - placeholder:1000000 - }, - ]; - let greenBuilding = [ - { - labelName: "설치완료일", - type: "chek", - selectvlaue: selectYNValue , - formName: "greenBuilding 1", - placeholder:'Y' - }, - { - labelName: "인증년도", - type: "input", - selectvlaue: undefined, - formName: " greenBuilding 2", - placeholder:'2024' - }, - { - labelName: "인증번호", - type: "input", - selectvlaue: undefined, - formName: "greenBuilding 3", - placeholder:'wr123456789' - }, - { - labelName: "인증등급", - type: "input", - selectvlaue: undefined, - formName: "greenBuilding 4", - placeholder:'A' - }, - ]; - let baseInfo = [ - { - labelName: "설치완료일", - type: "input", - selectvlaue: undefined , - formName: "baseInfo 1", - placeholder:'2022-1010' - }, - { - labelName: "설치비(월)", - type: "input", - selectvlaue: undefined, - formName: " baseInfo 2", - placeholder:'10000000' - }, - - ]; + const onSelectValue=(val:string)=>{ console.log(val) } + return (
@@ -167,34 +58,26 @@ export function RainReuseFaciltyInsertForm() {
-
- ( - - 설치완료일 - - - - - - )} +
+ ( + + + + )} />
-
+
( - - 설치비(월) - - - - - + + + )} />
@@ -207,12 +90,71 @@ export function RainReuseFaciltyInsertForm() {

✓ 1. 집수면

-
{IteraterFrom(homeWaterData,form,'2',onSelectValue)}
+
+
+ ( + + + + )} + /> +
+
+ ( + + + + + )} + /> +
+

✓ 2. 여과 등 처리시설

-
{IteraterFrom(filtrTrtmfct,form,'2' ,onSelectValue)}
+
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+ +

인센티브 정보 @@ -221,14 +163,80 @@ export function RainReuseFaciltyInsertForm() {

✓ 1. 설치비 지원

-
{IteraterFrom(instlCst,form,'2' ,onSelectValue)}
+
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+

✓ 2. 녹색건축물 인증

-
{IteraterFrom(greenBuilding,form,'2',onSelectValue)}
- - +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+