Admin
# feat: - Admin ganti status review ke publish
This commit is contained in:
@@ -11,8 +11,8 @@ export default function Admin_LayoutHalamanAksi({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{/* {children} */}
|
||||
<AppShell header={<HeaderTamplate title="Pilih Aksi" />}>
|
||||
{/* {children} */}
|
||||
<AppShell padding={"md"} header={<HeaderTamplate title="Pilih Aksi" />}>
|
||||
{children}
|
||||
</AppShell>
|
||||
</>
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Admin_HalamanAksi() {
|
||||
export default function Admin_HalamanAksi({idInves}: {idInves: string}) {
|
||||
const router = useRouter();
|
||||
const listHalamanAksi = [
|
||||
{
|
||||
@@ -58,7 +58,7 @@ export default function Admin_HalamanAksi() {
|
||||
compact
|
||||
radius={50}
|
||||
w={100}
|
||||
onClick={() => router.push(e.route)}
|
||||
onClick={() => router.push(e.route + `${idInves}`)}
|
||||
>
|
||||
Lihat
|
||||
</Button>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { RouterUserProfile } from "@/app/lib/router_hipmi/router_user_profile";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import funEditInvestasi from "@/app_modules/investasi/fun/fun_edit_investasi";
|
||||
import funGantiStatusInvestasi from "@/app_modules/investasi/fun/fun_ganti_status";
|
||||
import { gs_StatusPortoInvestasi } from "@/app_modules/investasi/g_state";
|
||||
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
|
||||
import { MODEL_User_profile } from "@/app_modules/models/user_profile";
|
||||
import {
|
||||
Group,
|
||||
Flex,
|
||||
@@ -20,24 +27,46 @@ import {
|
||||
Image,
|
||||
Collapse,
|
||||
Textarea,
|
||||
Divider,
|
||||
Mark,
|
||||
Modal,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
|
||||
import {
|
||||
IconAlertHexagonFilled,
|
||||
IconBan,
|
||||
IconBookDownload,
|
||||
IconCheck,
|
||||
IconChevronDown,
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconFile,
|
||||
IconFileDescription,
|
||||
IconFileTypePdf,
|
||||
IconPdf,
|
||||
IconSpeakerphone,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-simple-toasts";
|
||||
|
||||
export default function Admin_KonfirmasiInvestasi({ id }: { id: string }) {
|
||||
export default function Admin_KonfirmasiInvestasi({
|
||||
dataInvestasi,
|
||||
dataUser,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
dataUser: MODEL_User_profile;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
const [user, setUser] = useState(dataUser);
|
||||
const [publish, setPublish] = useState(true);
|
||||
const [opened, { toggle }] = useDisclosure(false);
|
||||
const [catatan, setCatatan] = useState<string | number>("");
|
||||
const [status, setStatus] = useAtom(gs_StatusPortoInvestasi);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
@@ -59,178 +88,244 @@ export default function Admin_KonfirmasiInvestasi({ id }: { id: string }) {
|
||||
route: RouterInvestasi.berita,
|
||||
},
|
||||
];
|
||||
|
||||
// useShallowEffect(() => {
|
||||
// cekStatusPublish()
|
||||
// },[])
|
||||
|
||||
// async function cekStatusPublish() {
|
||||
// if(investasi.MasterStatusInvestasi.id === "3")
|
||||
// setPublish(false)
|
||||
// }
|
||||
|
||||
async function onCatatan() {
|
||||
if (_.isEmpty(catatan)) return toast("Lengkapi alasan");
|
||||
console.log(catatan);
|
||||
toggle();
|
||||
}
|
||||
|
||||
async function onPublish() {
|
||||
// const res = await funGantiStatusInvestasi(investasi.id, "3")
|
||||
setTimeout(() => setPublish(false), 1000);
|
||||
toast("Proyek Investasi Di Publish");
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Group position="left" mb={"md"}>
|
||||
<Group position="apart" px={"md"}>
|
||||
<Flex align={"center"} gap={"xs"}>
|
||||
<Avatar src={"/aset/avatar.png"} />
|
||||
<Text>Username</Text>
|
||||
<Avatar
|
||||
radius={50}
|
||||
size={"lg"}
|
||||
src={
|
||||
RouterUserProfile.api_foto + `${user.Profile?.ImageProfile?.url}`
|
||||
}
|
||||
/>
|
||||
<Text>{user.username}</Text>
|
||||
</Flex>
|
||||
{/* <Text>Sisa waktu : 20 Hari</Text> */}
|
||||
<Group>
|
||||
{" "}
|
||||
<Center>
|
||||
{publish ? (
|
||||
<Button
|
||||
radius={50}
|
||||
bg={"green"}
|
||||
color="green"
|
||||
leftIcon={<IconCheck />}
|
||||
onClick={() => {
|
||||
onPublish();
|
||||
}}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
radius={50}
|
||||
leftIcon={<IconBan />}
|
||||
bg={"orange"}
|
||||
color="orange"
|
||||
onClick={() => {
|
||||
setTimeout(() => setPublish(true), 1000);
|
||||
toast("Proyek Investasi Di Non-Aktifkan");
|
||||
}}
|
||||
>
|
||||
Non - aktifkan
|
||||
</Button>
|
||||
)}
|
||||
</Center>
|
||||
<Button
|
||||
radius={50}
|
||||
bg={"red"}
|
||||
color="red"
|
||||
onClick={toggle}
|
||||
rightIcon={<IconAlertHexagonFilled />}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
<Paper withBorder mb={"md"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
<Divider my={"md"} />
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Box mb={"md"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
Judul Proyek
|
||||
</Title>
|
||||
<Slider
|
||||
disabled
|
||||
size={10}
|
||||
value={60}
|
||||
marks={[{ value: 60, label: "60%" }]}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid p={"md"} mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Terkumpul</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>3 Bulan </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Investor</Text>
|
||||
<Text>4657</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>%</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text>0</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>Selamanya</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"xl"}>
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${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>
|
||||
<Stack spacing={"lg"}>
|
||||
<Grid>
|
||||
<Grid.Col span={4}>
|
||||
{/* Title */}
|
||||
<Center my={"sm"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{investasi.title}
|
||||
</Title>
|
||||
</Center>
|
||||
<Paper withBorder mb={"md"} mah={300} maw={400} mx={"auto"} p={5}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
|
||||
<Stack mb={40}>
|
||||
{/* Button publish dan reject */}
|
||||
<Grid>
|
||||
{/* Publish */}
|
||||
<Grid.Col span={6}>
|
||||
<Center>
|
||||
{publish ? (
|
||||
<Button
|
||||
radius={50}
|
||||
w={200}
|
||||
bg={"green"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
setTimeout(() => setPublish(false), 1000);
|
||||
toast("Proyek Investasi Di Publish");
|
||||
}}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
radius={50}
|
||||
w={200}
|
||||
bg={"orange"}
|
||||
color="orange"
|
||||
onClick={() => {
|
||||
setTimeout(() => setPublish(true), 1000);
|
||||
toast("Proyek Investasi Di Non-Aktifkan");
|
||||
}}
|
||||
>
|
||||
Non - aktif
|
||||
</Button>
|
||||
)}
|
||||
</Center>
|
||||
{/* Rincian Data */}
|
||||
<Grid.Col span={4}>
|
||||
<Grid p={"md"} mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>Rp. {investasi.targetDana}</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>Rp.{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> {investasi.totalLembar} lembar</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>{investasi.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Grid.Col>
|
||||
{/* Reject */}
|
||||
<Grid.Col span={6}>
|
||||
<Center>
|
||||
<Button
|
||||
w={200}
|
||||
radius={50}
|
||||
bg={"red"}
|
||||
color="red"
|
||||
onClick={toggle}
|
||||
rightIcon={!opened ? <IconChevronLeft /> : <IconChevronDown />}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Center>
|
||||
|
||||
{/* Note dan dokumen */}
|
||||
<Grid.Col span={4}>
|
||||
<Stack>
|
||||
{/* Note */}
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Note :</Text>
|
||||
<Text fw={"lighter"} fs={"italic"}>
|
||||
Cek kembali kelengkapan file prospektus & semua dokumen
|
||||
terkait investasi sebelum mem-publish. Jika kelengkapan file
|
||||
kurang lengkap maka reject dan berikan pesan terkait
|
||||
kekurangnya.
|
||||
</Text>
|
||||
</Stack>
|
||||
{/* File file */}
|
||||
<Stack>
|
||||
{/* Prospektus */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={6}>Prospektus :</Title>
|
||||
{investasi.ProspektusInvestasi === null ? (
|
||||
<Text>Tidak ada file</Text>
|
||||
) : (
|
||||
<Paper p={"xs"}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>Prospektus_{investasi.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi.api_file_prospektus +
|
||||
`${
|
||||
investasi.ProspektusInvestasi === null
|
||||
? ""
|
||||
: investasi.ProspektusInvestasi.id
|
||||
}`
|
||||
}
|
||||
>
|
||||
<Button compact radius={50}>
|
||||
Buka
|
||||
</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{/* Dokumen */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={6}>Dokumen :</Title>
|
||||
{_.isEmpty(investasi.DokumenInvestasi) ? (
|
||||
<Text>Tidak ada dokumen</Text>
|
||||
) : (
|
||||
investasi.DokumenInvestasi.map((e) => (
|
||||
<Paper p={"xs"} key={e.id}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>{e.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi.api_file_dokumen + `${e.id}`
|
||||
}
|
||||
>
|
||||
<Button compact radius={50}>
|
||||
Buka
|
||||
</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
))
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* Text area reject */}
|
||||
<Collapse in={opened}>
|
||||
<Paper bg={"gray.4"} p={"xs"}>
|
||||
<Stack>
|
||||
<Textarea
|
||||
withAsterisk
|
||||
label="Alasan:"
|
||||
placeholder="Masukan alasan penolakan"
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button
|
||||
w={100}
|
||||
radius={50}
|
||||
bg={Warna.biru}
|
||||
compact
|
||||
onClick={toggle}
|
||||
>
|
||||
Kirim
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Collapse>
|
||||
<Modal
|
||||
centered
|
||||
opened={opened}
|
||||
onClose={toggle}
|
||||
// withCloseButton={false}
|
||||
title="Masukan alasan penolakan"
|
||||
>
|
||||
<Textarea
|
||||
mb={"md"}
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
onChange={(val) => setCatatan(val.target.value)}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={50} compact onClick={() => onCatatan()}>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Modal>
|
||||
</Stack>
|
||||
{/* <pre>{JSON.stringify(investasi, null, 2)}</pre> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function Admin_Investasi({
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() =>
|
||||
router.push(RouterAdminInvestasi.halaman_aksi + `${e.id}`)
|
||||
router.push(RouterAdminInvestasi.konfirmasi + `${e.id}`)
|
||||
}
|
||||
>
|
||||
<IconEdit />
|
||||
|
||||
Reference in New Issue
Block a user