# feat :
## Deskripsi : - Notifikasi investasi ## Issue : Gerbang pembayaran
This commit is contained in:
@@ -19,6 +19,8 @@ import { useRouter } from "next/navigation";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
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";
|
||||
|
||||
export default function BeritaInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -34,17 +36,23 @@ export default function BeritaInvestasi({
|
||||
berita.BeritaInvestasi.map((e) => (
|
||||
<Paper
|
||||
key={e.id}
|
||||
mb={"md"}
|
||||
w={"100%"}
|
||||
bg={"gray"}
|
||||
p={"sm"}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
onClick={() =>
|
||||
router.push(RouterInvestasi.detail_berita + `${e.id}`)
|
||||
}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>{e.title}</Title>
|
||||
<Title order={6} w={"70%"} lineClamp={1}>
|
||||
{e.title}
|
||||
</Title>
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("LL")}</Text>
|
||||
</Group>
|
||||
|
||||
@@ -56,7 +64,10 @@ export default function BeritaInvestasi({
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<AspectRatio ratio={16 / 9} h={50} w={100}>
|
||||
<Image alt="" src={RouterInvestasi.api_gambar + `${e.imagesId}`} />
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${e.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
@@ -64,9 +75,7 @@ export default function BeritaInvestasi({
|
||||
</Paper>
|
||||
))
|
||||
) : (
|
||||
<Center>
|
||||
<Title order={6}>Tidak Ada Berita</Title>
|
||||
</Center>
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -64,7 +64,7 @@ export function ComponentInvestasi_DetailDataNonPublish({
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Center>
|
||||
<Title order={4} align="center">
|
||||
<Title order={3} align="center">
|
||||
{_.startCase(data.title)}
|
||||
</Title>
|
||||
</Center>
|
||||
@@ -129,8 +129,8 @@ export function ComponentInvestasi_DetailDataNonPublish({
|
||||
{listBox.map((e) => (
|
||||
<Center key={e.id}>
|
||||
<Paper
|
||||
w={100}
|
||||
style={{
|
||||
width: 100,
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
|
||||
@@ -30,13 +30,15 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-simple-toasts";
|
||||
import { funCreateInvestasi } from "../fun/fun_create_investasi";
|
||||
import { gs_StatusPortoInvestasi, gs_investasiFooter } from "../g_state";
|
||||
import { gs_investasi_status, gs_investas_menu } from "../g_state";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
|
||||
export default function InvestasiCreate({
|
||||
id,
|
||||
@@ -55,8 +57,8 @@ export default function InvestasiCreate({
|
||||
const [pdf, setPdf] = useState<File | null>(null);
|
||||
const [filePdf, setFilePdf] = useState<any | null>(null);
|
||||
|
||||
const [changeColor, setChangeColor] = useAtom(gs_investasiFooter);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [changeColor, setChangeColor] = useAtom(gs_investas_menu);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
const [totalLembar, setTotalLembar] = useState(0);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
@@ -93,19 +95,39 @@ export default function InvestasiCreate({
|
||||
gmbr.append("file", fl as any);
|
||||
|
||||
const flPdf = new FormData();
|
||||
flPdf.append("file", fl as any);
|
||||
flPdf.append("file", pdf as any);
|
||||
|
||||
await funCreateInvestasi(gmbr, flPdf, body as any).then((res) => {
|
||||
if (res.status === 201) {
|
||||
const res = await funCreateInvestasi(gmbr, flPdf, body as any);
|
||||
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,
|
||||
})
|
||||
);
|
||||
setChangeColor(1);
|
||||
setActiveTab("Review");
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message)
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function onTotalLembar({
|
||||
@@ -115,11 +137,6 @@ export default function InvestasiCreate({
|
||||
target: number;
|
||||
harga: number;
|
||||
}) {
|
||||
// console.log(target, "ini target");
|
||||
// console.log(harga, "ini harga");
|
||||
|
||||
// if (harga === +"Nan") setTotalLembar(0);
|
||||
|
||||
const hasil: any = target / harga;
|
||||
setTotalLembar(_.floor(hasil === Infinity ? 0 : hasil));
|
||||
}
|
||||
@@ -206,7 +223,7 @@ export default function InvestasiCreate({
|
||||
backgroundColor: "gray.1",
|
||||
padding: "10px",
|
||||
borderRadius: "10px",
|
||||
color: "gray"
|
||||
color: "gray",
|
||||
}}
|
||||
>
|
||||
<Text>Upload File Prospektus</Text>
|
||||
@@ -227,7 +244,7 @@ export default function InvestasiCreate({
|
||||
)}
|
||||
{/* {JSON.stringify(filePdf)} */}
|
||||
<FileButton
|
||||
accept="application/pdf"
|
||||
accept={"application/pdf"}
|
||||
onChange={async (files: any) => {
|
||||
try {
|
||||
const buffer = URL.createObjectURL(
|
||||
|
||||
@@ -8,7 +8,9 @@ import {
|
||||
FileButton,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Textarea,
|
||||
Title,
|
||||
@@ -19,10 +21,11 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-simple-toasts";
|
||||
import funCreateBeritaInvestasi from "../fun/fun_create_berita";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||
|
||||
export default function CreateBeritaInvestasi({
|
||||
idInves,
|
||||
@@ -61,19 +64,35 @@ export default function CreateBeritaInvestasi({
|
||||
return (
|
||||
<>
|
||||
<Stack px={"xl"}>
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={300}>
|
||||
{img ? (
|
||||
<Image alt="" src={img} radius={"sm"} height={300} width={"100%"} />
|
||||
) : (
|
||||
<Image
|
||||
alt=""
|
||||
src={"/aset/no-img.png"}
|
||||
radius={"sm"}
|
||||
height={300}
|
||||
width={"100%"}
|
||||
/>
|
||||
)}
|
||||
</AspectRatio>
|
||||
{img ? (
|
||||
<AspectRatio ratio={1 / 1} mah={300}>
|
||||
<Paper
|
||||
style={{
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
backgroundColor: AccentColor.blue,
|
||||
padding: "10px",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
alt="Foto"
|
||||
src={img ? img : "/aset/no-img.png"}
|
||||
maw={200}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
) : (
|
||||
<Center>
|
||||
<Paper h={300} w={200} withBorder shadow="lg" bg={"gray.1"}>
|
||||
<Stack justify="center" align="center" h={"100%"}>
|
||||
<IconUpload color="gray" />
|
||||
<Text fz={10} fs={"italic"} c={"gray"} fw={"bold"}>
|
||||
Upload Gambar
|
||||
</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Center>
|
||||
)}
|
||||
<Group position="center" mt={"md"}>
|
||||
<FileButton
|
||||
onChange={async (files: any) => {
|
||||
@@ -101,6 +120,7 @@ export default function CreateBeritaInvestasi({
|
||||
</Group>
|
||||
<TextInput
|
||||
withAsterisk
|
||||
placeholder="Masukan judul berita"
|
||||
styles={{
|
||||
label: {
|
||||
color: "white",
|
||||
@@ -115,24 +135,33 @@ export default function CreateBeritaInvestasi({
|
||||
}}
|
||||
/>
|
||||
|
||||
<Textarea
|
||||
withAsterisk
|
||||
styles={{
|
||||
label: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
label="Deskripsi"
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={6}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
deskripsi: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Stack spacing={5}>
|
||||
<Textarea
|
||||
withAsterisk
|
||||
placeholder="Masukan deskripsi berita"
|
||||
styles={{
|
||||
label: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
label="Deskripsi"
|
||||
autosize
|
||||
maxLength={300}
|
||||
minRows={2}
|
||||
maxRows={6}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
deskripsi: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<ComponentGlobal_InputCountDown
|
||||
lengthInput={value.deskripsi.length}
|
||||
maxInput={300}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Button
|
||||
radius={50}
|
||||
bg={MainColor.yellow}
|
||||
@@ -145,7 +174,6 @@ export default function CreateBeritaInvestasi({
|
||||
Simpan
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,10 @@ import {
|
||||
Image,
|
||||
Paper,
|
||||
Progress,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Title
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBookDownload,
|
||||
@@ -33,7 +34,10 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { gs_TransferValue } from "../g_state";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function DetailInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -54,24 +58,25 @@ export default function DetailInvestasi({
|
||||
const [transaksiValue, setTransaksiValue] = useAtom(gs_TransferValue);
|
||||
const [boxId, setBoxId] = useState(0);
|
||||
const [isLoadingBox, setLoadingBox] = useState(false);
|
||||
const [isLoadingButton, setLoadingButton] = useState(false);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
icon: <IconBookDownload size={70} color="white" />,
|
||||
route: RouterInvestasi.detail_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
icon: <IconFileDescription size={70} color="white" />,
|
||||
route: RouterInvestasi.detail_dokumen,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} />,
|
||||
icon: <IconSpeakerphone size={70} color="white" />,
|
||||
route: RouterInvestasi.berita,
|
||||
},
|
||||
];
|
||||
@@ -85,6 +90,7 @@ export default function DetailInvestasi({
|
||||
nomorRekening: "",
|
||||
totalTransfer: "",
|
||||
});
|
||||
setLoadingButton(true);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -161,12 +167,12 @@ export default function DetailInvestasi({
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={300}>
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={250}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
radius={"sm"}
|
||||
height={300}
|
||||
height={250}
|
||||
width={"100%"}
|
||||
/>
|
||||
</AspectRatio>
|
||||
@@ -268,67 +274,73 @@ export default function DetailInvestasi({
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"md"}>
|
||||
<Group position="apart" px={"lg"}>
|
||||
{listBox.map((e, i) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e?.id}
|
||||
onClick={() => {
|
||||
setBoxId(e?.id);
|
||||
setLoadingBox(true);
|
||||
router.push(e.route + `${investasi.id}`);
|
||||
<Paper
|
||||
key={i}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Paper h={100} w={100} bg={"gray.4"} withBorder py={"xs"}>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>{e.name}</Text>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
loading={isLoadingBox && e?.id === boxId ? true : false}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
|
||||
{investasi.sisaLembar === "0" ||
|
||||
Number(investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(investasi.countDown), "days") <=
|
||||
0 ? (
|
||||
<Center mb={"md"}>
|
||||
<Button disabled radius={50} w={350} variant="transparent">
|
||||
Investasi Telah Ditutup
|
||||
</Button>
|
||||
</Center>
|
||||
) : (
|
||||
<Box>
|
||||
{loginUserId === investasi.authorId ? (
|
||||
<Center mb={"md"}>
|
||||
<Button disabled radius={50} w={350}>
|
||||
Investasi Ini Milik Anda
|
||||
</Button>
|
||||
</Center>
|
||||
) : (
|
||||
<Center mb={"md"}>
|
||||
<Button
|
||||
radius={50}
|
||||
w={350}
|
||||
bg={Warna.biru}
|
||||
onClick={() => {
|
||||
onSubmit();
|
||||
}}
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>{e.name}</Text>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
loading={isLoadingBox && e?.id === boxId ? true : false}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
onClick={() => router.push(e.route + `${investasi.id}`)}
|
||||
>
|
||||
Beli Saham
|
||||
</Button>
|
||||
</Center>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
))}
|
||||
</Group>
|
||||
|
||||
<Box my={"md"}>
|
||||
{investasi.sisaLembar === "0" ||
|
||||
Number(investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(investasi.countDown), "days") <=
|
||||
0 ? (
|
||||
<Center mb={"md"}>
|
||||
<Button disabled radius={50} variant="transparent">
|
||||
Investasi Telah Ditutup
|
||||
</Button>
|
||||
</Center>
|
||||
) : (
|
||||
<Box>
|
||||
{loginUserId === investasi.authorId ? (
|
||||
<Center mb={"md"}>
|
||||
<Button disabled radius={50}>
|
||||
Investasi Ini Milik Anda
|
||||
</Button>
|
||||
</Center>
|
||||
) : (
|
||||
<Center mb={"md"}>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingButton}
|
||||
w={"100%"}
|
||||
radius={50}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
onClick={() => {
|
||||
onSubmit();
|
||||
}}
|
||||
>
|
||||
Beli Saham
|
||||
</Button>
|
||||
</Center>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { AppShell } from "@mantine/core";
|
||||
import React from "react";
|
||||
|
||||
@@ -12,9 +14,9 @@ export default function LayoutDetailBeritaInvestasi({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate header={<ComponentGlobal_HeaderTamplate title="Detail Berita" />}>
|
||||
<UIGlobal_LayoutTamplate header={<UIGlobal_LayoutHeaderTamplate title="Detail Berita" />}>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Model_Berita_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import moment from "moment";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function DetailBeritaInvestasi({
|
||||
dataBerita,
|
||||
@@ -14,17 +15,42 @@ export default function DetailBeritaInvestasi({
|
||||
const [berita, setBerita] = useState(dataBerita);
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"lg"}>
|
||||
<Stack
|
||||
spacing={"lg"}
|
||||
style={{
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
padding: "15px",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Stack spacing={0}>
|
||||
<Title>{berita.title}</Title>
|
||||
<Text fz={12}>{moment(berita.createdAt).format("lll")}</Text>
|
||||
<Title order={4} align="center">
|
||||
{berita.title}
|
||||
</Title>
|
||||
<Text align="center" fz={12}>
|
||||
{moment(berita.createdAt).format("lll")}
|
||||
</Text>
|
||||
</Stack>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={250}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.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>
|
||||
</AspectRatio> */}
|
||||
<Text>{berita.deskripsi}</Text>
|
||||
</Stack>
|
||||
</>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { MODEL_Investasi } from "../model/model_investasi";
|
||||
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";
|
||||
|
||||
export default function DetailDokumenInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -17,35 +18,44 @@ export default function DetailDokumenInvestasi({
|
||||
return (
|
||||
<>
|
||||
{!_.isEmpty(dokumen.DokumenInvestasi) ? (
|
||||
dokumen.DokumenInvestasi.map((e) => (
|
||||
<Link
|
||||
key={e.id}
|
||||
href={`/file/${e.url}`}
|
||||
target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
>
|
||||
<Paper w={"100%"} h={50} bg={"gray"} mb={"md"}>
|
||||
<Grid
|
||||
align="center"
|
||||
justify="center"
|
||||
h={50}
|
||||
px={"sm"}
|
||||
onClick={() => ""}
|
||||
dokumen.DokumenInvestasi.map((e) => (
|
||||
<Link
|
||||
key={e.id}
|
||||
href={`/file/${e.url}`}
|
||||
target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
>
|
||||
<Grid.Col span={10}>
|
||||
<Text>{e.title}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<IconChevronRight />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Link>
|
||||
))
|
||||
<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.Col span={10}>
|
||||
<Text>{e.title}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<IconChevronRight />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Link>
|
||||
))
|
||||
) : (
|
||||
<ComponentGlobal_IsEmptyData/>
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,156 +1,79 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import {
|
||||
ActionIcon,
|
||||
AspectRatio,
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Slider,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
Stack
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBookDownload,
|
||||
IconFileDescription,
|
||||
IconSpeakerphone,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_StatusPortoInvestasi } from "../../g_state";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
||||
import { ComponentInvestasi_DetailDataNonPublish } from "../../component/detail/detai_data_non_publish";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
import { investasi_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import { gs_investasi_status } from "../../g_state";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
export default function DetailDraftInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: any;
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
// const [investasi, setInvestasi] = useState<MODEL_Investasi>(dataInvestasi);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
route: RouterInvestasi.edit_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
route: RouterInvestasi.edit_dokumen,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} />,
|
||||
route: RouterInvestasi.edit_berita,
|
||||
},
|
||||
];
|
||||
async function onAjukanReview() {
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: dataInvestasi.id,
|
||||
statusId: "2",
|
||||
});
|
||||
|
||||
async function onsubmit() {
|
||||
await funGantiStatusInvestasi(dataInvestasi.id, "2")
|
||||
.then((res) => res)
|
||||
.then((val) => {
|
||||
if (val.status === 200) {
|
||||
toast("Review Berhasil Diajukan");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
setActiveTab("Review");
|
||||
} else {
|
||||
toast("Error");
|
||||
}
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Mengajukan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
|
||||
setIsLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Berhasil Diajukan");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
setActiveTab("Review");
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <Paper withBorder mb={"md"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
|
||||
<Center>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{_.capitalize(investasi.title)}
|
||||
</Title>
|
||||
</Center>
|
||||
|
||||
|
||||
<Grid p={"md"} mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>Rp. {new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.targetDana)}</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>Rp. {new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.hargaLembar)}</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>{investasi.MasterPembagianDeviden.name} bulan </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text>{investasi.MasterPencarianInvestor.name} Hari </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>{investasi.roi} %</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text>{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.totalLembar)} lembar</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>{investasi.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid> */}
|
||||
|
||||
<Stack mb={"lg"}>
|
||||
{dataInvestasi.catatan && <ComponentGlobal_BoxInformation informasi={dataInvestasi.catatan} isReport/>}
|
||||
<ComponentInvestasi_DetailDataNonPublish data={dataInvestasi} />
|
||||
<Stack>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
radius={50}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
onClick={() => onsubmit()}
|
||||
onClick={() => onAjukanReview()}
|
||||
>
|
||||
Ajukan Review
|
||||
</Button>
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
ActionIcon,
|
||||
AspectRatio,
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Progress,
|
||||
Slider,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
Title
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBookDownload,
|
||||
@@ -26,14 +22,10 @@ import {
|
||||
IconFileDescription,
|
||||
IconSpeakerphone,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import moment from "moment";
|
||||
import _ from "lodash";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
|
||||
export default function DetailPublishInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -47,19 +39,19 @@ export default function DetailPublishInvestasi({
|
||||
{
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
icon: <IconBookDownload size={70} color="white" />,
|
||||
route: RouterInvestasi.detail_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
icon: <IconFileDescription size={70} color="white" />,
|
||||
route: RouterInvestasi.edit_dokumen,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} />,
|
||||
icon: <IconSpeakerphone size={70} color="white" />,
|
||||
route: RouterInvestasi.list_edit_berita,
|
||||
},
|
||||
];
|
||||
@@ -109,19 +101,19 @@ export default function DetailPublishInvestasi({
|
||||
</Group>
|
||||
)}
|
||||
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={300}>
|
||||
<AspectRatio ratio={1 / 1} mx={"sm"} mah={250}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
radius={"sm"}
|
||||
height={300}
|
||||
height={250}
|
||||
width={"100%"}
|
||||
/>
|
||||
</AspectRatio>
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Box mb={"md"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
<Title align="center" order={3} mb={"xs"}>
|
||||
{investasi.title}
|
||||
</Title>
|
||||
<Progress
|
||||
@@ -208,24 +200,33 @@ export default function DetailPublishInvestasi({
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"md"}>
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${investasi.id}`)}
|
||||
<Group position="apart" px={"lg"}>
|
||||
{listBox.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Paper h={100} w={100} bg={"gray.4"} withBorder py={"xs"}>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>{e.name}</Text>
|
||||
<ActionIcon variant="transparent" size={60}>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>{e.name}</Text>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
// loading={isLoadingBox && e?.id === boxId ? true : false}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
onClick={() => router.push(e.route + `${investasi.id}`)}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
))}
|
||||
</Grid>
|
||||
</Group>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ import { useState } from "react";
|
||||
import { ComponentInvestasi_DetailDataNonPublish } from "../../component/detail/detai_data_non_publish";
|
||||
import funDeleteInvestasi from "../../fun/fun_delete_investasi";
|
||||
import funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
||||
import { gs_StatusPortoInvestasi } from "../../g_state";
|
||||
import { gs_investasi_status } from "../../g_state";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
import { investasi_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||
|
||||
export default function DetailRejectInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -23,40 +24,22 @@ export default function DetailRejectInvestasi({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
route: RouterInvestasi.edit_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
route: RouterInvestasi.edit_dokumen,
|
||||
},
|
||||
// {
|
||||
// id: 3,
|
||||
// name: "Berita",
|
||||
// icon: <IconSpeakerphone size={70} />,
|
||||
// route: RouterInvestasi.edit_berita,
|
||||
// },
|
||||
];
|
||||
|
||||
async function onAjukan() {
|
||||
await funGantiStatusInvestasi(investasi.id, "1").then((res) => {
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
||||
setActiveTab("Draft");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
||||
}
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: dataInvestasi.id,
|
||||
statusId: "3",
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
||||
setActiveTab("Draft");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
||||
}
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_StatusPortoInvestasi } from "../../g_state";
|
||||
import { gs_investasi_status } from "../../g_state";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
import funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
||||
@@ -36,6 +36,9 @@ import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/noti
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentInvestasi_DetailDataNonPublish } from "../../component/detail/detai_data_non_publish";
|
||||
import { investasi_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
|
||||
export default function DetailReviewInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -45,40 +48,39 @@ export default function DetailReviewInvestasi({
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
const [data, setData] = useState<MODEL_Investasi>(dataInvestasi);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
route: RouterInvestasi.detail_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
route: RouterInvestasi.detail_dokumen,
|
||||
},
|
||||
// {
|
||||
// id: 3,
|
||||
// name: "Berita",
|
||||
// icon: <IconSpeakerphone size={70} />,
|
||||
// route: RouterInvestasi.berita,
|
||||
// },
|
||||
];
|
||||
|
||||
async function onsubmit() {
|
||||
await funGantiStatusInvestasi(data.id, "1").then((val) => {
|
||||
if (val.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
setActiveTab("Draft");
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan("Error");
|
||||
}
|
||||
async function onCancleReview() {
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "3",
|
||||
});
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||
setActiveTab("Draft");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -96,7 +98,7 @@ export default function DetailReviewInvestasi({
|
||||
radius={50}
|
||||
bg={"orange"}
|
||||
color="yellow"
|
||||
onClick={() => onsubmit()}
|
||||
onClick={() => onCancleReview()}
|
||||
>
|
||||
Batalkan Review
|
||||
</Button>
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function DetailPropektus({
|
||||
RouterInvestasi.api_file_prospektus +
|
||||
`${prospek.ProspektusInvestasi.id}`
|
||||
}
|
||||
target="_blank"
|
||||
// target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
>
|
||||
<Paper
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||
import { AppShell } from "@mantine/core";
|
||||
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";
|
||||
|
||||
export default function LayoutDetailSahamTerbeli({
|
||||
@@ -12,9 +11,9 @@ export default function LayoutDetailSahamTerbeli({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate header={<ComponentGlobal_HeaderTamplate title="Saham Terbeli" />}>
|
||||
<UIGlobal_LayoutTamplate header={<UIGlobal_LayoutHeaderTamplate title="Saham Terbeli" />}>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import { MODEL_Transaksi_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import moment from "moment";
|
||||
import _ from "lodash";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header";
|
||||
|
||||
export default function DetailSahamTerbeli({
|
||||
dataTransaksi,
|
||||
@@ -46,278 +48,332 @@ export default function DetailSahamTerbeli({
|
||||
{
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
icon: <IconBookDownload size={70} color="white" />,
|
||||
route: RouterInvestasi.detail_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
icon: <IconFileDescription size={70} color="white" />,
|
||||
route: RouterInvestasi.detail_dokumen,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} />,
|
||||
icon: <IconSpeakerphone size={70} color="white" />,
|
||||
route: RouterInvestasi.berita,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Group position="apart" mb={"md"}>
|
||||
<Flex align={"center"} gap={"xs"}>
|
||||
<Avatar radius={"xl"} bg={"gray"}>
|
||||
{(() => {
|
||||
const usr = investasi.Investasi.author.username;
|
||||
const splt = usr.split("");
|
||||
const Up = _.upperCase(splt[0]);
|
||||
<Stack>
|
||||
{/* Saham Terbeli */}
|
||||
<Stack
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
|
||||
return Up;
|
||||
})()}
|
||||
</Avatar>
|
||||
<Text>{investasi.Investasi.author.username}</Text>
|
||||
</Flex>
|
||||
{(() => {
|
||||
if (
|
||||
Number(investasi.Investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(investasi.createdAt), "days") <=
|
||||
0
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
<Group position="right">
|
||||
<IconCircleCheck color="green" />
|
||||
<Text c={"green"}>Selesai</Text>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
{(() => {
|
||||
if (
|
||||
Number(investasi.Investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.Investasi.countDown),
|
||||
"days"
|
||||
) <=
|
||||
0
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
<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}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(
|
||||
investasi.Investasi.MasterPencarianInvestor.name
|
||||
) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.Investasi.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</Group>
|
||||
|
||||
{/* Gambar Investasi */}
|
||||
<Paper withBorder mb={"md"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.Investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Box mb={"md"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{investasi.Investasi.title}
|
||||
</Title>
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+investasi.Investasi.totalLembar -
|
||||
+investasi.Investasi.sisaLembar) /
|
||||
+investasi.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+investasi.Investasi.totalLembar -
|
||||
+investasi.Investasi.sisaLembar) /
|
||||
+investasi.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(2)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid p={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
{/* <Box>
|
||||
<Text>Terkumpul</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box> */}
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.hargaLembar)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>
|
||||
{investasi.Investasi.MasterPembagianDeviden.name} bulan{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>{investasi.Investasi.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Investor</Text>
|
||||
<Text>{new Intl.NumberFormat("id-ID", {maximumSignificantDigits: 10}).format(investor)} </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>{investasi.Investasi.roi}%</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Sisa Lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.sisaLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Divider my={"md"} />
|
||||
|
||||
{/* Saham Terbeli */}
|
||||
<Box>
|
||||
<Center>
|
||||
<Title order={5}>Saham Anda</Title>
|
||||
</Center>
|
||||
<Grid p={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Total Pembelian</Text>
|
||||
<Group position="apart">
|
||||
<Group w={"40%"} position="center">
|
||||
<Stack spacing={5} align="center">
|
||||
<Text fw={'bold'}>Total Pembelian</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.gross_amount)}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Lembar Dibeli</Text>
|
||||
</Stack>
|
||||
</Group>
|
||||
|
||||
<Group w={"40%"} position="center">
|
||||
<Stack spacing={5} align="center">
|
||||
<Text fw={"bold"}>Lembar Dibeli</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.quantity)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Group>
|
||||
</Group>
|
||||
</Stack>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"sm"} justify="center">
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${investasi.Investasi.id}`)}
|
||||
>
|
||||
<Center>
|
||||
<Paper h={100} w={100} bg={"gray.4"} withBorder py={"xs"}>
|
||||
<Stack
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
>
|
||||
<Group position="apart" mb={"md"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
authorName={investasi?.Investasi?.author?.username}
|
||||
imagesId={investasi?.Investasi?.author?.Profile?.imagesId}
|
||||
profileId={investasi?.Investasi?.author?.Profile?.id}
|
||||
/>
|
||||
{(() => {
|
||||
if (
|
||||
Number(investasi.Investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.createdAt),
|
||||
"days"
|
||||
) <=
|
||||
0
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
<Group position="right">
|
||||
<IconCircleCheck color="green" />
|
||||
<Text c={"green"}>Selesai</Text>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
{(() => {
|
||||
if (
|
||||
Number(
|
||||
investasi.Investasi.MasterPencarianInvestor.name
|
||||
) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.Investasi.countDown),
|
||||
"days"
|
||||
) <=
|
||||
0
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
<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}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(
|
||||
investasi.Investasi.MasterPencarianInvestor
|
||||
.name
|
||||
) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.Investasi.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</Group>
|
||||
|
||||
{/* Gambar Investasi */}
|
||||
<AspectRatio ratio={1 / 1} mah={250} mx={"sm"}>
|
||||
<Image
|
||||
radius={"sm"}
|
||||
height={250}
|
||||
width={"100%"}
|
||||
alt=""
|
||||
src={
|
||||
RouterInvestasi.api_gambar + `${investasi.Investasi.imagesId}`
|
||||
}
|
||||
/>
|
||||
</AspectRatio>
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Box mb={"md"}>
|
||||
<Title align="center" order={3} mb={"xs"}>
|
||||
{investasi.Investasi.title}
|
||||
</Title>
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+investasi.Investasi.totalLembar -
|
||||
+investasi.Investasi.sisaLembar) /
|
||||
+investasi.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+investasi.Investasi.totalLembar -
|
||||
+investasi.Investasi.sisaLembar) /
|
||||
+investasi.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(2)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid p={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
{/* <Box>
|
||||
<Text>Terkumpul</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box> */}
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.hargaLembar)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>
|
||||
{investasi.Investasi.MasterPembagianDeviden.name} bulan{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>{investasi.Investasi.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Investor</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(investor)}{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>{investasi.Investasi.roi}%</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Sisa Lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.Investasi.sisaLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Group position="apart" px={"lg"}>
|
||||
{listBox.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
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}>{e.name}</Text>
|
||||
<ActionIcon variant="transparent" size={60}>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
size={60}
|
||||
onClick={() => router.push(e.route + `${investasi.Investasi.id}`)}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
))}
|
||||
</Group>
|
||||
|
||||
{/*
|
||||
<Grid mb={"sm"} justify="center">
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${investasi.Investasi.id}`)}
|
||||
>
|
||||
<Center>
|
||||
<Paper h={100} w={100} bg={"gray.4"} withBorder py={"xs"}>
|
||||
<Flex
|
||||
direction={"column"}
|
||||
align={"center"}
|
||||
justify={"center"}
|
||||
>
|
||||
<Text fz={12}>{e.name}</Text>
|
||||
<ActionIcon variant="transparent" size={60}>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
</Paper>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid> */}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AppShell, CloseButton, Group, Header, Text } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { gs_investasiFooter } from "../../g_state";
|
||||
import { gs_investas_menu } from "../../g_state";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
|
||||
export default function LayoutCountDownTransaksiInvestasi({
|
||||
@@ -14,7 +14,7 @@ export default function LayoutCountDownTransaksiInvestasi({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investasiFooter);
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||
import UIGlobal_Drawer from "@/app_modules/_global/ui/ui_drawer";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { AppShell } from "@mantine/core";
|
||||
import { IconEdit } from "@tabler/icons-react";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
import { IconDotsVertical, IconFilePlus } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
|
||||
export default function LayoutEditDokumenInvestasi({
|
||||
@@ -14,21 +14,47 @@ export default function LayoutEditDokumenInvestasi({
|
||||
idInves,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
idInves: string
|
||||
idInves: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isOpenDrawer, setIsOpenDrawer] = React.useState(false);
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Tambah Dokumen",
|
||||
icon: <IconFilePlus />,
|
||||
path: RouterInvestasi.upload_dokumen + `${idInves}`,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Edit Dokumen"
|
||||
iconRight={<IconEdit />}
|
||||
routerRight={RouterInvestasi.upload_dokumen + `${idInves}`}
|
||||
title="Daftar Dokumen"
|
||||
// iconRight={<IconEdit />}
|
||||
// routerRight={RouterInvestasi.upload_dokumen + `${idInves}`}
|
||||
customButtonRight={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setIsOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
<UIGlobal_Drawer
|
||||
opened={isOpenDrawer}
|
||||
close={() => setIsOpenDrawer(false)}
|
||||
component={listPage}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import {
|
||||
ActionIcon,
|
||||
Group,
|
||||
Paper,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconTrash,
|
||||
IconWorldShare
|
||||
} from "@tabler/icons-react";
|
||||
import { ActionIcon, Group, Paper, Text } from "@mantine/core";
|
||||
import { IconFolderOpen, IconTrash, IconWorldShare } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import funDeleteDokumenInvestasi from "../fun/fun_delete_dokumen";
|
||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { IconFile } from "@tabler/icons-react";
|
||||
|
||||
export default function EditDokumenInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -61,7 +57,11 @@ export default function EditDokumenInvestasi({
|
||||
<Group position="center">
|
||||
<Link href={`/file/${e.url}`} target="_blank">
|
||||
<ActionIcon variant="transparent">
|
||||
<IconWorldShare color="green" />
|
||||
<IconFolderOpen
|
||||
style={{
|
||||
color: MainColor.yellow,
|
||||
}}
|
||||
/>
|
||||
</ActionIcon>
|
||||
</Link>
|
||||
<ActionIcon
|
||||
|
||||
40
src/app_modules/investasi/fun/edit/fun_edit_status_by_id.ts
Normal file
40
src/app_modules/investasi/fun/edit/fun_edit_status_by_id.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function investasi_funEditStatusById({
|
||||
investasiId,
|
||||
statusId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
statusId: string;
|
||||
}) {
|
||||
const res = await prisma.investasi.update({
|
||||
where: {
|
||||
id: investasiId,
|
||||
},
|
||||
data: {
|
||||
masterStatusInvestasiId: statusId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
MasterStatusInvestasi: {
|
||||
select: {
|
||||
name: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterInvestasi.main_porto);
|
||||
return {
|
||||
data: res,
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
}
|
||||
@@ -10,19 +10,20 @@ import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import funUploadProspektusInvestasi from "./fun_upload_prospek";
|
||||
|
||||
export async function funCreateInvestasi(
|
||||
gamabar: FormData,
|
||||
fileGambar: FormData,
|
||||
filePdf: FormData,
|
||||
data: MODEL_Investasi
|
||||
) {
|
||||
// Function upload gambar
|
||||
const file: any = gamabar.get("file");
|
||||
const fName = file.name;
|
||||
const fExt = _.lowerCase(file.name.split(".").pop());
|
||||
const fRandomName = v4(fName) + "." + fExt;
|
||||
const gambar: any = fileGambar.get("file");
|
||||
const gambarName = gambar.name;
|
||||
const gambarExtention = _.lowerCase(gambar.name.split(".").pop());
|
||||
const gambarRandomName = v4(gambarName) + "." + gambarExtention;
|
||||
|
||||
const uploadImage = await prisma.images.create({
|
||||
data: {
|
||||
url: fRandomName,
|
||||
url: gambarRandomName,
|
||||
label: "INVESTASI",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
@@ -36,13 +37,13 @@ export async function funCreateInvestasi(
|
||||
message: "Gambar Kosong",
|
||||
};
|
||||
|
||||
const upFolder = Buffer.from(await file.arrayBuffer());
|
||||
const upFolder = Buffer.from(await gambar.arrayBuffer());
|
||||
fs.writeFileSync(`./public/investasi/${uploadImage.url}`, upFolder);
|
||||
|
||||
const createInvest = await prisma.investasi.create({
|
||||
data: {
|
||||
authorId: data.authorId,
|
||||
title: data.title,
|
||||
title: _.startCase(data.title),
|
||||
targetDana: data.targetDana.toString(),
|
||||
hargaLembar: data.hargaLembar.toString(),
|
||||
totalLembar: data.totalLembar.toString(),
|
||||
@@ -54,6 +55,16 @@ export async function funCreateInvestasi(
|
||||
imagesId: uploadImage.id,
|
||||
masterStatusInvestasiId: "2",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
MasterStatusInvestasi: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!createInvest)
|
||||
@@ -62,32 +73,27 @@ export async function funCreateInvestasi(
|
||||
message: "Gagal Disimpan",
|
||||
};
|
||||
|
||||
// File upload function
|
||||
// const dataPdf: any = filePdf.get("file");
|
||||
// const pdfName = dataPdf.name;
|
||||
// const pdfExt = _.lowerCase(dataPdf.name.split(".").pop());
|
||||
// const pdfRandomName = v4(pdfName) + "." + pdfExt;
|
||||
// await funUploadProspektusInvestasi(filePdf, createInvest.id);
|
||||
|
||||
// const uploadFile = await prisma.prospektusInvestasi.create({
|
||||
// data: {
|
||||
// investasiId: createInvest.id,
|
||||
// url: pdfRandomName,
|
||||
// },
|
||||
// select: {
|
||||
// id: true,
|
||||
// url: true,
|
||||
// },
|
||||
// });
|
||||
const file: any = filePdf.get("file");
|
||||
const fName = file.name;
|
||||
const fExt = _.lowerCase(file.name.split(".").pop());
|
||||
const fRandomName = v4(fName) + "." + fExt;
|
||||
|
||||
// if (!uploadFile) return { status: 400, message: "File Kosong" };
|
||||
// const upPdfFolder = Buffer.from(await file.arrayBuffer());
|
||||
// fs.writeFileSync(`./public/file/${uploadFile.url}`, upPdfFolder);
|
||||
const createFile = await prisma.prospektusInvestasi.create({
|
||||
data: {
|
||||
investasiId: createInvest.id,
|
||||
url: fRandomName,
|
||||
},
|
||||
});
|
||||
|
||||
await funUploadProspektusInvestasi(filePdf, createInvest.id);
|
||||
if (!createFile) return { status: 400, message: "Gagal Upload" };
|
||||
const uploadFile = Buffer.from(await file.arrayBuffer());
|
||||
fs.writeFileSync(`./public/file/${createFile.url}`, uploadFile);
|
||||
|
||||
revalidatePath(RouterInvestasi.main_porto);
|
||||
|
||||
return {
|
||||
data: createInvest,
|
||||
status: 201,
|
||||
message: "Berhasil Disimpan",
|
||||
};
|
||||
|
||||
@@ -14,10 +14,7 @@ export default async function funDeleteInvestasi(id: string) {
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal Hapus Data" };
|
||||
|
||||
|
||||
revalidatePath(RouterInvestasi.portofolio)
|
||||
revalidatePath(RouterAdminInvestasi_OLD.main_investasi)
|
||||
|
||||
revalidatePath(RouterInvestasi.portofolio);
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import _ from "lodash";
|
||||
import { v4 } from "uuid";
|
||||
import fs from "fs"
|
||||
import fs from "fs";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
@@ -11,12 +11,9 @@ export default async function funUploadProspektusInvestasi(
|
||||
formData: FormData,
|
||||
idInves: string
|
||||
) {
|
||||
|
||||
const file: any = formData.get("file");
|
||||
const fName = file.name;
|
||||
const fExt = _.lowerCase(file.name.split(".").pop());
|
||||
// console.log(fName)
|
||||
// console.log(fExt)
|
||||
const fRandomName = v4(fName) + "." + fExt;
|
||||
|
||||
const uploadFile = await prisma.prospektusInvestasi.upsert({
|
||||
@@ -32,13 +29,13 @@ export default async function funUploadProspektusInvestasi(
|
||||
},
|
||||
});
|
||||
|
||||
if(!uploadFile) return {status: 400, message: "Gagal Upload"}
|
||||
const upFolder = Buffer.from(await file.arrayBuffer())
|
||||
fs.writeFileSync(`./public/file/${uploadFile.url}`, upFolder)
|
||||
if (!uploadFile) return { status: 400, message: "Gagal Upload" };
|
||||
const upFolder = Buffer.from(await file.arrayBuffer());
|
||||
fs.writeFileSync(`./public/file/${uploadFile.url}`, upFolder);
|
||||
|
||||
revalidatePath(RouterInvestasi.edit_prospektus)
|
||||
revalidatePath(RouterInvestasi.edit_prospektus);
|
||||
return {
|
||||
status: 201,
|
||||
message: "File tersimpan "
|
||||
}
|
||||
message: "File tersimpan ",
|
||||
};
|
||||
}
|
||||
|
||||
86
src/app_modules/investasi/fun/get_all_investasi.ts
Normal file
86
src/app_modules/investasi/fun/get_all_investasi.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import moment from "moment";
|
||||
|
||||
export async function investasi_funGetAllPublish() {
|
||||
const data = await prisma.investasi.findMany({
|
||||
where: {
|
||||
masterStatusInvestasiId: "1",
|
||||
masterProgresInvestasiId: "1",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
MasterPencarianInvestor: true,
|
||||
countDown: true,
|
||||
progress: true,
|
||||
},
|
||||
});
|
||||
|
||||
for (let a of data) {
|
||||
if (
|
||||
(a.MasterPencarianInvestor?.name as any) -
|
||||
moment(new Date()).diff(new Date(a.countDown as any), "days") <=
|
||||
0
|
||||
) {
|
||||
// console.log(a.MasterPencarianInvestor?.name);
|
||||
|
||||
await prisma.investasi.update({
|
||||
where: {
|
||||
id: a.id,
|
||||
},
|
||||
data: {
|
||||
masterProgresInvestasiId: "3",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (a.progress === "100") {
|
||||
await prisma.investasi.update({
|
||||
where: {
|
||||
id: a.id,
|
||||
},
|
||||
data: {
|
||||
masterProgresInvestasiId: "2",
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// cek data yang lewat
|
||||
// klo ada, update status
|
||||
|
||||
const dataFix = await prisma.investasi.findMany({
|
||||
orderBy: [
|
||||
{
|
||||
masterProgresInvestasiId: "asc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
masterStatusInvestasiId: "1",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
progress: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
imagesId: true,
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
countDown: true,
|
||||
},
|
||||
});
|
||||
|
||||
return dataFix;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export default async function getAllDataPublishInvestasi() {
|
||||
const data = await prisma.investasi.findMany({
|
||||
orderBy: [
|
||||
{
|
||||
masterProgresInvestasiId: "asc",
|
||||
},
|
||||
{
|
||||
countDown: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
MasterStatusInvestasi: {
|
||||
name: {
|
||||
equals: "Publish",
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
progress: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
imagesId: true,
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
countDown: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
}
|
||||
@@ -17,12 +17,21 @@ export default async function getListTransaksiBerhasilInvestasi(
|
||||
id: true,
|
||||
Investasi: {
|
||||
select: {
|
||||
author: true,
|
||||
author: {
|
||||
select: {
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
userId: true,
|
||||
imagesId: true
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
imagesId: true,
|
||||
title: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
|
||||
},
|
||||
},
|
||||
Author: true,
|
||||
|
||||
@@ -6,11 +6,17 @@ export default async function getOneInvestasiById(id: string) {
|
||||
const data = await prisma.investasi.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
|
||||
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
@@ -33,8 +39,8 @@ export default async function getOneInvestasiById(id: string) {
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
author: true,
|
||||
countDown: true
|
||||
masterStatusInvestasiId: true,
|
||||
countDown: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,13 @@ export default async function getOneTransaksiBerhasilByIdInvestasi(
|
||||
select: {
|
||||
nomor: true,
|
||||
username: true,
|
||||
}
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
imagesId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
BeritaInvestasi: true,
|
||||
DokumenInvestasi: true,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { atom } from "jotai";
|
||||
import { atomWithStorage } from "jotai/utils";
|
||||
|
||||
export const gs_investasiFooter = atomWithStorage<number>("changeColor", 0);
|
||||
export const gs_StatusPortoInvestasi = atomWithStorage<any | string>(
|
||||
export const gs_investas_menu = atomWithStorage<number>("changeColor", 0);
|
||||
export const gs_investasi_status = atomWithStorage<any | string>(
|
||||
"gs_TabPortoInvestasi",
|
||||
"Draft"
|
||||
"Publish"
|
||||
);
|
||||
|
||||
export const gs_TransferValue = atomWithStorage("gs_TransferValue", {
|
||||
|
||||
@@ -2,34 +2,61 @@
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||
import { AppShell } from "@mantine/core";
|
||||
import { IconPencilPlus } from "@tabler/icons-react";
|
||||
import { ActionIcon, AppShell } from "@mantine/core";
|
||||
import { IconDotsVertical, IconPencilPlus } from "@tabler/icons-react";
|
||||
import React from "react";
|
||||
import getOneInvestasiById from "../fun/get_one_investasi_by_id";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import { useRouter } from "next/navigation";
|
||||
import UIGlobal_Drawer from "@/app_modules/_global/ui/ui_drawer";
|
||||
|
||||
export default function LayoutListEditBeritaInvestasi({
|
||||
children,
|
||||
idInves
|
||||
idInves,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
idInves: string
|
||||
idInves: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isOpenDrawer, setIsOpenDrawer] = React.useState(false);
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Tambah Berita",
|
||||
icon: <IconPencilPlus />,
|
||||
path: RouterInvestasi.create_berita + `${idInves}`,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="List Berita"
|
||||
iconRight={<IconPencilPlus />}
|
||||
routerRight={RouterInvestasi.create_berita + `${idInves}`}
|
||||
title="Daftar Berita"
|
||||
// iconRight={<IconPencilPlus />}
|
||||
// routerRight={RouterInvestasi.create_berita + `${idInves}`}
|
||||
customButtonRight={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setIsOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
<UIGlobal_Drawer
|
||||
opened={isOpenDrawer}
|
||||
close={() => setIsOpenDrawer(false)}
|
||||
component={listPage}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,18 +17,20 @@ import {
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconDots } from "@tabler/icons-react";
|
||||
import { IconDots, IconEdit } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import React, { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import getOneInvestasiById from "../fun/get_one_investasi_by_id";
|
||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
||||
import funDeleteBeritaInvestasi from "../fun/fun_delete_berita";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import UIGlobal_Drawer from "@/app_modules/_global/ui/ui_drawer";
|
||||
|
||||
export default function ListEditBeritaInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -37,6 +39,8 @@ export default function ListEditBeritaInvestasi({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
const [beritaId, setBeritaId] = React.useState("");
|
||||
const [isOpenDrawer, setIsOpenDrawer] = React.useState(false);
|
||||
|
||||
async function onDelete(idBerita: string) {
|
||||
await funDeleteBeritaInvestasi(idBerita).then(async (res) => {
|
||||
@@ -50,22 +54,54 @@ export default function ListEditBeritaInvestasi({
|
||||
});
|
||||
}
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Edit Berita",
|
||||
icon: <IconEdit />,
|
||||
// path: RouterInvestasi.edit_berita + `${v.id}`,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
{_.isEmpty(investasi.BeritaInvestasi) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
investasi.BeritaInvestasi.map((v, k) => (
|
||||
<Paper key={k} w={"100%"} bg={"gray"} p={"sm"} mb={"md"}>
|
||||
<Paper
|
||||
key={k}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
onClick={() => router.push(RouterInvestasi.detail_berita + v.id)}
|
||||
>
|
||||
<Stack spacing={"xs"}>
|
||||
<Group position="apart">
|
||||
<Box>
|
||||
<Title order={6}>{v.title}</Title>
|
||||
<Text fz={10}>
|
||||
<Title lineClamp={1} w={"70%"} order={6}>
|
||||
{v.title}
|
||||
</Title>
|
||||
<Text lineClamp={1} fz={10}>
|
||||
{moment(v.createdAt).local().format("lll")}
|
||||
</Text>
|
||||
</Box>
|
||||
<Menu position="left">
|
||||
|
||||
{/* <ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setIsOpenDrawer(true);
|
||||
}}
|
||||
>
|
||||
<IconDots color="white" />
|
||||
</ActionIcon> */}
|
||||
|
||||
{/* <Menu position="left">
|
||||
<Menu.Target>
|
||||
<ActionIcon variant="transparent">
|
||||
<IconDots color="black" />
|
||||
@@ -87,7 +123,7 @@ export default function ListEditBeritaInvestasi({
|
||||
Hapus
|
||||
</Menu.Item>
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
</Menu> */}
|
||||
</Group>
|
||||
<Grid pt={5}>
|
||||
<Grid.Col span={8}>
|
||||
@@ -115,6 +151,12 @@ export default function ListEditBeritaInvestasi({
|
||||
</Paper>
|
||||
))
|
||||
)}
|
||||
|
||||
<UIGlobal_Drawer
|
||||
opened={isOpenDrawer}
|
||||
close={() => setIsOpenDrawer(false)}
|
||||
component={listPage}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import {
|
||||
ActionIcon,
|
||||
Center,
|
||||
Flex,
|
||||
Footer,
|
||||
Grid,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconCash,
|
||||
@@ -22,13 +20,7 @@ import {
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { gs_investasiFooter } from "../g_state";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
|
||||
import { gs_investas_menu } from "../g_state";
|
||||
|
||||
export default function LayoutMainInvestasi({
|
||||
children,
|
||||
@@ -36,7 +28,7 @@ export default function LayoutMainInvestasi({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [active, setActive] = useAtom(gs_investasiFooter);
|
||||
const [active, setActive] = useAtom(gs_investas_menu);
|
||||
|
||||
const listFooter = [
|
||||
{
|
||||
|
||||
@@ -2,91 +2,75 @@
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import {
|
||||
ActionIcon,
|
||||
Affix,
|
||||
AspectRatio,
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
CardSection,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Progress,
|
||||
rem,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { useWindowScroll } from "@mantine/hooks";
|
||||
import {
|
||||
IconCircleCheck,
|
||||
IconPencilPlus,
|
||||
IconXboxX,
|
||||
} from "@tabler/icons-react";
|
||||
import { useShallowEffect, useWindowScroll } from "@mantine/hooks";
|
||||
import { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { investasi_funGetAllPublish } from "../fun/get_all_investasi";
|
||||
|
||||
export default function MainInvestasi({
|
||||
listData,
|
||||
dataSelesai,
|
||||
dataWaktuHabis,
|
||||
}: {
|
||||
listData: MODEL_Investasi[];
|
||||
dataSelesai: MODEL_Investasi[];
|
||||
dataWaktuHabis: MODEL_Investasi[];
|
||||
}) {
|
||||
// console.log(listData)
|
||||
const router = useRouter();
|
||||
const [investasi, setInvestasi] = useState(listData);
|
||||
const [invesDone, setInvesDone] = useState(dataSelesai);
|
||||
const [invesFail, setInvesFail] = useState(dataWaktuHabis);
|
||||
const [statusPublish, setStatusPublish] = useState(false);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [data, setData] = useState(listData);
|
||||
const [isLoadingDetail, setLoadingDetail] = useState(false);
|
||||
const [scroll, scrollTo] = useWindowScroll();
|
||||
const [isNewPost, setIsNewPost] = useState(false);
|
||||
|
||||
// console.log(dataWaktuHabis)
|
||||
|
||||
useShallowEffect(() => {
|
||||
mqtt_client.subscribe("Beranda_Investasi");
|
||||
|
||||
mqtt_client.on("message", (topic, message) => {
|
||||
const newPost = JSON.parse(message.toString());
|
||||
setIsNewPost(newPost);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <Affix position={{ bottom: rem(150), right: rem(30) }}>
|
||||
<ActionIcon
|
||||
loading={isLoading ? true : false}
|
||||
opacity={scroll.y > 0 ? 0.5 : ""}
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
size={"xl"}
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
bg={"blue"}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterInvestasi.create);
|
||||
}}
|
||||
>
|
||||
<IconPencilPlus color="white" />
|
||||
</ActionIcon>
|
||||
</Affix> */}
|
||||
{isNewPost && (
|
||||
<Affix position={{ top: rem(100) }} w={"100%"}>
|
||||
<ButtonUpdateBeranda
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setIsNewPost(val.isNewPost);
|
||||
}}
|
||||
/>
|
||||
</Affix>
|
||||
)}
|
||||
|
||||
<ComponentGlobal_CreateButton path={RouterInvestasi.create} />
|
||||
|
||||
{_.isEmpty(investasi) && _.isEmpty(invesDone) && _.isEmpty(invesFail) ? (
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
investasi.map((e) => (
|
||||
data.map((e) => (
|
||||
<Card
|
||||
key={e.id}
|
||||
style={{
|
||||
@@ -103,99 +87,59 @@ export default function MainInvestasi({
|
||||
router.push(RouterInvestasi.detail + `${e.id}`);
|
||||
}}
|
||||
>
|
||||
<CardSection>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"sm"} withBorder>
|
||||
<CardSection py={"md"} px={"sm"}>
|
||||
<AspectRatio ratio={1 / 1} mah={250}>
|
||||
<Box style={{ borderRadius: "7px" }}>
|
||||
{e.imagesId ? (
|
||||
<Image
|
||||
alt=""
|
||||
radius={"sm"}
|
||||
alt="Foto"
|
||||
src={RouterInvestasi.api_gambar + `${e.imagesId}`}
|
||||
w={200}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Paper>
|
||||
</Box>
|
||||
</AspectRatio>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"sm"}>
|
||||
<CardSection p={"md"}>
|
||||
<Stack>
|
||||
<Title order={4}>{e.title}</Title>
|
||||
<Progress
|
||||
<Title align="center" order={3}>
|
||||
{e.title}
|
||||
</Title>
|
||||
{/* <Progress
|
||||
label={(+e.progress).toFixed(2) + " %"}
|
||||
value={+e.progress}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/> */}
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+e.totalLembar - +e.sisaLembar) / +e.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+e.totalLembar - +e.sisaLembar) / +e.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Stack>
|
||||
</CardSection>
|
||||
<CardSection p={"sm"}>
|
||||
<Box>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Center>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text truncate>Dana Dibutuhkan</Text>
|
||||
<Text truncate>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+e.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text truncate>Harga Per Lembar</Text>
|
||||
<Text truncate>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+e.hargaLembar)}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Center>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text truncate>ROI</Text>
|
||||
<Text truncate>{e.roi}%</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text truncate>Sisa Lembar</Text>
|
||||
<Text truncate>
|
||||
{new Intl.NumberFormat("id-ID").format(
|
||||
+e.sisaLembar
|
||||
)}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
</CardSection>
|
||||
<Divider color="gray.4" />
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<Group position="right">
|
||||
{/* <Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingDetail ? true : false}
|
||||
radius={"xl"}
|
||||
compact
|
||||
bg={Warna.hijau_muda}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
setLoadingDetail(true);
|
||||
router.push(RouterInvestasi.detail + `${e.id}`);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button> */}
|
||||
|
||||
{e.progress === "100" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
@@ -253,3 +197,41 @@ export default function MainInvestasi({
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonUpdateBeranda({
|
||||
onLoadData,
|
||||
}: {
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
async function onLoaded() {
|
||||
const loadData = await investasi_funGetAllPublish();
|
||||
onLoadData({
|
||||
data: loadData,
|
||||
isNewPost: false,
|
||||
});
|
||||
|
||||
setIsLoading(true);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<center>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
border: `1px solid ${AccentColor.skyblue}`,
|
||||
}}
|
||||
bg={AccentColor.blue}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
onClick={() => onLoaded()}
|
||||
>
|
||||
Update beranda
|
||||
</Button>
|
||||
</center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,21 +23,22 @@ export interface MODEL_Investasi {
|
||||
MasterPembagianDeviden: Model_All_Master;
|
||||
MasterPencarianInvestor: Model_All_Master;
|
||||
MasterPeriodeDeviden: Model_All_Master;
|
||||
MasterProgresInvestasi: Model_All_Master,
|
||||
MasterProgresInvestasi: Model_All_Master;
|
||||
masterPeriodeDevidenId: string;
|
||||
masterPembagianDevidenId: string;
|
||||
masterPencarianInvestorId: string;
|
||||
masterStatusInvestasiId: string;
|
||||
author: MODEL_PROFILE_OLD;
|
||||
countDown: Date
|
||||
countDown: Date;
|
||||
}
|
||||
|
||||
export interface MODEL_Transaksi_Investasi {
|
||||
id: string;
|
||||
namaBank: string;
|
||||
nomorRekening: string;
|
||||
transaction_id: string,
|
||||
status_message: string
|
||||
payment_type: string,
|
||||
transaction_id: string;
|
||||
status_message: string;
|
||||
payment_type: string;
|
||||
active: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
|
||||
@@ -1,52 +1,27 @@
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
Card,
|
||||
CardSection,
|
||||
AspectRatio,
|
||||
Box,
|
||||
Title,
|
||||
Divider,
|
||||
Group,
|
||||
Badge,
|
||||
Image,
|
||||
Text,
|
||||
Center,
|
||||
Paper,
|
||||
Grid,
|
||||
Flex,
|
||||
Stack,
|
||||
} from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { Box } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ComponentInvestasi_CardStatus } from "../component/detail/card_status";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
|
||||
export default function Draft({ data }: { data: MODEL_Investasi[] }) {
|
||||
const router = useRouter();
|
||||
// console.log(data)
|
||||
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
</>
|
||||
);
|
||||
if (_.isEmpty(data)) return <ComponentGlobal_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <pre> {JSON.stringify(data,null, 2)}</pre> */}
|
||||
{data.map((e) => (
|
||||
<Box key={e.id}>
|
||||
<Box key={e.id}>
|
||||
<ComponentInvestasi_CardStatus
|
||||
data={e}
|
||||
path={RouterInvestasi.detail_draft}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
Grid,
|
||||
Image,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { Box } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { ComponentInvestasi_CardStatus } from "../component/detail/card_status";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
|
||||
export default function Reject({ data }: { data: MODEL_Investasi[] }) {
|
||||
const [investasi, setInvestasi] = useState(data);
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
if (_.isEmpty(data)) return <ComponentGlobal_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,38 +1,16 @@
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
Card,
|
||||
CardSection,
|
||||
AspectRatio,
|
||||
Box,
|
||||
Title,
|
||||
Divider,
|
||||
Group,
|
||||
Badge,
|
||||
Image,
|
||||
Center,
|
||||
Text,
|
||||
Paper,
|
||||
Grid,
|
||||
Stack,
|
||||
} from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import {
|
||||
MODEL_Status_investasi,
|
||||
MODEL_Investasi,
|
||||
} from "../model/model_investasi";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { Box } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ComponentInvestasi_CardStatus } from "../component/detail/card_status";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
|
||||
export default function Review({ data }: { data: MODEL_Investasi[] }) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
if (_.isEmpty(data)) return <ComponentGlobal_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
{data.map((e) => (
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useState } from "react";
|
||||
|
||||
import { useAtom } from "jotai";
|
||||
import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loader
|
||||
import { gs_StatusPortoInvestasi } from "../g_state";
|
||||
import { gs_investasi_status } from "../g_state";
|
||||
import { MODEL_Status_investasi } from "../model/model_investasi";
|
||||
import Draft from "./draft";
|
||||
import Publish from "./publish";
|
||||
@@ -31,7 +31,7 @@ export default function PortofolioInvestasi({
|
||||
dataReject: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
const [status_inves, setStatus_inves] =
|
||||
useState<MODEL_Status_investasi[]>(listStatusInvestasi);
|
||||
|
||||
|
||||
@@ -9,37 +9,26 @@ import { IconArrowLeft } from "@tabler/icons-react";
|
||||
import { title } from "process";
|
||||
import { useRouter } from "next/navigation";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
|
||||
export default function LayoutProsesTransaksiInvestasi({
|
||||
children,
|
||||
investasiId,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
investasiId: string;
|
||||
}) {
|
||||
const [snapShow, setSnapShow] = useAtom(gs_midtrans_snap);
|
||||
const router = useRouter();
|
||||
// console.log(snapShow)
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
header={
|
||||
<Header height={50} sx={{ borderStyle: "none" }}>
|
||||
<Group h={50} position="apart" px={"md"}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
router.back();
|
||||
}}
|
||||
>
|
||||
<IconArrowLeft />
|
||||
</ActionIcon>
|
||||
<Text fw={500}>Proses Transaksi</Text>
|
||||
<ActionIcon variant="transparent" disabled></ActionIcon>
|
||||
</Group>
|
||||
</Header>
|
||||
}
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Proses Transaksi" />}
|
||||
>
|
||||
<Box>{children}</Box>
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
Text,
|
||||
Container,
|
||||
Flex,
|
||||
TextInput,
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap, useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -22,8 +23,14 @@ import toast from "react-simple-toasts";
|
||||
import funUpdatePaymentInvestasi from "../fun/fun_update_payment";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_investasiFooter, gs_midtrans_snap } from "../g_state";
|
||||
import { gs_investas_menu, gs_midtrans_snap } from "../g_state";
|
||||
import funUpdateInvestasi from "../fun/fun_update_investasi";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
|
||||
export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
const router = useRouter();
|
||||
@@ -35,13 +42,13 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [jumlah, setJumlah] = useState(0);
|
||||
const [hotmenu, setHotmenu] = useAtom(gs_investasiFooter);
|
||||
const [hotmenu, setHotmenu] = useAtom(gs_investas_menu);
|
||||
const [snapShow, setSnapShow] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
setJumlah(0)
|
||||
setTotal(0)
|
||||
},[])
|
||||
setJumlah(0);
|
||||
setTotal(0);
|
||||
}, []);
|
||||
|
||||
// console.log(userLogin.id);
|
||||
// console.log(investasi);
|
||||
@@ -76,7 +83,8 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
async (resUpdate) => {
|
||||
if (resUpdate.status === 200) {
|
||||
// console.log(resUpdate.message)
|
||||
const lembarTersisa = investasi.sisaLembar - resUpdate.data.quantity;
|
||||
const lembarTersisa =
|
||||
investasi.sisaLembar - resUpdate.data.quantity;
|
||||
|
||||
const body2 = {
|
||||
id: investasi.id,
|
||||
@@ -84,37 +92,39 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
};
|
||||
|
||||
await funUpdateInvestasi(body2, investasi);
|
||||
toast(res.message);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(
|
||||
RouterInvestasi.status_pesanan + `${resUpdate.data.id}`
|
||||
);
|
||||
|
||||
setHotmenu(3);
|
||||
} else {
|
||||
toast(res.message);
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
onPending: async function (result) {
|
||||
// console.log("pending");
|
||||
// console.log(result);
|
||||
console.log(result);
|
||||
// await funUpdatePaymentInvestasi(result, res.dataTransaksi.id);
|
||||
// toast(res.message);
|
||||
// setHotmenu(3);
|
||||
// ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
// router.push(
|
||||
// RouterInvestasi.status_pesanan + `${res.dataTransaksi.id}`
|
||||
// );
|
||||
// router.push(RouterInvestasi.detail + `${investasi.id}`)
|
||||
await router.push(RouterInvestasi.detail + `${investasi.id}`);
|
||||
setJumlah(0);
|
||||
// setSnapShow(false);
|
||||
// setJumlah(0);
|
||||
},
|
||||
onClose: async function (result) {
|
||||
await router.push(RouterInvestasi.detail + `${investasi.id}`);
|
||||
console.log(result);
|
||||
// router.replace(RouterInvestasi.detail + `${investasi.id}`);
|
||||
|
||||
// if (result === undefined) {
|
||||
// const data = {
|
||||
// status_code: "400",
|
||||
// };
|
||||
// router.back();
|
||||
// setJumlah(0);
|
||||
// // await funUpdatePaymentInvestasi(data, res.dataTransaksi.id);
|
||||
// router.push(RouterInvestasi.main_transaksi);
|
||||
// setSnapShow(false);
|
||||
@@ -124,7 +134,7 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
toast("Gagal Membuat Token");
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Membuat Token");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -150,7 +160,16 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
{/* {!snapShow && (
|
||||
|
||||
)} */}
|
||||
<Box>
|
||||
<Box
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
>
|
||||
{/* Sisa Lembar Saham */}
|
||||
<Group position="apart" mb={"md"}>
|
||||
<Text>Sisa Lembar Saham</Text>
|
||||
@@ -193,6 +212,7 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
setJumlah(val);
|
||||
// console.log(val);
|
||||
}}
|
||||
inputMode="numeric"
|
||||
/>
|
||||
</Group>
|
||||
|
||||
@@ -211,22 +231,22 @@ export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||
</Group>
|
||||
|
||||
<Center>
|
||||
{jumlah < 10 ? (
|
||||
<Button w={350} radius={50} bg={"gray"} disabled>
|
||||
Beli
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
w={350}
|
||||
radius={50}
|
||||
bg={Warna.biru}
|
||||
onClick={() => {
|
||||
onProses();
|
||||
}}
|
||||
>
|
||||
Beli
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
disabled={jumlah < 10}
|
||||
w={350}
|
||||
radius={50}
|
||||
onClick={() => {
|
||||
onProses();
|
||||
}}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
>
|
||||
Beli
|
||||
</Button>
|
||||
</Center>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ import { useState } from "react";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header";
|
||||
|
||||
export default function InvestasiSahamTerbeli({
|
||||
listTransaksi,
|
||||
@@ -41,133 +44,109 @@ export default function InvestasiSahamTerbeli({
|
||||
const router = useRouter();
|
||||
const [transaksi, setTransaksi] = useState(listTransaksi);
|
||||
|
||||
if (_.isEmpty(transaksi)) {
|
||||
return (
|
||||
<>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (_.isEmpty(transaksi)) return <ComponentGlobal_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
cols={4}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "md", cols: 3, spacing: "md" },
|
||||
{ maxWidth: "sm", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "xs", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
{transaksi.map((e) => (
|
||||
<Card key={e.id} bg={"gray.5"} radius={"md"}>
|
||||
<Card.Section withBorder p={"sm"}>
|
||||
<Group position="apart">
|
||||
<Group>
|
||||
<Avatar radius={"xl"}>
|
||||
{(() => {
|
||||
const usr = e.Investasi.author.username;
|
||||
const splt = usr.split("");
|
||||
const Up = _.upperCase(splt[0]);
|
||||
{transaksi.map((e) => (
|
||||
<Card
|
||||
key={e.id}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
|
||||
return Up;
|
||||
})()}
|
||||
</Avatar>
|
||||
<Text>{e.Investasi.author.username}</Text>
|
||||
</Group>
|
||||
onClick={() => router.push(RouterInvestasi.detail_saham_terbeli + e.id)}
|
||||
>
|
||||
{/* <Card.Section p={"sm"} >
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
authorName={e?.Investasi?.author?.username}
|
||||
imagesId={e?.Investasi?.author.Profile.imagesId}
|
||||
profileId={e?.Investasi?.author.Profile.id}
|
||||
isPembatas
|
||||
/>
|
||||
|
||||
</Card.Section> */}
|
||||
|
||||
<Button
|
||||
bg={"teal"}
|
||||
radius={"xl"}
|
||||
compact
|
||||
onClick={() =>
|
||||
router.push(
|
||||
RouterInvestasi.detail_saham_terbeli + `${e.id}`
|
||||
)
|
||||
}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
</Group>
|
||||
</Card.Section>
|
||||
|
||||
<Card.Section p={"md"}>
|
||||
<Card.Section p={"md"}>
|
||||
<Stack spacing={"lg"}>
|
||||
<Stack spacing={"lg"}>
|
||||
<Stack spacing={"lg"}>
|
||||
<Center>
|
||||
<Text fw={"bold"} fz={20} truncate>
|
||||
{e.Investasi.title}
|
||||
</Text>
|
||||
</Center>
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+e.Investasi.totalLembar - +e.Investasi.sisaLembar) /
|
||||
+e.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+e.Investasi.totalLembar - +e.Investasi.sisaLembar) /
|
||||
+e.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Stack spacing={5}>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={14}>Lembar Saham:</Text>
|
||||
<Text fw={"bold"} truncate>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+e.quantity)}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={14}>Total:</Text>
|
||||
<Text fw={"bold"} truncate>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+e.gross_amount)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
{e.Investasi.imagesId ? (
|
||||
<Image
|
||||
alt=""
|
||||
src={
|
||||
RouterInvestasi.api_gambar +
|
||||
`${e.Investasi.imagesId}`
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Center>
|
||||
<Text fw={"bold"} fz={20} lineClamp={1}>
|
||||
{e.Investasi.title}
|
||||
</Text>
|
||||
</Center>
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+e.Investasi.totalLembar - +e.Investasi.sisaLembar) /
|
||||
+e.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+e.Investasi.totalLembar - +e.Investasi.sisaLembar) /
|
||||
+e.Investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Stack>
|
||||
<Box></Box>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Stack spacing={5}>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={14}>Lembar Saham:</Text>
|
||||
<Text fw={"bold"} lineClamp={1}>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+e.quantity)}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={14}>Total:</Text>
|
||||
<Text fw={"bold"} lineClamp={1}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+e.gross_amount)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
{e.Investasi.imagesId ? (
|
||||
<Image
|
||||
alt=""
|
||||
src={
|
||||
RouterInvestasi.api_gambar +
|
||||
`${e.Investasi.imagesId}`
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
<Box></Box>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { ActionIcon, AppShell, Group, Header, Text } from "@mantine/core";
|
||||
import { IconArrowLeft } from "@tabler/icons-react";
|
||||
import router from "next/router";
|
||||
@@ -15,17 +17,18 @@ export default function LayoutStatusPesananInvestasi({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<Header height={50}>
|
||||
<Group h={50} position="center" px={"md"}>
|
||||
<Text>Status Transaksi</Text>
|
||||
</Group>
|
||||
</Header>
|
||||
<UIGlobal_LayoutHeaderTamplate title="Status Transaksi" hideButtonLeft/>
|
||||
// <Header height={50}>
|
||||
// <Group h={50} position="center" px={"md"}>
|
||||
// <Text>Status Transaksi</Text>
|
||||
// </Group>
|
||||
// </Header>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,19 +5,32 @@ import { MODEL_Transaksi_Investasi } from "../model/model_investasi";
|
||||
import { Button, Group, Paper, Stack, Text } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function StatusPesananInvetsatsi({
|
||||
dataTransaksi,
|
||||
}: {
|
||||
dataTransaksi: MODEL_Transaksi_Investasi;
|
||||
}) {
|
||||
const router = useRouter()
|
||||
const router = useRouter();
|
||||
const [transaksi, setTransaksi] = useState(dataTransaksi);
|
||||
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Paper withBorder p={"md"}>
|
||||
<Stack pb={"lg"}>
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Pemilik Investasi</Text>
|
||||
@@ -33,7 +46,17 @@ export default function StatusPesananInvetsatsi({
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Paper withBorder p={"md"}>
|
||||
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Transaksi ID</Text>
|
||||
@@ -41,15 +64,23 @@ export default function StatusPesananInvetsatsi({
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Lembar Terbeli</Text>
|
||||
<Text>{new Intl.NumberFormat("id-ID").format(+transaksi.quantity)} lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID").format(+transaksi.quantity)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Total Transfer</Text>
|
||||
<Text>Rp. {new Intl.NumberFormat("id-ID", {maximumFractionDigits: 10}).format(+transaksi.gross_amount)}</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+transaksi.gross_amount)}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Tipe Pembayaran</Text>
|
||||
<Text>{transaksi.payment_type.replace('_', " ")}</Text>
|
||||
<Text>{transaksi.payment_type.replace("_", " ")}</Text>
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Nama Bank</Text>
|
||||
@@ -61,8 +92,19 @@ export default function StatusPesananInvetsatsi({
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Button radius={"xl"} onClick={() => router.push(RouterInvestasi.main_transaksi)}>
|
||||
Kembali ke List Transaksi
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterInvestasi.main_transaksi);
|
||||
}}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
>
|
||||
Kembali ke List Transaksi
|
||||
</Button>
|
||||
</Stack>
|
||||
</>
|
||||
|
||||
@@ -15,8 +15,9 @@ import {
|
||||
} from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_investasiFooter } from "../../g_state";
|
||||
import { gs_investas_menu } from "../../g_state";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
|
||||
export default function LayoutStatusTransaksiInvestasi_Gagal({
|
||||
children,
|
||||
@@ -24,11 +25,11 @@ export default function LayoutStatusTransaksiInvestasi_Gagal({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investasiFooter);
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<Header height={50}>
|
||||
<Group position="apart" align="center" h={50} px={"md"}>
|
||||
@@ -62,7 +63,7 @@ export default function LayoutStatusTransaksiInvestasi_Gagal({
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@ import {
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { gs_investasiFooter } from "../g_state";
|
||||
import { gs_investas_menu } from "../g_state";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
|
||||
export default function LayoutStatusTransaksiInvestasi({
|
||||
children,
|
||||
@@ -25,11 +26,11 @@ export default function LayoutStatusTransaksiInvestasi({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investasiFooter);
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<Header height={50}>
|
||||
<Group position="apart" align="center" h={50} px={"md"}>
|
||||
@@ -63,7 +64,7 @@ export default function LayoutStatusTransaksiInvestasi({
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import { useInterval, useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function TransaksiInvestasi({
|
||||
statusTransaksi,
|
||||
@@ -56,12 +58,7 @@ export default function TransaksiInvestasi({
|
||||
}
|
||||
}
|
||||
|
||||
if (_.isEmpty(transaksi))
|
||||
return (
|
||||
<>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada transaksi" />
|
||||
</>
|
||||
);
|
||||
if (_.isEmpty(transaksi)) return <ComponentGlobal_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -73,7 +70,15 @@ export default function TransaksiInvestasi({
|
||||
router.push(RouterInvestasi.status_pesanan + `${e.id}`)
|
||||
}
|
||||
>
|
||||
<Paper p="xs" bg={"gray"}>
|
||||
<Paper
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Group position="apart">
|
||||
<Title order={6}>{e.Investasi.title}</Title>
|
||||
<Title order={5}>
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { gs_investasiFooter } from "../g_state";
|
||||
import { gs_investas_menu } from "../g_state";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
|
||||
export default function LayoutTransferInvestasi({
|
||||
@@ -26,7 +26,7 @@ export default function LayoutTransferInvestasi({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investasiFooter);
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
} from "../model/model_investasi";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_TransferValue, gs_investasiFooter } from "../g_state";
|
||||
import { gs_TransferValue, gs_investas_menu } from "../g_state";
|
||||
import funGantiStatusTransaksi_Investasi from "../fun/fun_ganti_status_transaksi";
|
||||
|
||||
export default function TransferInvestasi({
|
||||
|
||||
@@ -35,6 +35,7 @@ export default function UploadDokumenInvestasi({
|
||||
const [file, setFile] = useState<any | null>(null);
|
||||
const [pdf, setPdf] = useState<File | null>(null);
|
||||
const [title, setTitle] = useState("");
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
async function onUpload() {
|
||||
const body = {
|
||||
@@ -50,6 +51,7 @@ export default function UploadDokumenInvestasi({
|
||||
await funUploadDokumenInvestasi(fd, body).then((res) => {
|
||||
// console.log(res);
|
||||
if (res.status === 201) {
|
||||
setLoading(true)
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil upload");
|
||||
router.back();
|
||||
} else {
|
||||
@@ -137,6 +139,8 @@ export default function UploadDokumenInvestasi({
|
||||
/>
|
||||
<Stack>
|
||||
<Button
|
||||
loading={isLoading}
|
||||
loaderPosition="center"
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
|
||||
Reference in New Issue
Block a user