fix: File view
Deksripsi: - Tampilan file view pdf - Optimalisasi admin ## No Isuue
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { Card } from "@mantine/core";
|
||||
import React from "react";
|
||||
|
||||
export function Investasi_ComponentStylesCard({
|
||||
children,
|
||||
backgroundColor,
|
||||
border,
|
||||
marginBottom,
|
||||
onClickHandler,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
backgroundColor?: string;
|
||||
border?: string;
|
||||
marginBottom?: string | number;
|
||||
onClickHandler?: (val: any) => void;
|
||||
}) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
style={{
|
||||
backgroundColor: backgroundColor
|
||||
? backgroundColor
|
||||
: AccentColor.darkblue,
|
||||
border: `2px solid ${border ? border : AccentColor.blue}`,
|
||||
paddingInline: "20px",
|
||||
paddingTop: "15px",
|
||||
paddingBottom: "20px",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: marginBottom ? marginBottom : "0x",
|
||||
}}
|
||||
onClick={onClickHandler}
|
||||
>
|
||||
{children}
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { 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";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function Investasi_ComponentBoxDaftarBerita({
|
||||
investasiId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<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);
|
||||
}}
|
||||
>
|
||||
{isLoading ? (
|
||||
<Loader color="yellow" />
|
||||
) : (
|
||||
<IconFileDescription size={70} color="white" />
|
||||
)}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { 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";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function Investasi_ComponentBoxDaftarDokumen({
|
||||
investasiId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<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);
|
||||
}}
|
||||
>
|
||||
{isLoading ? (
|
||||
<Loader color="yellow" />
|
||||
) : (
|
||||
<IconFileDescription size={70} color="white" />
|
||||
)}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { 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 { IconBookDownload } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function Investasi_ComponentBoxProspektus({
|
||||
investasiId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
|
||||
}}
|
||||
>
|
||||
<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);
|
||||
}}
|
||||
>
|
||||
{isLoading ? (
|
||||
<Loader color="yellow" />
|
||||
) : (
|
||||
<IconBookDownload size={70} color="white" />
|
||||
)}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { ComponentGlobal_AvatarAndAuthorName } from "@/app_modules/_global/component";
|
||||
import { MODEL_INVOICE_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
Stack,
|
||||
AspectRatio,
|
||||
Title,
|
||||
Grid,
|
||||
Box,
|
||||
SimpleGrid,
|
||||
Image,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { Investasi_ComponentStylesCard } from "../../comp_card_border_and_background";
|
||||
import { Investasi_ComponentBoxDaftarBerita } from "../comp_box_daftar_berita";
|
||||
import { Investasi_ComponentBoxDaftarDokumen } from "../comp_box_daftar_dokumen";
|
||||
import { Investasi_ComponentBoxProspektus } from "../comp_box_prospektus";
|
||||
|
||||
export function Investasi_ComponentBoxDetailData({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVOICE_INVESTASI;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard>
|
||||
<Stack>
|
||||
<ComponentGlobal_AvatarAndAuthorName dataUser={data?.Author} />
|
||||
<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>
|
||||
<Title order={3} mb={"xs"} align="center">
|
||||
{data?.Investasi.title}
|
||||
</Title>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data?.Investasi.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data?.Investasi.hargaLembar)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data?.Investasi?.MasterPembagianDeviden?.name} bulan{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data?.Investasi?.MasterPeriodeDeviden?.name}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Investor</Text>
|
||||
<Text fw={"bold"}>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(data?.Investor?.length)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text fw={"bold"}>{data?.Investasi.roi}%</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data?.Investasi.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Sisa Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data?.Investasi.sisaLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 3, spacing: "md" },
|
||||
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
<Investasi_ComponentBoxProspektus
|
||||
investasiId={data?.Investasi?.id}
|
||||
/>
|
||||
<Investasi_ComponentBoxDaftarDokumen
|
||||
investasiId={data?.Investasi?.id}
|
||||
/>
|
||||
<Investasi_ComponentBoxDaftarBerita
|
||||
investasiId={data?.Investasi?.id}
|
||||
/>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Investasi_ComponentStylesCard>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import {
|
||||
ComponentGlobal_TampilanRupiah,
|
||||
ComponentGlobal_TampilanAngkaRatusan,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { Stack, Grid, Text } from "@mantine/core";
|
||||
import { data } from "autoprefixer";
|
||||
import { Investasi_ComponentStylesCard } from "../../comp_card_border_and_background";
|
||||
import { MODEL_INVOICE_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
|
||||
export function Investasi_ComponentBoxHargaDanLembarSaham({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVOICE_INVESTASI;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard>
|
||||
<Stack>
|
||||
<Stack spacing={5}>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Transaksi Saham</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<ComponentGlobal_TampilanRupiah
|
||||
fontWeight={"bold"}
|
||||
nominal={+data?.nominal}
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Saham Terbeli</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<ComponentGlobal_TampilanAngkaRatusan
|
||||
fontWeight={"bold"}
|
||||
nominal={+data?.lembarTerbeli}
|
||||
textAfter="Lembar"
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Investasi_ComponentStylesCard>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import { Stack, Progress, Text } from "@mantine/core";
|
||||
import { Investasi_ComponentStylesCard } from "../../comp_card_border_and_background";
|
||||
|
||||
export function Investasi_ComponentBoxProgress({
|
||||
progress,
|
||||
}: {
|
||||
progress: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard>
|
||||
<Stack>
|
||||
<Text fw={"bold"}>Progres Saham</Text>
|
||||
<Progress
|
||||
styles={{ label: { color: "black" } }}
|
||||
color={MainColor.yellow}
|
||||
size={"xl"}
|
||||
value={+progress}
|
||||
label={progress + "%"}
|
||||
radius={"xl"}
|
||||
/>
|
||||
</Stack>
|
||||
</Investasi_ComponentStylesCard>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
import { Investasi_ComponentStylesCard } from "./comp_card_border_and_background";
|
||||
import { Investasi_ComponentBoxDaftarBerita } from "./detail/comp_box_daftar_berita";
|
||||
import { Investasi_ComponentBoxDaftarDokumen } from "./detail/comp_box_daftar_dokumen";
|
||||
import { Investasi_ComponentBoxProspektus } from "./detail/comp_box_prospektus";
|
||||
import { Investasi_ComponentBoxDetailData } from "./detail/saham_saya/comp_detail_data";
|
||||
import { Investasi_ComponentBoxHargaDanLembarSaham } from "./detail/saham_saya/comp_harga_dan_lembar";
|
||||
import { Investasi_ComponentBoxProgress } from "./detail/saham_saya/comp_progress_saham";
|
||||
import { Investasi_ComponentCardBeranda } from "./main/comp_card_beranda";
|
||||
import { Investasi_ComponentCardDaftarTransaksi } from "./main/comp_card_daftar_transaksi";
|
||||
import { Investasi_ComponentSahamSaya } from "./main/comp_card_saham_saya";
|
||||
import { Investasi_ComponentFooterMain } from "./main/comp_footer_main";
|
||||
import { Investasi_ComponentButtonUpdateBeranda } from "./main/comp_update_beranda";
|
||||
|
||||
@@ -7,3 +15,11 @@ export { Investasi_ComponentFooterMain };
|
||||
export { Investasi_ComponentCardBeranda };
|
||||
export { Investasi_ComponentButtonUpdateBeranda };
|
||||
export { Investasi_ComponentCardDaftarTransaksi };
|
||||
export { Investasi_ComponentSahamSaya };
|
||||
export { Investasi_ComponentStylesCard as Investasasi_ComponentBoxBorderAndBackground };
|
||||
export { Investasi_ComponentBoxProspektus };
|
||||
export { Investasi_ComponentBoxDaftarDokumen };
|
||||
export { Investasi_ComponentBoxDaftarBerita };
|
||||
export { Investasi_ComponentBoxHargaDanLembarSaham };
|
||||
export { Investasi_ComponentBoxProgress };
|
||||
export { Investasi_ComponentBoxDetailData };
|
||||
|
||||
@@ -19,7 +19,7 @@ import moment from "moment";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/_global/loading_card";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
|
||||
export function Investasi_ComponentCardBeranda({
|
||||
data,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/_global/loading_card";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
|
||||
export function Investasi_ComponentCardDaftarTransaksi({
|
||||
data,
|
||||
@@ -32,15 +32,13 @@ export function Investasi_ComponentCardDaftarTransaksi({
|
||||
invoiceId: string;
|
||||
statusInvoiceId: string;
|
||||
}) {
|
||||
|
||||
// Berhasil
|
||||
if (statusInvoiceId === "1") {
|
||||
setVisible(true);
|
||||
return router.push(NEW_RouterInvestasi.transaksi_berhasil + invoiceId, {
|
||||
scroll: false,
|
||||
});
|
||||
}
|
||||
|
||||
if (statusInvoiceId === "1") {
|
||||
setVisible(true);
|
||||
return router.push(NEW_RouterInvestasi.transaksi_berhasil + invoiceId, {
|
||||
scroll: false,
|
||||
});
|
||||
}
|
||||
|
||||
// Proses
|
||||
if (statusInvoiceId === "2") {
|
||||
@@ -86,24 +84,39 @@ export function Investasi_ComponentCardDaftarTransaksi({
|
||||
}
|
||||
>
|
||||
<Group position="apart">
|
||||
<Title order={6}>{data.Investasi.title}</Title>
|
||||
<Title order={5}>
|
||||
<Text fw={"bold"}>{data.Investasi.title}</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.nominal)}
|
||||
</Title>
|
||||
</Text>
|
||||
</Group>
|
||||
<Group position="apart">
|
||||
<Stack spacing={0}>
|
||||
{/* <Text fz={"xs"}>Bank {data.namaBank}</Text> */}
|
||||
<Text fz={"xs"}>{moment(data.createdAt).format("ll")}</Text>
|
||||
<Text fz={"xs"} c={"gray"}>
|
||||
{new Intl.DateTimeFormat("id-ID", { dateStyle: "long" }).format(
|
||||
data.createdAt
|
||||
)}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Text>{data.lembarTerbeli} Lembar</Text>
|
||||
<Title
|
||||
order={6}
|
||||
c={
|
||||
data.statusInvoiceId === "1"
|
||||
? "green"
|
||||
: data.statusInvoiceId === "2"
|
||||
? "blue"
|
||||
: data.statusInvoiceId === "3"
|
||||
? "orange"
|
||||
: "red"
|
||||
}
|
||||
>
|
||||
{data.StatusInvoice.name}
|
||||
</Title>
|
||||
</Group>
|
||||
<Center mt={"sm"}>
|
||||
<Badge>{data.StatusInvoice.name}</Badge>
|
||||
</Center>
|
||||
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</Card>
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Group,
|
||||
Paper,
|
||||
Progress,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { MODEL_INVOICE_INVESTASI } from "../../_lib/interface";
|
||||
import {
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_TampilanAngkaRatusan,
|
||||
ComponentGlobal_TampilanRupiah,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { useState } from "react";
|
||||
import { Investasi_ComponentStylesCard } from "../comp_card_border_and_background";
|
||||
|
||||
export function Investasi_ComponentSahamSaya({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVOICE_INVESTASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard
|
||||
onClickHandler={() => {
|
||||
setVisible(true);
|
||||
router.push(NEW_RouterInvestasi.detail_saham + data?.id, {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
marginBottom={"15px"}
|
||||
>
|
||||
<SimpleGrid cols={2} spacing={"xs"}>
|
||||
<Box>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"} lineClamp={2}>
|
||||
{data?.Investasi?.title}
|
||||
</Text>
|
||||
<ComponentGlobal_TampilanRupiah
|
||||
nominal={+data?.nominal}
|
||||
color="white"
|
||||
fontSize={"xs"}
|
||||
/>
|
||||
<ComponentGlobal_TampilanAngkaRatusan
|
||||
nominal={+data?.lembarTerbeli}
|
||||
color="white"
|
||||
fontSize={"xs"}
|
||||
textAfter="Lembar"
|
||||
/>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
<Stack justify="center">
|
||||
<Progress
|
||||
size={"xl"}
|
||||
radius={"xl"}
|
||||
color="yellow"
|
||||
value={+data.Investasi.progress}
|
||||
label={data.Investasi.progress + "%"}
|
||||
styles={{
|
||||
bar: {
|
||||
backgroundColor: MainColor.yellow,
|
||||
},
|
||||
root: {
|
||||
backgroundColor: "whitesmoke",
|
||||
},
|
||||
label: {
|
||||
color: "black",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
</SimpleGrid>
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</Investasi_ComponentStylesCard>
|
||||
|
||||
{/* <Card
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
onClick={}
|
||||
></Card> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function investasi_funGetInvoiceById({
|
||||
export async function investasi_funGetOneInvoiceById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
@@ -14,8 +14,30 @@ export async function investasi_funGetInvoiceById({
|
||||
include: {
|
||||
MasterBank: true,
|
||||
StatusInvoice: true,
|
||||
Investasi: {
|
||||
include: {
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
ProspektusInvestasi: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Author: {
|
||||
include: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
const { ...allData } = data;
|
||||
const Investor = data?.Investasi?.Investasi_Invoice;
|
||||
const result = { ...allData, Investor };
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function investasi_funGetSuccessTransactionById({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.investasi_Invoice.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: authorId,
|
||||
statusInvoiceId: "1",
|
||||
isActive: true,
|
||||
},
|
||||
include: {
|
||||
Investasi: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -2,8 +2,10 @@ import { investasi_funGetProspekById } from "./get/fun_get_file_by_prospek_id";
|
||||
import { investasi_funGetOneInvestasiById } from "./get/fun_get_one_investasi_by_id";
|
||||
import { investasi_funGetTransaksiByUserId } from "./get/fun_get_all_transaksi_by_user_id";
|
||||
import { investasi_funUploadBuktiTransferById } from "./upload/fun_upload_bukti_transfer";
|
||||
import { investasi_funGetSuccessTransactionById } from "./get/fun_get_success_transaction_by_id";
|
||||
|
||||
export { investasi_funGetOneInvestasiById };
|
||||
export { investasi_funGetProspekById };
|
||||
export { investasi_funUploadBuktiTransferById };
|
||||
export { investasi_funGetTransaksiByUserId };
|
||||
export { investasi_funGetSuccessTransactionById };
|
||||
|
||||
@@ -31,6 +31,7 @@ export interface MODEL_INVESTASI {
|
||||
masterStatusInvestasiId: string;
|
||||
author: MODEL_PROFILE_OLD;
|
||||
countDown: Date;
|
||||
Investasi_Invoice: MODEL_INVOICE_INVESTASI[];
|
||||
}
|
||||
|
||||
export interface MODEL_Transaksi_Investasi {
|
||||
@@ -128,11 +129,11 @@ export interface MODEL_INVOICE_INVESTASI {
|
||||
masterBankId: string;
|
||||
statusInvoiceId: string;
|
||||
authorId: string;
|
||||
Author: MODEL_USER
|
||||
Author: MODEL_USER;
|
||||
imagesId: string;
|
||||
MasterBank: MODEL_MASTER_BANK;
|
||||
StatusInvoice: MODEL_STATUS_INVOICE_INVESTASI;
|
||||
|
||||
Investor: any[];
|
||||
}
|
||||
|
||||
export interface MODEL_STATUS_INVOICE_INVESTASI {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"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 { Investasi_ViewDetailSahamSaya } from "../../_view";
|
||||
|
||||
export function Investasi_UiDetailSahamSaya({ dataSaham }: { dataSaham: any }) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Detail Saham" />}
|
||||
>
|
||||
<Investasi_ViewDetailSahamSaya dataSaham={dataSaham as any} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import dynamic from "next/dynamic";
|
||||
const PdfToImage = dynamic(
|
||||
() =>
|
||||
import("../../_view/file_view/view_file_viewer").then((mod) => mod.default),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
export function Investasi_UiFileViewDokumen({
|
||||
dokumenId,
|
||||
}: {
|
||||
dokumenId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="" iconLeft={<IconX/>} />}
|
||||
>
|
||||
<PdfToImage
|
||||
id={dokumenId}
|
||||
path={RouterInvestasi_OLD.api_file_dokumen}
|
||||
/>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import dynamic from "next/dynamic";
|
||||
const PdfToImage = dynamic(
|
||||
() =>
|
||||
import("../../_view/file_view/view_file_viewer").then((mod) => mod.default),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
export function Investasi_UiFileViewProspektus({
|
||||
prospekId,
|
||||
}: {
|
||||
prospekId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="" iconLeft={<IconX />} />}
|
||||
>
|
||||
<PdfToImage
|
||||
id={prospekId}
|
||||
path={RouterInvestasi_OLD.api_file_prospektus}
|
||||
/>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Investasi_UiFileView } from "./ui_file_view";
|
||||
import { Investasi_UiFileViewProspektus } from "./file_view/ui_file_view_prospektus";
|
||||
import { Investasi_UiInvoice } from "./transaksi/ui_invoice";
|
||||
import { Investasi_UiMetodePembayaran } from "./transaksi/ui_metode_pembayaran";
|
||||
import { Investasi_UiProsesPembelian } from "./transaksi/ui_proses_pembelian";
|
||||
@@ -7,13 +7,19 @@ import { Investasi_UiBeranda } from "./main/ui_beranda";
|
||||
import { Investasi_UiLayoutMain } from "./main/ui_layout_main";
|
||||
import { Investasi_UiDaftarTransaksi } from "./main/ui_transaksi";
|
||||
import { Investasi_UiTransaksiBerhasil } from "./status_transaksi/ui_transaksi_berhasil";
|
||||
import { Investasi_UiFileViewDokumen } from "./file_view/ui_file_view_dokumen";
|
||||
import { Investasi_UiSahamSaya } from "./main/ui_saham_saya";
|
||||
import { Investasi_UiDetailSahamSaya } from "./detail/ui_detail_saham_saya";
|
||||
|
||||
export { Investasi_UiProsesPembelian };
|
||||
export { Investasi_UiMetodePembayaran };
|
||||
export { Investasi_UiFileView };
|
||||
export { Investasi_UiFileViewProspektus as Investasi_UiFileView };
|
||||
export { Investasi_UiInvoice };
|
||||
export { Investasi_UiProsesTransaksi };
|
||||
export { Investasi_UiBeranda };
|
||||
export { Investasi_UiLayoutMain };
|
||||
export { Investasi_UiDaftarTransaksi };
|
||||
export { Investasi_UiTransaksiBerhasil };
|
||||
export { Investasi_UiFileViewDokumen };
|
||||
export { Investasi_UiSahamSaya };
|
||||
export { Investasi_UiDetailSahamSaya };
|
||||
|
||||
8
src/app_modules/investasi/_ui/main/ui_portofolio.tsx
Normal file
8
src/app_modules/investasi/_ui/main/ui_portofolio.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
"use client"
|
||||
|
||||
export function Investasi_UiPortofolio() {
|
||||
return <>
|
||||
|
||||
|
||||
</>;
|
||||
}
|
||||
11
src/app_modules/investasi/_ui/main/ui_saham_saya.tsx
Normal file
11
src/app_modules/investasi/_ui/main/ui_saham_saya.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { Investasi_ViewSahamSaya } from "../../_view";
|
||||
|
||||
export function Investasi_UiSahamSaya({ dataSaham }: { dataSaham: any[] }) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ViewSahamSaya dataSaham={dataSaham} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { ActionIcon, Box, Container, Group, Header, rem } from "@mantine/core";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Investasi_ViewFileViewer } from "../_view";
|
||||
|
||||
export function Investasi_UiFileView({ prospekId }: { prospekId: string }) {
|
||||
return (
|
||||
<>
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="File" />}
|
||||
>
|
||||
<ComponentInvestasi_FrameFileView fileId={prospekId} path={RouterInvestasi_OLD.api_file_prospektus} />
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
<Box
|
||||
w={"100%"}
|
||||
h={"100%"}
|
||||
style={{
|
||||
overflowY: "auto",
|
||||
overflowX: "auto",
|
||||
backgroundColor: MainColor.black,
|
||||
position: "fixed",
|
||||
}}
|
||||
>
|
||||
<Container mih={"100vh"} p={0} size={rem(500)} bg={MainColor.black}>
|
||||
<HeaderView />
|
||||
|
||||
<Investasi_ViewFileViewer
|
||||
fileId={prospekId}
|
||||
path={RouterInvestasi_OLD.api_file_prospektus}
|
||||
/>
|
||||
</Container>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function HeaderView() {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Header
|
||||
height={"8vh"}
|
||||
sx={{
|
||||
borderStyle: "none",
|
||||
}}
|
||||
bg={"white"}
|
||||
>
|
||||
<Group position="right" align="center" h={"100%"} px={"md"}>
|
||||
<ActionIcon onClick={() => router.back()}>
|
||||
<IconX />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
</Header>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Stack } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Investasi_ComponentBoxDetailData,
|
||||
Investasi_ComponentBoxHargaDanLembarSaham,
|
||||
Investasi_ComponentBoxProgress,
|
||||
} from "../../_component";
|
||||
import { MODEL_INVOICE_INVESTASI } from "../../_lib/interface";
|
||||
|
||||
export function Investasi_ViewDetailSahamSaya({
|
||||
dataSaham,
|
||||
}: {
|
||||
dataSaham: MODEL_INVOICE_INVESTASI;
|
||||
}) {
|
||||
const [data, setData] = useState(dataSaham);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack mb={"lg"}>
|
||||
<Investasi_ComponentBoxHargaDanLembarSaham data={data} />
|
||||
<Investasi_ComponentBoxProgress progress={data.Investasi.progress} />
|
||||
<Investasi_ComponentBoxDetailData data={data} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
.file_view {
|
||||
width: 100%;
|
||||
/* padding: 30px; */
|
||||
background-color: aqua;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: 92vh;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page {
|
||||
/* display: grid;
|
||||
place-items: center; Centers both horizontally and vertically */
|
||||
height: 5vh;
|
||||
width: 50%;
|
||||
position: absolute;
|
||||
}
|
||||
@@ -1,53 +1,88 @@
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
// import { useState } from "react";
|
||||
// import { Document, Page, pdfjs } from "react-pdf";
|
||||
// import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||
// import "react-pdf/dist/Page/TextLayer.css";
|
||||
// import styles from "./styles.module.css";
|
||||
// import { GlobalWorkerOptions } from "pdfjs-dist";
|
||||
"use client";
|
||||
|
||||
// GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.5.136/pdf.worker.js`;
|
||||
import { useEffect, useState } from "react";
|
||||
import { getDocument, GlobalWorkerOptions } from "pdfjs-dist";
|
||||
import { Image, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
GlobalWorkerOptions.workerSrc =
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.6.82/pdf.worker.min.mjs";
|
||||
|
||||
const PdfToImage = ({ id, path }: { id: string; path: string }) => {
|
||||
const [images, setImages] = useState<string[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
const renderPages = async () => {
|
||||
try {
|
||||
const loadingTask = getDocument(path + id); // Menggunakan md sebagai URL PDF
|
||||
const pdf = await loadingTask.promise;
|
||||
const numPages = pdf.numPages;
|
||||
const imagePromises: Promise<string>[] = [];
|
||||
|
||||
for (let pageNum = 1; pageNum <= numPages; pageNum++) {
|
||||
const renderPage = async (pageNum: number): Promise<string> => {
|
||||
const page = await pdf.getPage(pageNum);
|
||||
const viewport = page.getViewport({ scale: 2.0 });
|
||||
|
||||
// Buat elemen canvas
|
||||
const canvas = document.createElement("canvas");
|
||||
const context = canvas.getContext("2d");
|
||||
if (context) {
|
||||
canvas.width = viewport.width;
|
||||
canvas.height = viewport.height;
|
||||
|
||||
// Render halaman PDF ke dalam canvas
|
||||
const renderContext = {
|
||||
canvasContext: context,
|
||||
viewport: viewport,
|
||||
};
|
||||
await page.render(renderContext).promise;
|
||||
|
||||
// Konversi canvas ke gambar (data URL)
|
||||
return canvas.toDataURL("image/png");
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
imagePromises.push(renderPage(pageNum));
|
||||
}
|
||||
|
||||
const imageSrcs = await Promise.all(imagePromises);
|
||||
setImages(imageSrcs);
|
||||
} catch (error) {
|
||||
console.error("Error rendering PDF to images:", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
renderPages();
|
||||
}
|
||||
}, [id, path]);
|
||||
|
||||
export function Investasi_ViewFileViewer({
|
||||
fileId,
|
||||
path,
|
||||
}: {
|
||||
fileId: string;
|
||||
path: string;
|
||||
}) {
|
||||
return (
|
||||
<Stack>
|
||||
Maintenance
|
||||
{/* <MyFile file={path + fileId} /> */}
|
||||
{loading ? (
|
||||
<CustomLoading />
|
||||
) : (
|
||||
images.map((src, index) => (
|
||||
<Image key={index} src={src} alt={`Page ${index + 1}`} />
|
||||
))
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
function CustomLoading() {
|
||||
return (
|
||||
<Stack p="md">
|
||||
{[...Array(3)].map((_, index) => (
|
||||
<Skeleton key={index} height={500} />
|
||||
))}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
// function MyFile({ file }: { file: any }) {
|
||||
// const [numPages, setNumPages] = useState<number | null>(null);
|
||||
// const [pageNumber, setPageNumber] = useState(1);
|
||||
|
||||
// function onDocumentLoadSuccess({ numPages }: { numPages: number }) {
|
||||
// setNumPages(numPages);
|
||||
// }
|
||||
|
||||
// return<>
|
||||
// <Text>Maintenance</Text>
|
||||
// </>
|
||||
|
||||
// return (
|
||||
// <div>
|
||||
// <Document
|
||||
// // className={styles.file_view}
|
||||
// file={file}
|
||||
// onLoadSuccess={onDocumentLoadSuccess}
|
||||
|
||||
// >
|
||||
// <Page pageNumber={pageNumber} />
|
||||
// </Document>
|
||||
// {/* <p>
|
||||
// Page {pageNumber} of {numPages}
|
||||
// </p> */}
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
export default PdfToImage;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Investasi_ViewFileViewer } from "./file_view/view_file_viewer";
|
||||
import { Investasi_ViewDetailSahamSaya } from "./detail/view_detail_saham_saya";
|
||||
import PdfToImage from "./file_view/view_file_viewer";
|
||||
import { Investasi_ViewBeranda } from "./main/view_beranda";
|
||||
import { Investasi_ViewSahamSaya } from "./main/view_saham_saya";
|
||||
import { Investasi_ViewTransaksiBerhasil } from "./status_transaksi/view_invoice_berhasil";
|
||||
import { Investasi_ViewTransaksiGagal } from "./status_transaksi/view_transaksi_gagal";
|
||||
import { Investasi_ViewInvoice } from "./transaksi/view_invoice";
|
||||
@@ -11,7 +13,9 @@ export { Investasi_ViewProsesPembelian };
|
||||
export { Investasi_ViewMetodePembayaran };
|
||||
export { Investasi_ViewInvoice };
|
||||
export { Investasi_ViewProsesTransaksi };
|
||||
export { Investasi_ViewFileViewer };
|
||||
export { Investasi_ViewBeranda };
|
||||
export { Investasi_ViewTransaksiGagal };
|
||||
export { Investasi_ViewTransaksiBerhasil };
|
||||
export { PdfToImage as Investasi_ViewFileViewer };
|
||||
export { Investasi_ViewSahamSaya };
|
||||
export { Investasi_ViewDetailSahamSaya };
|
||||
|
||||
44
src/app_modules/investasi/_view/main/view_saham_saya.tsx
Normal file
44
src/app_modules/investasi/_view/main/view_saham_saya.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import { Investasi_ComponentSahamSaya } from "../../_component";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import { investasi_funGetAllPublish } from "../../fun/get_all_investasi";
|
||||
import { investasi_funGetSuccessTransactionById } from "../../_fun";
|
||||
|
||||
export function Investasi_ViewSahamSaya({ dataSaham }: { dataSaham: any[] }) {
|
||||
const [data, setData] = useState(dataSaham);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="82vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await investasi_funGetSuccessTransactionById({
|
||||
page: activePage + 1,
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => <Investasi_ComponentSahamSaya data={item as any} />}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -4,10 +4,8 @@ import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_invest
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentGlobal_TampilanRupiah } from "@/app_modules/_global/component";
|
||||
import {
|
||||
ActionIcon,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Collapse,
|
||||
Grid,
|
||||
Group,
|
||||
@@ -15,19 +13,12 @@ import {
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
Title
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBrandWhatsapp,
|
||||
IconMoneybag,
|
||||
IconMoodDollar,
|
||||
IconZoomMoney,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconBrandCashapp } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_INVOICE_INVESTASI } from "../../_lib/interface";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { IconBrandCashapp } from "@tabler/icons-react";
|
||||
|
||||
export function Investasi_ViewTransaksiBerhasil({
|
||||
dataTransaksi,
|
||||
|
||||
@@ -41,24 +41,18 @@ import { useState } from "react";
|
||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||
import { gs_TransferValue } from "../g_state";
|
||||
import { useLocalStorage } from "@mantine/hooks";
|
||||
import ComponentGlobal_AuthorNameAndAvatar from "@/app_modules/_global/author_name_on_header";
|
||||
import { ComponentGlobal_AvatarAndAuthorName } from "@/app_modules/_global/component";
|
||||
|
||||
export default function DetailInvestasi({
|
||||
dataInvestasi,
|
||||
dataUser,
|
||||
loginUserId,
|
||||
progress,
|
||||
totalInvestor,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
dataUser: MODEL_PROFILE_OLD;
|
||||
loginUserId: string;
|
||||
progress: number;
|
||||
totalInvestor: number;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(dataInvestasi);
|
||||
const [user, setUser] = useState(dataUser);
|
||||
const [transaksiValue, setTransaksiValue] = useAtom(gs_TransferValue);
|
||||
const [boxId, setBoxId] = useState(0);
|
||||
const [isLoadingBox, setLoadingBox] = useState(false);
|
||||
const [isLoadingButton, setLoadingButton] = useState(false);
|
||||
@@ -89,7 +83,7 @@ export default function DetailInvestasi({
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} color="white" />,
|
||||
route: RouterInvestasi_OLD.berita,
|
||||
route: RouterInvestasi_OLD.daftar_berita,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -116,75 +110,71 @@ export default function DetailInvestasi({
|
||||
<>
|
||||
<Stack
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderRadius: "10px",
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
padding: "15px",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
>
|
||||
{/* Foto username dan sisa waktu */}
|
||||
<Group position="apart" mb={"md"}>
|
||||
{/* <pre>{JSON.stringify(dataUser, null, 2)}</pre> */}
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
authorName={dataUser?.Profile?.name}
|
||||
imagesId={dataUser?.Profile?.imagesId}
|
||||
profileId={dataUser?.Profile?.id}
|
||||
/>
|
||||
|
||||
{data.MasterProgresInvestasi.id === "1" ? (
|
||||
<Box>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text>
|
||||
Sisa waktu:{" "}
|
||||
<Text span inherit>
|
||||
{Number(data.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(data.countDown),
|
||||
"days"
|
||||
)}{" "}
|
||||
Hari
|
||||
</Text>
|
||||
</Text>
|
||||
</Group>
|
||||
</Box>
|
||||
) : (
|
||||
<Box>
|
||||
{data.MasterProgresInvestasi.id === "2" ? (
|
||||
<ComponentGlobal_AvatarAndAuthorName
|
||||
dataUser={dataInvestasi.author as any}
|
||||
componentRight={
|
||||
data.MasterProgresInvestasi.id === "1" ? (
|
||||
<Box>
|
||||
<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>
|
||||
Sisa waktu:{" "}
|
||||
<Text span inherit>
|
||||
{Number(data.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(data.countDown),
|
||||
"days"
|
||||
)}{" "}
|
||||
Hari
|
||||
</Text>
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<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>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</Box>
|
||||
) : (
|
||||
<Box>
|
||||
{data.MasterProgresInvestasi.id === "2" ? (
|
||||
<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>
|
||||
) : (
|
||||
<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>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={250}>
|
||||
<Image
|
||||
@@ -261,7 +251,7 @@ export default function DetailInvestasi({
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(totalInvestor)}
|
||||
}).format(dataInvestasi.Investasi_Invoice.length)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
@@ -6,13 +6,27 @@ import { useState } from "react";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import moment from "moment";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import getOneBeritaInvestasiById from "../fun/get_one_berita_by_id";
|
||||
|
||||
export default function DetailBeritaInvestasi({
|
||||
dataBerita,
|
||||
investasiId,
|
||||
}: {
|
||||
dataBerita: Model_Berita_Investasi;
|
||||
investasiId: string;
|
||||
}) {
|
||||
const [berita, setBerita] = useState(dataBerita);
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadData();
|
||||
}, []);
|
||||
|
||||
async function onLoadData() {
|
||||
const loadData = await getOneBeritaInvestasiById(investasiId);
|
||||
setBerita(loadData as any);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack
|
||||
@@ -27,31 +41,24 @@ export default function DetailBeritaInvestasi({
|
||||
>
|
||||
<Stack spacing={0}>
|
||||
<Title order={4} align="center">
|
||||
{berita.title}
|
||||
{berita?.title}
|
||||
</Title>
|
||||
<Text align="center" fz={12}>
|
||||
{moment(berita.createdAt).format("lll")}
|
||||
{moment(berita?.createdAt).format("lll")}
|
||||
</Text>
|
||||
</Stack>
|
||||
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={250}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi_OLD.api_gambar + `${berita.imagesId}`}
|
||||
src={RouterInvestasi_OLD.api_gambar + `${berita?.imagesId}`}
|
||||
radius={"sm"}
|
||||
height={250}
|
||||
width={"100%"}
|
||||
/>
|
||||
</AspectRatio>
|
||||
|
||||
{/* <AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
radius={"sm"}
|
||||
src={RouterInvestasi.api_gambar + `${berita.imagesId}`}
|
||||
alt=""
|
||||
/>
|
||||
</AspectRatio> */}
|
||||
<Text>{berita.deskripsi}</Text>
|
||||
<Text>{berita?.deskripsi}</Text>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function LayoutDetailDokumenInvestasi({
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Dokumen" />}
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Daftar Dokumen" />}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
@@ -1,58 +1,64 @@
|
||||
"use client";
|
||||
|
||||
import { Paper, Grid, Center, Text, Title } from "@mantine/core";
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { IconChevronRight, IconFileTypePdf } from "@tabler/icons-react";
|
||||
import Link from "next/link";
|
||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
export default function DetailDokumenInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [dokumen, setDokumen] = useState(dataInvestasi);
|
||||
|
||||
return (
|
||||
<>
|
||||
{!_.isEmpty(dokumen.DokumenInvestasi) ? (
|
||||
dokumen.DokumenInvestasi.map((e) => (
|
||||
<Link
|
||||
<Paper
|
||||
key={e.id}
|
||||
href={`/file/${e.url}`}
|
||||
target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
onClick={() => {
|
||||
router.push(NEW_RouterInvestasi.file_view_dokumen + e.id, {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
<Grid
|
||||
align="center"
|
||||
justify="center"
|
||||
h={50}
|
||||
px={"sm"}
|
||||
onClick={() => ""}
|
||||
>
|
||||
<Grid
|
||||
align="center"
|
||||
justify="center"
|
||||
h={50}
|
||||
px={"sm"}
|
||||
onClick={() => ""}
|
||||
>
|
||||
<Grid.Col span={10}>
|
||||
<Text>{e.title}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<IconChevronRight />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Link>
|
||||
<Grid.Col span={10}>
|
||||
<Text>{e.title}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<IconFileTypePdf style={{ color: MainColor.yellow }} />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
))
|
||||
) : (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { IconChevronRight, IconFileTypePdf } from "@tabler/icons-react";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||
@@ -47,20 +47,22 @@ export default function DetailPropektus({
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
NEW_RouterInvestasi.file_view + `${data.ProspektusInvestasi.id}`,
|
||||
NEW_RouterInvestasi.file_view_prospektus +
|
||||
`${data.ProspektusInvestasi.id}`,
|
||||
{ scroll: false }
|
||||
)
|
||||
}
|
||||
>
|
||||
<Group position="apart">
|
||||
<Text w={"80%"} lineClamp={1}>
|
||||
Prospektus_{data.title}
|
||||
Prospektus_{data?.title}
|
||||
</Text>
|
||||
<Center>
|
||||
<IconChevronRight />
|
||||
<IconFileTypePdf style={{ color: MainColor.yellow }} />
|
||||
</Center>
|
||||
</Group>
|
||||
</Paper>
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function DetailSahamTerbeli({
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} color="white" />,
|
||||
route: RouterInvestasi_OLD.berita,
|
||||
route: RouterInvestasi_OLD.daftar_berita,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/_global/loading_card";
|
||||
import { Center, Grid, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
import { Center, Grid, Paper, Stack, Title } from "@mantine/core";
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
@@ -16,6 +16,7 @@ import funDeleteDokumenInvestasi from "../fun/fun_delete_dokumen";
|
||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||
import { IconFile } from "@tabler/icons-react";
|
||||
import { IconFileTypePdf } from "@tabler/icons-react";
|
||||
|
||||
export default function EditDokumenInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -57,7 +58,7 @@ export default function EditDokumenInvestasi({
|
||||
<Group position="center">
|
||||
<Link href={`/file/${e.url}`} target="_blank">
|
||||
<ActionIcon variant="transparent">
|
||||
<IconFolderOpen
|
||||
<IconFileTypePdf
|
||||
style={{
|
||||
color: MainColor.yellow,
|
||||
}}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use server"
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma"
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export default async function getOneBeritaInvestasiById(id: string) {
|
||||
const res = await prisma.beritaInvestasi.findUnique({
|
||||
where: {
|
||||
id: id
|
||||
}
|
||||
})
|
||||
return res;
|
||||
}
|
||||
const res = await prisma.beritaInvestasi.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use server";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { data } from "autoprefixer";
|
||||
|
||||
export default async function getOneInvestasiById(id: string) {
|
||||
const data = await prisma.investasi.findUnique({
|
||||
@@ -40,6 +39,11 @@ export default async function getOneInvestasiById(id: string) {
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
masterStatusInvestasiId: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "1",
|
||||
},
|
||||
},
|
||||
countDown: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -68,8 +68,8 @@ export default function Publish({ data }: { data: MODEL_INVESTASI[] }) {
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Divider my={"xs"} />
|
||||
<Group position="center">
|
||||
|
||||
<Group position="center" mt={"md"}>
|
||||
{Number(e.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(e.updatedAt), "days") <=
|
||||
0 ? (
|
||||
@@ -78,10 +78,7 @@ export default function Publish({ data }: { data: MODEL_INVESTASI[] }) {
|
||||
<Text c={"green"}>Selesai</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group position="center">
|
||||
{/* <Badge color="green" variant="dot">
|
||||
Publish
|
||||
</Badge> */}
|
||||
<Group position="center" style={{fontSize: 10, fontWeight: "bold"}}>
|
||||
<Group>
|
||||
{Number(e.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(e.countDown), "days") <=
|
||||
|
||||
@@ -77,14 +77,14 @@ export default function PortofolioInvestasi({
|
||||
))}
|
||||
</Tabs.List>
|
||||
|
||||
<Tabs.Panel value="Draft">
|
||||
<Draft data={dataDraft as any} />
|
||||
<Tabs.Panel value="Publish">
|
||||
<Publish data={dataPublish as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="Review">
|
||||
<Review data={dataReview as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="Publish">
|
||||
<Publish data={dataPublish as any} />
|
||||
<Tabs.Panel value="Draft">
|
||||
<Draft data={dataDraft as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="Reject">
|
||||
<Reject data={dataReject as any} />
|
||||
|
||||
Reference in New Issue
Block a user