wr: (with-layout) toast 변경

This commit is contained in:
dongsilove
2026-04-03 21:42:52 +09:00
parent 5e5678f005
commit 1b6fb6f77d
13 changed files with 57 additions and 65 deletions
@@ -1,4 +1,4 @@
/**
/**
* 수요처매칭 > 재이용검토이력
*/
"use client";
@@ -163,26 +163,6 @@ export default function RuseRvwHstry() {
// const handleConfirm = async () => {
// ruseRvwComplete(completeData as number[]);
// };
// toast((t) => (
// <span className="flex flex-col items-center">
// 매칭완료를 진행하시겠습니까?
// <br />
// <div className="mt-2 flex flex-row space-x-2">
// <Button
// size={"sm"}
// onClick={() => {
// toast.dismiss(t.id);
// ruseRvwComplete(completeData as number[]);
// }}
// >
// 확인
// </Button>
// <Button size={"sm"} onClick={() => toast.dismiss(t.id)}>
// 취소
// </Button>
// </div>
// </span>
// ));
} else {
alert(t('isNotMatchFinishMsg'));
}
@@ -1,4 +1,4 @@
"use client";
"use client";
/**
* 수요처관리
@@ -184,7 +184,6 @@ export default function CoSttn() {
}
} else {
alert("비밀번호 초기화를 원하는 행을 선택해주세요.");
// toast.error("비밀번호 초기화를 원하는 행을 선택해주세요.")
}
}
@@ -1,4 +1,4 @@
/**
/**
* 온배수시설 현황
*/
"use client";
@@ -34,7 +34,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function HtdflSttn() {
@@ -58,6 +58,7 @@ export default function HtdflSttn() {
// chBuilding: chgBuilding[];
// }>({ isOpen: false, chBuilding: [] });
const [fcltNm, setFcltNm] = useState<string>("");
const alert = useAlertStore((state) => state.setMessage);
console.log("laeSeCd : ", laeSeCd);
useEffect(() => {
@@ -128,7 +129,7 @@ export default function HtdflSttn() {
sheetArray
);
} else {
toast.error(t('excelDownErrMsg'));
alert(t('excelDownErrMsg'));
}
isDownloadTriggered.current = false;
}, [htdflSttn.excelList, code]);
@@ -1,4 +1,4 @@
/**
/**
* 하수재이용 시설 현황
* 재이용시설 현황 - 하수재이용시설 현황
* - layout.tsx에 의해 공통 레이아웃이 적용됨
@@ -30,7 +30,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
@@ -61,6 +61,7 @@ export default function PbnstSttn() {
const isDownloadTriggered = useRef(false);
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
const { t } = useTranslation("base");
const alert = useAlertStore((state) => state.setMessage);
const excelClick = useCallback(() => {
isDownloadTriggered.current = true;
pbnstSttnSearch(
@@ -119,7 +120,7 @@ export default function PbnstSttn() {
sheetArray
);
} else {
toast.error(t("excelDownErrMsg"));
alert(t("excelDownErrMsg"));
}
isDownloadTriggered.current = false;
}, [pbnstSttn.excelList]);
@@ -1,4 +1,4 @@
/**
/**
* 빗물이용시설 현황
*/
"use client";
@@ -32,7 +32,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function RainSttn() {
@@ -58,6 +58,7 @@ export default function RainSttn() {
const [fcltNm, setFcltNm] = useState<string>("");
const { t } = useTranslation("base");
const alert = useAlertStore((state) => state.setMessage);
const cellClick = (index: number | undefined) => {
if (index !== undefined && bdstTable !== undefined) {
@@ -173,7 +174,7 @@ export default function RainSttn() {
sheetArray
);
} else {
toast.error(t("excelDownErrMsg"));
alert(t("excelDownErrMsg"));
}
isDownloadTriggered.current = false;
}, [rainSttn.excelList]);
@@ -1,4 +1,4 @@
/**
/**
* 중수도시설 현황
*/
"use client";
@@ -32,7 +32,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function RswtSttn() {
@@ -52,6 +52,7 @@ export default function RswtSttn() {
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false })
const [fcltNm, setFcltNm] = useState<string>("");
const { t } = useTranslation('base');
const alert = useAlertStore((state) => state.setMessage);
const cellClick = (index: number | undefined) => {
if ( index !== undefined && bdstTable !== undefined) {
@@ -143,7 +144,7 @@ export default function RswtSttn() {
sheetArray
);
} else {
toast.error(t('excelDownErrMsg'));
alert(t('excelDownErrMsg'));
}
isDownloadTriggered.current = false;
}, [rswtSttn.excelList]);
@@ -1,4 +1,4 @@
"use client";
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
@@ -38,7 +38,7 @@ import {
TooltipTrigger,
} from "@common/components/ui/tooltip";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function Page() {
@@ -237,6 +237,7 @@ export default function Page() {
}, [rainChkgdn.isSttn, rswtChkgdn.isSttn]);
const { t } = useTranslation('base');
const alert = useAlertStore((state) => state.setMessage);
const clickDelete = async (data: number[], selFcltDiv: string) => {
if (data.length > 0) {
if (selFcltDiv === "RNB") {
@@ -261,13 +262,13 @@ export default function Page() {
if (updateRainDetail && updateRainDetail.length > 0) {
rainChkDetilUpdate(updateRainDetail, searchYear);
} else {
toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
alert("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
}
} else {
if (updateRswtDetail && updateRswtDetail.length > 0) {
rswtChkDetilsUpdate(updateRswtDetail, searchYear);
} else {
toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
alert("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
}
}
};
@@ -1,4 +1,4 @@
"use client";
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel";
@@ -37,7 +37,7 @@ import {
TableHeader,
} from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
@@ -73,6 +73,7 @@ export default function PrfmncPrfmncReg() {
String(new Date().getFullYear())
);
const { confirm } = useConfirm();
const alert = useAlertStore((state) => state.setMessage);
const useInitRef = useRef(false);
@@ -90,7 +91,7 @@ export default function PrfmncPrfmncReg() {
const handleConfirm = async () => {
if (!pbnstRuseFcltId) return;
prfmnRegData(
const message = await prfmnRegData(
1,
laeSeCd,
excelToPbnPrfData(
@@ -101,6 +102,7 @@ export default function PrfmncPrfmncReg() {
searchYear,
prfPbnFclts
);
alert(message);
};
if (await confirm(t("isUpdateMsg"))) {
@@ -287,7 +289,7 @@ export default function PrfmncPrfmncReg() {
className={btnClass}
onClick={() => {
if (cellNum === undefined) {
toast.error("하수처리재이용시설을 선택해주세요.");
alert("하수처리재이용시설을 선택해주세요.");
return;
} else {
setIsExcelOPen({ ...isExcelOpen, isModal: true });
@@ -374,7 +376,8 @@ export default function PrfmncPrfmncReg() {
setIsExcelOPen({ ...isExcelOpen, isModal: open });
}}
setModalExcelData={async (excelData) => {
await prfmnRegData(1, laeSeCd, excelData, searchYear, prfPbnFclts);
const message = await prfmnRegData(1, laeSeCd, excelData, searchYear, prfPbnFclts);
alert(message);
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
}}
></PbnPrfExcelModal>
@@ -1,4 +1,4 @@
"use client";
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
@@ -21,7 +21,7 @@ import {
import ListDiv from "@common/business_components/ui/list_div";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function Page() {
@@ -137,13 +137,14 @@ export default function Page() {
[isModal]
);
const { t } = useTranslation("base");
const alert = useAlertStore((state) => state.setMessage);
const excelDown = () => {
if (rainChkSttn.sttnExcelList && selFcltDiv === "RNB") {
if (
!rainChkSttn.sttnExcelList ||
rainChkSttn.sttnExcelList.length === 0
) {
toast.error(t("excelDownErrMsg"));
alert(t("excelDownErrMsg"));
return;
}
// console.log(rainChkSttn.sttnExcelList);
@@ -165,7 +166,7 @@ export default function Page() {
!rswtChkSttn.sttnExcelList ||
rswtChkSttn.sttnExcelList.length === 0
) {
toast.error(t("excelDownErrMsg"));
alert(t("excelDownErrMsg"));
return;
}
const sheetArray: SheetParameter[] = [{
@@ -1,4 +1,4 @@
"use client";
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
@@ -11,7 +11,7 @@ import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchI
import ListDiv from "@common/business_components/ui/list_div";
import { Label, Table, TableBody, TableHeader } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead";
@@ -37,6 +37,7 @@ export default function PbnstPrfmncSttn() {
// const [swtrmtFcltNm, setSwtrmtFcltNm] = useState<string>();
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
const { t } = useTranslation('base');
const alert = useAlertStore((state) => state.setMessage);
const searchYear = String(new Date().getFullYear());
const [excelData, setExcelData] = useState<any[]>([]);
const [pageNation, setPageNation] = useState(1);
@@ -44,7 +45,7 @@ export default function PbnstPrfmncSttn() {
const excelClick = useCallback(() => {
if (!excelData || excelData.length === 0) {
toast.error(t('excelDownErrMsg'));
alert(t('excelDownErrMsg'));
return;
}
const sheetArray: SheetParameter[] = [{
@@ -598,10 +599,10 @@ export default function PbnstPrfmncSttn() {
const fromNum = Number(fromDate);
const toNum = Number(toDate);
if (fromNum > toNum) {
toast.error("시작년도가 종료년도 이후로 설정할 수 없습니다.");
alert("시작년도가 종료년도 이후로 설정할 수 없습니다.");
} else {
if (toNum - fromNum > 4) {
toast.error("최대 5년까지 선택 가능합니다.");
alert("최대 5년까지 선택 가능합니다.");
} else {
tableHeadMaker(fromNum, toNum);
@@ -1,4 +1,4 @@
"use client";
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
@@ -17,7 +17,7 @@ import {
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function RainStat() {
@@ -30,6 +30,7 @@ export default function RainStat() {
//const [exData, setExData] = useState<Array<Record<string, string | number>>>();
const [bdstTable, setBdstTable] = useState<RainStatProps[]>();
const { t } = useTranslation('base');
const alert = useAlertStore((state) => state.setMessage);
useEffect(() => {
searchRainStatList(searchYear ,code.cityCd);
@@ -184,7 +185,7 @@ export default function RainStat() {
decimalArray0: [1,2,3,4,5,6,7,8,9,10,11,12], // 0부터 시작
})
}else{
toast.error(t('excelDownErrMsg'));
alert(t('excelDownErrMsg'));
}
}
@@ -1,4 +1,4 @@
"use client";
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import type { RswtStatProps } from "@/app/store/stats/rswtStat";
@@ -15,7 +15,7 @@ import {
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useAlertStore } from "@/src/shared/lib";
import { useTranslation } from "react-i18next";
export default function RswtStat() {
@@ -27,6 +27,7 @@ export default function RswtStat() {
);
const { t } = useTranslation('base');
const alert = useAlertStore((state) => state.setMessage);
useEffect(() => {
searchRswtStatList(searchYear, code.cityCd, code.rswtBdstType);
}, [searchRswtStatList, code.cityCd])
@@ -62,7 +63,7 @@ export default function RswtStat() {
decimalArray0: [1,2,3,4,5,6,7,8,9,10,11,12,13], // 0부터 시작
})
} else {
toast.error(t("excelDownErrMsg"))
alert(t("excelDownErrMsg"))
}
}
@@ -1,4 +1,4 @@
/**
/**
* 재이용실적등록 > 하수재이용실적등록
*
* 🔗 사용 API
@@ -13,7 +13,6 @@ import { pbnstPrfmncHeadListExport, monthHeadListExport } from "./headList";
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
import type { FcPrfType, PrfType } from "./type";
import type { TableUpperProps } from "../../common/type/header";
import toast from "react-hot-toast";
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
const monthHeadList = monthHeadListExport;
@@ -66,7 +65,7 @@ type pbnstPrfmncActions = {
data: PrfType,
year: string,
prfPbnFclts: string[]
) => void;
) => Promise<string>;
getPrfFmcRes: () => void;
};
@@ -203,6 +202,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
year: string,
prfPbnFclts: string[]
) => {
const failMessage = "하수재이용 시설 실적 등록이 실패하였습니다.";
try {
const ressponse = await postFectch(
"/reuseFc/pubFcPrf",
@@ -211,7 +211,6 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
);
if (ressponse.status === 200) {
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
const prfmncRes = await hasuListFetch(
page,
sggOrCity,
@@ -219,7 +218,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
prfPbnFclts
);
return set((state: pbnstPrfmncState) => ({
set((state: pbnstPrfmncState) => ({
...state,
prfmnc: {
...state.prfmnc,
@@ -229,10 +228,12 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
pageKey: state.prfmnc.pageKey + 1,
},
}));
return "하수재이용 시설 실적 등록이 완료되었습니다.";
}
return failMessage;
} catch (e) {
console.log(e);
toast.error("하수재이용 시설 실적 등록이 실패하였습니다.");
return failMessage;
}
},
};