Admin Investasi

# feat:
- Ganti status dan reject
### No issue
This commit is contained in:
2023-11-14 12:01:26 +08:00
parent 67212ca035
commit 989c9eed32
16 changed files with 341 additions and 158 deletions

View File

@@ -0,0 +1,79 @@
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
import {
Badge,
ActionIcon,
Box,
ScrollArea,
Table,
Tooltip,
} from "@mantine/core";
import { IconEyeCheck } from "@tabler/icons-react";
import { IconEdit, IconEye } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function TablePublish({
dataInvestsi,
}: {
dataInvestsi: MODEL_Investasi[];
}) {
const [investasi, setInvestasi] = useState(dataInvestsi);
const router = useRouter();
const tableBody = investasi.map((e) =>
e.MasterStatusInvestasi.id === "3" ? (
<tr key={e.id}>
<td>{e.title}</td>
<td>
{e.MasterStatusInvestasi.id === "3" ? (
<Badge variant="dot" color="green">
{e.MasterStatusInvestasi.name}
</Badge>
) : (
"-"
)}
</td>
<td>
<Tooltip label="Detail" withArrow position="bottom">
<ActionIcon
variant="transparent"
onClick={() =>
router.push(RouterAdminInvestasi.konfirmasi + `${e.id}`)
}
>
<IconEyeCheck />
</ActionIcon>
</Tooltip>
</td>
</tr>
) : (
""
)
);
return (
<>
<Box my={"lg"}>
<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>
<thead>
<tr>
<th>Nama Proyek Investasi</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
</Box>
</>
);
}

View File

@@ -0,0 +1,77 @@
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
import {
Badge,
ActionIcon,
Box,
ScrollArea,
Table,
Tooltip,
} from "@mantine/core";
import { IconEdit } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function TableReject({
dataInvestsi,
}: {
dataInvestsi: MODEL_Investasi[];
}) {
const [investasi, setInvestasi] = useState(dataInvestsi);
const router = useRouter();
const tableBody = investasi.map((e) =>
e.MasterStatusInvestasi.id === "4" ? (
<tr key={e.id}>
<td>{e.title}</td>
<td>
{e.MasterStatusInvestasi.id === "4" ? (
<Badge variant="dot" color="red">
{e.MasterStatusInvestasi.name}
</Badge>
) : (
"-"
)}
</td>
<td>{e.catatan}</td>
<td>
<Tooltip label="Konfirmasi" withArrow position="bottom">
<ActionIcon
variant="transparent"
onClick={() =>
router.push(RouterAdminInvestasi.konfirmasi + `${e.id}`)
}
>
<IconEdit />
</ActionIcon>
</Tooltip>
</td>
</tr>
) : (
""
)
);
return (
<>
<Box my={"lg"}>
<ScrollArea w={"100%"}>
<Badge color="red" variant="light" radius={0} size={"xl"}>
Reject
</Badge>
<Table withBorder highlightOnHover>
<thead>
<tr>
<th>Nama Proyek Investasi</th>
<th>Status</th>
<th>Catatan</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
</Box>
</>
);
}

View File

@@ -0,0 +1,74 @@
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
import {
Badge,
ActionIcon,
Box,
ScrollArea,
Table,
Tooltip,
} from "@mantine/core";
import { IconEdit } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function TableReview({
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>{e.title}</td>
<td>
{e.MasterStatusInvestasi.id === "2" ? (
<Badge variant="dot" color="orange">
{e.MasterStatusInvestasi.name}
</Badge>
) : (
"-"
)}
</td>
<td>
<Tooltip label="Konfirmasi" withArrow position="bottom">
<ActionIcon
variant="transparent"
onClick={() =>
router.push(RouterAdminInvestasi.konfirmasi + `${e.id}`)
}
>
<IconEdit />
</ActionIcon>
</Tooltip>
</td>
</tr>
) : (
""
)
);
return (
<>
<Box my={"lg"}>
<ScrollArea w={"100%"}>
<Badge color="orange" variant="light" radius={0} size={"xl"}>
Review
</Badge>
<Table withBorder highlightOnHover>
<thead>
<tr>
<th>Nama Proyek Investasi</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
</Box>
</>
);
}

View File

@@ -19,6 +19,9 @@ import {
import { IconEdit } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import TablePublish from "./table_publish";
import TableReview from "./table_review";
import TableReject from "./table_reject";
export default function Admin_Investasi({
listInvestasi,
@@ -59,33 +62,6 @@ export default function Admin_Investasi({
},
];
const tableBody = investasi.map((e) => (
<tr key={e.id}>
<td>{e.title}</td>
<td>
{e.MasterStatusInvestasi.id === "3" ? (
<Badge variant="dot" color="green">
{e.MasterStatusInvestasi.name}
</Badge>
) : (
<Badge variant="dot" color="red">
{e.MasterStatusInvestasi.name}
</Badge>
)}
</td>
<td>
<ActionIcon
variant="transparent"
onClick={() =>
router.push(RouterAdminInvestasi.konfirmasi + `${e.id}`)
}
>
<IconEdit />
</ActionIcon>
</td>
</tr>
));
return (
<>
<Title>Investasi</Title>
@@ -108,67 +84,16 @@ export default function Admin_Investasi({
</Grid.Col>
))}
</Grid>
<Box my={"lg"}>
<Center my={"xs"}>
<Text>List Investasi</Text>
</Center>
<ScrollArea w={"100%"}>
<Table withBorder highlightOnHover>
<thead>
<tr>
<th>Nama Proyek Investasi</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>{tableBody}</tbody>
</Table>
</ScrollArea>
</Box>
<TablePublish dataInvestsi={investasi as any} />
<TableReview dataInvestsi={investasi as any} />
<TableReject dataInvestsi={investasi as any} />
{/* <pre>{JSON.stringify(investasi, null, 2)}</pre> */}
</>
);
}
// const listTable = [
// {
// id: 1,
// status: {
// id: 1,
// name: "Publish",
// },
// name: "Subway Kuta",
// },
// {
// id: 2,
// status: {
// id: 2,
// name: "Review",
// },
// name: "Event MCD",
// },
// {
// id: 3,
// status: {
// id: 2,
// name: " Review",
// },
// name: "Villa Batubulan",
// },
// {
// id: 4,
// status: {
// id: 1,
// name: "Publish",
// },
// name: "Kost Alif Denpasar",
// },
// {
// id: 5,
// status: {
// id: 1,
// name: "Publish",
// },
// name: "Pabrik Rokok Surya Gandum",
// },
// ];