# Event Join
## feat - Join event - History semua event dan event saya ### No Issuue
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import {
|
||||
Affix,
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -25,6 +27,8 @@ import { MODEL_EVENT } from "../model/interface";
|
||||
import ComponentEvent_BoxListStatus from "../component/box_list_status";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
import _ from "lodash";
|
||||
import { IconCirclePlus } from "@tabler/icons-react";
|
||||
|
||||
export default function Event_Beranda({
|
||||
dataEvent,
|
||||
@@ -32,42 +36,72 @@ export default function Event_Beranda({
|
||||
dataEvent: MODEL_EVENT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
// if (_.isEmpty(dataEvent))
|
||||
// return (
|
||||
// <Center h={"80vh"}>
|
||||
// <Text fw={"bold"} fz={"sm"}>
|
||||
// Tidak Ada Event
|
||||
// </Text>
|
||||
// </Center>
|
||||
// );
|
||||
return (
|
||||
<>
|
||||
{dataEvent.map((e, i) => (
|
||||
<Card key={e.id} shadow="lg" radius={"md"} withBorder mb={"sm"}>
|
||||
<Card.Section px={"sm"} pt={"sm"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
profileId={e.Author.Profile.id}
|
||||
imagesId={e.Author.Profile.imagesId}
|
||||
authorName={e.Author.Profile.name}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_main + e.id)}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Title order={6} truncate>
|
||||
{e.title}
|
||||
</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Text fz={"sm"} truncate>
|
||||
{moment(e.tanggal).format("ll")}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{/* <Affix position={{ bottom: rem(100), right: rem(20) }}>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="blue"
|
||||
leftIcon={<IconCirclePlus />}
|
||||
onClick={() => router.push(RouterEvent.create)}
|
||||
>
|
||||
<Text fz={"sm"}> Tambah Event</Text>
|
||||
</Button>
|
||||
</Affix> */}
|
||||
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
{e.deskripsi}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
{_.isEmpty(dataEvent) ? (
|
||||
<Center h={"80vh"}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
Tidak Ada Event
|
||||
</Text>
|
||||
</Center>
|
||||
) : (
|
||||
<Box>
|
||||
{dataEvent.map((e, i) => (
|
||||
<Card key={e.id} shadow="lg" radius={"md"} withBorder mb={"sm"}>
|
||||
<Card.Section px={"sm"} pt={"sm"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
profileId={e.Author.Profile.id}
|
||||
imagesId={e.Author.Profile.imagesId}
|
||||
authorName={e.Author.Profile.name}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_main + e.id)}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Title order={6} truncate>
|
||||
{e.title}
|
||||
</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Text fz={"sm"} truncate>
|
||||
{moment(e.tanggal).format("ll")}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
{e.deskripsi}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
"use client"
|
||||
|
||||
export default function Event_History(){
|
||||
return<>
|
||||
ini history
|
||||
|
||||
</>
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
Avatar,
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
@@ -21,6 +22,7 @@ import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_Kontribusi({
|
||||
listKontribusi,
|
||||
@@ -42,6 +44,15 @@ export default function Event_Kontribusi({
|
||||
},
|
||||
];
|
||||
|
||||
if (_.isEmpty(listKontribusi))
|
||||
return (
|
||||
<Center h={"80vh"}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
Tidak Ada Kontribusi
|
||||
</Text>
|
||||
</Center>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(listKontribusi, null,2)}</pre> */}
|
||||
@@ -56,7 +67,9 @@ export default function Event_Kontribusi({
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_kontribusi + e.Event.id)}
|
||||
onClick={() =>
|
||||
router.push(RouterEvent.detail_kontribusi + e.Event.id)
|
||||
}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
@@ -77,18 +90,19 @@ export default function Event_Kontribusi({
|
||||
</Text> */}
|
||||
|
||||
<Group position="center">
|
||||
{e.Event.Event_Peserta.map((val) => (
|
||||
<Box key={val.id}>
|
||||
<Avatar
|
||||
size={"lg"}
|
||||
radius={"xl"}
|
||||
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||
src={
|
||||
RouterProfile.api_foto_profile + val.User.Profile.imagesId
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
{e.Event.Event_Peserta.map((val) => (
|
||||
<Box key={val.id}>
|
||||
<Avatar
|
||||
size={"lg"}
|
||||
radius={"xl"}
|
||||
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||
src={
|
||||
RouterProfile.api_foto_profile +
|
||||
val.User.Profile.imagesId
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Group>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
|
||||
@@ -55,10 +55,10 @@ export default function LayoutEvent_Main({
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "History",
|
||||
path: RouterEvent.history,
|
||||
name: "Riwayat",
|
||||
path: RouterEvent.riwayat,
|
||||
icon: <IconHistory />,
|
||||
}
|
||||
},
|
||||
];
|
||||
return (
|
||||
<>
|
||||
@@ -71,6 +71,19 @@ export default function LayoutEvent_Main({
|
||||
}
|
||||
footer={
|
||||
<Footer height={70} bg={"dark"} sx={{ borderTop: "px solid blue" }}>
|
||||
<Center>
|
||||
<ActionIcon
|
||||
sx={{ zIndex: 1, position: "absolute" }}
|
||||
mt={-5}
|
||||
size={"xl"}
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
bg={"white"}
|
||||
onClick={() => router.push(RouterEvent.create)}
|
||||
>
|
||||
<IconCirclePlus color="#347aeb" size={40} />
|
||||
</ActionIcon>
|
||||
</Center>
|
||||
<Grid>
|
||||
{listFooter.map((e, i) => (
|
||||
<Grid.Col
|
||||
|
||||
74
src/app_modules/event/main/riwayat/index.tsx
Normal file
74
src/app_modules/event/main/riwayat/index.tsx
Normal file
@@ -0,0 +1,74 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
import { Card, Stack, Grid, Title, Text, Center, Tabs } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import Event_SemuaRiwayat from "./semua";
|
||||
import Event_RiwayatSaya from "./saya";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_event_riwayat } from "../../global_state";
|
||||
|
||||
export default function Event_Riwayat({
|
||||
dataSemuaRiwayat,
|
||||
dataRiwayatSaya
|
||||
}: {
|
||||
dataSemuaRiwayat: MODEL_EVENT[];
|
||||
dataRiwayatSaya: MODEL_EVENT[]
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [tabsRiwayat, setTabsRiwayat] = useAtom(gs_event_riwayat)
|
||||
|
||||
const listTabs = [
|
||||
{
|
||||
id: 1,
|
||||
label: "Semua Riwayat",
|
||||
value: "Semua",
|
||||
path: <Event_SemuaRiwayat data={dataSemuaRiwayat as any} />,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
label: "Riwayat Saya",
|
||||
value: "Saya",
|
||||
path: <Event_RiwayatSaya data={dataRiwayatSaya as any}/>,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
defaultValue={"Semua"}
|
||||
variant="pills"
|
||||
radius={"xl"}
|
||||
onTabChange={setTabsRiwayat}
|
||||
value={tabsRiwayat}
|
||||
>
|
||||
<Stack>
|
||||
<Tabs.List grow>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Tab
|
||||
key={e.id}
|
||||
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>
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
61
src/app_modules/event/main/riwayat/saya.tsx
Normal file
61
src/app_modules/event/main/riwayat/saya.tsx
Normal file
@@ -0,0 +1,61 @@
|
||||
"use client";
|
||||
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
import { Card, Stack, Grid, Title, Text, Center } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_RiwayatSaya({ data }: { data: MODEL_EVENT[] }) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<Center h={"80vh"}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
Tidak Ada Event
|
||||
</Text>
|
||||
</Center>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{data.map((e, i) => (
|
||||
<Card key={e.id} shadow="lg" radius={"md"} withBorder mb={"sm"}>
|
||||
<Card.Section px={"sm"} pt={"sm"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
profileId={e.Author.Profile.id}
|
||||
imagesId={e.Author.Profile.imagesId}
|
||||
authorName={e.Author.Profile.name}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_riwayat + e.id)}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Title order={6} truncate>
|
||||
{e.title}
|
||||
</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Text fz={"sm"} truncate>
|
||||
{moment(e.tanggal).format("ll")}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
{e.deskripsi}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
62
src/app_modules/event/main/riwayat/semua.tsx
Normal file
62
src/app_modules/event/main/riwayat/semua.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
import { Card, Stack, Grid, Title, Text, Center } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import { useRouter } from "next/navigation";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_SemuaRiwayat({ data }: { data: MODEL_EVENT[] }) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<Center h={"80vh"}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
Tidak Ada Event
|
||||
</Text>
|
||||
</Center>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{data.map((e, i) => (
|
||||
<Card key={e.id} shadow="lg" radius={"md"} withBorder mb={"sm"}>
|
||||
<Card.Section px={"sm"} pt={"sm"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
profileId={e.Author.Profile.id}
|
||||
imagesId={e.Author.Profile.imagesId}
|
||||
authorName={e.Author.Profile.name}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_riwayat + e.id)}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Title order={6} truncate>
|
||||
{e.title}
|
||||
</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Text fz={"sm"} truncate>
|
||||
{moment(e.tanggal).format("ll")}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
{e.deskripsi}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -14,11 +14,13 @@ import Event_StatusReject from "./reject";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
|
||||
export default function Event_StatusPage({
|
||||
authorId,
|
||||
listPublish,
|
||||
listReview,
|
||||
listDraft,
|
||||
listReject,
|
||||
}: {
|
||||
authorId: string
|
||||
listPublish: any;
|
||||
listReview: any;
|
||||
listDraft: any;
|
||||
@@ -34,7 +36,7 @@ export default function Event_StatusPage({
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: <Event_StatusReview listReview={listReview} />,
|
||||
path: <Event_StatusReview listReview={listReview} authorId={authorId} />,
|
||||
value: "Review",
|
||||
},
|
||||
{
|
||||
@@ -50,16 +52,7 @@ export default function Event_StatusPage({
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<Affix position={{ bottom: rem(100), right: rem(20) }}>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="blue"
|
||||
leftIcon={<IconCirclePlus />}
|
||||
onClick={() => router.push(RouterEvent.create)}
|
||||
>
|
||||
Tambah Event
|
||||
</Button>
|
||||
</Affix>
|
||||
|
||||
|
||||
<Tabs
|
||||
color="blue"
|
||||
|
||||
@@ -28,7 +28,6 @@ export default function Event_StatusPublish({
|
||||
.map((e, i) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentEvent_BoxListStatus data={e} path={RouterEvent.detail_publish}/>
|
||||
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
|
||||
@@ -8,15 +8,29 @@ import { MODEL_EVENT } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||
import _ from "lodash";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { Event_getByStatusId } from "../../fun/get/get_event_by_status_id";
|
||||
|
||||
export default function Event_StatusReview({
|
||||
listReview,
|
||||
authorId,
|
||||
}: {
|
||||
listReview: MODEL_EVENT[];
|
||||
authorId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(listReview);
|
||||
|
||||
if (_.isEmpty(listReview))
|
||||
useShallowEffect(() => {
|
||||
setTimeout(() => loadData(authorId), 1000)
|
||||
}, []);
|
||||
|
||||
async function loadData(authorId: string) {
|
||||
const res : any = await Event_getByStatusId("2", authorId);
|
||||
setData(res);
|
||||
}
|
||||
|
||||
if (_.isEmpty(data))
|
||||
return (
|
||||
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
||||
Tidak Ada Event
|
||||
@@ -24,7 +38,7 @@ export default function Event_StatusReview({
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{listReview.map((e, i) => (
|
||||
{data.map((e, i) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentEvent_BoxListStatus
|
||||
data={e}
|
||||
|
||||
Reference in New Issue
Block a user