## 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,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>
</>
);
}