Revisi tampilan

fix:
- alur pembuatan investasi
- tampilan investasi
### No issue
This commit is contained in:
2023-12-05 10:14:51 +08:00
parent 7477b0f458
commit a2149b071e
61 changed files with 779 additions and 470 deletions

View File

@@ -5,7 +5,7 @@ import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin"
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"
import { revalidatePath } from "next/cache"
export default async function funRejectInvestasi(data: any) {
export default async function Admin_funRejectInvestasi(data: any) {
// console.log(data)
const res = await prisma.investasi.update({

View File

@@ -0,0 +1,17 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function Admin_getTotalInvestasiByUser() {
const data = await prisma.user.findMany({
include: {
_count: {
select: {
Investasi: true,
},
},
},
});
return data;
}

View File

@@ -52,7 +52,7 @@ import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import toast from "react-simple-toasts";
import funRejectInvestasi from "../fun/fun_reject_investasi";
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
export default function Admin_KonfirmasiInvestasi({
dataInvestasi,
@@ -105,7 +105,7 @@ export default function Admin_KonfirmasiInvestasi({
status: "4",
};
if (_.isEmpty(body.catatan)) return toast("Lengkapi alasan");
await funRejectInvestasi(body).then((res) => {
await Admin_funRejectInvestasi(body).then((res) => {
if (res.status === 200) {
toast(res.message);
toggle();

View File

@@ -4,11 +4,13 @@ import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
import {
ActionIcon,
Avatar,
Badge,
Box,
Center,
Divider,
Grid,
Group,
Paper,
ScrollArea,
Stack,
@@ -29,12 +31,14 @@ export default function Admin_Investasi({
countReview,
countPublish,
countReject,
totalInvestasiByUser,
}: {
listInvestasi: MODEL_Investasi[];
countDraft: number | any;
countReview: number | any;
countPublish: number | any;
countReject: number | any;
totalInvestasiByUser: any[];
}) {
const [investasi, setInvestasi] = useState(listInvestasi);
const router = useRouter();
@@ -44,21 +48,28 @@ export default function Admin_Investasi({
id: 1,
name: "Draft",
jumlah: countDraft,
color: "yellow"
},
{
id: 2,
name: "Review",
jumlah: countReview,
color: "orange"
},
{
id: 3,
name: "Publish",
jumlah: countPublish,
color: "green"
},
{
id: 4,
name: "Reject",
jumlah: countReject,
color: "red"
},
];
@@ -69,7 +80,12 @@ export default function Admin_Investasi({
<Grid mb={"md"}>
{listBox.map((e) => (
<Grid.Col sm={12} md={6} lg={3} key={e.id}>
<Paper h={100} bg={"gray"} p={"xs"}>
<Paper
h={100}
p={"xs"}
bg={"gray"}
// bg={e.color}
>
<Center>
<Stack spacing={0}>
<Text>{e.name}</Text>
@@ -84,16 +100,29 @@ export default function Admin_Investasi({
</Grid.Col>
))}
</Grid>
<TablePublish dataInvestsi={investasi as any} />
<Paper w={300} radius={"md"} p={"sm"} sx={{borderStyle: "solid", borderColor: "teal"}} >
<Title order={4}>Investasi by User</Title>
<Table >
<thead>
<tr>
<th><Center>Username</Center></th>
<th><Center>Total</Center></th>
</tr>
</thead>
<tbody>
{totalInvestasiByUser.map((e) => (
<tr key={e.id}>
<td><Group><Avatar variant="light" radius={"xl"}/> {e.username}</Group></td>
<td><Center>{e._count.Investasi}</Center></td>
</tr>
))}
</tbody>
</Table>
</Paper>
{/* <TablePublish dataInvestsi={investasi as any} />
<TableReview dataInvestsi={investasi as any} />
<TableReject dataInvestsi={investasi as any} />
{/* <pre>{JSON.stringify(investasi, null, 2)}</pre> */}
<TableReject dataInvestsi={investasi as any} /> */}
{/* <pre>{JSON.stringify(totalInvestasiByUser, null, 2)}</pre> */}
</>
);
}

View File

@@ -1,22 +1,30 @@
"use client";
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
import { Stack, Text, Title } from "@mantine/core";
import { AspectRatio, Center, Image, Stack, Text, Title } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { useRouter } from "next/navigation";
export default function SplashDashboardAdmin() {
const router = useRouter()
useShallowEffect(() => {
setTimeout(() => router.push(RouterAdminDashboard.main_admin), 2000)
},[])
const router = useRouter();
useShallowEffect(() => {
setTimeout(() => router.push(RouterAdminDashboard.main_admin), 2000)
}, []);
return (
<>
<Stack align="center" justify="center" h={"100vh"}>
<Title order={4} c={"orange"}>Selamat Datang, ADMIN</Title>
{/* <Stack align="center" justify="center" h={"100vh"}>
<Title order={4} c={"orange"}>
Selamat Datang, ADMIN
</Title>
<Title c={"red"}>HIPMI</Title>
</Stack>
</Stack> */}
<AspectRatio ratio={16 / 9}>
<Image src={"/aset/logo/logo-hipmi.png"} alt="Logo" />
</AspectRatio>
<Center>
<Title>Welcome Admin</Title>
</Center>
</>
);
}