fix
## Deskripsi: - Optimalisasi admin voting ## No issue
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export function AdminInvestasi_ViewDaftarInvestor() {
|
||||
return <>ini daftar investor</>;
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import { MODEL_DONASI_INVOICE } from "@/app_modules/donasi/model/interface";
|
||||
import {
|
||||
Stack,
|
||||
Group,
|
||||
Title,
|
||||
ActionIcon,
|
||||
Select,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Table,
|
||||
Center,
|
||||
Pagination,
|
||||
Badge,
|
||||
Button,
|
||||
} from "@mantine/core";
|
||||
import { IconReload } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
dataTransaksi,
|
||||
}: {
|
||||
dataTransaksi: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [idData, setIdData] = useState("");
|
||||
const [data, setData] = useState<MODEL_DONASI_INVOICE[]>(
|
||||
dataTransaksi.data
|
||||
);
|
||||
const [isNPage, setNPage] = useState(dataTransaksi.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSelect, setSelect] = useState("");
|
||||
|
||||
const tableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>{e?.Author.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.DonasiMaster_Bank?.name}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<TampilanRupiahDonasi nominal={+e?.nominal} />
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{new Intl.DateTimeFormat("id-ID", { dateStyle: "full" }).format(
|
||||
e?.createdAt
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Badge w={150} variant="dot">
|
||||
{e?.DonasiMaster_StatusInvoice?.name}
|
||||
</Badge>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{e?.donasiMaster_StatusInvoiceId === "1" ||
|
||||
e?.donasiMaster_StatusInvoiceId === "2" ? (
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
RouterAdminDonasi.transfer_invoice + `${e?.imagesId}`
|
||||
)
|
||||
}
|
||||
>
|
||||
Cek
|
||||
</Button>
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
test
|
||||
{/* <Center>
|
||||
{e?.donasiMaster_StatusInvoiceId === "1" ? (
|
||||
<Button radius={"xl"} disabled>
|
||||
Selesai
|
||||
</Button>
|
||||
) : e?.DonasiMaster_StatusInvoice?.id === "2" ? (
|
||||
<ButtonAccept
|
||||
invoiceId={e?.id}
|
||||
donasiId={dataDonasi?.id}
|
||||
nominal={+e?.nominal}
|
||||
danaTerkumpul={+dataDonasi?.terkumpul}
|
||||
target={+dataDonasi?.target}
|
||||
onSuccessDonasi={(val) => {
|
||||
onSuccessDonasi(val);
|
||||
}}
|
||||
onSuccessDonatur={(val) => {
|
||||
setListDonatur(val.data);
|
||||
setNPage(val.nPage);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Text>-</Text>
|
||||
)}
|
||||
</Center> */}
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
{/* <pre>{JSON.stringify(dataDonasi, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Transaksi</Title>
|
||||
<Group>
|
||||
<ActionIcon
|
||||
size={"lg"}
|
||||
radius={"xl"}
|
||||
variant="light"
|
||||
onClick={() => {
|
||||
// onRelaod();
|
||||
}}
|
||||
>
|
||||
<IconReload />
|
||||
</ActionIcon>
|
||||
<Select
|
||||
placeholder="Pilih status"
|
||||
value={isSelect}
|
||||
data={[]}
|
||||
// data={listMasterStatus.map((e) => ({
|
||||
// value: e.id,
|
||||
// label: e.name,
|
||||
// }))}
|
||||
// onChange={(val) => {
|
||||
// onSelect(val);
|
||||
// }}
|
||||
/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"xl"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Nama Investor</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nama Bank</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jumlah Investasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Bukti Transfer</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{tableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
// onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { SimpleGrid } from "@mantine/core";
|
||||
import { ComponentAdminInvestasi_DetailDataAuthor } from "../../_component/detail_data_author";
|
||||
import { ComponentAdminInvestasi_DetailData } from "../../_component/detail_data_investasi";
|
||||
import { ComponentAdminInvestasi_DetailGambar } from "../../_component/detail_gambar_investasi";
|
||||
import { ComponentAdminInvestasi_UIDetailFile } from "../../_component/ui_detail_file";
|
||||
|
||||
export function AdminInvestasi_ViewDetailData({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 3, spacing: "md" },
|
||||
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
{/* Data Author */}
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
||||
|
||||
{/* Data Detail */}
|
||||
<ComponentAdminInvestasi_DetailData data={data} />
|
||||
</SimpleGrid>
|
||||
<ComponentAdminInvestasi_UIDetailFile
|
||||
title={data.title}
|
||||
dataProspektus={data.ProspektusInvestasi}
|
||||
listDokumen={data.DokumenInvestasi}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
7
src/app_modules/admin/investasi/_view/index.ts
Normal file
7
src/app_modules/admin/investasi/_view/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { AdminInvestasi_ViewDaftarInvestor } from "./detail/view_daftar_investor";
|
||||
import { AdminInvestasi_ViewDaftarTransaksi } from "./detail/view_daftar_transaksi";
|
||||
import { AdminInvestasi_ViewDetailData } from "./detail/view_detail_data";
|
||||
|
||||
export { AdminInvestasi_ViewDetailData };
|
||||
export { AdminInvestasi_ViewDaftarTransaksi };
|
||||
export { AdminInvestasi_ViewDaftarInvestor };
|
||||
@@ -1,159 +1,69 @@
|
||||
"use client";
|
||||
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
Center,
|
||||
Grid,
|
||||
Image,
|
||||
List,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
ThemeIcon,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import { IconCircleCheck } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { IconCircleCheck, IconHome } from "@tabler/icons-react";
|
||||
import investasi from "../../notifikasi/route_setting/investasi";
|
||||
import {
|
||||
AdminInvestasi_ViewDaftarInvestor,
|
||||
AdminInvestasi_ViewDaftarTransaksi,
|
||||
AdminInvestasi_ViewDetailData,
|
||||
} from "../_view";
|
||||
|
||||
export function AdminInvestasi_DetailPublish({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
}) {
|
||||
const [selectPage, setSelectPage] = useState("1");
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Detail Data",
|
||||
icon: <IconCircleCheck />,
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Daftar Transaksi",
|
||||
icon: <IconCircleCheck />,
|
||||
},
|
||||
// {
|
||||
// id: "3",
|
||||
// name: "Daftar Investor",
|
||||
// icon: <IconCircleCheck />,
|
||||
// },
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Stack px={"lg"}>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<SimpleGrid cols={2}>
|
||||
<InformasiAuthor data={data} />
|
||||
<InformasiDataInvestasi data={data} />
|
||||
</SimpleGrid>
|
||||
|
||||
<Group>
|
||||
{listPage.map((e) => (
|
||||
<Button
|
||||
key={e.id}
|
||||
color={selectPage == e.id ? "green" : "gray"}
|
||||
radius={"xl"}
|
||||
onClick={() => setSelectPage(e.id)}
|
||||
style={{
|
||||
transition: "all 0.3s",
|
||||
}}
|
||||
>
|
||||
{e.name}
|
||||
</Button>
|
||||
))}
|
||||
</Group>
|
||||
|
||||
{selectPage == "1" ? (
|
||||
<AdminInvestasi_ViewDetailData data={data} />
|
||||
) : null}
|
||||
{selectPage == "2" ? (
|
||||
<AdminInvestasi_ViewDaftarTransaksi dataTransaksi={{}} />
|
||||
) : null}
|
||||
{selectPage == "3" ? <AdminInvestasi_ViewDaftarInvestor /> : null}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function InformasiAuthor({ data }: { data: MODEL_INVESTASI }) {
|
||||
return (
|
||||
<>
|
||||
<Paper withBorder>
|
||||
<Stack p={"lg"} spacing={"xl"}>
|
||||
<Title align="center" order={3}>
|
||||
{data.title}
|
||||
</Title>
|
||||
|
||||
<AspectRatio ratio={1 / 1} mah={300}>
|
||||
<Center>
|
||||
<Image
|
||||
bg={"blue"}
|
||||
style={{ borderRadius: "10px" }}
|
||||
radius={"md"}
|
||||
width={250}
|
||||
alt=""
|
||||
src={RouterInvestasi_OLD.api_gambar + `${data.imagesId}`}
|
||||
/>
|
||||
</Center>
|
||||
</AspectRatio>
|
||||
|
||||
<Stack spacing={"sm"}>
|
||||
<Title order={4}>Informasi pemilik</Title>
|
||||
|
||||
<List
|
||||
spacing="xs"
|
||||
size="sm"
|
||||
center
|
||||
icon={
|
||||
<ThemeIcon color="teal" size={24} radius="xl">
|
||||
<IconCircleCheck size="1rem" />
|
||||
</ThemeIcon>
|
||||
}
|
||||
>
|
||||
<List.Item>{data.author.username}</List.Item>
|
||||
<List.Item>+{data.author.nomor}</List.Item>
|
||||
<List.Item>{data.author.Profile.email}</List.Item>
|
||||
</List>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function InformasiDataInvestasi({ data }: { data: MODEL_INVESTASI }) {
|
||||
return (
|
||||
<>
|
||||
<Paper withBorder p={"lg"}>
|
||||
<Stack>
|
||||
<Title order={3}>Rincian Data Investasi</Title>
|
||||
<Grid justify="center">
|
||||
<Grid.Col>
|
||||
<Grid mt={"md"} justify="center">
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.hargaLembar)}{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data.MasterPembagianDeviden.name} bulan{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data.MasterPencarianInvestor.name} hari{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text fw={"bold"}>{data.roi} %</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text fw={"bold"}>{data.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { BeritaInvestasi } from "@/app_modules/investasi";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Modal,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Textarea,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import {
|
||||
IconAlertHexagonFilled,
|
||||
IconCheck,
|
||||
IconFileTypePdf,
|
||||
} from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import "react-simple-toasts/dist/theme/dark.css";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||
@@ -44,7 +19,6 @@ import { ComponentAdminInvestasi_DetailGambar } from "../_component/detail_gamba
|
||||
import { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
||||
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
||||
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
export default function AdminInvestasi_DetailReview({
|
||||
dataInvestasi,
|
||||
@@ -180,6 +154,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
""
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
spacing="lg"
|
||||
@@ -207,245 +182,4 @@ export default function AdminInvestasi_DetailReview({
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Group position="apart" px={"md"}>
|
||||
<ComponentAdminGlobal_BackButton
|
||||
path={RouterAdminInvestasi.table_review}
|
||||
/>
|
||||
<Group>
|
||||
<Center>
|
||||
{!publish || data.MasterStatusInvestasi.id === "4" ? (
|
||||
""
|
||||
) : (
|
||||
<Button
|
||||
radius={50}
|
||||
bg={"green"}
|
||||
color="green"
|
||||
leftIcon={<IconCheck />}
|
||||
onClick={() => {
|
||||
onPublish();
|
||||
}}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
)}
|
||||
</Center>
|
||||
{data.MasterStatusInvestasi.id === "3" ? (
|
||||
""
|
||||
) : (
|
||||
<Button
|
||||
radius={50}
|
||||
bg={"red"}
|
||||
color="red"
|
||||
onClick={() => setOpenModal(true)}
|
||||
rightIcon={<IconAlertHexagonFilled />}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
)}
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
<Divider my={"md"} />
|
||||
|
||||
<Stack spacing={"lg"}>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
{/* Title */}
|
||||
<Center my={"sm"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{data.title}
|
||||
</Title>
|
||||
</Center>
|
||||
<Paper withBorder mb={"md"} mah={300} maw={400} mx={"auto"} p={5}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi_OLD.api_gambar + `${data.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid.Col span={6}>
|
||||
<Grid mt={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.hargaLembar)}{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>{data.MasterPembagianDeviden.name} bulan </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text>{data.MasterPencarianInvestor.name} hari </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>{data.roi} %</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text>
|
||||
{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>{data.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
{/* Note */}
|
||||
{!publish || data.MasterStatusInvestasi.id === "4" ? (
|
||||
""
|
||||
) : (
|
||||
<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>
|
||||
)}
|
||||
{publish &&
|
||||
data.MasterStatusInvestasi.id === "3" &&
|
||||
_.isEmpty(data.BeritaInvestasi) ? (
|
||||
<BeritaInvestasi dataInvestasi={data} />
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Grid.Col>
|
||||
{/* Note dan dokumen */}
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
{/* File file */}
|
||||
<Stack>
|
||||
{/* Prospektus */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={6}>Prospektus :</Title>
|
||||
{data.ProspektusInvestasi === null ? (
|
||||
<Text>Tidak ada file</Text>
|
||||
) : (
|
||||
<Paper p={"xs"}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>Prospektus_{data.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi_OLD.api_file_prospektus +
|
||||
`${
|
||||
data.ProspektusInvestasi === null
|
||||
? ""
|
||||
: data.ProspektusInvestasi.id
|
||||
}`
|
||||
}
|
||||
>
|
||||
<Button compact radius={50}>
|
||||
Buka
|
||||
</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{/* Dokumen */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={6}>Dokumen :</Title>
|
||||
{_.isEmpty(data.DokumenInvestasi) ? (
|
||||
<Text>Tidak ada dokumen</Text>
|
||||
) : (
|
||||
data.DokumenInvestasi.map((e) => (
|
||||
<Paper p={"xs"} key={e.id}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>{e.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi_OLD.api_file_dokumen + `${e.id}`
|
||||
}
|
||||
>
|
||||
<Button compact radius={50}>
|
||||
Buka
|
||||
</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
))
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Modal
|
||||
centered
|
||||
opened={openModal}
|
||||
onClose={() => setOpenModal(false)}
|
||||
// withCloseButton={false}
|
||||
title="Masukan alasan penolakan"
|
||||
>
|
||||
<Textarea
|
||||
mb={"md"}
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
value={data.catatan === null ? [] : data.catatan}
|
||||
onChange={(val) =>
|
||||
setData({
|
||||
...data,
|
||||
catatan: val.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={50} compact onClick={() => onReject()}>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Modal>
|
||||
</Stack>
|
||||
{/* <pre>{JSON.stringify(investasi, null, 2)}</pre> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconSearch } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
@@ -21,7 +22,6 @@ import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_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,
|
||||
@@ -45,6 +45,8 @@ function TableView({ listData }: { listData: any }) {
|
||||
const [nPage, setNPage] = useState(listData.nPage);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [idData, setIdData] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
@@ -99,12 +101,16 @@ function TableView({ listData }: { listData: any }) {
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Button
|
||||
loading={isLoading && idData === e.id}
|
||||
loaderPosition="center"
|
||||
bg={"green"}
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.push(RouterAdminInvestasi.detail_publish +`${e.id}`)
|
||||
}
|
||||
onClick={() => {
|
||||
setIdData(e.id);
|
||||
setLoading(true);
|
||||
router.push(RouterAdminInvestasi.detail_publish + `${e.id}`);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
Badge,
|
||||
ActionIcon,
|
||||
@@ -122,6 +122,8 @@ function TableView({ listData }: { listData: any }) {
|
||||
const [nPage, setNPage] = useState(listData.nPage);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [idData, setIdData] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
@@ -165,11 +167,15 @@ function TableView({ listData }: { listData: any }) {
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Button
|
||||
loading={isLoading && idData === e.id}
|
||||
loaderPosition="center"
|
||||
color="orange"
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.push(RouterAdminInvestasi.detail_reject + `${e.id}`)
|
||||
}
|
||||
onClick={() => {
|
||||
setIdData(e.id);
|
||||
setLoading(true);
|
||||
router.push(RouterAdminInvestasi.detail_reject + `${e.id}`);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"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/_lib/interface";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
Badge,
|
||||
ActionIcon,
|
||||
@@ -50,6 +50,8 @@ function TableView({ listData }: { listData: any }) {
|
||||
const [nPage, setNPage] = useState(listData.nPage);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [idData, setIdData] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
@@ -106,11 +108,15 @@ function TableView({ listData }: { listData: any }) {
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Button
|
||||
loading={isLoading && idData === e.id}
|
||||
loaderPosition="center"
|
||||
color="orange"
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`)
|
||||
}
|
||||
onClick={() => {
|
||||
setIdData(e.id);
|
||||
setLoading(true);
|
||||
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
||||
import {
|
||||
Stack,
|
||||
Center,
|
||||
Spoiler,
|
||||
Button,
|
||||
Modal,
|
||||
Paper,
|
||||
Title,
|
||||
Grid,
|
||||
Avatar,
|
||||
Group,
|
||||
Divider,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconBan, IconEyeCheck } from "@tabler/icons-react";
|
||||
import { IconEyeShare } from "@tabler/icons-react";
|
||||
import { IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
@@ -31,6 +27,8 @@ import { useState } from "react";
|
||||
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
||||
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
|
||||
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
|
||||
import { adminVote_funGetListRiwayat } from "../../fun";
|
||||
import { IconCircleCheckFilled } from "@tabler/icons-react";
|
||||
|
||||
export default function AdminVote_Riwayat({
|
||||
dataVote,
|
||||
@@ -40,46 +38,73 @@ export default function AdminVote_Riwayat({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Riwayat" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||
<TableStatus listPublish={dataVote} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listPublish);
|
||||
const [data, setData] = useState<MODEL_VOTING[]>(listPublish.data);
|
||||
const [hasil, setHasil] = useState<any[]>();
|
||||
const [kontributor, setKontributor] = useState<any[]>();
|
||||
const [voteId, setVoteId] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminVote_funGetListRiwayat({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminVote_funGetListRiwayat({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>
|
||||
<Button
|
||||
loading={
|
||||
e.id === voteId ? (loading === true ? true : false) : false
|
||||
e?.id === voteId ? (loading === true ? true : false) : false
|
||||
}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
leftIcon={<IconEyeCheck />}
|
||||
leftIcon={<IconCircleCheckFilled />}
|
||||
onClick={async () => {
|
||||
setVoteId(e.id);
|
||||
setVoteId(e?.id);
|
||||
setLoading(true);
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
onList(e.id, setHasil, setKontributor, setLoading, open);
|
||||
onList(e?.id, setHasil, setKontributor, setLoading, open);
|
||||
}}
|
||||
>
|
||||
Hasil Voting
|
||||
Lihat Hasil
|
||||
</Button>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e.title}</Center>
|
||||
<Center>{e?.Author?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.title}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
@@ -89,27 +114,27 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
maxHeight={50}
|
||||
showLabel="tampilkan"
|
||||
>
|
||||
{e.deskripsi}
|
||||
{e?.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
<th>
|
||||
<Stack>
|
||||
{e.Voting_DaftarNamaVote.map((v) => (
|
||||
<Box key={v.id}>
|
||||
<Text>- {v.value}</Text>
|
||||
{e?.Voting_DaftarNamaVote.map((v) => (
|
||||
<Box key={v?.id}>
|
||||
<Text>- {v?.value}</Text>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</th>
|
||||
<td>
|
||||
<Center>
|
||||
{e.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
||||
{e?.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
||||
{e?.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -117,6 +142,76 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Riwayat</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Pilihan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Mulai Vote</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Selesai Vote</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
@@ -128,54 +223,6 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
kontributor={kontributor}
|
||||
/>
|
||||
</Modal>
|
||||
<Box>
|
||||
<Box bg={"gray.1"} p={"xs"}>
|
||||
<Title order={6} c={"gray"}>
|
||||
RIWAYAT
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Pilihan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Mulai Vote</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Selesai Vote</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,44 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import {
|
||||
MODEL_VOTE_KONTRIBUTOR,
|
||||
MODEL_VOTING,
|
||||
MODEL_VOTING_DAFTAR_NAMA_VOTE,
|
||||
} from "@/app_modules/vote/model/interface";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { IconCircleCheckFilled, IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
||||
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
|
||||
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
|
||||
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
||||
import { adminVote_funGetListPublish } from "../../fun/get/status/get_list_publish";
|
||||
|
||||
export default function AdminVote_TablePublish({
|
||||
dataVote,
|
||||
@@ -48,22 +35,46 @@ export default function AdminVote_TablePublish({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Publish" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||
<TableStatus listPublish={dataVote} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listPublish);
|
||||
const [data, setData] = useState<MODEL_VOTING[]>(listPublish.data);
|
||||
const [hasil, setHasil] = useState<any[]>();
|
||||
const [kontributor, setKontributor] = useState<any[]>();
|
||||
const [voteId, setVoteId] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminVote_funGetListPublish({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminVote_funGetListPublish({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
@@ -74,7 +85,7 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
leftIcon={<IconEyeCheck />}
|
||||
leftIcon={<IconCircleCheckFilled />}
|
||||
onClick={async () => {
|
||||
setVoteId(e?.id);
|
||||
setLoading(true);
|
||||
@@ -87,7 +98,7 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.Author?.Profile?.name}</Center>
|
||||
<Center>{e?.Author?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.title}</Center>
|
||||
@@ -128,6 +139,76 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"green.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Publish</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Pilihan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Mulai Vote</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Selesai Vote</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
@@ -139,57 +220,6 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
||||
kontributor={kontributor}
|
||||
/>
|
||||
</Modal>
|
||||
<Box>
|
||||
<Box bg={"green.1"} p={"xs"}>
|
||||
<Title order={6} c={"green"}>
|
||||
PUBLISH
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Pilihan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Mulai Vote</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Selesai Vote</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
||||
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
@@ -20,40 +18,80 @@ import {
|
||||
Table,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconBan, IconEyeShare } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { IconBan, IconSearch } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { adminVote_funGetListReject } from "../../fun";
|
||||
import { AdminVote_funEditCatatanRejectById } from "../../fun/edit/fun_edit_catatan_reject_by_id";
|
||||
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
|
||||
export default function AdminVote_TableReject({
|
||||
dataVote,
|
||||
}: {
|
||||
dataVote: MODEL_VOTING[];
|
||||
}) {
|
||||
export default function AdminVote_TableReject({ dataVote }: { dataVote: any }) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Reject" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||
<TableStatus listData={dataVote} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
function TableStatus({ listData }: { listData: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listData);
|
||||
const [data, setData] = useState<MODEL_VOTING[]>(listData.data);
|
||||
const [votingId, setVotingId] = useState("");
|
||||
const [catatan, setCatatan] = useState("");
|
||||
|
||||
const [isNPage, setNPage] = useState(listData.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminVote_funGetListReject({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminVote_funGetListReject({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onReject(
|
||||
votingId: string,
|
||||
catatan: string,
|
||||
close: any,
|
||||
setData: any
|
||||
) {
|
||||
const res = await AdminVote_funEditCatatanRejectById(votingId, catatan);
|
||||
if (res.status === 200) {
|
||||
const loadData = await adminVote_funGetListReject({
|
||||
page: 1,
|
||||
search: isSearch,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
setActivePage(1);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
@@ -129,53 +167,32 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
maxLength={300}
|
||||
autosize
|
||||
label="Masukan Alasan Penolakan"
|
||||
placeholder="Contoh: Karena deskripsi kurang lengkap, dll"
|
||||
value={catatan}
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"red.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Reject</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
setCatatan(val.target.value);
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onReject(votingId, catatan, close, setData);
|
||||
console.log(catatan);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
</Group>
|
||||
|
||||
<Box>
|
||||
<Box bg={"red.1"} p={"xs"}>
|
||||
<Title order={6} c={"red"}>
|
||||
REJECT
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Box w={2000}>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
@@ -209,39 +226,56 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</ScrollArea>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"md"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
maxLength={300}
|
||||
autosize
|
||||
label="Masukan Alasan Penolakan"
|
||||
placeholder="Contoh: Karena deskripsi kurang lengkap, dll"
|
||||
value={catatan}
|
||||
onChange={(val) => {
|
||||
setCatatan(val.target.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={"xl"} onClick={() => close()}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onReject(votingId, catatan, close, setData);
|
||||
console.log(catatan);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function onReject(
|
||||
votingId: string,
|
||||
catatan: string,
|
||||
close: any,
|
||||
setData: any
|
||||
) {
|
||||
await AdminVote_funEditCatatanRejectById(votingId, catatan).then(
|
||||
async (res) => {
|
||||
if (res.status === 200) {
|
||||
await AdminVote_getListTableByStatusId("4").then((val) => {
|
||||
setData(val);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,19 @@ import {
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconBan, IconEyeShare } from "@tabler/icons-react";
|
||||
import { IconBan, IconEyeShare, IconSearch } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
@@ -31,6 +34,8 @@ import { AdminEvent_funEditCatatanById } from "../../fun/edit/fun_edit_status_re
|
||||
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||
import { adminVote_funGetListReview } from "../../fun";
|
||||
import { IconCircleCheckFilled } from "@tabler/icons-react";
|
||||
|
||||
export default function AdminVote_TableReview({
|
||||
listVote,
|
||||
@@ -40,26 +45,50 @@ export default function AdminVote_TableReview({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Review" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||
<TableStatus listData={listVote} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
function TableStatus({ listData }: { listData: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listData);
|
||||
const [data, setData] = useState<MODEL_VOTING[]>(listData.data);
|
||||
const [votingId, setVotingId] = useState("");
|
||||
const [catatan, setCatatan] = useState("");
|
||||
const [isLoadingPublish, setLoadingPublish] = useState(false);
|
||||
const [isSaveLoading, setSaveLoading] = useState(false);
|
||||
|
||||
const [isNPage, setNPage] = useState(listData.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminVote_funGetListReview({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminVote_funGetListReview({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>{e?.Author?.Profile?.name}</Center>
|
||||
<Center>{e?.Author?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e.title}</Center>
|
||||
@@ -105,7 +134,7 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
}
|
||||
w={120}
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
leftIcon={<IconCircleCheckFilled />}
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
onPublish(
|
||||
@@ -138,12 +167,83 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"orange.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Review</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Pilihan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Mulai Vote</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Selesai Vote</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
size={"md"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
@@ -174,63 +274,6 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Box>
|
||||
<Box bg={"orange.1"} p={"xs"}>
|
||||
<Title order={6} c={"orange"}>
|
||||
REVIEW
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Pilihan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Mulai Vote</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Selesai Vote</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</ScrollArea>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminVote_funGetListReject({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.voting.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
voting_StatusId: "4",
|
||||
isActive: true,
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Voting_Kontributor: true,
|
||||
Voting_DaftarNamaVote: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.voting.count({
|
||||
where: {
|
||||
voting_StatusId: "4",
|
||||
isActive: true,
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminVote_funGetListReview({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.voting.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
voting_StatusId: "2",
|
||||
isActive: true,
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Voting_Kontributor: true,
|
||||
Voting_DaftarNamaVote: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.voting.count({
|
||||
where: {
|
||||
voting_StatusId: "2",
|
||||
isActive: true,
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
73
src/app_modules/admin/vote/fun/get/status/fun_get_riwayat.ts
Normal file
73
src/app_modules/admin/vote/fun/get/status/fun_get_riwayat.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
"use server"
|
||||
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminVote_funGetListRiwayat({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.voting.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
voting_StatusId: "1",
|
||||
isActive: true,
|
||||
akhirVote: {
|
||||
lte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Voting_Kontributor: true,
|
||||
Voting_DaftarNamaVote: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.voting.count({
|
||||
where: {
|
||||
voting_StatusId: "1",
|
||||
isActive: true,
|
||||
akhirVote: {
|
||||
lte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminVote_funGetListPublish({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.voting.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
voting_StatusId: "1",
|
||||
isActive: true,
|
||||
akhirVote: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Voting_Kontributor: true,
|
||||
Voting_DaftarNamaVote: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.voting.count({
|
||||
where: {
|
||||
voting_StatusId: "1",
|
||||
isActive: true,
|
||||
akhirVote: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
7
src/app_modules/admin/vote/fun/index.ts
Normal file
7
src/app_modules/admin/vote/fun/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { adminVote_funGetListReject } from "./get/status/fun_get_list_reject";
|
||||
import { adminVote_funGetListReview } from "./get/status/fun_get_list_review";
|
||||
import { adminVote_funGetListRiwayat } from "./get/status/fun_get_riwayat";
|
||||
|
||||
export { adminVote_funGetListReview };
|
||||
export { adminVote_funGetListReject };
|
||||
export { adminVote_funGetListRiwayat };
|
||||
Reference in New Issue
Block a user