From bb908f5861c2320454ee7c8d86dd00a14c3edf58 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 18 Jun 2025 20:32:37 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EB=A7=A4?= =?UTF-8?q?=ED=95=91,=20=EC=9E=AC=EC=9D=B4=EC=9A=A9=20=EA=B2=80=ED=86=A0?= =?UTF-8?q?=EC=9D=B4=EB=A0=A5=20=EA=B3=B5=EC=82=AC=EB=B9=84=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20=EC=A0=9C=EC=99=B8=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 371 ++-------- .../wr/app/matMng/coMat/ruseRvwHstry/page.tsx | 694 +++++++----------- apps/wr/app/store/matDmd/coMatRvw/index.tsx | 87 ++- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 56 +- .../store/matDmd/ruseRvwHstry/headList.tsx | 137 +--- .../app/store/matDmd/ruseRvwHstry/index.tsx | 202 ++++- .../ui/form/coMat/conCostForm/conCostForm.tsx | 377 ++++++++++ .../bizTotalMoneyPop/bizTotalMoneyPop.tsx | 28 - .../ui/popover/usagePorcPop/usageProcPop.tsx | 30 - 9 files changed, 1008 insertions(+), 974 deletions(-) create mode 100644 apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx delete mode 100644 apps/wr/components/ui/popover/bizTotalMoneyPop/bizTotalMoneyPop.tsx delete mode 100644 apps/wr/components/ui/popover/usagePorcPop/usageProcPop.tsx diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index 5f4a3943b..49f23127f 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -36,38 +36,32 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button, Input, Label } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; -import { useForm } from "react-hook-form"; +import { useForm } from "react-hook-form"; import toast, { Toaster } from "react-hot-toast"; import { z } from "zod"; import moment from "moment"; import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList"; -import UsageProcData from "@/components/ui/popover/usagePorcPop/usageProcPop"; -import BizTotalMoneyPop from "@/components/ui/popover/bizTotalMoneyPop/BizTotalMoneyPop"; -import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { zodResolver } from "@hookform/resolvers/zod"; - +import ConCostForm from "@/components/ui/form/coMat/conCostForm/conCostForm"; export default function CoMatRvw() { - const { code, coRvw, coMatRvwInit ,coMatRvwUpdate} = useWrStore((state) => state); + const { code, coRvw, coMatRvwInit ,coMatRvwSearch ,coMatRvwInqua} = useWrStore( + (state) => state + ); const { coMatRvwRes } = coRvw; //init, sub, match const initRef = useRef(false); const { coRvwHeadList } = coRvw; + const [pageNation, setPageNatiion] = useState(1); + + const [dmdCoNm, setDmdCoNm] = useState(""); const [dmdMatData, setDmdMtaData] = useState([]); const [selectSgg, setSelectSgg] = useState(); const [objSearch, setObjSearch] = useState({ sgg: "", city: "", }); - const [isPrcsMo, setIsPrcsMo] = useState<{ - isModal: boolean; - }>({ isModal: false }); - const [isTrfMo, setIsTrfMo] = useState<{ - isModal: boolean; - }>({ isModal: false }); - const [isCmpttnMo, setIsCmpttnMo] = useState<{ - isModal: boolean; - }>({ isModal: false }); + const [fromDate, setFromDate] = useState( String(new Date().getFullYear()) ); @@ -77,6 +71,29 @@ export default function CoMatRvw() { const [selectData, setSelectData] = useState( {} as DmdCoReqType ); + + const getSearch = ( + startYear: number, + endYear: number, + sggCd: string, + dmdCoNm: string + ) => { + + if (dmdCoNm.length>0 ) { + + coMatRvwSearch( + pageNation, + 13, + String(startYear), + String(endYear), + sggCd, + dmdCoNm + ); + } else { + coMatRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd); + } + }; + const form = useForm>({ resolver: zodResolver(DmdCoReqSchema), }); @@ -89,22 +106,6 @@ export default function CoMatRvw() { setSelectData(coMatRvwRes[index]); } }; - const onSubmit = () => { - const data:DedMatUpdateType = { - dmdInfoSn: form.getValues("dmdInfoSn"), - usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs"), - cstrnCst:form.getValues("demandCst.cstrnCst"), - fcltSbsdEpsTrf:form.getValues("demandCst.fcltSbsdEpsTrf"), - prcsFcltCpctCstrnCst:form.getValues("demandCst.prcsFcltCpctCstrnCst"), - rgtr:TEST_UUID - - }; - - - - coMatRvwUpdate( '11000SW001R1', form.getValues('dmdInfoFk'), data ) - }; - useEffect(() => { if (form?.getValues("useUsgCd")) { form.setValue( @@ -118,8 +119,7 @@ export default function CoMatRvw() { useEffect(() => { - - console.log('coMatRvwRes ', coMatRvwRes) + console.log(' coMatRvwRes ', coMatRvwRes) if (coMatRvwRes) { const data = coMatRvwRes?.map((item, index) => { console.log(" item ", item); @@ -152,7 +152,7 @@ export default function CoMatRvw() { useEffect(() => { if (!initRef.current) { - coMatRvwInit(1, 13, fromDate, toDate, "47"); + coMatRvwInit(1, 13, fromDate, toDate); initRef.current = true; } }, [coMatRvwInit, initRef, fromDate, toDate]); @@ -216,8 +216,8 @@ export default function CoMatRvw() { {}} + textValue={dmdCoNm} + setText={setDmdCoNm} /> @@ -238,6 +238,20 @@ export default function CoMatRvw() { "시작년도가 종료년도 이후로 설정할 수 없습니다." ); } else { + let con: string | number = ""; + if (String(objSearch.city).length > 0) { + con = String(objSearch.city); + } + if (String(objSearch.sgg).length > 0) { + con = String(objSearch.sgg); + } + getSearch( + fromNum, + toNum, + con, + dmdCoNm + ); + } } }} @@ -660,293 +674,10 @@ export default function CoMatRvw() { -
-
-

- 표준공사비 산정 -

-
-

처리시설 표준공사비 산정

- - - -
-
-

기본사항

-
-
-
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? ""} - /> - - )} - /> -
-
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - - )} - /> -
-
- - - - } - > - ( - - - - )} - /> -
-
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={Number(field.value) * 365} - /> - - )} - /> -
-
-

공사비 입력사항

-
-
-
- - -
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - - )} - /> -
-
-
- - -
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - - )} - /> -
-
- - - - {}} - value={ - form.getValues("demandCst.prcsFcltCpctCstrnCst") + - form.getValues("demandCst.fcltSbsdEpsTrf") || 0 - } - /> -
-
-
- - -
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? ""} - /> - - )} - /> -
- -
-
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - - )} - /> -
-
- - -
-
- ( - - )} - /> -
-
-
- + - - } - bodyClass="w-[40vw] max-w-none h-[70vh]" - open={isTrfMo.isModal} - onOpenChange={(open) => { - setIsTrfMo({ isModal: open }); - }} - /> - } - bodyClass="w-[70vw] max-w-none h-[50vh]" - open={isCmpttnMo.isModal} - onOpenChange={(open) => { - setIsCmpttnMo({ isModal: open }); - }} - /> diff --git a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx index 70d57d0b9..934831be8 100644 --- a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx @@ -1,434 +1,292 @@ "use client"; import { useWrStore } from "@/app/store"; -import { formTableName } from "@/components/lib/class/comClass"; -import { getCity } from "@/components/lib/func/commom"; -import { CmpttnModal } from "@/components/ui/modal/coMat/cmpttnModal"; -import { CoMatModal } from "@/components/ui/modal/coMat/coMatModal"; +import { + DmdCoReqSchema, + type DmdCoReqType, +} from "@/app/store/matDmd/coMatRvw/type"; +import { + getCity, + getdmdMatFlag, + yearOptions, +} from "@/components/lib/func/commom"; +import ConCostForm from "@/components/ui/form/coMat/conCostForm/conCostForm"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; -import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiModal, UiTable, type SelectDataType } from "@common/business_components/ui"; +import { + ContentsDiv, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, + Title, + UiTable, + type SelectDataType, +} from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, DatePicker, Input, Label } from "@common/components/ui"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@common/components/ui/tooltip"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect, useState } from "react"; -import { useFieldArray, useForm } from "react-hook-form"; +import moment from "moment"; +import { useCallback, useEffect, useState } from "react"; +import { set, useFieldArray, useForm } from "react-hook-form"; import { z } from "zod"; - - +import { tableData } from "@/components/lib/func/commom"; +import toast, { Toaster } from "react-hot-toast"; export default function RuseRvwHstry() { - const { code, ruseHstry, } = useWrStore((state) => state); - const { ruseHstryHeadList, } = ruseHstry; - const [fromDate, setFromDate] = useState(new Date()); - const [toDate, setToDate] = useState(new Date()); - const schema = z.object({}); - const [selectSgg, setSelectSgg] = useState() - const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); + const { code, ruseHist, ruseRvwHistInit, ruseRvwSearch, ruseRvwInqua } = + useWrStore((state) => state); + const { rvwHistRes, ruseHistHeadList } = ruseHist; + const schema = z.object({}); + const [pageNation, setPageNatiion] = useState(1); - const getSelCity = (val: string | number) => { - const cityValue = String(val); // Ensure val is treated as a string - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: '' }); - }; + const [dmdCoNm, setDmdCoNm] = useState(""); + const [ruseUtztnFcltNm, setRuseUtztnFcltNm] = useState(""); + const [selectSgg, setSelectSgg] = useState(); + const [objSearch, setObjSearch] = useState({ + sgg: "", + city: "", + }); - const getSgg = (val: string | number) => { - console.log(val); - setObjSearch({ ...objSearch, sgg: String(val) }) - }; + const [fromDate, setFromDate] = useState( + String(new Date().getFullYear()) + ); + const [toDate, setToDate] = useState( + String(new Date().getFullYear()) + ); + const [rvwHistData, setRvwHistData] = useState(); - const form = useForm>({ - resolver: zodResolver(schema), - defaultValues: { - fcltCpct: 0, - } - }); - const [isPrcsMo, setIsPrcsMo] = useState<{ - isModal: boolean; - }>({ isModal: false }); - const [isTrfMo, setIsTrfMo] = useState<{ - isModal: boolean; - }>({ isModal: false, }); - const [isCmpttnMo, setIsCmpttnMo] = useState<{ - isModal: boolean; - }>({ isModal: false, }); + const getSelCity = (val: string | number) => { + const cityValue = String(val); // Ensure val is treated as a string + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + setObjSearch({ city: cityValue, sgg: "0" }); + }; - return ( - -
-
- - <SearchDiv> - <SearchFormLeft> - <div className="col-span-8 flex flex-row"> - <SelectBox - className="col-span-2 w-1/3 h-full text-2xl" - label="시도" - selectClass={""} - selectArray={code.cityCd || []} - onSelectValue={getSelCity} - > - {""} - </SelectBox> - <SelectBox - className="col-span-2 w-1/3 h-full text-2xl ml-4" - label="시군구" - selectClass={""} - selectArray={selectSgg || []} - onSelectValue={getSgg} - > - {""} - </SelectBox> - <div className="col-span-5 w-full"> - <div className="flex flex-row items-center"> - <Label className="text-xl text-gray-600 ml-4 mr-4">수요신청년도</Label> - <div className="flex flex-row"> - <DatePicker mode={'single'} - className="w-full" - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> - <span className="ml-2 mr-2">~</span> - <DatePicker mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> - </div> - </div> - </div> - <SearchInput - className={"text-2xl"} - label="시설명" - textValue={""} - setText={(e) => { - }} - /> - <SearchInput - className={"text-2xl ml-4"} - label="회사명" - textValue={""} - setText={(e) => { - }} - /> - </div> - </SearchFormLeft> - <SearchFormRight - className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> - <div className="space-y"> - <div className="flex flex-row space-x-2"> - <Button - size={"sm"} - onClick={(e) => { }} - > - 조회 - </Button> - <Button - size={"sm"} - onClick={(e) => { }} - > - 검토완료 - </Button> - </div> - </div> - </SearchFormRight> - </SearchDiv> + const getSgg = (val: string | number) => { + console.log(val); + setObjSearch({ ...objSearch, sgg: String(val) }); + }; + + const getSearch = ( + startYear: number, + endYear: number, + sggCd: string, + dmdCoNm: string, + ruseUtztnFcltNm: string + ) => { + if (dmdCoNm || ruseUtztnFcltNm) { + ruseRvwSearch( + pageNation, + 13, + String(startYear), + String(endYear), + sggCd, + dmdCoNm, + ruseUtztnFcltNm + ); + } else { + ruseRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd); + } + }; + + const form = useForm<DmdCoReqType>({ + resolver: zodResolver(DmdCoReqSchema), + }); + + const TableCellClick = useCallback( + (index: number | undefined) => { + if ( + index !== undefined && + index >= 0 && + rvwHistRes && + rvwHistRes[index] + ) { + form.reset(rvwHistRes[index]); + } + }, + [rvwHistRes, form] + ); + + useEffect(() => { + if (!ruseHist.isInit) { + ruseRvwHistInit( + 1, + 13, + new Date().getFullYear().toString(), + new Date().getFullYear().toString() + ); + } + }, [ruseHist.isInit]); + + useEffect(() => { + if (rvwHistRes) { + const data = rvwHistRes?.map((item, index) => { + return { + ...item, + ctpvCd: item.demandCo.ctpvCd, + sggCd: item.demandCo.sggCd, + dmdCoNm: item.demandCo.dmdCoNm, + daddr: item.demandCo.daddr, + telno: item.demandCo.telno, + regDt: item?.demandCo?.regDt + ? moment(item?.demandCo?.regDt).format("YYYY-MM-DD") + : "없음", + rvwCmptnYmd: item?.rvwCmptnYmd + ? moment(item?.rvwCmptnYmd).format("YYYY-MM-DD") + : "없음", + mtchnCmptnYmd: item?.mtchnCmptnYmd + ? moment(item?.mtchnCmptnYmd).format("YYYY-MM-DD") + : "없음", + splyFcltFk: item.demandMatching?.splyFcltFk, + dmndQty: item.dmndQty, + splyFcltFlg: getdmdMatFlag(item.demandMatching?.splyFcltFlg), + matYn: false, + }; + }); + setRvwHistData(tableData(data, { code })); + } + }, [rvwHistRes]); + + useEffect(() => { + }, [form.formState]); + + return ( + <ContentsDiv> + <div className="grid grid-cols-4 gap-4"> + <div className="col-span-4"> + <Title title={"재이용검토이력"} /> + <SearchDiv> + <SearchFormLeft> + <div className="col-span-10 flex flex-row"> + <SelectBox + className="w-80 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd || []} + onSelectValue={getSelCity} + > + {""} + </SelectBox> + <SelectBox + className="w-80 h-full text-2xl ml-4" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + onSelectValue={getSgg} + > + {""} + </SelectBox> + <div className="col-span-4 w-full"> + <div className="flex flex-row items-center"> + <Label className="text-xl text-gray-600 ml-4 mr-4"> + 수요신청년도 + </Label> + <div className="flex flex-row mt-2"> + <SelectBox + className="h-full w-32 text-2xl" + label="" + selectClass={""} + selectArray={yearOptions} + value={fromDate} + onSelectValue={(val: string | number) => + setFromDate(String(val)) + } + /> + <span className="mx-6">~</span> + <SelectBox + className="h-full w-32 text-2xl" + label="" + selectClass={""} + selectArray={yearOptions} + value={toDate} + onSelectValue={(val: string | number) => + setToDate(String(val)) + } + /> + <SearchInput + className={"text-2xl w-60 ml-4 "} + label="시설명" + textValue={ruseUtztnFcltNm} + setText={setRuseUtztnFcltNm} + /> + <SearchInput + className={"text-2xl w-60 ml-4 "} + label="회사명" + textValue={dmdCoNm} + setText={setDmdCoNm} + /> + </div> + </div> </div> - </div> - - <div className="grid grid-cols-6 gap-4 "> - <div className="col-span-6"> - <ListDiv> - <UiTable - headName={"재이용검토현황"} - tableData={[]} - children={undefined} - headlist={ruseHstryHeadList} - pageSize={20} - total={100000} - cellClick={(index: number | undefined, headId: string) => { - }} - onPageChange={() => { }} - ></UiTable> - <hr /> - <Form {...form}> - <h3 className="mt-4 ml-2 text-2xl font-medium text-label">수요신청 상세현황</h3> - <h1 className="mt-2 ml-3">표준공사비 산정</h1> - <div className="flex items-center mx-3 mb-3"> - <h1 className="">처리시설 표준공사비 산정</h1> - <Button - size={"sm"} - onClick={(e) => { }} - > - 재계산 - </Button> - <Button - size={"sm"} - onClick={(e) => { }} - > - 저장 - </Button> - - </div> - <div className="grid grid-cols-12 gap-4 ml-4 mr-4"> - <div className="col-span-3 mt-4"> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label="용도"> - <Input - placeholder="" - type="text" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? ""} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label="요구수량(M3/d)"> - <Input - placeholder="" - type="number" - step="0.1" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <Label className="">용도에 따른 처리공정<i className="diveicon di-search" onClick={(e) => setIsPrcsMo({ isModal: true })} /></Label> - - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="text" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value || ""} - className="mt-2" - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label="처리시설 용량(요구수량 * 365일)"> - <Input - placeholder="" - type="number" - step="0.001" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <div className="flex items-center justify-between"> - <Label>처리시설용량에 따른 공사비(백만원)</Label> - <Button - size={"sm"} - onClick={(e) => setIsCmpttnMo({ isModal: true })} - className="bg-none" - > - 공사비 산정표 보기 - </Button> - </div> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="number" - step="0.001" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <div className="flex items-center justify-between"> - <Label>시설부대경비 요율(%)</Label> - <Button - size={"sm"} - onClick={(e) => setIsTrfMo({ isModal: true })} - > - 요율표 보기 - </Button> - </div> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="number" - step="0.01" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - - <div className="col-span-3 mt-4"> - <Label>총사업비 (백만원) - <TooltipProvider> - <Tooltip> - <TooltipTrigger asChild> - <i className="diveicon di-search" /> - </TooltipTrigger> - <TooltipContent> - <div className="font-bold mb-1 text-xl">총사업비 계산방법</div> - <div className="text-lg">하수처리수 재이용시설 총 사업비 = 공사비+시설부대경비 </div> - </TooltipContent> - </Tooltip> - </TooltipProvider> - </Label> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - className="mt-2" - type="number" - step="0.01" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <div className="flex items-center justify-between"> - <Label>공급처 선정</Label> - <Button - size={"sm"} - onClick={(e) => { }} - className="bg-none" - > - 후보지 조회 - </Button> - </div> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="text" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? ""} - /> - </FormUi> - )} - /> - </div> - - <div className="col-span-4 mt-4 mb-3"> - <div className="mt-4"> - <Label>관로 표준공사비 산정</Label> - </div> - </div> - </div> - </Form> - </ListDiv> + </div> + </SearchFormLeft> + <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="space-y"> + <div className="flex flex-row space-x-2"> + <Button + size={"sm"} + onClick={(e) => { + if (fromDate && toDate) { + const fromNum = Number(fromDate); + const toNum = Number(toDate); + if (fromNum > toNum) { + toast.error( + "시작년도가 종료년도 이후로 설정할 수 없습니다." + ); + } else { + let con: string | number = ""; + if (String(objSearch.city).length > 0) { + con = String(objSearch.city); + } + if (String(objSearch.sgg).length > 0) { + con = String(objSearch.sgg); + } + getSearch( + fromNum, + toNum, + con, + dmdCoNm, + ruseUtztnFcltNm + ); + } + } + }} + > + 조회 + </Button> + <Button size={"sm"} onClick={(e) => {}}> + 검토완료 + </Button> </div> - <UiModal - body={ - <> - <UiTable - headName={"용도에 따른 처리공정"} - tableData={[ - { usage: "청소", process: "총인처리시설 + 염소소독" }, - { usage: "화장실용수", process: "총인처리시설 + 염소소독" }, - { usage: "세척", process: "총인처리시설 + UV소독" }, - { usage: "살수", process: "총인처리시설 + UV소독" }, - { usage: "조경", process: "총인처리시설 + UV소독" }, - { usage: "농업", process: "총인처리시설 + UV소독" }, - { usage: "하천", process: "총인처리시설 + UV소독" }, - { usage: "지하수", process: "전처리시설 + RO" }, - { usage: "공업용수", process: "전처리시설 + RO" }, + </div> + </SearchFormRight> + </SearchDiv> + </div> + </div> - ]} - headlist={[ - { id: "usage", title: "용도" }, - { id: "process", title: "단위공정" } - ]} - pageSize={0} - total={0} - cellClick={() => { }} - onPageChange={() => { }} - /> - </> - } - bodyClass="w-[25vw] max-w-none h-[60vh]" - open={isPrcsMo.isModal} - onOpenChange={(open) => { - setIsPrcsMo({ isModal: open }); - }} - /> - <UiModal - body={ - <CoMatModal data={[]}></CoMatModal> - } - bodyClass="w-[40vw] max-w-none h-[70vh]" - open={isTrfMo.isModal} - onOpenChange={(open) => { - setIsTrfMo({ isModal: open }); - }} - /> - <UiModal - body={ - <CmpttnModal data={[]}></CmpttnModal> - } - bodyClass="w-[70vw] max-w-none h-[50vh]" - open={isCmpttnMo.isModal} - onOpenChange={(open) => { - setIsCmpttnMo({ isModal: open }); - }} - /> - </div> - </ContentsDiv > - ) -} \ No newline at end of file + <div className="grid grid-cols-6 gap-4 "> + <div className="col-span-6"> + <ListDiv> + <UiTable + headName={"재이용검토현황"} + tableData={rvwHistData || []} + headlist={ruseHistHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + TableCellClick(index); + }} + onPageChange={setPageNatiion} + ></UiTable> + <hr /> + <h3 className="mt-4 ml-2 text-2xl font-medium text-label"> + 수요신청 상세현황 + </h3> + <ConCostForm form={form} type={"hist"} /> + </ListDiv> + </div> + </div> + <Toaster position="top-center" /> + </ContentsDiv> + ); +} diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index 9362ead28..6ad500d99 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -35,13 +35,27 @@ type coRvwActions = { pageCnt: number, startYear: string, endYear: string, - sggCd: string - ) => void, - coMatRvwUpdate: ( + ) => void; + coMatRvwUpdate: ( splyCd: string, dmdCd: string, data: DedMatUpdateType - )=>void + ) => void; + coMatRvwSearch: ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string, + dmdCoNm: string, + ) => void; + coMatRvwInqua: ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string + ) => void; }; const coMatInit = async ( @@ -49,9 +63,8 @@ const coMatInit = async ( pageCnt: number, startYear: string, endYear: string, - sggCd: string ) => { - const url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}/${sggCd}`; + const url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; const coMatRvwRes = await getFetch(fetchType.WR, url); return coMatRvwRes; @@ -64,9 +77,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { pageCnt: number, startYear: string, endYear: string, - sggCd: string ) => { - const url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}/${sggCd}`; + const url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; const coMatRvwRes = await getFetch(fetchType.WR, url); return set((state: coRvwState) => ({ @@ -94,7 +106,6 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { 10, new Date().getFullYear().toString(), new Date().getFullYear().toString(), - "11" ); return set((state: coRvwState) => ({ ...state, @@ -108,5 +119,63 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { toast.error("매칭 검토 저장 오류입니다."); } }, + coMatRvwSearch: async ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string, + dmdCoNm: string, + ) => { + let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + + if (sggCd.length > 0) { + url += `/${sggCd}`; + } else { + url += `/0`; + } + if (dmdCoNm?.length > 0) { + url += `/${dmdCoNm}`; + } else { + url += `/0`; + } + + console.log(' url ', url) + const coMatRvwRes = await getFetch(fetchType.WR, url); + + return set((state: coRvwState) => ({ + ...state, + coRvw: { + ...state.coRvw, + coMatRvwRes: coMatRvwRes, + }, + })); + }, + coMatRvwInqua: async ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string + ) => { + try { + let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + if (sggCd.length > 0) { + url += `/${sggCd}`; + }else if(sggCd ==='0'){ + url += `/0/0`; + } + const coMatRvwRes = await getFetch(fetchType.WR, url); + return set((state: coRvwState) => ({ + ...state, + coRvw: { + ...state.coRvw, + coMatRvwRes: coMatRvwRes, + }, + })); + } catch (e) { + console.log(" error ", e); + } + }, }; }; diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 93e214643..de1b123c7 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -11,7 +11,7 @@ import { z } from "zod"; trbt: z.number(), blgcOxygDmndQnt: z.number(), smll: z.number(), - crmty: z.number(), + crmty: z.number().nullish(), tn: z.number(), tph: z.number(), ph: z.number(), @@ -19,22 +19,22 @@ import { z } from "zod"; cdtnv: z.number(), rmrk: z.string(), useUsgCd: z.string(), - mtchnCmptnYmd: z.string(), - rvwCmptnYmd: z.string() + mtchnCmptnYmd: z.string().nullish(), + rvwCmptnYmd: z.string().nullish() }); const DemandMatchingSchema = z.object({ - dmdInfoFk: z.string(), - splyFcltFk: z.string(), - splyFcltFlg: z.string(), - pbnstRuseFcltBizFk: z.number(), - splyBgngDay: z.coerce.date(), - splyEndDay: z.coerce.date(), - splyCpct: z.number(), - splyFmYn: z.string(), - useUsgCd: z.string(), - dmdInfoSn: z.number(), - splyCndtList:z.array(z.string()) + dmdInfoFk: z.string().nullish(), + splyFcltFk: z.string().nullish(), + splyFcltFlg: z.string().nullish(), + pbnstRuseFcltBizFk: z.number().nullish(), + splyBgngDay: z.coerce.date().nullish(), + splyEndDay: z.coerce.date().nullish(), + splyCpct: z.number().nullish(), + splyFmYn: z.string().nullish(), + useUsgCd: z.string().nullish(), + dmdInfoSn: z.number().nullish(), + splyCndtList:z.array(z.string().nullish() ).nullish() }); const DemandCoSchema = z.object({ @@ -46,21 +46,21 @@ import { z } from "zod"; splyBgngDay: z.coerce.date(), splyEndDay: z.coerce.date(), splyCpct: z.number(), - splyFmYn: z.string(), + splyFmYn: z.string().nullish(), telno: z.string(), - useUsgCd: z.string(), - regDt: z.coerce.date(), - rgtr: z.string(), - mdfcnDt: z.coerce.date(), - mdfr: z.string(), + useUsgCd: z.string().nullish(), + regDt: z.coerce.date().nullish(), + rgtr: z.string().nullish(), + mdfcnDt: z.coerce.date().nullish(), + mdfr: z.string().nullish(), dmdAplyPswd: z.string(), - demandInfo: z.array(DemandInfoSchema).nullish(), // 안쓰는 거임 - demandMatchings: z.array(DemandMatchingSchema).nullish()// 안쓰는 거임 + demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임 + demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish()// 안쓰는 거임 }); const DemandCstSchema = z.object({ dmdInfoSn: z.number(), - usgPrcsProcs: z.string(), + usgPrcsProcs: z.string().nullish(), cstrnCst: z.number(), fcltSbsdEpsTrf: z.number(), prcsFcltCpctCstrnCst: z.number() @@ -86,11 +86,11 @@ import { z } from "zod"; clIonQnt: z.number(), cdtnv: z.number(), rmrk: z.string(), - useUsgCd: z.string(), - mtchnCmptnYmd: z.string(), - rvwCmptnYmd: z.string(), - demandCo: DemandCoSchema, - demandMatching: DemandMatchingSchema, + useUsgCd: z.string().nullish(), + mtchnCmptnYmd: z.string().nullish(), + rvwCmptnYmd: z.string().nullish(), + demandCo: DemandCoSchema.nullish(), + demandMatching: DemandMatchingSchema.nullish(), demandCst: DemandCstSchema }); diff --git a/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx b/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx index 8bbaa8e89..5702406e1 100644 --- a/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx +++ b/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx @@ -1,37 +1,29 @@ -import { z } from "zod"; -import type { CommonTableProps } from "../../common/type/header"; +import type { TableUpperProps } from "../../common/type/header"; -export const sttnHeadListType = z.array( - z.object({ - id: z.string(), - title: z.string(), - visible: z.boolean(), - }) -); -export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [ +export const ruseHstryHeadListExport:TableUpperProps[]= [ { - id: "ctpv", + id: "cityText", title: "시도", visible: true, }, { - id: "sgg", + id: "sggText", title: "시군구", visible: true, }, { - id: "coNm", + id: "dmdCoNm", title: "회사명", visible: true, }, { - id: "addr", + id: "daddr", title: "공장주소", visible: true, }, { - id: "telNo", + id: "telno", title: "전화번호", visible: true, }, @@ -41,17 +33,17 @@ export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [ visible: true, }, { - id: "rvwDt", //바꾸기 + id: "rvwCmptnYmd", //바꾸기 title: "검토일자", visible: true, }, { - id: "matDt", //바꾸기 + id: "mtchnCmptnYmd", //바꾸기 title: "매칭 완료일자", visible: true, }, { - id: "gong", //바꾸기 + id: "splyFcltFk", //바꾸기 title: "공급처", visible: true, }, @@ -66,7 +58,7 @@ export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [ visible: true, }, { - id: "state", //바꾸기 + id: "splyFcltFlg", //바꾸기 title: "진행상태", visible: true, }, @@ -74,112 +66,7 @@ export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [ id: "matYn", //바꾸기 title: "매칭완료 여부", visible: true, + type:'check' }, ]; - -// id는 다확인해야함 -export const ruseHstryNodeListExport: CommonTableProps[] = [ - { - id: "ctpv", - title: "시도", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "sgg", - title: "시군구", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "coNm", - title: "회사명", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "addr", - title: "공장주소", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - },{ - id: "telNo", - title: "전화번호", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "regDt", //바꾸기 - title: "신청일자", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "rvwDt", //바꾸기 - title: "검토일자", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - },{ - id: "matDt", //바꾸기 - title: "매칭 완료일자", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - },{ - id: "gong", //바꾸기 - title: "공급처", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "dmndQty", //바꾸기 - title: "요구수량(M3/d)", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "useUsgCd", //바꾸기 - title: "사용용도", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "state", //바꾸기 - title: "진행상태", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - { - id: "matYn", //바꾸기 - title: "매칭완료 여부", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, - -]; \ No newline at end of file diff --git a/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx b/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx index 8bb70deae..b14e7b3a0 100644 --- a/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx +++ b/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx @@ -1,34 +1,204 @@ import type { z } from "zod"; import type { sttnHeadListType } from "../coSttn/headList"; -import type { CommonTableProps } from "../../common/type/header"; -import { ruseHstryHeadListExport, ruseHstryNodeListExport } from "./headList"; +import type { + CommonTableProps, + TableUpperProps, +} from "../../common/type/header"; +import { ruseHstryHeadListExport } from "./headList"; +import { fetchType, getFetch, putFectch } from "@/components/lib/api"; +import type { DmdCoReqType } from "../coMatRvw/type"; +import toast from "react-hot-toast"; -const ruseHstryHeadList = ruseHstryHeadListExport; -const ruseHstryNodeList = ruseHstryNodeListExport; +const ruseHistHeadList = ruseHstryHeadListExport; export type ruseHstryState = { - ruseHstry: { + ruseHist: { isInit: boolean; - ruseHstryHeadList: z.infer<typeof sttnHeadListType>; - ruseHstryNodeList: CommonTableProps[]; - + rvwHistRes: DmdCoReqType[]; + ruseHistHeadList: TableUpperProps[]; }; }; export const ruseHstryStateExport: ruseHstryState = { - ruseHstry: { + ruseHist: { isInit: false, - ruseHstryHeadList: ruseHstryHeadList, - ruseHstryNodeList: ruseHstryNodeList, - } -} + rvwHistRes: [], + ruseHistHeadList: ruseHistHeadList, + }, +}; export type ruseHstryType = ruseHstryState & ruseHstryActions; type ruseHstryActions = { + ruseRvwHistInit: ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd?: string + ) => void; + ruseRvwCalUpdate: (data: DmdCoReqType) => void; + ruseRvwSearch: ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string, + dmdCoNm: string, + ruseUtztnFcltNm: string + + ) => void; + ruseRvwInqua: ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string + ) => void; }; -export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (set: any) => { - return { +const irvwHistInit = async ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd?: string +) => { + let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + + console.log("sggCd ", sggCd); + if (sggCd) { + url += `/${sggCd}`; } -} \ No newline at end of file + + const rvwHistRes = await getFetch(fetchType.WR, url); + + return rvwHistRes; +}; + +export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( + set: any +) => { + return { + ruseRvwHistInit: async ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd?: string + ) => { + let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + + if (sggCd) { + url += `/${sggCd}`; + } + const rvwHistRes = await irvwHistInit( + pageNo, + pageCnt, + startYear, + endYear, + sggCd + ); + + return set((state: ruseHstryState) => ({ + ...state, + ruseHist: { + ...state.ruseHist, + init: false, + rvwHistRes: rvwHistRes, + }, + })); + }, + ruseRvwCalUpdate: async (data: DmdCoReqType) => { + try { + const update = await putFectch( + `/reuseFc/request/cst`, + JSON.stringify(data) + ); + if (update.status === 200) { + toast.success("매칭 계산 저장이 완료입니다."); + const rvwHistRes = await irvwHistInit( + 1, + 10, + new Date().getFullYear().toString(), + new Date().getFullYear().toString(), + "11" + ); + return set((state: ruseHstryState) => ({ + ...state, + ruseHist: { + ...state.ruseHist, + init: false, + rvwHistRes: rvwHistRes, + }, + })); + } + } catch (e) { + toast.error("매칭 계산 저장이 오류입니다."); + console.log(e); + } + }, + ruseRvwSearch: async ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string, + dmdCoNm: string, + ruseUtztnFcltNm: string + + ) => { + let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + + if (sggCd.length > 0) { + url += `/${sggCd}`; + } else { + url += `/0`; + } + if (dmdCoNm?.length > 0) { + url += `/${dmdCoNm}`; + } else { + url += `/0`; + } + if (ruseUtztnFcltNm?.length > 0) { + url += `/${ruseUtztnFcltNm}`; + } else { + url += `/0`; + } + const rvwHistRes = await getFetch(fetchType.WR, url); + + return set((state: ruseHstryState) => ({ + ...state, + ruseHist: { + ...state.ruseHist, + rvwHistRes: rvwHistRes, + }, + })); + }, + ruseRvwInqua: async ( + pageNo: number, + pageCnt: number, + startYear: string, + endYear: string, + sggCd: string + ) => { + try { + let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + if (sggCd.length > 0) { + url += `/${sggCd}`; + } + + const rvwHistRes = await getFetch(fetchType.WR, url); + return set((state: ruseHstryState) => ({ + ...state, + ruseHist: { + ...state.ruseHist, + rvwHistRes: rvwHistRes, + }, + })); + } catch (e) { + console.log(" error ", e); + } + }, + }; +}; diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx new file mode 100644 index 000000000..1d5fa789c --- /dev/null +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -0,0 +1,377 @@ +import { useWrStore } from "@/app/store"; +import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList"; +import type { + DedMatUpdateType, + DmdCoReqType, +} from "@/app/store/matDmd/coMatRvw/type"; +import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { formH1Class } from "@/components/lib/class/comClass"; +import { CmpttnModal } from "@/components/ui/modal/coMat/cmpttnModal"; +import { CoMatModal } from "@/components/ui/modal/coMat/coMatModal"; +import { + Form, + FormField, + FormUi, + UiModal, + UiTable, +} from "@common/business_components/ui"; +import PopoverUi from "@common/business_components/ui/popover_ui"; +import { Button, Input, Label } from "@common/components/ui"; +import { useEffect, useState } from "react"; +import { type UseFormReturn } from "react-hook-form"; + +export default function ConCostForm({ + form, + type, +}: { + form: UseFormReturn<DmdCoReqType>; + type: string; +}) { + const { coMatRvwUpdate,ruseRvwCalUpdate } = useWrStore((state) => state); + + const [isTrfMo, setIsTrfMo] = useState<{ + isModal: boolean; + }>({ isModal: false }); + const [isCmpttnMo, setIsCmpttnMo] = useState<{ + isModal: boolean; + }>({ isModal: false }); + + + + const onSubmit = (value: DmdCoReqType) => { + + if (type === "mat") { + const data: DedMatUpdateType = { + dmdInfoSn: form.getValues("dmdInfoSn"), + usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs"), + cstrnCst: form.getValues("demandCst.cstrnCst"), + fcltSbsdEpsTrf: form.getValues("demandCst.fcltSbsdEpsTrf"), + prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"), + rgtr: TEST_UUID, + }; + console.log("mat data ", data); + coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + } else if (type === "hist") { + console.log("hist data ", value); + ruseRvwCalUpdate(value) + } + }; + + useEffect(() => { + console.log(" form ", form.formState.errors); + }, [form.formState]); + + return ( + <> + <hr className="mt-8" /> + <Form {...form}> + <h3 className="mt-4 ml-2 text-2xl font-medium text-label"> + 표준공사비 산정 + </h3> + <div className="flex items-center mx-3 mb-3"> + <h1 className="">처리시설 표준공사비 산정</h1> + + <Button size={"sm"} onClick={(e) => {}}> + 계산 + </Button> + <Button size={"sm"} onClick={form.handleSubmit(onSubmit)}> + 저장 + </Button> + </div> + <div className="col-span-12 w-full"> + <h1 className={formH1Class}>기본사항</h1> + </div> + <div className="grid grid-cols-12 gap-4 ml-4 mr-4"> + <div className="col-span-3 mt-4"> + <FormField + control={form.control} + name="useUsgCd" + render={({ field }) => ( + <FormUi label="용도"> + <Input + placeholder="" + type="text" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? ""} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <FormField + control={form.control} + name="dmndQty" + render={({ field }) => ( + <FormUi label="요구수량(M3/d)"> + <Input + placeholder="" + type="number" + step="0.1" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <PopoverUi + childrenTriger={ + <> + <Label className="underline"> + 용도에 따른 처리공정 + <i className="diveicon di-search" /> + </Label> + </> + } + childrenBody={ + <> + <UiTable + className="" + headName={"용도에 따른 처리공정"} + tableData={usageProcData} + headlist={[ + { id: "usage", title: "용도" }, + { id: "process", title: "단위공정" }, + ]} + pageSize={0} + total={0} + cellClick={() => {}} + onPageChange={() => {}} + /> + </> + } + bodyClassName={"w-[25vw] max-w-none h-[54vh]"} + ></PopoverUi> + <FormField + control={form.control} + name="demandCst.usgPrcsProcs" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="text" + onChange={field.onChange} + value={form.getValues("demandCst.usgPrcsProcs") ?? ""} + className="mt-2" + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <FormField + control={form.control} + name="dmndQty" + render={({ field }) => ( + <FormUi label="처리시설 용량(요구수량 * 365일)"> + <Input + placeholder="" + type="number" + step="0.001" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={(Number(field.value) * 365)|| 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-12 w-full"> + <h1 className={formH1Class}>공사비 입력사항</h1> + </div> + <div className="col-span-3 mt-4"> + <div className="flex items-center justify-between"> + <Label>처리시설용량에 따른 공사비(백만원)</Label> + <Button + size={"sm"} + onClick={(e) => setIsCmpttnMo({ isModal: true })} + className="bg-none" + > + 공사비 산정표 보기 + </Button> + </div> + <FormField + control={form.control} + name="demandCst.prcsFcltCpctCstrnCst" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="number" + step="0.001" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <div className="flex items-center justify-between"> + <Label>시설부대경비 요율(%)</Label> + <Button + size={"sm"} + onClick={(e) => setIsTrfMo({ isModal: true })} + > + 요율표 보기 + </Button> + </div> + <FormField + control={form.control} + name="demandCst.fcltSbsdEpsTrf" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="number" + step="0.01" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <PopoverUi + childrenTriger={ + <> + <Label className="underline"> + 총사업비 (백만원) <i className="diveicon di-search" /> + </Label> + </> + } + childrenBody={ + <> + <div className="!w-full "> + <div className=" items-center font-bold mb-1 !text-3xl"> + 총사업비 계산방법 + </div> + <div className=" items-center !text-2xl"> + 하수처리수 재이용시설 총 사업비 = + 공사비+시설부대경비{" "} + </div> + </div> + </> + } + bodyClassName={"w-[22vw]"} + ></PopoverUi> + <Input + placeholder="" + className="mt-2" + type="number" + step="0.01" + onChange={(e) => {}} + value={ + form.getValues("demandCst.prcsFcltCpctCstrnCst") + + form.getValues("demandCst.fcltSbsdEpsTrf") || 0 + } + /> + </div> + <div className="col-span-3 mt-4"> + <div className="flex items-center justify-between"> + <Label>공급처 선정</Label> + <Button size={"sm"} onClick={(e) => {}} className="bg-none"> + 후보지 조회 + </Button> + </div> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="text" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? ""} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-4 mt-4"> + <div> + <FormField + control={form.control} + name="demandCst.cstrnCst" + render={({ field }) => ( + <FormUi label="공급관로 표준공사비(백만원)"> + <Input + placeholder="" + type="text" + step="0.001" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="mt-4"> + <Label>관로 표준공사비 산정 프로그램</Label> + <Button size={"sm"} onClick={(e) => {}} className="bg-none"> + 다운로드 + </Button> + </div> + <div className="col-span-4 mt-4 mb-3"> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <Label className="text-xl"> + 처리시설 + 공급관로 총사업비(백만원) + <FormUi label=""> + <Input + placeholder="" + type="number" + step="0.001" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + readOnly={true} + value={field.value ?? 0} + /> + </FormUi> + </Label> + )} + /> + </div> + </div> + </div> + <UiModal + body={<CoMatModal data={[]}></CoMatModal>} + bodyClass="w-[40vw] max-w-none h-[70vh]" + open={isTrfMo.isModal} + onOpenChange={(open) => { + setIsTrfMo({ isModal: open }); + }} + /> + <UiModal + body={<CmpttnModal data={[]}></CmpttnModal>} + bodyClass="w-[70vw] max-w-none h-[50vh]" + open={isCmpttnMo.isModal} + onOpenChange={(open) => { + setIsCmpttnMo({ isModal: open }); + }} + /> + </Form> + </> + ); +} diff --git a/apps/wr/components/ui/popover/bizTotalMoneyPop/bizTotalMoneyPop.tsx b/apps/wr/components/ui/popover/bizTotalMoneyPop/bizTotalMoneyPop.tsx deleted file mode 100644 index 84fbd83a5..000000000 --- a/apps/wr/components/ui/popover/bizTotalMoneyPop/bizTotalMoneyPop.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { - Label, - Popover, - PopoverContent, - PopoverTrigger, -} from "@common/components"; - -export default function BizTotalMoneyPop({ - children, -}: { - children: React.ReactNode; -}) { - return ( - <> - <Popover> - <PopoverTrigger>{children}</PopoverTrigger> - <PopoverContent className="w-[22vw]"> - <div className="!w-full justify-center flex items-center"> - <div className=" items-center font-bold mb-1 !text-3xl">총사업비 계산방법</div> - <div className=" items-center !text-2xl"> - 하수처리수 재이용시설 총 사업비 = 공사비+시설부대경비{" "} - </div> - </div> - </PopoverContent> - </Popover> - </> - ); -} diff --git a/apps/wr/components/ui/popover/usagePorcPop/usageProcPop.tsx b/apps/wr/components/ui/popover/usagePorcPop/usageProcPop.tsx deleted file mode 100644 index c1483847a..000000000 --- a/apps/wr/components/ui/popover/usagePorcPop/usageProcPop.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList"; -import { UiTable } from "@common/business_components/ui"; -import { Popover, PopoverContent, PopoverTrigger } from "@common/components"; -import { Children } from "react"; - -export default function UsageProcData({ children }: { children: React.ReactNode }) { - return ( - <> - <Popover> - <PopoverTrigger>{children}</PopoverTrigger> - - <PopoverContent className="w-[25vw] max-w-none h-[54vh]"> - <UiTable - className="" - headName={"용도에 따른 처리공정"} - tableData={usageProcData} - headlist={[ - { id: "usage", title: "용도" }, - { id: "process", title: "단위공정" }, - ]} - pageSize={0} - total={0} - cellClick={() => {}} - onPageChange={() => {}} - /> - </PopoverContent> - </Popover> - </> - ); -}