fix admin voting

- fix detail riwayat
This commit is contained in:
2025-03-25 10:38:04 +08:00
parent 2db82ec7d1
commit bd7837134a
3 changed files with 26 additions and 19 deletions

View File

@@ -32,6 +32,8 @@ import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id"; import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id"; import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
import { apiGetAdminVotingRiwayat } from "../../lib/api_fetch_admin_voting"; import { apiGetAdminVotingRiwayat } from "../../lib/api_fetch_admin_voting";
import Admin_DetailButton from "@/app_modules/admin/_admin_global/_component/button/detail_button";
import { RouterAdminVote } from "@/lib/router_admin/router_admin_vote";
export default function AdminVote_Riwayat() { export default function AdminVote_Riwayat() {
return ( return (
@@ -104,7 +106,7 @@ function TableStatus() {
return data.map((e, i) => ( return data.map((e, i) => (
<tr key={i}> <tr key={i}>
<td> {/* <td>
<Center> <Center>
<Button <Button
loading={ loading={
@@ -123,14 +125,14 @@ function TableStatus() {
Lihat Hasil Lihat Hasil
</Button> </Button>
</Center> </Center>
</td> </td> */}
<td> <td>
<Center c={AccentColor.white}>{e?.Author?.username}</Center> <Center c={AccentColor.white}>{e?.Author?.username}</Center>
</td> </td>
<td> <td>
<Center c={AccentColor.white}>{e?.title}</Center> <Center c={AccentColor.white}>{e?.title}</Center>
</td> </td>
<td> {/* <td>
<Center c="white"> <Center c="white">
<Spoiler <Spoiler
hideLabel="sembunyikan" hideLabel="sembunyikan"
@@ -141,8 +143,8 @@ function TableStatus() {
{e?.deskripsi} {e?.deskripsi}
</Spoiler> </Spoiler>
</Center> </Center>
</td> </td> */}
<td> {/* <td>
<Stack> <Stack>
{e?.Voting_DaftarNamaVote.map((v) => ( {e?.Voting_DaftarNamaVote.map((v) => (
<Box key={v?.id}> <Box key={v?.id}>
@@ -150,7 +152,7 @@ function TableStatus() {
</Box> </Box>
))} ))}
</Stack> </Stack>
</td> </td> */}
<td> <td>
<Center c={AccentColor.white}> <Center c={AccentColor.white}>
@@ -166,6 +168,13 @@ function TableStatus() {
}).format(new Date(e?.akhirVote))} }).format(new Date(e?.akhirVote))}
</Center> </Center>
</td> </td>
<td>
<Center>
<Admin_DetailButton path={RouterAdminVote.detail({id: e.id})}/>
</Center>
</td>
</tr> </tr>
)); ));
}; };
@@ -204,27 +213,21 @@ function TableStatus() {
> >
<thead> <thead>
<tr> <tr>
<th>
<Center c={AccentColor.white}>Aksi</Center>
</th>
<th> <th>
<Center c={AccentColor.white}>Username</Center> <Center c={AccentColor.white}>Username</Center>
</th> </th>
<th> <th>
<Center c={AccentColor.white}>Judul</Center> <Center c={AccentColor.white}>Judul</Center>
</th> </th>
<th>
<Center c={AccentColor.white}>Deskripsi</Center>
</th>
<th>
<Center c={AccentColor.white}>Pilihan</Center>
</th>
<th> <th>
<Center c={AccentColor.white}>Mulai Vote</Center> <Center c={AccentColor.white}>Mulai Vote</Center>
</th> </th>
<th> <th>
<Center c={AccentColor.white}>Selesai Vote</Center> <Center c={AccentColor.white}>Selesai Vote</Center>
</th> </th>
<th>
<Center c={AccentColor.white}>Aksi</Center>
</th>
</tr> </tr>
</thead> </thead>
<tbody>{renderTableBody()}</tbody> <tbody>{renderTableBody()}</tbody>

View File

@@ -9,6 +9,8 @@ interface Props {
} }
export function AdminVoting_ComponentDetail({ data }: Props) { export function AdminVoting_ComponentDetail({ data }: Props) {
const cekHari = moment(data.akhirVote).diff(new Date(), "minutes");
const listData = [ const listData = [
{ {
title: "Username", title: "Username",
@@ -32,7 +34,9 @@ export function AdminVoting_ComponentDetail({ data }: Props) {
}, },
{ {
title: "Status", title: "Status",
value: <Badge variant="light">{data.Voting_Status.name}</Badge>, value: (
<Badge variant="light">{cekHari < 0 ? "Riwayat" : "Publish"}</Badge>
),
}, },
]; ];

View File

@@ -49,11 +49,11 @@ export function AdminVote_DetailVoting() {
</SimpleGrid> </SimpleGrid>
)} )}
{data && data.voting_StatusId === "1" ? ( {data && data.Voting_Status.name === "Publish" ? (
<AdminVoting_ComponentDetailPublish data={data} /> <AdminVoting_ComponentDetailPublish data={data} />
) : data && data.voting_StatusId === "2" ? ( ) : data && data.Voting_Status.name === "Review" ? (
<AdminVoting_ComponentDetailReview data={data} /> <AdminVoting_ComponentDetailReview data={data} />
) : data && data.voting_StatusId === "4" ? ( ) : data && data.Voting_Status.name === "Reject" ? (
<AdminVoting_ComponentDetailReject data={data} /> <AdminVoting_ComponentDetailReject data={data} />
) : ( ) : (
"" ""