diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 1aec73e63..95666f8ca 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -20,6 +20,7 @@ import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRe import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm"; import { z } from "zod"; import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal"; +import { Toaster } from "react-hot-toast"; export default function PublicReuseFaciltyInsert() { const { code, pbnst, pubHasuInit,pbnstRegInit } = useWrStore((state) => state); @@ -32,6 +33,7 @@ export default function PublicReuseFaciltyInsert() { const [searchTxt, setSearchTxt] = useState(); const [bdstTable, setbdstTable] = useState(); const [selectBdst, setSelectBdst] = useState(null); + const [selectedRow, setSelectedRow] = useState(null); useEffect(() => { if (!pbnst.isInit ) { @@ -55,6 +57,14 @@ useEffect(() => { }; const cellClick = (val: number | undefined) => { if (val === undefined) return; + console.log("pbnstRes", pbnstRes) + const selectRow = pbnstHasuRes?.[val]; + setSelectedRow(selectRow); + console.log("아제발", selectRow) + if (pbnstRes === null){ + alert("등록된 재이용시설 정보가 없습니다. 신규등록 하십시오.") + return; + } setSelectBdst(pbnstRes); setPbnstBiz(pbnstRes?.fcBizs) }; @@ -141,7 +151,7 @@ useEffect(() => { } + body={} bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { @@ -149,6 +159,7 @@ useEffect(() => { }} /> + ); diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index aaafb9ba4..29af7285a 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -102,6 +102,12 @@ const getBizCycle = (fcBizs: z.infer[]) => { return pbnstBizCycle; }; + +const initFetch = async (code:string|undefined) => { + const pbnstRes =await getFetch("wr", `${code}`); + return pbnstRes; +}; + export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { return { pubHasuInit: async (txt: string | undefined) => { @@ -125,7 +131,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { pbnstRegInit: async (txt: string | undefined) => { try { - //const pbnstRes = await initFetch(txt); + // const pbnstRes = await initFetch(txt); const pbnstRes = exampleData; diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx index 3d37a8832..4ffae932d 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -76,8 +76,8 @@ export function PbnstMngForm({ data }: { data: customPbnst }) { const onSelectValue = (val: string) => {}; useEffect(() => { - form.reset(data); - setRuseOperData(data?.fcOpers); + form.reset(data); + setRuseOperData(data.fcOpers); }, [data]); // 2. Define a submit handler. diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index 3d33d3e92..b46bd028e 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -7,114 +7,51 @@ import { getCity } from "@/components/lib/func/commom"; import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm"; import { ScrollArea, SelectBox, UiTable, type SelectDataType } from "@common/business_components"; import { Button, Input, Label, Tabs, TabsContent, TabsList, TabsTrigger } from "@common/components/ui"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import type { objSearchType } from "../bdstRegModal/bdstRegModal"; import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm"; -export function PbnstRegModal() { - const {code, pbnst} = useWrStore((state) => { + +export function PbnstRegModal({ data }: { data: customPbnst }) { + + const { code, pbnst } = useWrStore((state) => { return state; }); const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst; - const [selectSgg, setSelectSgg] = useState() - const [objSearch, setObjSearch] = useState({sgg:"",city:""}); - const [searchTxt, setSearchTxt] = useState() - const [bdstTable, setbdstTable] = useState(); - const [selectBdst, setSelectBdst] = useState(null); - const [pbnstBiz, setPbnstBiz] = useState(); const [pbnstBdstForm, setPbnstBdstForm] = useState({} as customPbnst); const [currentTab, setCurrentTab] = useState("mng"); // const nodeList = headMakeColSpan(pubFacHeadList.moUpHeadList); - const getSelCity = (val: string | number) => { - const cityValue = String(val); - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: '' }); - }; - const getSgg = (val: string | number) => { - console.log(val); - setObjSearch({...objSearch,sgg: String(val)}) - }; - const tableClick: (val: number | undefined , headId:string) => void = (val ,headId) => { - // if(val!==undefined && bdst?.bdstBase.length>0){ - // const data:BdstTypeMap[T] =bdst?.bdstBase[val] - // if (data) { - // setRainBdstForm(data); - // } - // } - } + const handleTabChange = (value: string) => { setCurrentTab(value); }; - return ( - <> -
- - {""} - - - {" "} - - - {}}/> - -
-
-
-

공공 하수처리시설 목록

- -
- (tableClick(idx, headId || ""))} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}> - {/* {nodeList} */} - -
-
-
- - - - 시설정보 - 차수별정보 - - - - - - - - -
- - + useEffect(() => { + if (!data) return; + console.log("데이터", data) + }, [data]); - -
-
-
+ return ( + <> +

하수재이용 시설 신규등록

+ +
+ + + + 시설정보 + 차수별정보 + + + + + + + + + - + ) }