wr: message alert matMng
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
getInterpolation,
|
||||
transformAndInterpolate,
|
||||
} from "@/components/lib/func/calculateConstCost ";
|
||||
import { useAlertStore } from "@/src/shared/lib";
|
||||
import { ConstCostFeeTable } from "@/components/ui/modal/coMat/constCostFeeTable";
|
||||
import { RateFeeTableModal } from "@/components/ui/modal/coMat/rateFeeModal";
|
||||
import {
|
||||
@@ -53,6 +54,7 @@ export default function ConCostForm({
|
||||
getRateFee,
|
||||
getConstCostFee,
|
||||
} = useWrStore((state) => state);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
|
||||
const ref = useRef<boolean>(false);
|
||||
|
||||
@@ -108,11 +110,11 @@ export default function ConCostForm({
|
||||
const calculateConstCost = useCallback(() => {
|
||||
const usgPrcsProcs = usgPrcsProcsWatch;
|
||||
if (!dmndQtyWatch) {
|
||||
toast.error("요구수량(m³/일)을 확인해주세요 계산할수 없습니다. ");
|
||||
alert("요구수량(m³/일)을 확인해주세요 계산할수 없습니다. ");
|
||||
return;
|
||||
}
|
||||
if (usgPrcsProcs === null || usgPrcsProcs === undefined) {
|
||||
toast.error(
|
||||
alert(
|
||||
"용도에 따른 처리공정을 확인할수 없습니다. 용도를 확인해주세요. "
|
||||
);
|
||||
return;
|
||||
@@ -175,9 +177,9 @@ export default function ConCostForm({
|
||||
form.setValue("totalConstCost", Math.round(realResult));
|
||||
}
|
||||
}, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]);
|
||||
const onSubmit = (value: DmdCoReqType) => {
|
||||
const onSubmit = async (value: DmdCoReqType) => {
|
||||
if (value.demandCst && !value.demandCst.prcsFcltCpctCstrnCst) {
|
||||
toast.error("공사비 계산 진행 후 저장을 눌러주새요");
|
||||
alert("공사비 계산 진행 후 저장을 눌러주새요");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -211,10 +213,15 @@ export default function ConCostForm({
|
||||
<div className="flex gap-2 mt-2">
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
toast.dismiss(t.id);
|
||||
|
||||
coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data);
|
||||
|
||||
const message = await coMatRvwUpdate(
|
||||
pk,
|
||||
form.getValues("dmdInfoId"),
|
||||
data
|
||||
);
|
||||
alert(message);
|
||||
}}
|
||||
>
|
||||
확인
|
||||
@@ -226,10 +233,15 @@ export default function ConCostForm({
|
||||
</span>
|
||||
));
|
||||
} else {
|
||||
coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data);
|
||||
const message = await coMatRvwUpdate(
|
||||
pk,
|
||||
form.getValues("dmdInfoId"),
|
||||
data
|
||||
);
|
||||
alert(message);
|
||||
}
|
||||
}else{
|
||||
toast.error('후보지를 먼저 선택해주세요')
|
||||
alert('후보지를 먼저 선택해주세요')
|
||||
}
|
||||
}
|
||||
} else if (type === "hist") {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useWrStore } from "@/app/store";
|
||||
import { coRegExcel } from "@/app/store/matDmd/coSttn/headList";
|
||||
import { mapAndValidateRow, type ruseCaseMngExcelProps } from "@/app/store/matDmd/ruseCaseMng/excel";
|
||||
import { showConfirmToast } from "@/components/lib/func/commom";
|
||||
import { useAlertStore } from "@/src/shared/lib";
|
||||
import { filePicked, Title } from "@common/business_components/ui";
|
||||
import { Form } from "@common/business_components/ui/form";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
@@ -12,6 +13,7 @@ import type { z } from "zod";
|
||||
|
||||
export default function RuseCaseMngExcel({setIsExcelOpen}:{setIsExcelOpen: (isOpen:boolean)=>void}) {
|
||||
const { insertRuseCaseMng } = useWrStore((state) => state);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const form = useForm<z.infer<typeof coRegExcel>>({
|
||||
resolver: zodResolver(coRegExcel),
|
||||
});
|
||||
@@ -20,7 +22,7 @@ export default function RuseCaseMngExcel({setIsExcelOpen}:{setIsExcelOpen: (isOp
|
||||
|
||||
const onSubmit = () => {
|
||||
if (file) {
|
||||
filePicked(file, 0).then((res: unknown) => {
|
||||
filePicked(file, 0).then(async (res: unknown) => {
|
||||
try {
|
||||
const newArray: ruseCaseMngExcelProps[] = []
|
||||
const isError:string[][] = []
|
||||
@@ -144,7 +146,8 @@ export default function RuseCaseMngExcel({setIsExcelOpen}:{setIsExcelOpen: (isOp
|
||||
alert("업로드할 데이터가 없습니다.");
|
||||
return;
|
||||
}else if(newArray.length > 0){
|
||||
insertRuseCaseMng(newArray);
|
||||
const message = await insertRuseCaseMng(newArray);
|
||||
alert(message);
|
||||
setIsExcelOpen(false);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -188,4 +191,4 @@ export default function RuseCaseMngExcel({setIsExcelOpen}:{setIsExcelOpen: (isOp
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user