## Deskripsi :
- Notifikasi investasi
## Issue : Gerbang pembayaran
This commit is contained in:
2024-08-12 10:20:28 +08:00
parent 7131e93a49
commit 6ffeb097e8
188 changed files with 4409 additions and 2488 deletions

View File

@@ -2,116 +2,189 @@
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
import {
Badge,
ActionIcon,
Box,
ScrollArea,
Table,
Tooltip,
Stack,
Avatar,
Group,
Text,
Button,
Center,
Group,
Pagination,
Paper,
ScrollArea,
Stack,
Table,
Text,
TextInput,
Title
} from "@mantine/core";
import { IconChevronLeft, IconEyeCheck } from "@tabler/icons-react";
import { IconEdit, IconEye } from "@tabler/icons-react";
import { IconSearch } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import ComponentAdminGlobal_HeaderTamplate from "../../component_global/header_tamplate";
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
import { adminInvestasi_funGetAllPublish } from "../fun/get/get_all_publish";
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
export default function Admin_TablePublishInvestasi({
dataInvestsi,
}: {
dataInvestsi: MODEL_Investasi[];
}) {
const [investasi, setInvestasi] = useState(dataInvestsi);
const router = useRouter();
// console.log(investasi);
const tableBody = investasi.map((e) =>
e.MasterStatusInvestasi.id === "3" ? (
<tr key={e.id}>
<td>
<Group position="left">
<Avatar variant="outline" radius={"xl"} />
<Text>{e.author.username}</Text>
</Group>
</td>
<td>{e.title}</td>
<td>
<Center> {e.progress} %</Center>
</td>
<td>
<Center> {new Intl.NumberFormat("id-ID", {maximumFractionDigits: 10}).format(+e.sisaLembar)}</Center>
</td>
<td>
<Center> {new Intl.NumberFormat("id-ID", {maximumFractionDigits: 10}).format(+e.totalLembar)}</Center>
</td>
<td>
<Center>
<Tooltip label="Detail" withArrow position="bottom">
<ActionIcon
variant="transparent"
onClick={() =>
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`)
}
>
<IconEyeCheck color="green" />
</ActionIcon>
</Tooltip>
</Center>
</td>
</tr>
) : (
""
)
);
return (
<>
<Stack>
<ActionIcon variant="outline" onClick={() => router.push(RouterAdminInvestasi_OLD.main_investasi)}>
<IconChevronLeft />
</ActionIcon>
<Box>
<ScrollArea w={"100%"}>
{/* <Title order={5} mb={5}>
List Publish
</Title> */}
<Badge color="green" variant="light" radius={0} size={"xl"}>
Publish
</Badge>
<Table
withBorder
highlightOnHover
verticalSpacing={"md"}
horizontalSpacing={"md"}
>
<thead>
<tr>
<th>Username</th>
<th>Nama Proyek Investasi</th>
<th>
<Center>Progres</Center>
</th>
<th>
<Center>Sisa Saham</Center>
</th>
<th>
<Center>Total Saham</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
</Box>
<ComponentAdminGlobal_HeaderTamplate name="Investasi" />
<TableView listData={dataInvestsi} />
{/* <pre>{JSON.stringify(listPublish, null, 2)}</pre> */}
</Stack>
</>
);
}
function TableView({ listData }: { listData: any }) {
const router = useRouter();
const [data, setData] = useState<MODEL_Investasi[]>(listData.data);
const [nPage, setNPage] = useState(listData.nPage);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
async function onSearch(s: string) {
setSearch(s);
setActivePage(1);
const loadData = await adminInvestasi_funGetAllPublish({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminInvestasi_funGetAllPublish({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
const tableBody = data.map((e) => (
<tr key={e.id}>
<td>
<Center w={200}>
<Text lineClamp={1}>{e.author.username}</Text>
</Center>
</td>
<td>
<Center w={400}>
<Text lineClamp={1}>{e.title}</Text>
</Center>
</td>
<td>
<Center w={200}>{_.toNumber(e.progress).toFixed(2)} %</Center>
</td>
<td>
<Center w={200}>
{new Intl.NumberFormat("id-ID", {
maximumFractionDigits: 10,
}).format(+e.sisaLembar)}
</Center>
</td>
<td>
<Center w={200}>
{new Intl.NumberFormat("id-ID", {
maximumFractionDigits: 10,
}).format(+e.totalLembar)}
</Center>
</td>
<td>
<Center w={200}>
<Button
bg={"green"}
color="green"
radius={"xl"}
onClick={() =>
router.push(RouterAdminInvestasi.detail_publish +`${e.id}`)
}
>
Detail
</Button>
</Center>
</td>
</tr>
));
return (
<>
<Stack spacing={"xs"} h={"100%"}>
<Group
position="apart"
bg={"green.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4} c={"black"}>
Publish
</Title>
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Cari nama proyek"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
</Group>
{_.isEmpty(data) ? (
<ComponentAdminGlobal_IsEmptyData />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center w={200}>Username</Center>
</th>
<th>
<Center w={400}>Nama Proyek</Center>
</th>
<th>
<Center w={200}>Progres</Center>
</th>
<th>
<Center w={200}>Sisa Saham</Center>
</th>
<th>
<Center w={200}>Total Saham</Center>
</th>
<th>
<Center w={200}>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
</>
);

View File

@@ -13,11 +13,21 @@ import {
Avatar,
Group,
Text,
Button,
Pagination,
Paper,
TextInput,
Title,
} from "@mantine/core";
import { IconChevronLeft, IconEdit } from "@tabler/icons-react";
import { IconChevronLeft, IconEdit, IconSearch } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import ComponentAdminGlobal_HeaderTamplate from "../../component_global/header_tamplate";
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
import { adminInvestasi_funGetAllReview } from "../fun/get/get_all_review";
import { adminInvestasi_funGetAllReject } from "../fun/get/get_all_reject";
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
export default function Admin_TableRejectInvestasi({
dataInvestsi,
@@ -27,6 +37,15 @@ export default function Admin_TableRejectInvestasi({
const [investasi, setInvestasi] = useState(dataInvestsi);
const router = useRouter();
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Investasi" />
<TableView listData={dataInvestsi} />
</Stack>
</>
);
const tableBody = investasi.map((e) =>
e.MasterStatusInvestasi.id === "4" ? (
<tr key={e.id}>
@@ -61,8 +80,10 @@ export default function Admin_TableRejectInvestasi({
return (
<>
<Stack>
<ActionIcon variant="outline" onClick={() => router.push(RouterAdminInvestasi_OLD.main_investasi)}>
<ActionIcon
variant="outline"
onClick={() => router.push(RouterAdminInvestasi_OLD.main_investasi)}
>
<IconChevronLeft />
</ActionIcon>
<Box>
@@ -94,3 +115,136 @@ export default function Admin_TableRejectInvestasi({
</>
);
}
function TableView({ listData }: { listData: any }) {
const router = useRouter();
const [data, setData] = useState<MODEL_Investasi[]>(listData.data);
const [nPage, setNPage] = useState(listData.nPage);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
async function onSearch(s: string) {
setSearch(s);
setActivePage(1);
const loadData = await adminInvestasi_funGetAllReject({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminInvestasi_funGetAllReject({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
const tableBody = data.map((e) => (
<tr key={e.id}>
<td>
<Center w={200}>
<Text lineClamp={1}>{e.author.username}</Text>
</Center>
</td>
<td>
<Center w={400}>
<Text lineClamp={1}>{e.title}</Text>
</Center>
</td>
<td>
<Center w={400}>
<Text lineClamp={1}>{e.catatan}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Button
color="orange"
radius={"xl"}
onClick={() =>
router.push(RouterAdminInvestasi.detail_reject + `${e.id}`)
}
>
Detail
</Button>
</Center>
</td>
</tr>
));
return (
<>
<Stack spacing={"xs"} h={"100%"}>
<Group
position="apart"
bg={"red.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4} c={"black"}>
Reject
</Title>
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Cari nama proyek"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
</Group>
{_.isEmpty(data) ? (
<ComponentAdminGlobal_IsEmptyData />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center w={200}>Username</Center>
</th>
<th>
<Center w={400}>Nama Proyek</Center>
</th>
<th>
<Center w={400}>Catatan Penolakan</Center>
</th>
<th>
<Center w={200}>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
</>
);
}

View File

@@ -1,4 +1,5 @@
"use client";
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
import {
@@ -13,85 +14,184 @@ import {
Avatar,
Text,
Center,
Button,
Pagination,
Paper,
TextInput,
Title,
} from "@mantine/core";
import { IconChevronLeft, IconEdit } from "@tabler/icons-react";
import { IconChevronLeft, IconEdit, IconSearch } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import ComponentAdminGlobal_HeaderTamplate from "../../component_global/header_tamplate";
import { adminInvestasi_funGetAllReview } from "../fun/get/get_all_review";
import _ from "lodash";
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
import ComponentAdminGlobal_TampilanRupiahDonasi from "../../component_global/tampilan_rupiah";
export default function Admin_TableReviewInvestasi({
dataInvestsi,
}: {
dataInvestsi: MODEL_Investasi[];
}) {
const [investasi, setInvestasi] = useState(dataInvestsi);
const router = useRouter();
const tableBody = investasi.map((e) =>
e.MasterStatusInvestasi.id === "2" ? (
<tr key={e.id}>
<td>
<Group position="left">
<Avatar variant="outline" radius={"xl"} />
<Text>{e.author.username}</Text>
</Group>
</td>
<td>
{e.title}
</td>
<td>
<Center>
{e.ProspektusInvestasi === null ? (
<Badge color="red">Unavailable</Badge>
) : (
<Badge variant="dot" color="green">
Available
</Badge>
)}
</Center>
</td>
<td>
<Center>
<Tooltip label="Konfirmasi" withArrow position="bottom">
<ActionIcon
variant="transparent"
onClick={() =>
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`)
}
>
<IconEdit color="green" />
</ActionIcon>
</Tooltip>
</Center>
</td>
</tr>
) : (
""
)
);
return (
<>
<Stack>
<ActionIcon variant="outline" onClick={() => router.push(RouterAdminInvestasi_OLD.main_investasi)}>
<IconChevronLeft />
</ActionIcon>
<Box>
<ScrollArea w={"100%"}>
<Badge color="orange" variant="light" radius={0} size={"xl"}>
Review
</Badge>
<Table withBorder highlightOnHover verticalSpacing={"md"} horizontalSpacing={"md"}>
<thead>
<tr>
<th>Username</th>
<th>Nama Proyek Investasi</th>
<th><Center>File Prospektus</Center></th>
<th><Center>Aksi</Center></th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
</Box>
<ComponentAdminGlobal_HeaderTamplate name="Investasi" />
<TableView listData={dataInvestsi} />
</Stack>
</>
);
}
function TableView({ listData }: { listData: any }) {
const router = useRouter();
const [data, setData] = useState<MODEL_Investasi[]>(listData.data);
const [nPage, setNPage] = useState(listData.nPage);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
async function onSearch(s: string) {
setSearch(s);
setActivePage(1);
const loadData = await adminInvestasi_funGetAllReview({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminInvestasi_funGetAllReview({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
const tableBody = data.map((e) => (
<tr key={e.id}>
<td>
<Center w={200}>
<Text lineClamp={1}>{e.author.username}</Text>
</Center>
</td>
<td>
<Center w={400}>
<Text lineClamp={1}>{e.title}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Text lineClamp={1}>{e.roi} %</Text>
</Center>
</td>
<td>
<Center w={200}>
<ComponentAdminGlobal_TampilanRupiahDonasi
nominal={_.toNumber(e.targetDana)}
/>
</Center>
</td>
<td>
<Center w={200}>
<ComponentAdminGlobal_TampilanRupiahDonasi
nominal={_.toNumber(e.hargaLembar)}
/>
</Center>
</td>
<td>
<Center w={200}>
<Button
color="orange"
radius={"xl"}
onClick={() =>
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`)
}
>
Detail
</Button>
</Center>
</td>
</tr>
));
return (
<>
<Stack spacing={"xs"} h={"100%"}>
<Group
position="apart"
bg={"orange.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4} c={"black"}>
Review
</Title>
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Cari nama proyek"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
</Group>
{_.isEmpty(data) ? (
<ComponentAdminGlobal_IsEmptyData />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center w={200}>Username</Center>
</th>
<th>
<Center w={400}>Nama Proyek</Center>
</th>
<th>
<Center w={200}>ROI</Center>
</th>
<th>
<Center w={200}>Target Dana</Center>
</th>
<th>
<Center w={200}>Harga Perlembar</Center>
</th>
<th>
<Center w={200}>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
</>
);

View File

@@ -61,12 +61,13 @@ export default function Admin_Investasi({
const router = useRouter();
const listBox = [
{
id: 1,
name: "Draft",
jumlah: countDraft,
link: "",
color: "yellow",
name: "Publish",
jumlah: countPublish,
link: RouterAdminInvestasi_OLD.table_status_publish,
color: "green",
},
{
id: 2,
@@ -77,13 +78,6 @@ export default function Admin_Investasi({
},
{
id: 3,
name: "Publish",
jumlah: countPublish,
link: RouterAdminInvestasi_OLD.table_status_publish,
color: "green",
},
{
id: 4,
name: "Reject",
jumlah: countReject,
link: RouterAdminInvestasi_OLD.table_status_reject,
@@ -97,7 +91,7 @@ export default function Admin_Investasi({
<ComponentAdminGlobal_HeaderTamplate name="Investasi" />
<SimpleGrid
cols={4}
cols={3}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },