QC Investasi
# fix Tampilan admin investasi Tampilan admin donasi ## No issuee
This commit is contained in:
13
src/app_modules/investasi/component/is_empty_data.tsx
Normal file
13
src/app_modules/investasi/component/is_empty_data.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { Center } from "@mantine/core";
|
||||
|
||||
export default function ComponentInvestasi_IsEmptyData({ text }: { text: string }) {
|
||||
return (
|
||||
<>
|
||||
<Center h={"50vh"} fz={"sm"} fw={"bold"} c={"gray"}>
|
||||
{text}
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -18,9 +18,17 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Grid,
|
||||
Tooltip,
|
||||
ActionIcon,
|
||||
} from "@mantine/core";
|
||||
import { IconCamera, IconPdf, IconUpload } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
IconCamera,
|
||||
IconPdf,
|
||||
IconQuestionMark,
|
||||
IconUpload,
|
||||
} from "@tabler/icons-react";
|
||||
import _, { toNumber } from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { funCreateInvestasi } from "../fun/fun_create_investasi";
|
||||
@@ -29,6 +37,11 @@ import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_StatusPortoInvestasi, gs_investasiFooter } from "../g_state";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||
import {
|
||||
ComponentGlobal_WarningMaxUpload,
|
||||
maksimalUploadFile,
|
||||
} from "@/app_modules/component_global/variabel_global";
|
||||
|
||||
export default function InvestasiCreate({
|
||||
id,
|
||||
@@ -50,6 +63,7 @@ export default function InvestasiCreate({
|
||||
const [changeColor, setChangeColor] = useAtom(gs_investasiFooter);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [totalLembar, setTotalLembar] = useState(0);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [value, setValue] = useState({
|
||||
title: "",
|
||||
@@ -60,6 +74,8 @@ export default function InvestasiCreate({
|
||||
periodeDevidenId: "",
|
||||
pembagianDevidenId: "",
|
||||
});
|
||||
const [target, setTarget] = useState("");
|
||||
const [harga, setHarga] = useState("");
|
||||
|
||||
async function onSubmit() {
|
||||
const body = {
|
||||
@@ -73,31 +89,41 @@ export default function InvestasiCreate({
|
||||
masterPembagianDevidenId: value.pembagianDevidenId,
|
||||
masterPencarianInvestorId: value.pencarianInvestorId,
|
||||
};
|
||||
// toast("Berhasil disimpan")
|
||||
|
||||
// if (_.values(body).includes("")) return toast("Lengkapi data");
|
||||
if (!fl) return toast("Gambar Kosong");
|
||||
if (!pdf) return toast("File Kosong");
|
||||
// if (_.values(body).includes("")) return toast("Lengkapi data");
|
||||
if (!fl) return ComponentGlobal_NotifikasiPeringatan("Gambar Kosong");
|
||||
if (!pdf) return ComponentGlobal_NotifikasiPeringatan("File Kosong");
|
||||
|
||||
const gmbr = new FormData();
|
||||
gmbr.append("file", fl);
|
||||
const gmbr = new FormData();
|
||||
gmbr.append("file", fl as any);
|
||||
|
||||
const flPdf = new FormData();
|
||||
flPdf.append("file", pdf as any);
|
||||
const flPdf = new FormData();
|
||||
flPdf.append("file", fl as any);
|
||||
|
||||
await funCreateInvestasi(gmbr, flPdf, body as any).then((res) => {
|
||||
if (res.status === 201) {
|
||||
// toast(res.message);
|
||||
setChangeColor(1);
|
||||
setActiveTab("Review");
|
||||
router.push(RouterInvestasi.dialog_create);
|
||||
} else {
|
||||
toast(res.message);
|
||||
}
|
||||
});
|
||||
await funCreateInvestasi(gmbr, flPdf, body as any).then((res) => {
|
||||
if (res.status === 201) {
|
||||
setChangeColor(1);
|
||||
setActiveTab("Review");
|
||||
setLoading(true);
|
||||
router.push(RouterInvestasi.dialog_create);
|
||||
} else {
|
||||
toast(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function onTotalLembar(target: any, harga: any) {
|
||||
async function onTotalLembar({
|
||||
target,
|
||||
harga,
|
||||
}: {
|
||||
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));
|
||||
}
|
||||
@@ -121,12 +147,21 @@ export default function InvestasiCreate({
|
||||
<Group position="center" mb={"md"}>
|
||||
<FileButton
|
||||
onChange={async (files: any) => {
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
// console.log(files);
|
||||
setImg(buffer);
|
||||
setFl(files);
|
||||
try {
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
console.log(files.size);
|
||||
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setImg(buffer);
|
||||
setFl(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}}
|
||||
accept="image/png,image/jpeg"
|
||||
>
|
||||
@@ -159,12 +194,20 @@ export default function InvestasiCreate({
|
||||
<FileButton
|
||||
accept="application/pdf"
|
||||
onChange={async (files: any) => {
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
// console.log(files.name)
|
||||
setFilePdf(buffer);
|
||||
setPdf(files);
|
||||
try {
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setFilePdf(buffer);
|
||||
setPdf(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{(props) => (
|
||||
@@ -183,6 +226,8 @@ export default function InvestasiCreate({
|
||||
<TextInput
|
||||
withAsterisk
|
||||
label="Judul Investasi"
|
||||
placeholder="Judul investasi"
|
||||
maxLength={100}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -190,10 +235,12 @@ export default function InvestasiCreate({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<NumberInput
|
||||
|
||||
{/* <NumberInput
|
||||
withAsterisk
|
||||
type="number"
|
||||
label="Dana Dibutuhkan"
|
||||
placeholder="Masukan nominal dana"
|
||||
onChange={(val: any) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -201,17 +248,81 @@ export default function InvestasiCreate({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<NumberInput
|
||||
label="Harga Per Lembar"
|
||||
type="number"
|
||||
placeholder="Masukan nominal harga"
|
||||
onChange={(val) => {
|
||||
//console.log(val)
|
||||
setValue({
|
||||
...value,
|
||||
hargaLembar: +val,
|
||||
});
|
||||
onTotalLembar(value.targetDana, val);
|
||||
onTotalLembar({ target: value.targetDana, harga: +val });
|
||||
}}
|
||||
/> */}
|
||||
|
||||
<TextInput
|
||||
icon={<Text fw={"bold"}>Rp.</Text>}
|
||||
min={0}
|
||||
withAsterisk
|
||||
label="Dana Dibutuhkan"
|
||||
placeholder="0"
|
||||
value={target}
|
||||
onChange={(val) => {
|
||||
// console.log(typeof val)
|
||||
const match = val.currentTarget.value
|
||||
.replace(/\./g, "")
|
||||
.match(/^[0-9]+$/);
|
||||
|
||||
if (val.currentTarget.value === "") return setTarget(0 + "");
|
||||
if (!match?.[0]) return null;
|
||||
|
||||
const nilai = val.currentTarget.value.replace(/\./g, "");
|
||||
const targetNilai = Intl.NumberFormat("id-ID").format(+nilai);
|
||||
|
||||
setTarget(targetNilai);
|
||||
setValue({
|
||||
...value,
|
||||
targetDana: +nilai,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
icon={<Text fw={"bold"}>Rp.</Text>}
|
||||
min={0}
|
||||
withAsterisk
|
||||
label="Harga Per Lembar"
|
||||
placeholder="0"
|
||||
value={harga}
|
||||
onChange={(val) => {
|
||||
try {
|
||||
// console.log(typeof +val.currentTarget.value);
|
||||
|
||||
const match = val.currentTarget.value
|
||||
.replace(/\./g, "")
|
||||
.match(/^[0-9]+$/);
|
||||
|
||||
if (val.currentTarget.value === "") return setHarga(0 + "");
|
||||
|
||||
if (!match?.[0]) return null;
|
||||
|
||||
const nilai = val.currentTarget.value.replace(/\./g, "");
|
||||
const targetNilai = Intl.NumberFormat("id-ID").format(+nilai);
|
||||
|
||||
onTotalLembar({
|
||||
target: value.targetDana,
|
||||
harga: +nilai,
|
||||
});
|
||||
|
||||
setHarga(targetNilai);
|
||||
setValue({
|
||||
...value,
|
||||
hargaLembar: +nilai,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -223,25 +334,33 @@ export default function InvestasiCreate({
|
||||
<Text>{totalLembar}</Text>
|
||||
<Divider />
|
||||
</Stack>
|
||||
<Text c={"blue"} fz={10}>
|
||||
<Text c={"gray"} fz={10} fs={"italic"}>
|
||||
*Total lembar dihitung dari, Target Dana : Harga Perlembar
|
||||
</Text>
|
||||
</Stack>
|
||||
|
||||
<NumberInput
|
||||
<TextInput
|
||||
rightSection={
|
||||
<Text fw={"bold"} c={"gray"}>
|
||||
%
|
||||
</Text>
|
||||
}
|
||||
withAsterisk
|
||||
type="number"
|
||||
label="Rasio Keuntungan / ROI"
|
||||
onChange={(val: any) => {
|
||||
label={"Rasio Keuntungan / ROI %"}
|
||||
placeholder="Masukan rasio keuntungan"
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
roi: val,
|
||||
roi: _.toNumber(val.target.value),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<Select
|
||||
withAsterisk
|
||||
label="Pencarian Investor"
|
||||
placeholder="Pilih batas waktu"
|
||||
data={pencarianInvestor.map((e) => ({
|
||||
value: e.id,
|
||||
label: e.name + " " + "hari",
|
||||
@@ -256,6 +375,7 @@ export default function InvestasiCreate({
|
||||
<Select
|
||||
withAsterisk
|
||||
label="Periode Deviden"
|
||||
placeholder="Pilih batas waktu"
|
||||
data={periodeDeviden.map((e) => ({ value: e.id, label: e.name }))}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
@@ -267,6 +387,7 @@ export default function InvestasiCreate({
|
||||
<Select
|
||||
withAsterisk
|
||||
label="Pembagian Deviden"
|
||||
placeholder="Pilih batas waktu"
|
||||
data={pembagianDeviden.map((e) => ({
|
||||
value: e.id,
|
||||
label: e.name + " " + "bulan",
|
||||
@@ -282,6 +403,24 @@ export default function InvestasiCreate({
|
||||
|
||||
<Center my={"lg"}>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
disabled={
|
||||
value.title === "" ||
|
||||
value.hargaLembar === 0 ||
|
||||
value.targetDana === 0 ||
|
||||
value.roi === 0 ||
|
||||
value.pencarianInvestorId === "" ||
|
||||
value.periodeDevidenId === "" ||
|
||||
value.pembagianDevidenId === "" ||
|
||||
fl === null ||
|
||||
filePdf === null
|
||||
? true
|
||||
: false
|
||||
}
|
||||
w={300}
|
||||
radius={50}
|
||||
bg={Warna.biru}
|
||||
|
||||
@@ -36,6 +36,7 @@ import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { gs_TransferValue } from "../g_state";
|
||||
import { useAtom } from "jotai";
|
||||
import _ from "lodash";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
|
||||
export default function DetailInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -54,6 +55,8 @@ export default function DetailInvestasi({
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
const [user, setUser] = useState(dataUser);
|
||||
const [transaksiValue, setTransaksiValue] = useAtom(gs_TransferValue);
|
||||
const [boxId, setBoxId] = useState(0);
|
||||
const [isLoadingBox, setLoadingBox] = useState(false);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
@@ -89,229 +92,237 @@ export default function DetailInvestasi({
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Foto username dan sisa waktu */}
|
||||
<Group position="apart" mb={"md"}>
|
||||
<Flex align={"center"} gap={"xs"}>
|
||||
<Avatar radius={"xl"} bg={"gray"}>
|
||||
{(() => {
|
||||
const usr = investasi.author.username;
|
||||
const splt = usr.split("");
|
||||
const Up = _.upperCase(splt[0]);
|
||||
<Box px={"sm"}>
|
||||
{/* Foto username dan sisa waktu */}
|
||||
<Group position="apart" mb={"md"}>
|
||||
{/* <pre>{JSON.stringify(dataUser, null, 2)}</pre> */}
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
authorName={dataUser?.Profile?.name}
|
||||
imagesId={dataUser?.Profile?.imagesId}
|
||||
profileId={dataUser?.Profile?.id}
|
||||
/>
|
||||
|
||||
return Up;
|
||||
})()}
|
||||
</Avatar>
|
||||
<Text>{user.username}</Text>
|
||||
</Flex>
|
||||
{investasi.MasterProgresInvestasi.id === "1" ? (
|
||||
<Box>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text>Sisa waktu:</Text>
|
||||
<Text>
|
||||
{Number(investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text>Hari</Text>
|
||||
</Group>
|
||||
</Box>
|
||||
{investasi.MasterProgresInvestasi.id === "1" ? (
|
||||
<Box>
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text>
|
||||
Sisa waktu:{" "}
|
||||
<Text span inherit>
|
||||
{Number(investasi.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(investasi.countDown),
|
||||
"days"
|
||||
)}{" "}
|
||||
Hari
|
||||
</Text>
|
||||
</Text>
|
||||
</Group>
|
||||
</Box>
|
||||
) : (
|
||||
<Box>
|
||||
{investasi.MasterProgresInvestasi.id === "2" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<Paper withBorder mb={"md"} p={"xs"}>
|
||||
<AspectRatio ratio={1 / 1}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
|
||||
{/* Title dan Progress */}
|
||||
<Box mb={"md"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{investasi.title}
|
||||
</Title>
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+investasi.totalLembar - +investasi.sisaLembar) /
|
||||
+investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+investasi.totalLembar - +investasi.sisaLembar) /
|
||||
+investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<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>Pembagian Deviden</Text>
|
||||
<Text>{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(totalInvestor)}
|
||||
</Text>
|
||||
</Box>
|
||||
<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>Sisa Lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.sisaLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"md"}>
|
||||
{listBox.map((e, i) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e?.id}
|
||||
onClick={() => {
|
||||
setBoxId(e?.id);
|
||||
setLoadingBox(true);
|
||||
router.push(e.route + `${investasi.id}`);
|
||||
}}
|
||||
>
|
||||
<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>
|
||||
{investasi.MasterProgresInvestasi.id === "2" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
{loginUserId === investasi.authorId ? (
|
||||
<Center mb={"md"}>
|
||||
<Button disabled radius={50} w={350}>
|
||||
Investasi Ini Milik Anda
|
||||
</Button>
|
||||
</Center>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
<Center mb={"md"}>
|
||||
<Button
|
||||
radius={50}
|
||||
w={350}
|
||||
bg={Warna.biru}
|
||||
onClick={() => {
|
||||
onSubmit();
|
||||
}}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
Beli Saham
|
||||
</Button>
|
||||
</Center>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<Paper withBorder mb={"md"} p={"xs"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
|
||||
{/* Title dan Progress */}
|
||||
<Box mb={"md"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{investasi.title}
|
||||
</Title>
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+investasi.totalLembar - +investasi.sisaLembar) /
|
||||
+investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+investasi.totalLembar - +investasi.sisaLembar) /
|
||||
+investasi.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<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>Pembagian Deviden</Text>
|
||||
<Text>{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(totalInvestor)}
|
||||
</Text>
|
||||
</Box>
|
||||
<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>Sisa Lembar</Text>
|
||||
<Text>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+investasi.sisaLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"md"}>
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${investasi.id}`)}
|
||||
>
|
||||
<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>
|
||||
))}
|
||||
</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();
|
||||
}}
|
||||
>
|
||||
Beli Saham
|
||||
</Button>
|
||||
</Center>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
199
src/app_modules/investasi/detail_portofolio/review/index.tsx
Normal file
199
src/app_modules/investasi/detail_portofolio/review/index.tsx
Normal file
@@ -0,0 +1,199 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
ActionIcon,
|
||||
AspectRatio,
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Slider,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} 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 funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
|
||||
export default function DetailReviewInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [investasi, setInvestasi] = 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(investasi.id, "1")
|
||||
.then((val) => {
|
||||
if (val.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
setActiveTab("Draft");
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan("Error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Paper withBorder>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Center>
|
||||
<Title order={4}>{_.capitalize(investasi.title)}</Title>
|
||||
</Center>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid p={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 20,
|
||||
}).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>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid>
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${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>
|
||||
|
||||
{/* Tombol Ajukan */}
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
my={"xl"}
|
||||
radius={50}
|
||||
bg={"orange"}
|
||||
color="yellow"
|
||||
onClick={() => onsubmit()}
|
||||
>
|
||||
Batalkan Review
|
||||
</Button>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
ActionIcon,
|
||||
AspectRatio,
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Slider,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} 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 funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function DetailReviewInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [investasi, setInvestasi] = 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(investasi.id, "1")
|
||||
.then((res) => res)
|
||||
.then((val) => {
|
||||
if (val.status === 200) {
|
||||
toast("Review Dibatalkan");
|
||||
router.push(RouterInvestasi.portofolio);
|
||||
setActiveTab("Draft");
|
||||
} else {
|
||||
toast("Error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper withBorder mb={"md"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Center mb={"xs"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{_.capitalize(investasi.title)}
|
||||
</Title>
|
||||
</Center>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid p={"md"} mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>Rp. {new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 20,
|
||||
}).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>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"md"}>
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${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>
|
||||
|
||||
{/* Tombol Ajukan */}
|
||||
<Center>
|
||||
<Button
|
||||
w={300}
|
||||
mb={"xl"}
|
||||
radius={50}
|
||||
bg={"red.7"}
|
||||
color="yellow"
|
||||
onClick={() => onsubmit()}
|
||||
>
|
||||
Batalkan Review
|
||||
</Button>
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Center, Grid, Group, Paper, Text, Title } from "@mantine/core";
|
||||
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/component_global/loading_card";
|
||||
import { Center, Grid, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function EditInvestasi({id}:{id:string}) {
|
||||
export default function EditInvestasi({ id }: { id: string }) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [listId, setListId] = useState(0);
|
||||
|
||||
const listEdit = [
|
||||
{
|
||||
id: 1,
|
||||
@@ -33,19 +38,32 @@ export default function EditInvestasi({id}:{id:string}) {
|
||||
<>
|
||||
{listEdit.map((e) => (
|
||||
<Paper
|
||||
shadow="lg"
|
||||
key={e.id}
|
||||
w={"100%"}
|
||||
h={50}
|
||||
bg={"gray"}
|
||||
bg={"gray.4"}
|
||||
mb={"md"}
|
||||
onClick={() => router.push(e.route + `${id}`)}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
setListId(e.id);
|
||||
router.push(e.route + `${id}`);
|
||||
}}
|
||||
>
|
||||
<Grid align="center" justify="center" h={50} px={"sm"}>
|
||||
<Grid.Col span={10}>
|
||||
<Text>{e.name}</Text>
|
||||
{isLoading && e.id === listId ? (
|
||||
<ComponentGlobal_CardLoadingOverlay />
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<Grid justify="center" h={70} px={"sm"}>
|
||||
<Grid.Col span={10} h={"100%"}>
|
||||
<Stack h={"100%"} justify="center">
|
||||
<Title order={4} fw={"bold"}>
|
||||
{e.name}
|
||||
</Title>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<Center h={"100%"}>
|
||||
<IconChevronRight />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
|
||||
@@ -32,6 +32,11 @@ import _ from "lodash";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||
import funEditInvestasi from "../fun/fun_edit_investasi";
|
||||
import { useDisclosure, useWindowScroll } from "@mantine/hooks";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
import {
|
||||
ComponentGlobal_WarningMaxUpload,
|
||||
maksimalUploadFile,
|
||||
} from "@/app_modules/component_global/variabel_global";
|
||||
|
||||
export default function EditIntroInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -109,11 +114,20 @@ export default function EditIntroInvestasi({
|
||||
<Group position="center" mb={"md"}>
|
||||
<FileButton
|
||||
onChange={async (files: any) => {
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
setImg(buffer);
|
||||
setFl(files);
|
||||
try {
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setImg(buffer);
|
||||
setFl(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}}
|
||||
accept="image/png,image/jpeg"
|
||||
>
|
||||
@@ -136,6 +150,14 @@ export default function EditIntroInvestasi({
|
||||
label="Judul Proyek"
|
||||
placeholder={"Masukan Judul"}
|
||||
value={edit_inves.title}
|
||||
maxLength={100}
|
||||
error={
|
||||
edit_inves.title === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan judul" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
setEdit_inves({
|
||||
...edit_inves,
|
||||
|
||||
@@ -83,11 +83,7 @@ export async function funCreateInvestasi(
|
||||
// const upPdfFolder = Buffer.from(await file.arrayBuffer());
|
||||
// fs.writeFileSync(`./public/file/${uploadFile.url}`, upPdfFolder);
|
||||
|
||||
const updloadPDF = await funUploadProspektusInvestasi(
|
||||
filePdf,
|
||||
createInvest.id
|
||||
);
|
||||
// console.log(updloadPDF);
|
||||
await funUploadProspektusInvestasi(filePdf, createInvest.id);
|
||||
|
||||
revalidatePath(RouterInvestasi.main_porto);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
@@ -16,7 +16,7 @@ export default async function funDeleteInvestasi(id: string) {
|
||||
|
||||
|
||||
revalidatePath(RouterInvestasi.portofolio)
|
||||
revalidatePath(RouterAdminInvestasi.main_investasi)
|
||||
revalidatePath(RouterAdminInvestasi_OLD.main_investasi)
|
||||
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import moment from "moment";
|
||||
import { revalidatePath } from "next/cache";
|
||||
@@ -36,7 +36,7 @@ export default async function funGantiStatusInvestasi(
|
||||
if (!data) return { status: 400 };
|
||||
|
||||
revalidatePath(RouterInvestasi.portofolio);
|
||||
revalidatePath(RouterAdminInvestasi.main_investasi);
|
||||
revalidatePath(RouterAdminInvestasi_OLD.main_investasi);
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
@@ -60,7 +60,7 @@ export default async function funGantiStatusInvestasi(
|
||||
if (!data) return { status: 400 };
|
||||
|
||||
revalidatePath(RouterInvestasi.portofolio);
|
||||
revalidatePath(RouterAdminInvestasi.main_investasi);
|
||||
revalidatePath(RouterAdminInvestasi_OLD.main_investasi);
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
|
||||
@@ -49,7 +49,7 @@ import LayoutListEditBeritaInvestasi from "./list_edit_berita/layout";
|
||||
import InvestasiSahamTerbeli from "./saham_saya/saham_saya";
|
||||
import DetailDraftInvestasi from "./detail_portofolio/draft/page";
|
||||
import LayoutDetailDraftInvestasi from "./detail_portofolio/draft/layout";
|
||||
import DetailReviewInvestasi from "./detail_portofolio/review/page";
|
||||
import DetailReviewInvestasi from "./detail_portofolio/review";
|
||||
import LayoutDetailReviewInvestasi from "./detail_portofolio/review/layout";
|
||||
import DetailPublishInvestasi from "./detail_portofolio/publish/page";
|
||||
import LayoutDetailPublishInvestasi from "./detail_portofolio/publish/layout";
|
||||
|
||||
@@ -75,7 +75,7 @@ export default function LayoutMainInvestasi({
|
||||
/>
|
||||
}
|
||||
footer={
|
||||
<Footer height={"10vh"} bg={"dark.4"}>
|
||||
<Footer height={"10vh"} bg={"black"}>
|
||||
<Grid align="center" h={"10vh"} pt={"xs"} grow>
|
||||
{/* Tampilan Bursa */}
|
||||
{listFooter.map((e, k) => (
|
||||
@@ -91,11 +91,11 @@ export default function LayoutMainInvestasi({
|
||||
<Flex direction={"column"} align={"center"} w={"100%"}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c={active === k ? "green" : "white"}
|
||||
c={active === k ? "blue" : "white"}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
<Text c={active === k ? "green" : "white"} fz={"xs"}>
|
||||
<Text c={active === k ? "blue" : "white"} fz={"xs"}>
|
||||
{e.name}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||
import {
|
||||
ActionIcon,
|
||||
Affix,
|
||||
AspectRatio,
|
||||
Badge,
|
||||
Box,
|
||||
@@ -21,17 +23,25 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import dataDummy from "../dummy/data_dummy.json";
|
||||
import moment from "moment";
|
||||
import { IconCheck, IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||
import {
|
||||
IconCheck,
|
||||
IconCircleCheck,
|
||||
IconPencilPlus,
|
||||
IconXboxX,
|
||||
} from "@tabler/icons-react";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import _ from "lodash";
|
||||
import { useState } from "react";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useShallowEffect, useWindowScroll } from "@mantine/hooks";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
||||
|
||||
export default function MainInvestasi({
|
||||
listData,
|
||||
@@ -48,169 +58,194 @@ export default function MainInvestasi({
|
||||
const [invesDone, setInvesDone] = useState(dataSelesai);
|
||||
const [invesFail, setInvesFail] = useState(dataWaktuHabis);
|
||||
const [statusPublish, setStatusPublish] = useState(false);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [isLoadingDetail, setLoadingDetail] = useState(false);
|
||||
const [scroll, scrollTo] = useWindowScroll();
|
||||
|
||||
// console.log(dataWaktuHabis)
|
||||
|
||||
if (_.isEmpty(investasi) && _.isEmpty(invesDone) && _.isEmpty(invesFail))
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
<Center h={"80vh"}>
|
||||
<Text>BURSA KOSONG</Text>
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
{investasi.map((e) => (
|
||||
<Card
|
||||
// sx={{ borderStyle: "solid", borderColor: "black", borderWidth: "0.5px" }}
|
||||
radius={"md"}
|
||||
key={e.id}
|
||||
mb={"lg"}
|
||||
bg={"dark.1"}
|
||||
<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);
|
||||
}}
|
||||
>
|
||||
<CardSection p={"md"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
{e.imagesId ? (
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${e.imagesId}`}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</CardSection>
|
||||
<IconPencilPlus color="white" />
|
||||
</ActionIcon>
|
||||
</Affix>
|
||||
|
||||
<CardSection p={"lg"}>
|
||||
<Stack>
|
||||
<Title order={4}>{e.title}</Title>
|
||||
<Progress
|
||||
label={(+e.progress).toFixed(2) + " %"}
|
||||
value={+e.progress}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Stack>
|
||||
</CardSection>
|
||||
<CardSection p={"md"}>
|
||||
<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="dark.4" />
|
||||
<CardSection p={"md"}>
|
||||
<Group position="apart">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
compact
|
||||
bg={Warna.hijau_muda}
|
||||
color="green"
|
||||
onClick={() => router.push(RouterInvestasi.detail + `${e.id}`)}
|
||||
>
|
||||
Details
|
||||
</Button>
|
||||
|
||||
{e.progress === "100" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
{+e.MasterPencarianInvestor.name -
|
||||
moment(new Date()).diff(new Date(e.countDown), "days") <=
|
||||
0 ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
{_.isEmpty(investasi) && _.isEmpty(invesDone) && _.isEmpty(invesFail) ? (
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
) : (
|
||||
investasi.map((e) => (
|
||||
<Card
|
||||
// sx={{ borderStyle: "solid", borderColor: "black", borderWidth: "0.5px" }}
|
||||
radius={"sm"}
|
||||
key={e.id}
|
||||
mb={"lg"}
|
||||
withBorder
|
||||
p={"xl"}
|
||||
shadow="lg"
|
||||
>
|
||||
<CardSection>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"sm"} withBorder>
|
||||
{e.imagesId ? (
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${e.imagesId}`}
|
||||
/>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text truncate>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(e.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(e.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</CardSection>
|
||||
</Card>
|
||||
))}
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"sm"}>
|
||||
<Stack>
|
||||
<Title order={4}>{e.title}</Title>
|
||||
<Progress
|
||||
label={(+e.progress).toFixed(2) + " %"}
|
||||
value={+e.progress}
|
||||
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="apart">
|
||||
<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" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
{+e.MasterPencarianInvestor.name -
|
||||
moment(new Date()).diff(new Date(e.countDown), "days") <=
|
||||
0 ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text truncate>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(e.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(e.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</CardSection>
|
||||
</Card>
|
||||
))
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function Draft({ data }: { data: MODEL_Investasi[] }) {
|
||||
const router = useRouter();
|
||||
@@ -27,7 +28,7 @@ export default function Draft({ data }: { data: MODEL_Investasi[] }) {
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<Center h={"50vh"}>Tidak ada Draft</Center>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -40,7 +41,6 @@ export default function Draft({ data }: { data: MODEL_Investasi[] }) {
|
||||
p={"xs"}
|
||||
key={e.id}
|
||||
mb={"md"}
|
||||
bg={"yellow.1"}
|
||||
withBorder
|
||||
onClick={() => router.push(RouterInvestasi.detail_draft + `${e.id}`)}
|
||||
>
|
||||
|
||||
@@ -25,6 +25,7 @@ import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { useState } from "react";
|
||||
import { IconChecklist, IconCircleCheck } from "@tabler/icons-react";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function Publish({ data }: { data: MODEL_Investasi[] }) {
|
||||
const router = useRouter();
|
||||
@@ -33,7 +34,7 @@ export default function Publish({ data }: { data: MODEL_Investasi[] }) {
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<Center h={"50vh"}>Tidak ada Publish</Center>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -45,7 +46,6 @@ export default function Publish({ data }: { data: MODEL_Investasi[] }) {
|
||||
withBorder
|
||||
mb={"md"}
|
||||
p={"xs"}
|
||||
bg={"green.1"}
|
||||
onClick={() =>
|
||||
router.push(RouterInvestasi.detail_publish + `${e.id}`)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
} from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function Reject({ data }: { data: MODEL_Investasi[] }) {
|
||||
const [investasi, setInvestasi] = useState(data);
|
||||
@@ -30,7 +31,7 @@ export default function Reject({ data }: { data: MODEL_Investasi[] }) {
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<Center h={"50vh"}>Tidak ada Reject</Center>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -43,7 +44,6 @@ export default function Reject({ data }: { data: MODEL_Investasi[] }) {
|
||||
withBorder
|
||||
mb={"md"}
|
||||
p={"xs"}
|
||||
bg={"red.1"}
|
||||
onClick={() => router.push(RouterInvestasi.detail_reject + `${e.id}`)}
|
||||
>
|
||||
<Grid>
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
MODEL_Investasi,
|
||||
} from "../model/model_investasi";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function Review({ data }: { data: MODEL_Investasi[] }) {
|
||||
const router = useRouter();
|
||||
@@ -28,7 +29,7 @@ export default function Review({ data }: { data: MODEL_Investasi[] }) {
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<>
|
||||
<Center h={"50vh"}>Tidak ada Review</Center>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
return (
|
||||
@@ -38,7 +39,6 @@ export default function Review({ data }: { data: MODEL_Investasi[] }) {
|
||||
// sx={{ borderStyle: "solid", borderColor: "orange", borderWidth: "1px" }}
|
||||
key={e.id}
|
||||
mb={"md"}
|
||||
bg={"orange.1"}
|
||||
p={"xs"}
|
||||
withBorder
|
||||
onClick={() => router.push(RouterInvestasi.detail_review + `${e.id}`)}
|
||||
|
||||
@@ -78,7 +78,7 @@ export default function PortofolioInvestasi({
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(dataInvestasi, null, 2)}</pre> */}
|
||||
<Stack>
|
||||
<Button
|
||||
{/* <Button
|
||||
radius={"xl"}
|
||||
bg={Warna.hijau_muda}
|
||||
color="green"
|
||||
@@ -86,7 +86,7 @@ export default function PortofolioInvestasi({
|
||||
onClick={() => router.push(RouterInvestasi.create)}
|
||||
>
|
||||
Buat Proyek Invetasi
|
||||
</Button>
|
||||
</Button> */}
|
||||
<Tabs
|
||||
variant="pills"
|
||||
radius="xl"
|
||||
@@ -94,30 +94,41 @@ export default function PortofolioInvestasi({
|
||||
value={activeTab}
|
||||
onTabChange={setActiveTab}
|
||||
>
|
||||
<Tabs.List grow>
|
||||
{status_inves.map((e) => (
|
||||
<Tabs.Tab
|
||||
key={e.id}
|
||||
value={e.name}
|
||||
color={!activeTab ? "gray" : e.color}
|
||||
>
|
||||
{e.name}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
<Divider my={"xs"} />
|
||||
<Tabs.Panel key={"1"} value="Draft">
|
||||
<Draft data={dataDraft as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel key={"2"} value="Review">
|
||||
<Review data={dataReview as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel key={"3"} value="Publish">
|
||||
<Publish data={dataPublish as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel key={"4"} value="Reject">
|
||||
<Reject data={dataReject as any} />
|
||||
</Tabs.Panel>
|
||||
<Stack>
|
||||
<Tabs.List grow>
|
||||
{status_inves.map((e) => (
|
||||
<Tabs.Tab
|
||||
sx={
|
||||
activeTab === e.name
|
||||
? {
|
||||
boxShadow:
|
||||
"0 2px 4px 0 rgba(0, 0, 0, 0.1), 0 2px 6px 0 rgba(0, 0, 0, 0.2)",
|
||||
}
|
||||
: {}
|
||||
}
|
||||
key={e.id}
|
||||
value={e.name}
|
||||
bg={activeTab === e.name ? "blue" : "gray.1"}
|
||||
fw={activeTab === e.name ? "bold" : "normal"}
|
||||
>
|
||||
{e.name}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
|
||||
<Tabs.Panel key={"1"} value="Draft">
|
||||
<Draft data={dataDraft as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel key={"2"} value="Review">
|
||||
<Review data={dataReview as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel key={"3"} value="Publish">
|
||||
<Publish data={dataPublish as any} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel key={"4"} value="Reject">
|
||||
<Reject data={dataReject as any} />
|
||||
</Tabs.Panel>
|
||||
</Stack>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</>
|
||||
|
||||
@@ -31,6 +31,7 @@ import { MODEL_Transaksi_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import _ from "lodash";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function InvestasiSahamTerbeli({
|
||||
listTransaksi,
|
||||
@@ -43,9 +44,7 @@ export default function InvestasiSahamTerbeli({
|
||||
if (_.isEmpty(transaksi)) {
|
||||
return (
|
||||
<>
|
||||
<Center h={"80vh"}>
|
||||
<Text>Saham Anda Kosong</Text>
|
||||
</Center>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada data" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import funGantiStatusTransaksi_Investasi from "../fun/fun_ganti_status_transaksi
|
||||
import { useInterval, useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function TransaksiInvestasi({
|
||||
statusTransaksi,
|
||||
@@ -58,9 +59,7 @@ export default function TransaksiInvestasi({
|
||||
if (_.isEmpty(transaksi))
|
||||
return (
|
||||
<>
|
||||
<Center h={"80vh"}>
|
||||
<Text >Tidak Ada Transaksi</Text>
|
||||
</Center>
|
||||
<ComponentInvestasi_IsEmptyData text="Tidak ada transaksi" />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -68,26 +67,30 @@ export default function TransaksiInvestasi({
|
||||
<>
|
||||
<Stack>
|
||||
{transaksi.map((e) => (
|
||||
<Box key={e.id} onClick={() => router.push(RouterInvestasi.status_pesanan + `${e.id}`)}>
|
||||
|
||||
<Paper p="xs" bg={"gray"}>
|
||||
<Group position="apart">
|
||||
<Title order={6}>{e.Investasi.title}</Title>
|
||||
<Title order={5}>
|
||||
Rp.
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+e.gross_amount)}
|
||||
</Title>
|
||||
</Group>
|
||||
<Group position="apart">
|
||||
<Stack spacing={0}>
|
||||
{/* <Text fz={"xs"}>Bank {e.namaBank}</Text> */}
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||
</Stack>
|
||||
<Text>{e.quantity} Lembar</Text>
|
||||
</Group>
|
||||
</Paper>
|
||||
<Box
|
||||
key={e.id}
|
||||
onClick={() =>
|
||||
router.push(RouterInvestasi.status_pesanan + `${e.id}`)
|
||||
}
|
||||
>
|
||||
<Paper p="xs" bg={"gray"}>
|
||||
<Group position="apart">
|
||||
<Title order={6}>{e.Investasi.title}</Title>
|
||||
<Title order={5}>
|
||||
Rp.
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+e.gross_amount)}
|
||||
</Title>
|
||||
</Group>
|
||||
<Group position="apart">
|
||||
<Stack spacing={0}>
|
||||
{/* <Text fz={"xs"}>Bank {e.namaBank}</Text> */}
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||
</Stack>
|
||||
<Text>{e.quantity} Lembar</Text>
|
||||
</Group>
|
||||
</Paper>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user