# Voting
## feat - Voting user - Halaman kontribusi - Halaman riwayat ### No issuue
This commit is contained in:
65
src/app_modules/vote/main/beranda.tsx
Normal file
65
src/app_modules/vote/main/beranda.tsx
Normal file
@@ -0,0 +1,65 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
ActionIcon,
|
||||
Affix,
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { IconCirclePlus } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../component/card_view_publish";
|
||||
import { MODEL_VOTING } from "../model/interface";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
|
||||
export default function Vote_Beranda({
|
||||
dataVote,
|
||||
}: {
|
||||
dataVote: MODEL_VOTING[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Affix position={{ bottom: rem(100), right: rem(30) }}>
|
||||
<ActionIcon
|
||||
size={"xl"}
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
bg={"blue"}
|
||||
onClick={() => {
|
||||
router.push(RouterVote.create);
|
||||
}}
|
||||
>
|
||||
<IconCirclePlus color="white" size={40} />
|
||||
</ActionIcon>
|
||||
</Affix>
|
||||
|
||||
<Stack>
|
||||
{dataVote.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.main_detail}
|
||||
data={e}
|
||||
authorName={true}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
47
src/app_modules/vote/main/kontribusi.tsx
Normal file
47
src/app_modules/vote/main/kontribusi.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../component/card_view_publish";
|
||||
import { MODEL_VOTE_KONTRIBUTOR } from "../model/interface";
|
||||
|
||||
export default function Vote_Kontribusi({
|
||||
dataKontribusi,
|
||||
}: {
|
||||
dataKontribusi: MODEL_VOTE_KONTRIBUTOR[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{dataKontribusi.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.detail_kontribusi}
|
||||
pilihanSaya={true}
|
||||
data={e.Voting}
|
||||
authorName={true}
|
||||
namaPilihan={e.Voting_DaftarNamaVote.value}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
{/* <pre>{JSON.stringify(dataKontribusi, null, 2)}</pre> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
107
src/app_modules/vote/main/layout.tsx
Normal file
107
src/app_modules/vote/main/layout.tsx
Normal file
@@ -0,0 +1,107 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
ActionIcon,
|
||||
AppShell,
|
||||
Center,
|
||||
Footer,
|
||||
Grid,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import React, { useState } from "react";
|
||||
import ComponentVote_HeaderTamplate from "../component/header_tamplate";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
IconClick,
|
||||
IconHistory,
|
||||
IconHome,
|
||||
IconReservedLine,
|
||||
} from "@tabler/icons-react";
|
||||
import { gs_vote_hotMenu } from "../global_state";
|
||||
import { useAtom } from "jotai";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
|
||||
export default function LayoutVote_Main({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_vote_hotMenu);
|
||||
|
||||
const listFooter = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Beranda",
|
||||
path: RouterVote.beranda,
|
||||
icon: <IconHome />,
|
||||
},
|
||||
|
||||
{
|
||||
id: 2,
|
||||
name: "Status",
|
||||
path: RouterVote.status,
|
||||
icon: <IconReservedLine />,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Kontribusi",
|
||||
path: RouterVote.kontribusi,
|
||||
icon: <IconClick />,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Riwayat",
|
||||
path: RouterVote.riwayat,
|
||||
icon: <IconHistory />,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppShell
|
||||
header={
|
||||
<ComponentVote_HeaderTamplate
|
||||
title="Voting"
|
||||
route={RouterHome.main_home}
|
||||
/>
|
||||
}
|
||||
footer={
|
||||
<Footer height={70} bg={"dark"} sx={{ borderTop: "px solid blue" }}>
|
||||
<Grid>
|
||||
{listFooter.map((e, i) => (
|
||||
<Grid.Col
|
||||
key={e.id}
|
||||
span={"auto"}
|
||||
pt={"md"}
|
||||
onClick={() => {
|
||||
router.replace(e.path);
|
||||
setHotMenu(i);
|
||||
}}
|
||||
>
|
||||
<Center>
|
||||
<Stack align="center" spacing={0}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c={hotMenu === i ? "blue" : "white"}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
<Text fz={10} c={hotMenu === i ? "blue" : "white"}>
|
||||
{e.name}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
</Footer>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</AppShell>
|
||||
</>
|
||||
);
|
||||
}
|
||||
66
src/app_modules/vote/main/riwayat/index.tsx
Normal file
66
src/app_modules/vote/main/riwayat/index.tsx
Normal file
@@ -0,0 +1,66 @@
|
||||
"use client";
|
||||
|
||||
import { Stack, Tabs } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import Vote_SemuaRiwayat from "./semua";
|
||||
import Vote_RiwayatSaya from "./saya";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_vote_riwayat } from "../../global_state";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
|
||||
export default function Vote_Riwayat({
|
||||
listRiwayat,
|
||||
listRiwayatSaya,
|
||||
}: {
|
||||
listRiwayat: MODEL_VOTING[];
|
||||
listRiwayatSaya: MODEL_VOTING[]
|
||||
}) {
|
||||
const [tabsRiwayat, setTabsRiwayat] = useAtom(gs_vote_riwayat);
|
||||
const listTabs = [
|
||||
{
|
||||
id: 1,
|
||||
path: <Vote_SemuaRiwayat listRiwayat={listRiwayat} />,
|
||||
value: "Semua",
|
||||
label: "Semua Riwayat",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: <Vote_RiwayatSaya listRiwayatSaya={listRiwayatSaya} />,
|
||||
value: "Saya",
|
||||
label: "Riwayat Saya",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
variant="pills"
|
||||
radius={"xl"}
|
||||
color="blue"
|
||||
defaultValue={"Semua"}
|
||||
value={tabsRiwayat}
|
||||
onTabChange={setTabsRiwayat}
|
||||
>
|
||||
<Stack>
|
||||
<Tabs.List grow>
|
||||
{listTabs.map((e, i) => (
|
||||
<Tabs.Tab
|
||||
key={i}
|
||||
value={e.value}
|
||||
bg={tabsRiwayat === e.value ? "blue" : "gray.1"}
|
||||
fw={tabsRiwayat === e.value ? "bold" : "normal"}
|
||||
>
|
||||
{e.label}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Panel key={e.id} value={e.value}>
|
||||
{e.path}
|
||||
</Tabs.Panel>
|
||||
))}
|
||||
</Stack>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
}
|
||||
44
src/app_modules/vote/main/riwayat/saya.tsx
Normal file
44
src/app_modules/vote/main/riwayat/saya.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Stack,
|
||||
Card,
|
||||
Grid,
|
||||
Avatar,
|
||||
Divider,
|
||||
Title,
|
||||
Badge,
|
||||
Group,
|
||||
Radio,
|
||||
Center,
|
||||
Text,
|
||||
Box,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../../component/card_view_publish";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
|
||||
export default function Vote_RiwayatSaya({
|
||||
listRiwayatSaya,
|
||||
}: {
|
||||
listRiwayatSaya: MODEL_VOTING[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{listRiwayatSaya.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.detail_riwayat_saya}
|
||||
data={e}
|
||||
authorName={true}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
44
src/app_modules/vote/main/riwayat/semua.tsx
Normal file
44
src/app_modules/vote/main/riwayat/semua.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Stack,
|
||||
Card,
|
||||
Grid,
|
||||
Avatar,
|
||||
Divider,
|
||||
Title,
|
||||
Badge,
|
||||
Group,
|
||||
Radio,
|
||||
Center,
|
||||
Text,
|
||||
Box,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../../component/card_view_publish";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
|
||||
export default function Vote_SemuaRiwayat({
|
||||
listRiwayat,
|
||||
}: {
|
||||
listRiwayat: MODEL_VOTING[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{listRiwayat.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.detail_semua_riwayat}
|
||||
data={e}
|
||||
authorName={true}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
31
src/app_modules/vote/main/status/draft.tsx
Normal file
31
src/app_modules/vote/main/status/draft.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import ComponentVote_CardViewStatus from "../../component/card_view_status";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import _ from "lodash";
|
||||
import { Box, Center, Stack, Text } from "@mantine/core";
|
||||
import ComponentVote_IsEmptyData from "../../component/is_empty_data";
|
||||
|
||||
export default function Vote_StatusDraft({
|
||||
listDraft,
|
||||
}: {
|
||||
listDraft: MODEL_VOTING[];
|
||||
}) {
|
||||
if (_.isEmpty(listDraft))
|
||||
return <ComponentVote_IsEmptyData text="Tidak ada draft" />;
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{listDraft.map((e) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentVote_CardViewStatus
|
||||
path={RouterVote.detail_draft}
|
||||
data={e}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
80
src/app_modules/vote/main/status/index.tsx
Normal file
80
src/app_modules/vote/main/status/index.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
"use client";
|
||||
|
||||
import { Stack, Tabs } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { gs_vote_status } from "../../global_state";
|
||||
import Vote_StatusPublish from "./publish";
|
||||
import Vote_StatusReview from "./review";
|
||||
import Vote_StatusDraft from "./draft";
|
||||
import Vote_StatusReject from "./reject";
|
||||
|
||||
export default function Vote_Status({
|
||||
listPublish,
|
||||
listReview,
|
||||
listDraft,
|
||||
listReject,
|
||||
}: {
|
||||
listPublish: any[];
|
||||
listReview: any[];
|
||||
listDraft: any[];
|
||||
listReject: any[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
|
||||
const listTabs = [
|
||||
{
|
||||
id: 1,
|
||||
path: <Vote_StatusPublish listPublish={listPublish} />,
|
||||
value: "Publish",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: <Vote_StatusReview listReview={listReview} />,
|
||||
value: "Review",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
path: <Vote_StatusDraft listDraft={listDraft} />,
|
||||
value: "Draft",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
path: <Vote_StatusReject listReject={listReject} />,
|
||||
value: "Reject",
|
||||
},
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
color="blue"
|
||||
variant="pills"
|
||||
radius={"xl"}
|
||||
defaultValue={"Publish"}
|
||||
value={tabsStatus}
|
||||
onTabChange={setTabsStatus}
|
||||
>
|
||||
<Stack>
|
||||
<Tabs.List grow>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Tab
|
||||
key={e.id}
|
||||
value={e.value}
|
||||
bg={tabsStatus === e.value ? "blue" : "gray.1"}
|
||||
fw={tabsStatus === e.value ? "bold" : "normal"}
|
||||
>
|
||||
{e.value}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Panel key={e.id} value={e.value}>
|
||||
{e.path}
|
||||
</Tabs.Panel>
|
||||
))}
|
||||
</Stack>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
}
|
||||
54
src/app_modules/vote/main/status/publish.tsx
Normal file
54
src/app_modules/vote/main/status/publish.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Skeleton,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import ComponentVote_IsEmptyData from "../../component/is_empty_data";
|
||||
import _ from "lodash";
|
||||
import ComponentVote_CardViewPublish from "../../component/card_view_publish";
|
||||
|
||||
export default function Vote_StatusPublish({
|
||||
listPublish,
|
||||
}: {
|
||||
listPublish: MODEL_VOTING[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(listPublish))
|
||||
return (
|
||||
<>
|
||||
<ComponentVote_IsEmptyData text="Tidak ada voting" />
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{listPublish.map((e) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentVote_CardViewPublish
|
||||
data={e}
|
||||
path={RouterVote.detail_publish}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
31
src/app_modules/vote/main/status/reject.tsx
Normal file
31
src/app_modules/vote/main/status/reject.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import ComponentVote_CardViewStatus from "../../component/card_view_status";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import { Box, Stack } from "@mantine/core";
|
||||
import ComponentVote_IsEmptyData from "../../component/is_empty_data";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Vote_StatusReject({
|
||||
listReject,
|
||||
}: {
|
||||
listReject: MODEL_VOTING[];
|
||||
}) {
|
||||
if (_.isEmpty(listReject))
|
||||
return <ComponentVote_IsEmptyData text="Tidak ada review" />;
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{listReject.map((e) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentVote_CardViewStatus
|
||||
path={RouterVote.detail_reject}
|
||||
data={e}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
32
src/app_modules/vote/main/status/review.tsx
Normal file
32
src/app_modules/vote/main/status/review.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import ComponentVote_CardViewStatus from "../../component/card_view_status";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import { Box, Center, Stack, Text } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import ComponentVote_IsEmptyData from "../../component/is_empty_data";
|
||||
|
||||
export default function Vote_StatusReview({
|
||||
listReview,
|
||||
}: {
|
||||
listReview: MODEL_VOTING[];
|
||||
}) {
|
||||
if (_.isEmpty(listReview))
|
||||
return <ComponentVote_IsEmptyData text="Tidak ada review" />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{listReview.map((e) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentVote_CardViewStatus
|
||||
path={RouterVote.detail_review}
|
||||
data={e}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user