fix ( upload image )

deksripsi:
- fix upload image investasi dan file prospektus
This commit is contained in:
2025-01-15 10:25:41 +08:00
parent d0680f2743
commit 1855b6df32
24 changed files with 725 additions and 859 deletions

View File

@@ -65,6 +65,7 @@ export function Investasi_ComponentButtonCreateNewInvestasi({
dirId: DIRECTORY_ID.investasi_prospektus,
});
if (!uploadFilePdf.success) {
setIsLoading(false);
ComponentGlobal_NotifikasiPeringatan("Gagal upload file pdf");
return;
}
@@ -104,17 +105,16 @@ export function Investasi_ComponentButtonCreateNewInvestasi({
router.push(NEW_RouterInvestasi.portofolio({ id: "2" }));
setActiveTab("Review");
setHotMenu(1);
setIsLoading(true);
ComponentGlobal_NotifikasiBerhasil(res.message);
}
} else {
setIsLoading(false);
ComponentGlobal_NotifikasiGagal(res.message);
}
} catch (error) {
clientLogger.error("Error create new investasi", error);
} finally {
setIsLoading(false);
}
clientLogger.error("Error create new investasi", error);
}
}
return (

View File

@@ -6,11 +6,15 @@ import {
ComponentGlobal_NotifikasiPeringatan,
} from "@/app_modules/_global/notif_global";
import { DIRECTORY_ID } from "@/app/lib";
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
import {
funGlobal_DeleteFileById,
funGlobal_UploadToStorage,
} from "@/app_modules/_global/fun";
import _ from "lodash";
import { investasi_funUpdateInvestasi } from "../../_fun";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { clientLogger } from "@/util/clientLogger";
export function Investasi_ComponentButtonUpdateDataInvestasi({
data,
@@ -37,11 +41,21 @@ export function Investasi_ComponentButtonUpdateDataInvestasi({
file: file as any,
dirId: DIRECTORY_ID.investasi_image,
});
if (!uploadImage.success) {
setIsLoading(false);
return ComponentGlobal_NotifikasiPeringatan("Gagal upload file gambar");
}
const deleteFile = await funGlobal_DeleteFileById({
fileId: data.imageId,
});
if (!deleteFile.success) {
setIsLoading(false);
clientLogger.error("Error delete file:", deleteFile.message);
}
const updtWithImage = await investasi_funUpdateInvestasi({
data: data,
imageId: uploadImage.data.id,

View File

@@ -0,0 +1,35 @@
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
import { Box, Center, Stack } from "@mantine/core";
export { Investasi_SkeletonEditProspektus };
function Investasi_SkeletonEditProspektus() {
return (
<>
<Stack>
<CustomSkeleton h={70} radius={"md"} />
<CustomSkeleton h={70} radius={"md"} />
<Center>
<CustomSkeleton h={40} w={100} radius={"xl"} />
</Center>
<Box
style={{
display: "flex",
justifyContent: "center",
}}
>
<Box
style={{
transition: "all 0.3s ease",
position: "absolute",
bottom: 20,
width: "90%",
}}
>
<CustomSkeleton h={40} width={"100%"} radius={"xl"} />
</Box>
</Box>
</Stack>
</>
);
}