-
-
-
+
+ {/* 시설 등록 */}
+
+
시설 등록
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ {/* 지도점검 결과 */}
+
+
지도점검 결과
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 시설 현황 */}
+
+
시설 현황
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 수요처 관리 */}
+
+
수요처 관리
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 수요처 매칭 */}
+
+
수요처 매칭
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 통계*/}
+
+
통계 매칭
+
+
+
+
+
+
+
+
+
+
+
+
- >
+ >
);
}
diff --git a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx
deleted file mode 100644
index 57c48a84d..000000000
--- a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert/page.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-'use client'
-
-import { ScrollArea, SearchDiv, SelectBox, UiTable } from '@common/business_components';
-import { Button } from '@common/components';
-import { PublicReuseFaciltyFormInsert } from '../../../../components/ui/publicReuseInsertForm';
-import { useWrStore } from '../../../store';
-
-
-
- export default function PublicReuseFaciltyInsert() {
- const {pubFac} = useWrStore((state) => state);
- const { pubFacHeadList, publicReuseFacilityData} = pubFac;
- const searchDiv = '하수재이용시설 '
- const selectBox = [{ text: '서울하수처리시설', val: "1_hasu" }, { text: '서울1하수처리시설', val: "2_hasu" }, { text: '서울2하수처리시설', val: "3_hasu" }]
- const headName = () => {
- return (
-
○공공 하수처리시설 등록
- )
- }
- const onSelectValue = (val: string) => {
- console.log(val)
- }
- return (
- <>
-
-
-
하수재이용시설 등록
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
diff --git a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx
deleted file mode 100644
index c94a93075..000000000
--- a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert/page.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-'use client'
-import { useWrStore } from "@/app/store";
-import type { TableUpperProps } from "@/app/store/rainReuseFacilityInsert"
-import { RainReuseFaciltyInsertForm } from "@/components/ui/rainReuseInsertForm";
-import { ScrollArea, SearchDiv, SearchInput, UiTable } from "@common/business_components";
-import { Button, TableHead, TableRow } from "@common/components";
-
-
-export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
- return (<>
-
{
- upHeadList.map((head: TableUpperProps) =>
- (!head.upSequnce ? {head.title} :
- head.upName === 'upChangeRe' && head.upSequnce === 1 ? {'중축 개축 증축 '} : null))}
-
-
- {upHeadList.map((head: TableUpperProps) =>
- (head.upName === 'upChangeRe' ? {head.title} : null))}
-
- >)
-}
-
-
-export default function Home() {
- const { rain } = useWrStore((state) => state);
- const nodeList = headMakeColSpan(rain.upHeadList);
-
-
- const headName = () => {
- return (
-
○건축물 목록
- )
- }
- return (
- <>
-
-
-
빗물이용시설 등록
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {nodeList}
-
-
-
-
-
-
-
-
-
- >
- );
-}
diff --git a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rswtReuseFacilityInsert/page.tsx b/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rswtReuseFacilityInsert/page.tsx
deleted file mode 100644
index cecd4177c..000000000
--- a/apps/wr/app/reuseFaciltyManage/reuseFacilityInsert/rswtReuseFacilityInsert/page.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-'use client'
-import { useWrStore } from "@/app/store";
-import type { TableUpperProps } from "@/app/store/rainReuseFacilityInsert";
-import { RswtrReuseFaciltyInsertForm } from "@/components/ui/rswtrReuseInsetForm";
-import { ScrollArea, SearchDiv, SearchInput, UiTable } from "@common/business_components";
-import { Button, TableHead, TableRow } from "@common/components";
-
-
-const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
- return (<>
-
{
- upHeadList.map((head: TableUpperProps) =>
- (!head.upSequnce ? {head.title} :
- head.upName === 'upChangeRe' && head.upSequnce === 1 ? {'중축 개축 증축 '} : null))}
-
-
- {upHeadList.map((head: TableUpperProps) =>
- (head.upName === 'upChangeRe' ? {head.title} : null))}
-
- >)
-}
-
-
-export default function Home() {
- const {rswt} = useWrStore((state) => state);
- const nodeList = headMakeColSpan(rswt.upHeadList);
- const total = 100;
-
-
- const headName = () => {
- return (
-
○건축물 목록
- )
- }
-
- return (
- <>
-
-
-
중수도시설 등록
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {nodeList}
-
-
-
-
-
-
-
-
-
- >
- );
-}
diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx
new file mode 100644
index 000000000..8227e0347
--- /dev/null
+++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx
@@ -0,0 +1,167 @@
+"use client";
+
+import { useWrStore } from "@/app/store";
+import {
+ ContentsDiv,
+ ScrollArea,
+ SearchDiv,
+ SearchFormLeft,
+ SearchFormRight,
+ SearchInput,
+ Title,
+ UiModal,
+ UiTable,
+} from "@common/business_components";
+import { Button } from "@common/components";
+import ListDiv from "@common/business_components/ui/list_div";
+import { useEffect, useState } from "react";
+import { tableData } from "@/components/lib/func/commom";
+import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
+import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
+import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
+import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
+import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
+
+export default function Home() {
+ const { code, htdfl, initHtdfl,getHtdflBdstData } = useWrStore((state) => state);
+ const [searchTxt, setSearchTxt] = useState("");
+ const [pageNation, setPageNation] = useState(1);
+
+ const [htdflForm, setHtdflForm] = useState
();
+ const [bdstTable, setbdstTable] = useState();
+ const [issNewReg,setIsNewReg] = useState( false);
+
+ const [bdstChgProps, setBdstChgProps] = useState<{
+ isOpen: boolean;
+ chgBuilding: chgBuilding[];
+ }>({ isOpen: false, chgBuilding: [] });
+
+ const { htdflRes } = htdfl;
+
+ useEffect(() => {
+ if (!htdfl.isInit) {
+ initHtdfl('0');
+ }
+ }, [htdfl.isInit, initHtdfl]);
+
+ useEffect(() => {
+ if (code.sggCd.length > 0) {
+
+ const htdflData = tableData(htdflRes, { code }).map(
+ (item: customHtdflBdst) => {
+ return {
+ ...item,
+ bdstChgYn: item?.chgBuilding && item.chgBuilding.length > 0 && item.chgBuilding[0]?.bdstChgNm !== null ? 'Y' : 'N',
+ bdstUsgCd: item.reuseBuilding[0]?.bdstUsgCd
+ };
+ }
+ );
+ setbdstTable(htdflData);
+ }
+ }, [code, htdflRes]);
+
+ const cellClick: (val: number|undefined ,headId: string) => void = (
+ val
+ ,headId) => {
+ if ((bdstTable ?? []).length > 0 && val !== undefined) {
+ {
+ setHtdflForm(htdflRes[val]);
+ }
+ }
+
+ if (headId === "bdstChgYn" && val !== undefined) {
+ if (
+ htdflRes[val]?.bdstInfoPk != null &&
+ htdflRes[val]?.chgBuilding?.length > 0
+ ) {
+ bdstChgModal(htdflRes[val]?.chgBuilding as chgBuilding[]);
+ }
+ }
+ };
+ const bdstChgModal = (chgBuilding: chgBuilding[]) => {
+ setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
+ };
+ useEffect(() => {
+ getHtdflBdstData(pageNation, "0");
+ }, [pageNation]);
+
+ return (
+ <>
+
+
+
+
+
+
+ {
+ setSearchTxt(e);
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { cellClick(val || undefined, headId); } }
+ onPageChange={setPageNation}
+ >
+
+
+
+
+
+
+
+
+
+
+
+ }
+ bodyClass="w-[68vw] max-w-none h-[90vh]"
+ open={issNewReg}
+ onOpenChange={(open) => {
+ setIsNewReg(open);
+ }}
+ />
+
+ }
+ onOpenChange={(open) => {
+ setBdstChgProps({ ...bdstChgProps, isOpen: open });
+ }
+ }
+ />
+
+ >
+ );
+}
diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx
new file mode 100644
index 000000000..441eabf25
--- /dev/null
+++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx
@@ -0,0 +1,329 @@
+"use client";
+import {
+ ContentsDiv,
+ ScrollArea,
+ SearchDiv,
+ SearchFormLeft,
+ SearchInput,
+ Title,
+ UiModal,
+ UiTable,
+} from "@common/business_components";
+import { Button } from "@common/components";
+import { useWrStore } from "../../../store";
+import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
+import { useCallback, useEffect, useState } from "react";
+import ListDiv from "@common/business_components/ui/list_div";
+import { tableData } from "@/components/lib/func/commom";
+import type {
+ customPbnst,
+ fcBizType,
+ PbnstRegArrrayType,
+ pubHasuType,
+} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
+import {
+ pbnstRegZod,
+ pbnstRegArrayZod,
+ fcBizSchema,
+} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
+import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
+import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
+import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal";
+import toast, { Toaster } from "react-hot-toast";
+import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
+import { useFieldArray, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+export default function PublicReuseFaciltyInsert() {
+ const {
+ code,
+ pbnst,
+ searchFclts,
+ pubHasuInit,
+ pbnstRegClick,
+ pbnstRuseFcltUpdate,
+ pubHasuSearch,
+ pbnstRuseBizUpdate,
+ } = useWrStore((state) => state);
+ const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst;
+ const [currentTab, setCurrentTab] = useState("mng");
+ const [isRuseReg, setIsRuseReg] = useState<{
+ isModal: boolean;
+ data: pubHasuType;
+ }>({ isModal: false, data: {} as pubHasuType });
+
+ const [indexMng, setIndexMng] = useState(0);
+ const [indexBiz, setIndexBiz] = useState(0);
+ const [searchTxt, setSearchTxt] = useState();
+ const [bdstTable, setbdstTable] = useState();
+ const [selectRow, setSelectRow] = useState();
+ const [pageNation, setPageNation] = useState(1);
+
+
+ const form = useForm<{
+ items: z.infer[];
+ }>({
+ resolver: zodResolver(z.object({ items: pbnstRegArrayZod })),
+ // defaultValues: { items: pbnstRegArrayZod.parse([]) },
+ mode: "onChange",
+ });
+ const {
+ fields: items,
+ append,
+ remove,
+ } = useFieldArray({
+ control: form.control,
+ name: `items`,
+ });
+ useEffect(() => {
+ if (!pbnst.isInit) {
+ pubHasuInit("1", "41");
+ }
+ }, [pbnst.isInit, pubHasuInit]);
+
+ const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
+ const data = writeRgtrAndMdfr(valuse.items);
+ let bizs = [] as fcBizType[];
+ data.forEach((fclt) => {
+ bizs = [...bizs, ...fclt.fcBizs];
+ });
+ const pbnst =data.map((fclt) => {
+ return({
+ pbnstRuseFcltPk: fclt.pbnstRuseFcltPk,
+ fcltCpct: fclt.fcltCpct,
+ ruseCpct: fclt.ruseCpct,
+ splyExtraCpct: fclt.splyExtraCpct,
+ rgtr: fclt.rgtr,
+ mdfr: fclt.mdfr,
+ fcFiles: fclt.fcFiles,
+ fcOpers: fclt.fcOpers,
+ })
+ })
+ await pbnstRuseFcltUpdate(pbnst as customPbnst[]);
+
+ await pbnstRuseBizUpdate(bizs);
+ };
+
+ useEffect(() => {
+ if (code.sggCd.length) {
+ if (searchFclts) {
+ setbdstTable(tableData(searchFclts, { code }));
+ } else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) {
+ setbdstTable(tableData(pbnstHasuRes, { code }));
+ }
+ }
+ }, [code, pbnstHasuRes, searchFclts]);
+
+ const cellClick = (val: number | undefined) => {
+ if (val === undefined) return;
+ const selectRow = pbnstHasuRes?.[val];
+ setSelectRow(pbnstHasuRes?.[val]);
+ if (selectRow) {
+ pbnstRegClick(selectRow);
+ }
+ };
+
+ const handleTabChange = (value: string) => {
+ setCurrentTab(value);
+ };
+
+ useEffect(() => {
+ if (pbnst.pbnstRes&& pbnst.pbnstRes?.length>0) {
+ console.log("pbnst.pbnstRes", pbnstRes);
+ form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) });
+ }else{
+
+ console.log("pbnst.pbnstRes is null", pbnstRes);
+ form.reset({ items: [] });
+ }
+ }, [pbnst.pbnstRes]);
+ useEffect(() => {
+ if (indexMng) {
+ setIndexBiz(0);
+ }
+ }, [indexMng]);
+
+ useEffect(() => {
+ console.log("form errors:", form.formState.errors);
+ }, [form.formState.errors]);
+
+ const appendPbnstRuseFclt = useCallback(() => {
+ const selecTableRow = selectRow;
+
+ if (pbnstRes && pbnstRes.length > 0) {
+ const lastPbnst = pbnstRes[pbnstRes.length - 1];
+ if (lastPbnst && selecTableRow) {
+
+ append(
+ pbnstRegZod.parse({
+ pbnstRuseFcltPk:
+ String(selecTableRow.bscFctCd) + String(pbnstRes.length + 1),
+ ruseUtztnFcltNm: "",
+ fcBizs: [
+ fcBizSchema.parse({
+ pbnstRuseFcltFk:
+ String(lastPbnst.pbnstRuseFcltPk) +
+ String(pbnstRes.length + 1),
+ cycl: 1,
+ }),
+ ] as fcBizType[],
+ })
+ );
+ setIsRuseReg({ ...isRuseReg, isModal: true });
+ }
+ } else {
+ if (selecTableRow) {
+ append(
+ pbnstRegZod.parse({
+ pbnstRuseFcltPk: String(selecTableRow.bscFctCd)+'1',
+ ruseUtztnFcltNm: "",
+ regDt: null,
+ mdfcnDt: null,
+ fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(selecTableRow.bscFctCd)+'1',cycl:1})] as fcBizType[],
+ })
+ )
+ setIsRuseReg({ ...isRuseReg, isModal: true });
+ }
+ }
+ }, [pbnstRegZod, pbnstRes, append, selectRow, form]);
+
+ useEffect(() => {
+ // console.log(" page getgetvaslue ", form.getValues());
+ }, [form.getValues()]);
+
+useEffect(() =>{
+ pubHasuInit(String(pageNation), "41");
+},[pageNation,pubHasuInit])
+
+ return (
+ <>
+
+
+
+
+
+
+ {
+ setSearchTxt(e);
+ }}
+ />
+