Fix: Investasi
Deskripsi: - Upload gambar investasi ke storage wibu - Upload bukti transfer ke storage wibu # No Issue
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
"use client";
|
||||
|
||||
import { DIRECTORY_ID } from "@/app/lib";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
|
||||
import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiGagal,
|
||||
ComponentGlobal_NotifikasiPeringatan,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
import { notifikasiToAdmin_funCreate } from "@/app_modules/notifikasi/fun";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { investasi_funCreateNewInvestasi } from "../../_fun";
|
||||
import { gs_investas_menu, gs_investasi_status } from "../../g_state";
|
||||
|
||||
export function Investasi_ComponentButtonCreateNewInvestasi({
|
||||
data,
|
||||
totalLembar,
|
||||
fileImage,
|
||||
filePdf,
|
||||
}: {
|
||||
data: any;
|
||||
totalLembar: number;
|
||||
fileImage: File;
|
||||
filePdf: File;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||
|
||||
async function onSubmit() {
|
||||
setIsLoading(true);
|
||||
const body = {
|
||||
title: data.title,
|
||||
targetDana: data.targetDana,
|
||||
hargaLembar: data.hargaLembar,
|
||||
totalLembar: totalLembar,
|
||||
roi: data.roi,
|
||||
masterPeriodeDevidenId: data.periodeDevidenId,
|
||||
masterPembagianDevidenId: data.pembagianDevidenId,
|
||||
masterPencarianInvestorId: data.pencarianInvestorId,
|
||||
};
|
||||
|
||||
const uploadImage = await funGlobal_UploadToStorage({
|
||||
file: fileImage,
|
||||
dirId: DIRECTORY_ID.investasi_image,
|
||||
});
|
||||
if (!uploadImage.success) {
|
||||
setIsLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan("Gagal upload file gambar");
|
||||
}
|
||||
|
||||
const uploadFilePdf = await funGlobal_UploadToStorage({
|
||||
file: filePdf,
|
||||
dirId: DIRECTORY_ID.investasi_prospektus,
|
||||
});
|
||||
if (!uploadFilePdf.success) {
|
||||
setIsLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan("Gagal upload file pdf");
|
||||
}
|
||||
|
||||
const res = await investasi_funCreateNewInvestasi({
|
||||
data: body as any,
|
||||
fileImageId: uploadImage.data.id,
|
||||
filePdfId: uploadFilePdf.data.id,
|
||||
});
|
||||
|
||||
if (res.status === 201) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Investasi baru",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"ADMIN",
|
||||
JSON.stringify({
|
||||
count: 1,
|
||||
})
|
||||
);
|
||||
setActiveTab("Review");
|
||||
setHotMenu(1);
|
||||
setIsLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(NEW_RouterInvestasi.portofolio({ id: "2" }));
|
||||
}
|
||||
setIsLoading(false);
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
my={"xl"}
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
disabled={
|
||||
data.title === "" ||
|
||||
data.hargaLembar === 0 ||
|
||||
data.targetDana === 0 ||
|
||||
data.roi === 0 ||
|
||||
data.pencarianInvestorId === "" ||
|
||||
data.periodeDevidenId === "" ||
|
||||
data.pembagianDevidenId === "" ||
|
||||
fileImage === null ||
|
||||
filePdf === null
|
||||
? true
|
||||
: false
|
||||
}
|
||||
radius={50}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
onClick={() => onSubmit()}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiPeringatan,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
import { DIRECTORY_ID } from "@/app/lib";
|
||||
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
|
||||
import _ from "lodash";
|
||||
import { investasi_funUpdateInvestasi } from "../../_fun";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function Investasi_ComponentButtonUpdateDataInvestasi({
|
||||
data,
|
||||
file,
|
||||
totalLembar,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
file: File;
|
||||
totalLembar: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
async function onUpdate() {
|
||||
if (totalLembar === "0")
|
||||
return ComponentGlobal_NotifikasiPeringatan("Total lembar kosong");
|
||||
|
||||
if (file !== null) {
|
||||
if (_.values(data).includes(""))
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi data");
|
||||
|
||||
const uploadImage = await funGlobal_UploadToStorage({
|
||||
file: file as any,
|
||||
dirId: DIRECTORY_ID.investasi_image,
|
||||
});
|
||||
if (!uploadImage.success) {
|
||||
setIsLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan("Gagal upload file gambar");
|
||||
}
|
||||
|
||||
const updtWithImage = await investasi_funUpdateInvestasi({
|
||||
data: data,
|
||||
imageId: uploadImage.data.id,
|
||||
totalLembar: totalLembar,
|
||||
});
|
||||
|
||||
if (updtWithImage.status === 200) {
|
||||
setIsLoading(false);
|
||||
router.back();
|
||||
return ComponentGlobal_NotifikasiBerhasil(updtWithImage.message);
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan(updtWithImage.message);
|
||||
}
|
||||
} else {
|
||||
const updtNoImage = await investasi_funUpdateInvestasi({
|
||||
data: data,
|
||||
totalLembar: totalLembar,
|
||||
});
|
||||
|
||||
if (updtNoImage.status === 200) {
|
||||
setIsLoading(false);
|
||||
router.back();
|
||||
return ComponentGlobal_NotifikasiBerhasil(updtNoImage.message);
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan(updtNoImage.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Stack>
|
||||
<Button
|
||||
my={50}
|
||||
radius={50}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
onClick={() => {
|
||||
onUpdate();
|
||||
}}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { ActionIcon, Flex, Loader, Paper, Text } from "@mantine/core";
|
||||
import { IconFileDescription } from "@tabler/icons-react";
|
||||
@@ -23,18 +23,17 @@ export function Investasi_ComponentBoxDaftarBerita({
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(
|
||||
NEW_RouterInvestasi.detail_prospektus({ id: investasiId }),
|
||||
{ scroll: false }
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>Berita</Text>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterInvestasi_OLD.daftar_berita + investasiId);
|
||||
}}
|
||||
>
|
||||
<ActionIcon radius={"xl"} variant="transparent" size={60}>
|
||||
{isLoading ? (
|
||||
<Loader color="yellow" />
|
||||
) : (
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
NEW_RouterInvestasi,
|
||||
RouterInvestasi_OLD,
|
||||
} from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { ActionIcon, Flex, Loader, Paper, Text } from "@mantine/core";
|
||||
import { IconFileDescription } from "@tabler/icons-react";
|
||||
@@ -23,18 +26,17 @@ export function Investasi_ComponentBoxDaftarDokumen({
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(NEW_RouterInvestasi.daftar_dokumen({ id: investasiId }), {
|
||||
scroll: false,
|
||||
});
|
||||
// router.push(RouterInvestasi_OLD.detail_dokumen + investasiId, { scroll: false });
|
||||
}}
|
||||
>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>Dokumen</Text>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterInvestasi_OLD.detail_dokumen + investasiId);
|
||||
}}
|
||||
>
|
||||
<ActionIcon radius={"xl"} variant="transparent" size={60}>
|
||||
{isLoading ? (
|
||||
<Loader color="yellow" />
|
||||
) : (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { ActionIcon, Flex, Loader, Paper, Text } from "@mantine/core";
|
||||
import { IconBookDownload } from "@tabler/icons-react";
|
||||
@@ -6,9 +6,9 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function Investasi_ComponentBoxProspektus({
|
||||
investasiId,
|
||||
prospektusFileId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
prospektusFileId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
@@ -22,20 +22,18 @@ export function Investasi_ComponentBoxProspektus({
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(
|
||||
NEW_RouterInvestasi.file_prospektus({ id: prospektusFileId }),
|
||||
{ scroll: false }
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>Prospektus</Text>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterInvestasi_OLD.detail_prospektus + investasiId);
|
||||
}}
|
||||
>
|
||||
<ActionIcon radius={"xl"} variant="transparent" size={60}>
|
||||
{isLoading ? (
|
||||
<Loader color="yellow" />
|
||||
) : (
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_CardStyles,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_INVESTASI_DOKUMEN } from "../../_lib/interface";
|
||||
|
||||
export function Investasi_ComponentCardDaftarDocument({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVESTASI_DOKUMEN;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
return (
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Stack
|
||||
justify="center"
|
||||
h={"100%"}
|
||||
onClick={() => {
|
||||
router.push(
|
||||
NEW_RouterInvestasi.file_prospektus({ id: data.fileId }),
|
||||
{ scroll: false }
|
||||
);
|
||||
setVisible(true);
|
||||
}}
|
||||
>
|
||||
<Text lineClamp={2}>{data.title}</Text>
|
||||
</Stack>
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</ComponentGlobal_CardStyles>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_CardStyles,
|
||||
} from "@/app_modules/_global/component";
|
||||
import {
|
||||
UIGlobal_DrawerCustom,
|
||||
UIGlobal_Modal,
|
||||
} from "@/app_modules/_global/ui";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Grid,
|
||||
Group,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { IconDots, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_INVESTASI_DOKUMEN } from "../../_lib/interface";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import {
|
||||
investasi_funDeleteDokumenById,
|
||||
investasi_funGetAllDocumentById,
|
||||
} from "../../_fun";
|
||||
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||
import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiPeringatan,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
|
||||
export function Investasi_ComponentCardRekapDocument({
|
||||
data,
|
||||
onSetData,
|
||||
}: {
|
||||
data: MODEL_INVESTASI_DOKUMEN;
|
||||
onSetData: (val: any) => any[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
const [isLoadingEdit, setIsLoadingEdit] = useState(false);
|
||||
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [isLoadingDelete, setIsLoadingDelete] = useState(false);
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
async function onDelete() {
|
||||
try {
|
||||
setIsLoadingDelete(true);
|
||||
const deleteFileFromStorage = await funGlobal_DeleteFileById({
|
||||
fileId: data.fileId,
|
||||
});
|
||||
|
||||
if (!deleteFileFromStorage.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus file lama");
|
||||
}
|
||||
|
||||
const deleteFromDB = await investasi_funDeleteDokumenById({
|
||||
dokumenId: data.id,
|
||||
});
|
||||
|
||||
if (deleteFromDB.status !== 200) {
|
||||
ComponentGlobal_NotifikasiPeringatan(deleteFromDB.message);
|
||||
}
|
||||
ComponentGlobal_NotifikasiBerhasil(deleteFromDB.message);
|
||||
setOpenModal(false);
|
||||
|
||||
const loadData = await investasi_funGetAllDocumentById({
|
||||
investasiId: data.investasiId,
|
||||
page: 1,
|
||||
});
|
||||
|
||||
onSetData(loadData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setIsLoadingDelete(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Grid>
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
onClick={() => {
|
||||
router.push(
|
||||
NEW_RouterInvestasi.file_prospektus({ id: data.fileId }),
|
||||
{ scroll: false }
|
||||
);
|
||||
setVisible(true);
|
||||
}}
|
||||
>
|
||||
<Stack justify="center" h={"100%"}>
|
||||
<Text lineClamp={2}>{data.title}</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={"content"} onClick={() => setOpenDrawer(true)}>
|
||||
<Group grow>
|
||||
<ActionIcon variant="transparent">
|
||||
<IconDots color="white" />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</ComponentGlobal_CardStyles>
|
||||
|
||||
<UIGlobal_DrawerCustom
|
||||
opened={openDrawer}
|
||||
close={() => setOpenDrawer(false)}
|
||||
component={
|
||||
<SimpleGrid cols={2}>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c="white"
|
||||
onClick={() => {
|
||||
setIsLoadingEdit(true);
|
||||
router.push(
|
||||
NEW_RouterInvestasi.edit_dokumen({ id: data.id }),
|
||||
{ scroll: false }
|
||||
);
|
||||
}}
|
||||
>
|
||||
{isLoadingEdit ? <ComponentGlobal_Loader /> : <IconEdit />}
|
||||
</ActionIcon>
|
||||
<Text fz={"sm"} align="center" color="white">
|
||||
Edit Dokumen
|
||||
</Text>
|
||||
</Stack>
|
||||
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c="white"
|
||||
onClick={() => {
|
||||
setOpenModal(true);
|
||||
setOpenDrawer(false);
|
||||
}}
|
||||
>
|
||||
<IconTrash color="red" />
|
||||
</ActionIcon>
|
||||
<Text fz={"sm"} c={"red"} align="center" color="white">
|
||||
Hapus Dokumen
|
||||
</Text>
|
||||
</Stack>
|
||||
</SimpleGrid>
|
||||
}
|
||||
/>
|
||||
|
||||
<UIGlobal_Modal
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
title={"Anda yakin akan menghapus dokumen ini ?"}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingDelete}
|
||||
radius={"xl"}
|
||||
color={"red"}
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import {
|
||||
ComponentGlobal_CardStyles,
|
||||
ComponentGlobal_LoadImageLandscape,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { Center, SimpleGrid, Stack, Text, Title } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { Investasi_ComponentBoxDaftarDokumen } from "./comp_box_daftar_dokumen";
|
||||
import { Investasi_ComponentBoxProspektus } from "./comp_box_prospektus";
|
||||
import { Investasi_ComponentTitleAndValueInDetail } from "./comp_title_and_value_in_detail";
|
||||
|
||||
export function Investasi_ComponentDetailDataNonPublish({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Stack spacing={"xl"}>
|
||||
<ComponentGlobal_LoadImageLandscape fileId={data.imageId} />
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Center>
|
||||
<Title order={3} align="center">
|
||||
{_.startCase(data.title)}
|
||||
</Title>
|
||||
</Center>
|
||||
|
||||
{/* Rincian Data */}
|
||||
|
||||
<Stack>
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title="Target Dana"
|
||||
value={
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 20,
|
||||
}).format(+data.targetDana)}{" "}
|
||||
</Text>
|
||||
}
|
||||
/>
|
||||
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title="Harga Per Lembar"
|
||||
value={
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data.hargaLembar)}
|
||||
</Text>
|
||||
}
|
||||
/>
|
||||
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title={<Text fs={"italic"}>Return Of Invesment (RoI)</Text>}
|
||||
value={<Text>{data.roi} %</Text>}
|
||||
/>
|
||||
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title="Total Lembar"
|
||||
value={
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
}
|
||||
/>
|
||||
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title="Jadwal Pembagian"
|
||||
value={<Text>{data.MasterPembagianDeviden.name} Bulan </Text>}
|
||||
/>
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title="Pembagian Deviden"
|
||||
value={<Text>{data.MasterPeriodeDeviden.name}</Text>}
|
||||
/>
|
||||
<Investasi_ComponentTitleAndValueInDetail
|
||||
title="Pencarian Investor"
|
||||
value={<Text>{data.MasterPencarianInvestor.name} Hari </Text>}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
{/* List Box */}
|
||||
<SimpleGrid
|
||||
cols={2}
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 2, spacing: "md" },
|
||||
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
<Investasi_ComponentBoxProspektus
|
||||
prospektusFileId={data.prospektusFileId}
|
||||
/>
|
||||
<Investasi_ComponentBoxDaftarDokumen investasiId={data?.id} />
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Grid, Text } from "@mantine/core";
|
||||
import { data } from "autoprefixer";
|
||||
import React from "react";
|
||||
|
||||
export function Investasi_ComponentTitleAndValueInDetail({
|
||||
title,
|
||||
value,
|
||||
}: {
|
||||
title: string | React.ReactNode;
|
||||
value: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Grid>
|
||||
<Grid.Col span={5}>
|
||||
<Text fw={"bold"}>{title} </Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>: </Grid.Col>
|
||||
<Grid.Col span={6}>{value}</Grid.Col>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { ComponentGlobal_AvatarAndUsername } from "@/app_modules/_global/component";
|
||||
import {
|
||||
ComponentGlobal_AvatarAndUsername,
|
||||
ComponentGlobal_CardStyles,
|
||||
ComponentGlobal_LoadImageLandscape,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { MODEL_INVOICE_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
AspectRatio,
|
||||
@@ -23,20 +27,14 @@ export function Investasi_ComponentBoxDetailData({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard>
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Stack>
|
||||
<ComponentGlobal_AvatarAndUsername profile={data?.Author.Profile as any} />
|
||||
<AspectRatio ratio={1 / 1} mx={0} mah={250}>
|
||||
<Image
|
||||
alt=""
|
||||
src={
|
||||
RouterInvestasi_OLD.api_gambar + `${data?.Investasi.imagesId}`
|
||||
}
|
||||
radius={"sm"}
|
||||
mah={250}
|
||||
width={"100%"}
|
||||
/>
|
||||
</AspectRatio>
|
||||
<ComponentGlobal_AvatarAndUsername
|
||||
profile={data?.Author.Profile as any}
|
||||
/>
|
||||
|
||||
<ComponentGlobal_LoadImageLandscape fileId={data.Investasi.imageId} />
|
||||
|
||||
<Title order={3} mb={"xs"} align="center">
|
||||
{data?.Investasi.title}
|
||||
</Title>
|
||||
@@ -122,7 +120,7 @@ export function Investasi_ComponentBoxDetailData({
|
||||
]}
|
||||
>
|
||||
<Investasi_ComponentBoxProspektus
|
||||
investasiId={data?.Investasi?.id}
|
||||
prospektusFileId={data.Investasi.prospektusFileId}
|
||||
/>
|
||||
<Investasi_ComponentBoxDaftarDokumen
|
||||
investasiId={data?.Investasi?.id}
|
||||
@@ -132,7 +130,7 @@ export function Investasi_ComponentBoxDetailData({
|
||||
/>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Investasi_ComponentStylesCard>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@ import { Investasi_ComponentFooterMain } from "./main/comp_footer_main";
|
||||
import { Investasi_ComponentCardPortofolioPublish } from "./main/comp_card_portofolio_publish";
|
||||
import { Investasi_ComponentButtonUpdateBeranda } from "./main/comp_update_beranda";
|
||||
import { Investasi_ComponentCardPortofolio_NotPublish } from "./main/comp_card_portofolio_not_publish";
|
||||
import { Investasi_ComponentButtonCreateNewInvestasi } from "./button/comp_button_create_new_investasi";
|
||||
import { Investasi_ComponentTitleAndValueInDetail } from "./detail/comp_title_and_value_in_detail";
|
||||
import { Investasi_ComponentDetailDataNonPublish } from "./detail/comp_detail_data_non_publish";
|
||||
import { Investasi_ComponentButtonUpdateDataInvestasi } from "./button/comp_button_update_investasi";
|
||||
import { Investasi_ComponentCardRekapDocument } from "./detail/comp_card_rekap_document";
|
||||
import { Investasi_ComponentCardDaftarDocument } from "./detail/comp_card_daftar_document";
|
||||
|
||||
export { Investasi_ComponentFooterMain };
|
||||
export { Investasi_ComponentCardBeranda };
|
||||
@@ -27,3 +33,9 @@ export { Investasi_ComponentBoxProgress };
|
||||
export { Investasi_ComponentBoxDetailData };
|
||||
export { Investasi_ComponentCardPortofolioPublish };
|
||||
export { Investasi_ComponentCardPortofolio_NotPublish };
|
||||
export { Investasi_ComponentButtonCreateNewInvestasi };
|
||||
export { Investasi_ComponentTitleAndValueInDetail };
|
||||
export { Investasi_ComponentDetailDataNonPublish };
|
||||
export { Investasi_ComponentButtonUpdateDataInvestasi };
|
||||
export { Investasi_ComponentCardRekapDocument };
|
||||
export { Investasi_ComponentCardDaftarDocument };
|
||||
|
||||
@@ -15,16 +15,20 @@ import {
|
||||
Group,
|
||||
Image,
|
||||
Text,
|
||||
Grid,
|
||||
} from "@mantine/core";
|
||||
import { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { Component, useState } from "react";
|
||||
import {
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_CardStyles,
|
||||
ComponentGlobal_LoadImage,
|
||||
ComponentGlobal_LoadImageCustom,
|
||||
ComponentGlobal_LoadImageLandscape,
|
||||
} from "@/app_modules/_global/component";
|
||||
|
||||
export function Investasi_ComponentCardBeranda({
|
||||
@@ -45,109 +49,89 @@ export function Investasi_ComponentCardBeranda({
|
||||
router.push(RouterInvestasi_OLD.detail + `${data?.id}`);
|
||||
}}
|
||||
>
|
||||
<CardSection py={"md"} px={"sm"}>
|
||||
<AspectRatio ratio={1 / 1} mah={250}>
|
||||
<Box style={{ borderRadius: "7px" }}>
|
||||
{data.imagesId ? (
|
||||
<Image
|
||||
radius={"sm"}
|
||||
alt="Foto"
|
||||
src={RouterInvestasi_OLD.api_gambar + `${data?.imagesId}`}
|
||||
w={200}
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<ComponentGlobal_LoadImageCustom
|
||||
height={100}
|
||||
fileId={data.imageId}
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Text fw={"bold"} align="center" lineClamp={2}>{data?.title}</Text>
|
||||
|
||||
<Progress
|
||||
label={(+data?.progress).toFixed(2) + " %"}
|
||||
value={+data?.progress}
|
||||
color={MainColor.yellow}
|
||||
size="xl"
|
||||
radius="xl"
|
||||
styles={{
|
||||
label: { color: MainColor.black },
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Box>
|
||||
</AspectRatio>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<Stack>
|
||||
<Title align="center" order={3}>
|
||||
{data?.title}
|
||||
</Title>
|
||||
<Progress
|
||||
label={(+data?.progress).toFixed(2) + " %"}
|
||||
value={+data?.progress}
|
||||
color={MainColor.yellow}
|
||||
size="xl"
|
||||
radius="xl"
|
||||
styles={{
|
||||
label: { color: MainColor.black },
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<Group position="right">
|
||||
{data?.progress === "100" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
{+data?.MasterPencarianInvestor.name -
|
||||
moment(new Date()).diff(new Date(data?.countDown), "days") <=
|
||||
0 ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text truncate>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(data?.MasterPencarianInvestor.name) -
|
||||
<Group position="right">
|
||||
{data?.progress === "100" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
{+data?.MasterPencarianInvestor.name -
|
||||
moment(new Date()).diff(
|
||||
new Date(data?.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</CardSection>
|
||||
) <=
|
||||
0 ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text truncate>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(data?.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(data?.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
|
||||
{visible ? <ComponentGlobal_CardLoadingOverlay /> : ""}
|
||||
</ComponentGlobal_CardStyles>
|
||||
|
||||
{/* <Card
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderRadius: "10px",
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
marginInline: "15px",
|
||||
}}
|
||||
|
||||
></Card> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Grid, Stack, AspectRatio, Paper, Text, Image } from "@mantine/core";
|
||||
import {
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_CardStyles,
|
||||
ComponentGlobal_LoadImageCustom,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { Grid, Stack, Text } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { Investasi_ComponentStylesCard } from "../comp_card_border_and_background";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
|
||||
export function Investasi_ComponentCardPortofolio_NotPublish({
|
||||
data,
|
||||
@@ -16,12 +18,13 @@ export function Investasi_ComponentCardPortofolio_NotPublish({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard
|
||||
{/* <pre style={{color: "white"}}>{JSON.stringify(data, null, 2)}</pre> */}
|
||||
|
||||
<ComponentGlobal_CardStyles
|
||||
onClickHandler={() => {
|
||||
router.push(path + data?.id);
|
||||
router.push(path, { scroll: false });
|
||||
setVisible(true);
|
||||
}}
|
||||
>
|
||||
@@ -43,18 +46,14 @@ export function Investasi_ComponentCardPortofolio_NotPublish({
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={4}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi_OLD.api_gambar + `${data.imagesId}`}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
<ComponentGlobal_LoadImageCustom
|
||||
fileId={data.imageId}
|
||||
height={80}
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</Investasi_ComponentStylesCard>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export function Investasi_ComponentCardPortofolioPublish({
|
||||
<Investasi_ComponentStylesCard
|
||||
marginBottom={"15px"}
|
||||
onClickHandler={() => {
|
||||
router.push(NEW_RouterInvestasi.detail_publish + data?.id);
|
||||
router.push(NEW_RouterInvestasi.detail_portofolio({ id: data?.id }));
|
||||
setVisible(true);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
NEW_RouterInvestasi,
|
||||
RouterInvestasi_OLD,
|
||||
} from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { SimpleGrid, Stack, ActionIcon, Text } from "@mantine/core";
|
||||
import {
|
||||
@@ -21,7 +24,7 @@ const listFooter = [
|
||||
{
|
||||
id: 2,
|
||||
name: "Portofolio",
|
||||
route: RouterInvestasi_OLD.main_porto,
|
||||
route: NEW_RouterInvestasi.portofolio({ id: "1" }),
|
||||
icon: <IconChartPie />,
|
||||
},
|
||||
{
|
||||
@@ -45,14 +48,14 @@ export function Investasi_ComponentFooterMain() {
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid cols={listFooter.length} h={"9vh"} mx={"xs"}>
|
||||
{listFooter.map((e, i) => (
|
||||
{listFooter.map((e: any, i) => (
|
||||
<Stack key={i} align="center" justify="center" spacing={0}>
|
||||
<ActionIcon
|
||||
// disabled={e.path === "" ? true : false}
|
||||
variant="transparent"
|
||||
c={hotMenu === i ? MainColor.yellow : "white"}
|
||||
onClick={() => {
|
||||
router.push(e.route);
|
||||
router.push(e.route, { scroll: false });
|
||||
setHotMenu(i);
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user