## feat
- Voting user
- Halaman kontribusi
- Halaman riwayat
### No issuue
This commit is contained in:
2024-02-16 17:20:06 +08:00
parent 0dd8e287f4
commit e629157960
135 changed files with 3160 additions and 1501 deletions

View File

@@ -0,0 +1,191 @@
"use client";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_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,
Table,
Text,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan, IconEyeCheck } from "@tabler/icons-react";
import { IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function AdminVote_Riwayat({
dataVote,
}: {
dataVote: MODEL_VOTING[];
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Riwayat" />
<TableStatus listPublish={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listPublish);
const [peserta, setPeserta] = useState<any[]>();
const [eventId, setEventId] = useState("");
const [loading, setLoading] = useState(false);
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Center>
<Button
radius={"xl"}
color="green"
leftIcon={<IconEyeCheck />}
onClick={() => ComponentGlobal_NotifikasiPeringatan("On Process")}
>
Hasil Voting
</Button>
</Center>
</td>
<td>
<Center>{e.title}</Center>
</td>
<td>
<Center>
<Spoiler
hideLabel="sembunyikan"
maw={400}
maxHeight={50}
showLabel="tampilkan"
>
{e.deskripsi}
</Spoiler>
</Center>
</td>
<th>
<Stack>
{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" })}
</Center>
</td>
<td>
<Center>
{e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
</Center>
</td>
</tr>
));
return (
<>
<Modal opened={opened} onClose={close}>
<Paper>
<Stack>
<Center>
<Title order={3}>Daftar Peserta</Title>
</Center>
<Stack>
{peserta?.map((e) => (
<Stack key={e.id} spacing={"xs"}>
<Grid>
<Grid.Col span={"content"}>
<Avatar
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
radius={"xl"}
src={
RouterProfile.api_foto_profile +
e.User.Profile.imagesId
}
/>
</Grid.Col>
<Grid.Col span={"auto"}>
<Group align="center" h={"100%"}>
<Text>{e.User.Profile.name}</Text>
</Group>
</Grid.Col>
</Grid>
<Divider />
</Stack>
))}
</Stack>
</Stack>
</Paper>
</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>
</>
);
}

View File

@@ -0,0 +1,193 @@
"use client";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import {
MODEL_EVENT,
MODEL_EVENT_PESERTA,
} from "@/app_modules/event/model/interface";
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
import {
Avatar,
Box,
Button,
Center,
Divider,
Grid,
Group,
Modal,
Paper,
Spoiler,
Stack,
Table,
Text,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function AdminVote_TablePublish({
dataVote,
}: {
dataVote: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Publish" />
<TableStatus listPublish={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listPublish);
const [peserta, setPeserta] = useState<any[]>();
const [eventId, setEventId] = useState("");
const [loading, setLoading] = useState(false);
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Center>
<Button
radius={"xl"}
color="green"
leftIcon={<IconEyeCheck />}
onClick={() => ComponentGlobal_NotifikasiPeringatan("On Process")}
>
Lihat Hasil
</Button>
</Center>
</td>
<td>
<Center>{e.title}</Center>
</td>
<td>
<Center>
<Spoiler
hideLabel="sembunyikan"
maw={400}
maxHeight={50}
showLabel="tampilkan"
>
{e.deskripsi}
</Spoiler>
</Center>
</td>
<th>
<Stack>
{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" })}
</Center>
</td>
<td>
<Center>
{e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
</Center>
</td>
</tr>
));
return (
<>
<Modal opened={opened} onClose={close}>
<Paper>
<Stack>
<Center>
<Title order={3}>Daftar Peserta</Title>
</Center>
<Stack>
{peserta?.map((e) => (
<Stack key={e.id} spacing={"xs"}>
<Grid>
<Grid.Col span={"content"}>
<Avatar
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
radius={"xl"}
src={
RouterProfile.api_foto_profile +
e.User.Profile.imagesId
}
/>
</Grid.Col>
<Grid.Col span={"auto"}>
<Group align="center" h={"100%"}>
<Text>{e.User.Profile.name}</Text>
</Group>
</Grid.Col>
</Grid>
<Divider />
</Stack>
))}
</Stack>
</Stack>
</Paper>
</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>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>
</>
);
}

View File

@@ -0,0 +1,242 @@
"use client";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/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,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Textarea,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
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/component_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
export default function AdminVote_TableReject({
dataVote,
}: {
dataVote: MODEL_VOTING[];
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Reject" />
<TableStatus listData={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listData);
const [votingId, setVotingId] = useState("");
const [catatan, setCatatan] = useState("");
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Center>
<Button
color={"red"}
leftIcon={<IconBan />}
radius={"xl"}
onClick={() => {
open();
setVotingId(e.id);
setCatatan(e.catatan);
}}
>
<Stack spacing={0}>
<Text fz={10}>Tambah</Text>
<Text fz={10}>Catatan</Text>
</Stack>
</Button>
</Center>
</td>
<td>
<Center>
<Spoiler
hideLabel="sembunyikan"
maw={400}
maxHeight={50}
showLabel="tampilkan"
>
{e.catatan}
</Spoiler>
</Center>
</td>
<td>
<Center>{e.title}</Center>
</td>
<td>
<Center>
<Spoiler
hideLabel="sembunyikan"
maw={400}
maxHeight={50}
showLabel="tampilkan"
>
{e.deskripsi}
</Spoiler>
</Center>
</td>
<th>
<Stack>
{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" })}
</Center>
</td>
<td>
<Center>
{e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
</Center>
</td>
</tr>
));
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}
onChange={(val) => {
setCatatan(val.target.value);
}}
/>
<Group position="right">
<Button
radius={"xl"}
onClick={() => {
onReject(votingId, catatan, close, setData);
console.log(catatan);
}}
>
Simpan
</Button>
</Group>
</Stack>
</Modal>
<Box>
<Box bg={"red.1"} p={"xs"}>
<Title order={6} c={"red"}>
REJECT
</Title>
</Box>
<ScrollArea w={"100%"}>
<Box w={2000}>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Aksi</Center>
</th>
<th>
<Center>Catatan</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>
</Box>
</ScrollArea>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
</>
);
}
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);
}
}
);
}

View File

@@ -0,0 +1,253 @@
"use client";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/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,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Textarea,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan } from "@tabler/icons-react";
import { IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { AdminVote_funEditStatusPublishById } from "../../fun/edit/fun_edit_status_publish_by_id";
import toast from "react-simple-toasts";
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { AdminEvent_funEditCatatanById } from "../../fun/edit/fun_edit_status_reject_by_id";
export default function AdminVote_TableReview({
listVote,
}: {
listVote: MODEL_VOTING[];
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Review" />
<TableStatus listData={listVote} />
</Stack>
</>
);
}
function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listData);
const [votingId, setVotingId] = useState("");
const [catatan, setCatatan] = useState("");
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Center>{e.title}</Center>
</td>
<td>
<Center>
<Spoiler
hideLabel="sembunyikan"
maw={400}
maxHeight={50}
showLabel="tampilkan"
>
{e.deskripsi}
</Spoiler>
</Center>
</td>
<th>
<Stack>
{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" })}
</Center>
</td>
<td>
<Center>
{e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
</Center>
</td>
<td>
<Stack align="center">
<Button
w={120}
color={"green"}
leftIcon={<IconEyeShare />}
radius={"xl"}
onClick={() => onPublish(e.id, setData)}
>
Publish
</Button>
<Button
w={120}
color={"red"}
leftIcon={<IconBan />}
radius={"xl"}
onClick={() => {
open();
setVotingId(e.id);
}}
>
Reject
</Button>
</Stack>
</td>
</tr>
));
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"
onChange={(val) => {
setCatatan(val.target.value);
}}
/>
<Group position="right">
<Button
radius={"xl"}
onClick={() => {
onReject(votingId, setData, catatan, close);
// console.log("hehe")
}}
>
Simpan
</Button>
</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>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>
</>
);
}
async function onPublish(voteId: string, setData: any) {
await AdminVote_funEditStatusPublishById(voteId).then(async (res) => {
if (res.status === 200) {
await AdminVote_getListTableByStatusId("2").then((val) => {
setData(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
async function onReject(
voteId: string,
setData: any,
catatan: string,
close: any
) {
const data = {
id: voteId,
catatan: catatan,
};
await AdminEvent_funEditCatatanById(data as any).then(async (res) => {
if (res.status === 200) {
await AdminVote_getListTableByStatusId("2").then((val) => {
setData(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
close();
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}

View File

@@ -0,0 +1,68 @@
"use server";
import prisma from "@/app/lib/prisma";
/**
*
* @param statusId 0: Riwayat , 1: Publish, 2:Review, 4:Reject
* @type string
* @returns jumlah dari voting per status
*/
export default async function AdminVote_funCountByStatusId(statusId: string) {
if (statusId === "0") {
const count = await prisma.voting.count({
where: {
voting_StatusId: "1",
isActive: true,
akhirVote: {
lte: new Date(),
},
},
});
return count;
}
if (statusId === "1") {
const count = await prisma.voting.count({
where: {
voting_StatusId: "1",
akhirVote: {
gte: new Date(),
},
},
});
return count;
}
if (statusId === "2") {
const count = await prisma.voting.count({
where: {
voting_StatusId: "2",
// akhirVote: {
// gte: new Date(),
// },
},
});
return count;
}
if (statusId === "4") {
const count = await prisma.voting.count({
where: {
voting_StatusId: "4",
isActive: true,
// akhirVote: {
// gte: new Date(),
// },
},
});
return count;
}
if (statusId === undefined || statusId === null) {
return {
status: 400,
message: "Parameter tidak sesuai",
};
}
}

View File

@@ -0,0 +1,22 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminVote_funEditCatatanRejectById(
voteId: string,
catatan: string
) {
const updt = await prisma.voting.update({
where: {
id: voteId,
},
data: {
catatan: catatan,
},
});
if (!updt) return { status: 400, message: "Gagal Update Catatan" };
revalidatePath("/dev/admin/vote/child/table_reject");
return { status: 200, message: "Berhasil Update Catatan" };
}

View File

@@ -0,0 +1,23 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminVote_funEditStatusPublishById(voteId: string) {
const updt = await prisma.voting.update({
where: {
id: voteId,
},
data: {
voting_StatusId: "1",
},
});
if (!updt) return { status: 400, message: "Update Gagal" };
revalidatePath("/dev/admin/vote/main");
return {
status: 200,
message: "Berhasil Update Status",
};
}

View File

@@ -0,0 +1,26 @@
"use server";
import prisma from "@/app/lib/prisma";
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
import { revalidatePath } from "next/cache";
export async function AdminEvent_funEditCatatanById(
data: MODEL_VOTING,
) {
const updt = await prisma.voting.update({
where: {
id: data.id,
},
data: {
voting_StatusId: "4",
catatan: data.catatan,
},
});
if (!updt) return { status: 400, message: "Update Gagal" };
revalidatePath("/dev/admin/event/main");
return {
status: 200,
message: "Berhasil Update Status",
};
}

View File

@@ -0,0 +1,117 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function AdminVote_getListTableByStatusId(statusId: string) {
if (statusId === "0") {
const getData = await prisma.voting.findMany({
where: {
voting_StatusId: "1",
isActive: true,
akhirVote: {
lte: new Date(),
},
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
deskripsi: true,
awalVote: true,
akhirVote: true,
catatan: true,
authorId: true,
Author: true,
voting_StatusId: true,
Voting_DaftarNamaVote: true,
},
});
return getData;
}
if (statusId === "1") {
const getData = await prisma.voting.findMany({
where: {
voting_StatusId: "1",
isActive: true,
akhirVote: {
gte: new Date(),
},
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
deskripsi: true,
awalVote: true,
akhirVote: true,
catatan: true,
authorId: true,
Author: true,
voting_StatusId: true,
Voting_DaftarNamaVote: true,
},
});
return getData;
}
if (statusId === "2") {
const getData = await prisma.voting.findMany({
where: {
voting_StatusId: "2",
isActive: true,
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
deskripsi: true,
awalVote: true,
akhirVote: true,
catatan: true,
authorId: true,
Author: true,
voting_StatusId: true,
Voting_DaftarNamaVote: true,
},
});
return getData;
}
if (statusId === "4") {
const getData = await prisma.voting.findMany({
where: {
voting_StatusId: "4",
isActive: true,
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
deskripsi: true,
awalVote: true,
akhirVote: true,
catatan: true,
authorId: true,
Author: true,
voting_StatusId: true,
Voting_DaftarNamaVote: true,
},
});
return getData;
}
}

View File

@@ -0,0 +1,13 @@
import AdminVote_Main from "./main";
import AdminVote_TablePublish from "./child/table_publish";
import AdminVote_TableReview from "./child/table_review";
import AdminVote_TableReject from "./child/table_reject";
import AdminVote_Riwayat from "./child/riwayat";
export {
AdminVote_Main,
AdminVote_TablePublish,
AdminVote_TableReview,
AdminVote_TableReject,
AdminVote_Riwayat,
};

View File

@@ -0,0 +1,94 @@
"use client";
import { Stack, SimpleGrid, Paper, Group, Title, Text } from "@mantine/core";
import { useRouter } from "next/navigation";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
export default function AdminVote_Main({
countPublish,
countReview,
countDraft,
countReject,
countRiwayat,
}: {
countPublish?: number;
countReview?: number;
countDraft?: number;
countReject?: number;
countRiwayat?: number;
}) {
const router = useRouter();
const listStatus = [
{
id: 1,
name: "Publish",
jumlah: countPublish,
color: "green",
},
{
id: 2,
name: "Review",
jumlah: countReview,
color: "orange",
},
{
id: 3,
name: "Reject",
jumlah: countReject,
color: "red",
},
{
id: 4,
name: "Riwayat",
jumlah: countDraft,
path: "",
color: "gray",
},
];
return (
<>
<Stack spacing={"xl"}>
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
>
{listStatus.map((e, i) => (
<Paper
key={i}
bg={`${e.color}.2`}
shadow="md"
radius="md"
p="md"
// sx={{ borderColor: e.color, borderStyle: "solid" }}
>
<Group position="center">
<Stack align="center" spacing={0}>
<Text>{e.name}</Text>
<Title>{e.jumlah ? e.jumlah : 0}</Title>
</Stack>
</Group>
</Paper>
))}
</SimpleGrid>
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
></SimpleGrid>
</Stack>
</>
);
}