diff --git a/src/app/api/new/investasi/[id]/route.ts b/src/app/api/new/investasi/[id]/route.ts index ef327393..2b7342d1 100644 --- a/src/app/api/new/investasi/[id]/route.ts +++ b/src/app/api/new/investasi/[id]/route.ts @@ -23,6 +23,7 @@ export async function GET(request: Request, context: { params: { id: string } }) catatan: true, sisaLembar: true, imageId: true, + prospektusFileId: true, masterPencarianInvestorId: true, masterPeriodeDevidenId: true, masterPembagianDevidenId: true, diff --git a/src/app/dev/investasi/edit/[id]/page.tsx b/src/app/dev/investasi/edit/[id]/page.tsx index a81633bb..76a5e468 100644 --- a/src/app/dev/investasi/edit/[id]/page.tsx +++ b/src/app/dev/investasi/edit/[id]/page.tsx @@ -1,38 +1,8 @@ -import { investasi_funGetOneInvestasiById } from "@/app_modules/investasi/_fun"; -import { Investasi_UiEditInvestasi, Investasi_UiEditInvestasiNew } from "@/app_modules/investasi/_ui"; -import getPembagianDeviden from "@/app_modules/investasi/fun/master/get_pembagian_deviden"; -import getPencarianInvestor from "@/app_modules/investasi/fun/master/get_pencarian_investor"; -import getPeriodeDeviden from "@/app_modules/investasi/fun/master/get_periode_deviden"; -import _ from "lodash"; - -export default async function Page({ params }: { params: { id: string } }) { - // const investasiId = params.id; - - // const allData = await investasi_funGetOneInvestasiById({ investasiId }); - // const dataInvestasi = _.omit(allData, [ - // "BeritaInvestasi", - // "DokumenInvestasi", - // "MasterPembagianDeviden", - // "MasterPencarianInvestor", - // "MasterProgresInvestasi", - // "MasterStatusInvestasi", - // "ProspektusInvestasi", - // "MasterPeriodeDeviden", - // "author", - // ]); - - // const listPencarian = await getPencarianInvestor(); - // const listPeriode = await getPeriodeDeviden(); - // const listPembagian = await getPembagianDeviden(); +import { Investasi_UiEditInvestasiNew } from "@/app_modules/investasi/_ui"; +export default async function Page() { return ( <> - {/* */} ); diff --git a/src/app/dev/investasi/edit/prospektus/[id]/page.tsx b/src/app/dev/investasi/edit/prospektus/[id]/page.tsx index 519debdf..4c09a503 100644 --- a/src/app/dev/investasi/edit/prospektus/[id]/page.tsx +++ b/src/app/dev/investasi/edit/prospektus/[id]/page.tsx @@ -1,11 +1,10 @@ import { Investasi_UiEditProspektus } from "@/app_modules/investasi/_ui"; -export default async function Page({ params }: { params: { id: string } }) { - const investasiId = params.id; +export default async function Page() { return ( <> - + ); } diff --git a/src/app/dev/investasi/edit_prospektus/[id]/layout.tsx b/src/app/dev/investasi/edit_prospektus/[id]/layout.tsx deleted file mode 100644 index 0c6a45a1..00000000 --- a/src/app/dev/investasi/edit_prospektus/[id]/layout.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { LayoutEditProspektusInvestasi } from "@/app_modules/investasi"; -import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id"; -import React from "react"; - -export default async function Layout({ - children, - params, -}: { - children: React.ReactNode; - params: { id: string }; -}) { - const dataInvestasi = await getOneInvestasiById(params.id); - - return ( - <> - - {children} - - - ); -} diff --git a/src/app/dev/investasi/edit_prospektus/[id]/page.tsx b/src/app/dev/investasi/edit_prospektus/[id]/page.tsx deleted file mode 100644 index 521d1475..00000000 --- a/src/app/dev/investasi/edit_prospektus/[id]/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { EditProspektusInvestasi } from "@/app_modules/investasi"; -import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id"; - -export default async function Page({ params }: { params: { id: string } }) { - const dataInvestasi = await getOneInvestasiById(params.id); -// console.log(dataInvestasi); - return ( - <> - - - ); -} diff --git a/src/app_modules/_global/button/comp_button_upload_photo.tsx b/src/app_modules/_global/button/comp_button_upload_photo.tsx index 2d6f1a6f..59103c6c 100644 --- a/src/app_modules/_global/button/comp_button_upload_photo.tsx +++ b/src/app_modules/_global/button/comp_button_upload_photo.tsx @@ -10,9 +10,15 @@ import { ComponentGlobal_NotifikasiPeringatan } from "../notif_global"; export function ComponentGlobal_ButtonUploadFileImage({ onSetFile, onSetImage, + text, + icon, + accept, }: { onSetFile: File | null | any; - onSetImage: any | null; + onSetImage?: any | null; + text?: string; + icon?: string | any + accept?: string; }) { const [isLoading, setIsLoading] = useState(false); @@ -28,6 +34,7 @@ export function ComponentGlobal_ButtonUploadFileImage({ if (files.size > 100 * 1024 * 1024) { setIsLoading(false); ComponentGlobal_NotifikasiPeringatan("File terlalu besar"); + return } onSetFile(files); @@ -38,7 +45,7 @@ export function ComponentGlobal_ButtonUploadFileImage({ setIsLoading(false); } }} - accept="image/png,image/png,image/jpeg,image/gif" + accept={accept ? accept : "image/png,image/png,image/jpeg,image/gif"} > {(props) => ( )} diff --git a/src/app_modules/_global/component/box_information.tsx b/src/app_modules/_global/component/box_information.tsx index 8dbe0a0b..94afb1f2 100644 --- a/src/app_modules/_global/component/box_information.tsx +++ b/src/app_modules/_global/component/box_information.tsx @@ -42,7 +42,13 @@ export default function ComponentGlobal_BoxInformation({ - + {informasi} diff --git a/src/app_modules/investasi/_component/button/comp_button_create_new_investasi.tsx b/src/app_modules/investasi/_component/button/comp_button_create_new_investasi.tsx index 8dbb877b..2e37d8e4 100644 --- a/src/app_modules/investasi/_component/button/comp_button_create_new_investasi.tsx +++ b/src/app_modules/investasi/_component/button/comp_button_create_new_investasi.tsx @@ -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 ( diff --git a/src/app_modules/investasi/_component/button/comp_button_update_investasi.tsx b/src/app_modules/investasi/_component/button/comp_button_update_investasi.tsx index c2cc815e..8487ced8 100644 --- a/src/app_modules/investasi/_component/button/comp_button_update_investasi.tsx +++ b/src/app_modules/investasi/_component/button/comp_button_update_investasi.tsx @@ -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, diff --git a/src/app_modules/investasi/_component/skeleton_view.tsx b/src/app_modules/investasi/_component/skeleton_view.tsx new file mode 100644 index 00000000..8f03289b --- /dev/null +++ b/src/app_modules/investasi/_component/skeleton_view.tsx @@ -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 ( + <> + + + +
+ +
+ + + + + +
+ + ); +} diff --git a/src/app_modules/investasi/_ui/edit/ui_edit_investasi_new.tsx b/src/app_modules/investasi/_ui/edit/ui_edit_investasi_new.tsx index bbd22683..e0edfa1e 100644 --- a/src/app_modules/investasi/_ui/edit/ui_edit_investasi_new.tsx +++ b/src/app_modules/investasi/_ui/edit/ui_edit_investasi_new.tsx @@ -1,6 +1,6 @@ "use client"; import { UIGlobal_LayoutHeaderTamplate, UIGlobal_LayoutTamplate, } from "@/app_modules/_global/ui"; -import { Investasi_ViewEditInvestasiNew } from "../../_view/edit/vew_edit_investasi_new"; +import { Investasi_ViewEditInvestasiNew } from "../../_view/edit/view_edit_investasi_new"; export function Investasi_UiEditInvestasiNew() { return ( diff --git a/src/app_modules/investasi/_ui/edit/ui_edit_prospektus.tsx b/src/app_modules/investasi/_ui/edit/ui_edit_prospektus.tsx index d4aea25c..92f02d46 100644 --- a/src/app_modules/investasi/_ui/edit/ui_edit_prospektus.tsx +++ b/src/app_modules/investasi/_ui/edit/ui_edit_prospektus.tsx @@ -6,17 +6,13 @@ import { } from "@/app_modules/_global/ui"; import { Investasi_ViewEditProspektus } from "../../_view"; -export function Investasi_UiEditProspektus({ - investasiId, -}: { - investasiId: string; -}) { +export function Investasi_UiEditProspektus() { return ( <> } > - + ); diff --git a/src/app_modules/investasi/_view/edit/vew_edit_investasi_new.tsx b/src/app_modules/investasi/_view/edit/vew_edit_investasi_new.tsx deleted file mode 100644 index 54f11867..00000000 --- a/src/app_modules/investasi/_view/edit/vew_edit_investasi_new.tsx +++ /dev/null @@ -1,420 +0,0 @@ -import { MainColor } from "@/app_modules/_global/color"; -import { ComponentGlobal_BoxInformation, ComponentGlobal_BoxUploadImage, ComponentGlobal_LoadImage, } from "@/app_modules/_global/component"; -import { AspectRatio, Box, Button, FileButton, Group, Image, Select, Stack, Text, TextInput, } from "@mantine/core"; -import { useShallowEffect } from "@mantine/hooks"; -import { IconCamera } from "@tabler/icons-react"; -import _ from "lodash"; -import { useState } from "react"; -import { Investasi_ComponentButtonUpdateDataInvestasi } from "../../_component"; -import { apiGetMasterInvestasi, apiGetOneInvestasiById } from "../../_lib/api_interface"; -import { IDataInvestasi } from "../../_lib/type_investasi"; -import { useParams } from "next/navigation"; -import SkeletonEditInvestasi from "./skeleton_edit_investasi"; - -export function Investasi_ViewEditInvestasiNew() { - const param = useParams<{ id: string }>() - const [loading, setLoading] = useState(true) - const [loadingMasterInvestor, setLoadingMasterInvestor] = useState(true) - const [loadingMasterPeriodeDeviden, setLoadingMasterPeriodeDeviden] = useState(true) - const [loadingMasterPembagianDeviden, setLoadingMasterPembagianDeviden] = useState(true) - const [periodeDeviden, setPeriodeDeviden] = useState([]); - const [pembagianDeviden, setPembagianDeviden] = useState([]); - const [pencarianInvestor, setPencarianInvestor] = useState([]); - const [data, setData] = useState(); - const [file, setFile] = useState(null); - const [img, setImg] = useState(); - const [target, setTarget] = useState(""); - const [harga, setHarga] = useState(""); - const [totalLembar, setTotalLembar] = useState(""); - - - async function onGetOneInvestasiById() { - try { - setLoading(true) - const response = await apiGetOneInvestasiById(param.id) - if (response.success) { - setData(response.data) - setTotalLembar(response.data.totalLembar) - } - } catch (error) { - console.error(error) - } finally { - setLoading(false) - } - } - - async function onGetMasterInvestor() { - try { - setLoadingMasterInvestor(true) - const response = await apiGetMasterInvestasi("?cat=pencarian-investor") - if (response.success) { - setPencarianInvestor(response.data) - } - } catch (error) { - console.log(error) - } finally { - setLoadingMasterInvestor(false) - } - } - - async function onGetMasterPeriodeDeviden() { - try { - setLoadingMasterPeriodeDeviden(true) - const response = await apiGetMasterInvestasi("?cat=periode-deviden") - if (response.success) { - setPeriodeDeviden(response.data) - } - } catch (error) { - console.log(error) - } finally { - setLoadingMasterPeriodeDeviden(false) - } - } - - - async function onGetMasterPembagianDeviden() { - try { - setLoadingMasterPembagianDeviden(true) - const response = await apiGetMasterInvestasi("?cat=pembagian-deviden") - if (response.success) { - setPembagianDeviden(response.data) - } - } catch (error) { - console.log(error) - } finally { - setLoadingMasterPembagianDeviden(false) - } - } - - useShallowEffect(() => { - onGetOneInvestasiById() - onGetMasterInvestor() - onGetMasterPeriodeDeviden() - onGetMasterPembagianDeviden() - }, []) - - async function onTotalLembar({ target, harga, }: { target?: number | any; harga?: number | any; }) { - if (target !== 0 && harga !== 0) { - const hasil: any = target / harga; - const result = _.floor(hasil === Infinity ? 0 : hasil); - setTotalLembar(result.toString()); - } - } - - return ( - <> - - { - loading ? - - : - <> - - - - - - {img ? ( - - Avatar - - ) : ( - - )} - - {/* Upload Foto */} - - { - try { - const buffer = URL.createObjectURL( - new Blob([new Uint8Array(await files.arrayBuffer())]) - ); - setImg(buffer); - setFile(files); - } catch (error) { - console.log(error); - } - }} - accept="image/png,image/jpeg" - > - {(props) => ( - - )} - - - - - - { - setData({ - ...data as any, - title: val.target.value, - }); - }} - /> - - Rp.} - min={0} - withAsterisk - label="Dana Dibutuhkan" - placeholder="0" - value={target ? target : data?.targetDana} - onChange={(val) => { - const match = val.currentTarget.value - .replace(/\./g, "") - .match(/^[0-9]+$/); - - if (val.currentTarget.value === "") return setTarget(0 + ""); - if (!match?.[0]) return null; - - const nilai = val.currentTarget.value.replace(/\./g, ""); - const targetNilai = Intl.NumberFormat("id-ID").format(+nilai); - - onTotalLembar({ - target: +nilai, - harga: +Number(data?.hargaLembar), - }); - - setTarget(targetNilai); - setData({ - ...data as any, - targetDana: nilai as string, - }); - }} - /> - - Rp.} - min={0} - withAsterisk - label="Harga Per Lembar" - placeholder="0" - value={harga ? harga : data?.hargaLembar} - onChange={(val) => { - try { - const match = val.currentTarget.value - .replace(/\./g, "") - .match(/^[0-9]+$/); - - if (val.currentTarget.value === "") return setHarga(0 + ""); - - if (!match?.[0]) return null; - - const nilai = val.currentTarget.value.replace(/\./g, ""); - const targetNilai = Intl.NumberFormat("id-ID").format(+nilai); - - onTotalLembar({ - harga: +nilai, - target: +Number(data?.targetDana), - }); - - setHarga(targetNilai); - setData({ - ...data as any, - hargaLembar: nilai as string, - }); - } catch (error) { - console.log(error); - } - }} - /> - - - - - % - - } - withAsterisk - type="number" - label={"Rasio Keuntungan / ROI %"} - placeholder="Masukan rasio keuntungan" - value={data?.roi} - onChange={(val) => { - setData({ - ...data as any, - roi: val.target.value, - }); - }} - /> - - ({ value: e.id, label: e.name }))} - value={data?.masterPeriodeDevidenId} - onChange={(val) => { - setData({ - ...(data as any), - masterPeriodeDevidenId: val, - }); - }} - /> - - ({ + value: e.id, + label: e.name + " " + "hari", + }))} + value={data?.masterPencarianInvestorId} + onChange={(val) => { + setData({ + ...(data as any), + masterPencarianInvestorId: val, + }); + }} + /> + + ({ + value: e.id, + label: e.name + " " + "bulan", + }))} + value={data?.masterPembagianDevidenId} + onChange={(val) => { + setData({ + ...(data as any), + masterPembagianDevidenId: val, + }); + }} + /> + + + + )} + + + ); +} diff --git a/src/app_modules/investasi/_view/edit/view_edit_prospektus.tsx b/src/app_modules/investasi/_view/edit/view_edit_prospektus.tsx index 6b7ea3b0..caf1c5f1 100644 --- a/src/app_modules/investasi/_view/edit/view_edit_prospektus.tsx +++ b/src/app_modules/investasi/_view/edit/view_edit_prospektus.tsx @@ -1,82 +1,118 @@ import { MainColor } from "@/app_modules/_global/color"; import { ComponentGlobal_BoxInformation, + ComponentGlobal_ButtonUploadFileImage, ComponentGlobal_CardStyles, } from "@/app_modules/_global/component"; import { + Box, Button, Center, - FileButton, Grid, - Group, Stack, Text } from "@mantine/core"; import { - IconCamera, - IconCircleCheck + IconCircleCheck, + IconFileTypePdf } from "@tabler/icons-react"; 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 { ComponentGlobal_NotifikasiBerhasil, ComponentGlobal_NotifikasiPeringatan, } from "@/app_modules/_global/notif_global"; -import { useRouter } from "next/navigation"; +import { clientLogger } from "@/util/clientLogger"; +import { useShallowEffect } from "@mantine/hooks"; +import { useParams, useRouter } from "next/navigation"; import { useState } from "react"; +import { Investasi_SkeletonEditProspektus } from "../../_component/skeleton_view"; import { investasi_funUpdateProspektus } from "../../_fun"; +import { apiGetOneInvestasiById } from "../../_lib/api_interface"; -export function Investasi_ViewEditProspektus({ - investasiId, -}: { - investasiId: string; -}) { +export function Investasi_ViewEditProspektus() { + const params = useParams<{ id: string }>(); + const investasiId = params.id; const router = useRouter(); const [filePdf, setFilePdf] = useState(null); const [isLoading, setIsLoading] = useState(false); + const [fileRemoveId, setFileRemoveId] = useState(null); + + useShallowEffect(() => { + onLoadData(); + }, []); + + async function onLoadData() { + try { + const respone = await apiGetOneInvestasiById(investasiId); + if (respone.success) { + setFileRemoveId(respone.data.prospektusFileId); + } + } catch (error) { + clientLogger.error("Error get data investasi:", error); + } + } async function onUpload() { - setIsLoading(true); - const uploadFilePdf = await funGlobal_UploadToStorage({ - file: filePdf as any, - dirId: DIRECTORY_ID.investasi_prospektus, - }); - - if (!uploadFilePdf.success) { - setIsLoading(false); - return ComponentGlobal_NotifikasiPeringatan("Gagal upload file pdf"); - } - try { + setIsLoading(true); + const uploadFilePdf = await funGlobal_UploadToStorage({ + file: filePdf as any, + dirId: DIRECTORY_ID.investasi_prospektus, + }); + + if (!uploadFilePdf.success) { + setIsLoading(false); + ComponentGlobal_NotifikasiPeringatan("Gagal upload file pdf"); + return; + } + + const deleteFile = await funGlobal_DeleteFileById({ + fileId: fileRemoveId as string, + dirId: DIRECTORY_ID.investasi_prospektus, + }); + + if (!deleteFile.success) { + setIsLoading(false); + clientLogger.error("Error delete file:", deleteFile.message); + } + const updte = await investasi_funUpdateProspektus({ fileId: uploadFilePdf.data.id, investasiId: investasiId, }); if (updte.status !== 200) { - return ComponentGlobal_NotifikasiPeringatan("Gagal update prospektus"); + setIsLoading(false); + ComponentGlobal_NotifikasiPeringatan("Gagal update prospektus"); + return; } + ComponentGlobal_NotifikasiBerhasil(updte.message); router.back(); - - return ComponentGlobal_NotifikasiBerhasil(updte.message); } catch (error) { - console.log(error); - } finally { setIsLoading(false); + clientLogger.error("Error update prospektus:", error); } } + if (fileRemoveId == null) { + return ; + } + return ( <> - + {!filePdf ? ( - - Upload File Prospektus - + + + ) : ( @@ -94,54 +130,43 @@ export function Investasi_ViewEditProspektus({ )} - - + { - try { - const buffer = URL.createObjectURL( - new Blob([new Uint8Array(await files.arrayBuffer())]) - ); + text="Upload File" + /> + - setFilePdf(files); - } catch (error) { - console.log(error); - } - }} - > - {(props) => ( - - )} - - - - + + ); diff --git a/src/app_modules/investasi/_view/transaksi/view_invoice.tsx b/src/app_modules/investasi/_view/transaksi/view_invoice.tsx index 22b21722..17b5f793 100644 --- a/src/app_modules/investasi/_view/transaksi/view_invoice.tsx +++ b/src/app_modules/investasi/_view/transaksi/view_invoice.tsx @@ -32,6 +32,7 @@ import { IRealtimeData } from "@/app/lib/global_state"; import { notifikasiToAdmin_funCreate } from "@/app_modules/notifikasi/fun"; import { WibuRealtime } from "wibu-pkg"; import { clientLogger } from "@/util/clientLogger"; +import { ComponentGlobal_ButtonUploadFileImage } from "@/app_modules/_global/component"; export function Investasi_ViewInvoice({ dataInvoice, @@ -42,6 +43,7 @@ export function Investasi_ViewInvoice({ const [isLoading, setLoading] = useState(false); const [data, setData] = useState(dataInvoice); const [file, setFile] = useState(null); + const [img, setImg] = useState(null); async function onUpload() { try { @@ -52,6 +54,7 @@ export function Investasi_ViewInvoice({ }); if (!uploadFileToStorage.success) { + setLoading(false); ComponentGlobal_NotifikasiPeringatan("Gagal upload bukti transfer"); return; } @@ -62,6 +65,7 @@ export function Investasi_ViewInvoice({ }); if (res.status != 200) { + setLoading(false); ComponentGlobal_NotifikasiGagal(res.message); return; } @@ -93,9 +97,8 @@ export function Investasi_ViewInvoice({ }); } } catch (error) { - clientLogger.error(" Error upload invoice", error); - } finally { setLoading(false); + clientLogger.error(" Error upload invoice", error); } } @@ -245,29 +248,10 @@ export function Investasi_ViewInvoice({ >
- { - try { - setFile(files); - } catch (error) { - console.log(error); - } - }} - accept="image/png,image/jpeg" - > - {(props) => ( - - )} - +
{file ? (
diff --git a/src/app_modules/investasi/create/view_new.tsx b/src/app_modules/investasi/create/view_new.tsx index 0459787c..b0f1c46e 100644 --- a/src/app_modules/investasi/create/view_new.tsx +++ b/src/app_modules/investasi/create/view_new.tsx @@ -3,6 +3,7 @@ import { MainColor } from "@/app_modules/_global/color/color_pallet"; import { ComponentGlobal_BoxInformation, ComponentGlobal_BoxUploadImage, + ComponentGlobal_ButtonUploadFileImage, ComponentGlobal_CardStyles, } from "@/app_modules/_global/component"; import { MAX_SIZE } from "@/app_modules/_global/lib"; @@ -131,7 +132,7 @@ export default function InvestasiCreateNew() { {/* Upload Image */} - + {isLoadingImg ? ( @@ -155,7 +156,13 @@ export default function InvestasiCreateNew() { {/* Upload Foto */} - +
+ +
+ {/* { try { @@ -196,12 +203,12 @@ export default function InvestasiCreateNew() { )} - +
*/}
{/* Upload File */} - + {isLoadingPdf ? ( @@ -228,7 +235,16 @@ export default function InvestasiCreateNew() { )} - +
+ } + /> +
+ {/* { @@ -269,7 +285,7 @@ export default function InvestasiCreateNew() { )} - +
*/}
@@ -283,7 +299,7 @@ export default function InvestasiCreateNew() { }, input: { backgroundColor: MainColor.white, - } + }, }} withAsterisk label="Judul Investasi" @@ -307,7 +323,7 @@ export default function InvestasiCreateNew() { }, input: { backgroundColor: MainColor.white, - } + }, }} icon={Rp.} min={0} @@ -350,7 +366,7 @@ export default function InvestasiCreateNew() { }, input: { backgroundColor: MainColor.white, - } + }, }} icon={Rp.} min={0} @@ -403,7 +419,7 @@ export default function InvestasiCreateNew() { }, input: { backgroundColor: MainColor.white, - } + }, }} /> @@ -417,7 +433,7 @@ export default function InvestasiCreateNew() { }, input: { backgroundColor: MainColor.white, - } + }, }} rightSection={ diff --git a/src/app_modules/investasi/edit_propektus/layout.tsx b/src/app_modules/investasi/edit_propektus/layout.tsx deleted file mode 100644 index eb70c31c..00000000 --- a/src/app_modules/investasi/edit_propektus/layout.tsx +++ /dev/null @@ -1,30 +0,0 @@ -"use client"; - -import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; -import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; -import React from "react"; -import { MODEL_INVESTASI } from "../_lib/interface"; - -export default function LayoutEditProspektusInvestasi({ - children, - dataInvestasi, -}: { - children: React.ReactNode; - dataInvestasi: MODEL_INVESTASI; -}) { - return ( - <> - } - // route2={RouterInvestasi.upload_prospektus + `${dataInvestasi.id}`} - /> - } - > - {children} - - - ); -} diff --git a/src/app_modules/investasi/edit_propektus/view.tsx b/src/app_modules/investasi/edit_propektus/view.tsx deleted file mode 100644 index 276c1f05..00000000 --- a/src/app_modules/investasi/edit_propektus/view.tsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; - -import { - Paper, - Grid, - Center, - Title, - Divider, - Button, - Text, - Group, - FileButton, - FileInput, - Image, - AspectRatio, - Flex, - Stack, - Box, -} from "@mantine/core"; -import { IconChevronRight, IconFileTypePdf } from "@tabler/icons-react"; -import Link from "next/link"; -import { useState } from "react"; -import { MODEL_INVESTASI } from "../_lib/interface"; -import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi"; - -export default function EditProspektusInvestasi({ - dataInvestasi, -}: { - dataInvestasi: MODEL_INVESTASI; -}) { - const [prospek, setProspek] = useState(dataInvestasi); - - return ( - <> - {/*
{JSON.stringify(prospek, null, 2)}
*/} - - - {prospek.ProspektusInvestasi != null ? ( - - - ""} - > - - - {/* */} - Prospektus_{prospek.title} - - - -
- -
-
-
-
- - ) : ( -
- Tidak ada file -
- )} - {/* */} -
- - ); -} diff --git a/src/app_modules/investasi/index.ts b/src/app_modules/investasi/index.ts index 1881634e..96964af3 100644 --- a/src/app_modules/investasi/index.ts +++ b/src/app_modules/investasi/index.ts @@ -7,8 +7,6 @@ import PortofolioInvestasi from "./portofolio/view"; import LayoutPortofolioInvestasi from "./portofolio/layout"; import EditIntroInvestasi from "./edit_intro/view"; import LayoutEditIntroInvestasi from "./edit_intro/layout"; -import EditProspektusInvestasi from "./edit_propektus/view"; -import LayoutEditProspektusInvestasi from "./edit_propektus/layout"; import EditDokumenInvestasi from "./edit_dokumen/view"; import LayoutEditDokumenInvestasi from "./edit_dokumen/layout"; import EditBeritaInvestasi from "./edit_berita/view"; @@ -58,8 +56,6 @@ export { LayoutPortofolioInvestasi, EditIntroInvestasi, LayoutEditIntroInvestasi, - EditProspektusInvestasi, - LayoutEditProspektusInvestasi, EditDokumenInvestasi, LayoutEditDokumenInvestasi, EditBeritaInvestasi, diff --git a/src/app_modules/job/edit/view.tsx b/src/app_modules/job/edit/view.tsx index 9556a825..b41fb92d 100644 --- a/src/app_modules/job/edit/view.tsx +++ b/src/app_modules/job/edit/view.tsx @@ -2,22 +2,15 @@ import { AspectRatio, - Button, Center, - FileButton, Image, Stack, Text, TextInput, } from "@mantine/core"; -import { IconCamera } from "@tabler/icons-react"; import { useState } from "react"; import { MODEL_JOB } from "../model/interface"; -import { - AccentColor, - MainColor, -} from "@/app_modules/_global/color/color_pallet"; import { ComponentGlobal_BoxUploadImage, ComponentGlobal_ButtonUploadFileImage, diff --git a/src/app_modules/katalog/profile/create/view_upload_foto.tsx b/src/app_modules/katalog/profile/create/view_upload_foto.tsx index 6e4cfa0c..2163dd53 100644 --- a/src/app_modules/katalog/profile/create/view_upload_foto.tsx +++ b/src/app_modules/katalog/profile/create/view_upload_foto.tsx @@ -3,13 +3,7 @@ import { ComponentGlobal_BoxInformation, ComponentGlobal_ButtonUploadFileImage, } from "@/app_modules/_global/component"; -import { - Avatar, - Box, - Center, - Paper, - Stack -} from "@mantine/core"; +import { Avatar, Box, Center, Paper, Stack } from "@mantine/core"; import { useState } from "react"; export default function Profile_ViewUploadFoto({ @@ -68,125 +62,6 @@ export default function Profile_ViewUploadFoto({ onSetImage={onSetImgPP} />
- - {/*
- { - try { - setLoadingButton(true); - const buffer = URL.createObjectURL( - new Blob([new Uint8Array(await files.arrayBuffer())]) - ); - - // if (files.size > MAX_SIZE) { - // ComponentGlobal_NotifikasiPeringatan( - // PemberitahuanMaksimalFile - // ); - // onSetImgPP(null); - - // return; - // } - - if (fotoProfileId != "") { - try { - const deleteFotoProfile = await funGlobal_DeleteFileById({ - fileId: fotoProfileId, - dirId: DIRECTORY_ID.profile_foto, - }); - - if (!deleteFotoProfile.success) { - clientLogger.error( - "Client failed delete photo profile:" + - deleteFotoProfile.message - ); - - return; - } - - if (deleteFotoProfile.success) { - onSetFotoProfileId(""); - onSetImgPP(null); - - const uploadPhoto = await funGlobal_UploadToStorage({ - file: files, - dirId: DIRECTORY_ID.profile_foto, - }); - - if (!uploadPhoto.success) { - clientLogger.error( - "Client failed upload photo profile::" + - uploadPhoto.message - ); - return; - } - - if (uploadPhoto.success) { - clientLogger.info( - "Client success upload foto profile" - ); - onSetFotoProfileId(uploadPhoto.data.id); - onSetImgPP(buffer); - } else { - clientLogger.error( - "Client failed upload foto:", - uploadPhoto.message - ); - ComponentGlobal_NotifikasiPeringatan( - "Gagal upload foto profile" - ); - } - } - } catch (error) { - clientLogger.error("Client error upload foto:", error); - } - } else { - try { - const uploadPhoto = await funGlobal_UploadToStorage({ - file: files, - dirId: DIRECTORY_ID.profile_foto, - }); - - if (uploadPhoto.success) { - clientLogger.info("Client success upload foto profile"); - onSetFotoProfileId(uploadPhoto.data.id); - onSetImgPP(buffer); - } else { - clientLogger.error( - "Client failed upload foto:", - uploadPhoto.message - ); - ComponentGlobal_NotifikasiPeringatan( - "Gagal upload foto profile" - ); - } - } catch (error) { - clientLogger.error("Client error upload foto:", error); - } - } - } catch (error) { - clientLogger.error("Client error upload foto:", error); - } finally { - setLoadingButton(false); - } - }} - accept="image/png,image/jpeg" - > - {(props) => ( - - )} - -
*/}
diff --git a/src/middleware.ts b/src/middleware.ts index bbabbb1d..d06f99e2 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -29,12 +29,13 @@ const middlewareConfig: MiddlewareConfig = { "/api/collaboration/*", "/api/notifikasi/*", "/api/logs/*", - // "/api/image/*", "/api/job/*", "/api/auth/*", "/api/origin-url", - // "/api/user", "/api/event/*", + // "/api/image/*", + // "/api/user", + // "/api/new/*", // Akses awal "/api/get-cookie", "/api/user/activation", diff --git a/xhtml/index.html b/xhtml/index.html new file mode 100644 index 00000000..23e750a9 --- /dev/null +++ b/xhtml/index.html @@ -0,0 +1,44 @@ + + + + + + Document + + + +
+ + +