();
+ const [eventId, setEventId] = useState("");
+ const [loading, setLoading] = useState(false);
+
+ const TableRows = data.map((e, i) => (
+
+ {e.title}
+ {e.lokasi}
+ {e.EventMaster_TipeAcara.name}
+ {e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
+
+ {e.tanggal.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })}
+
+
+
+ {e.deskripsi}
+
+
+
+
+ }
+ radius={"xl"}
+ onClick={async () => {
+ setEventId(e.id);
+ setLoading(true);
+ await new Promise((v) => setTimeout(v, 500));
+ await AdminEvent_getListPesertaById(e.id).then((res: any) => {
+ setPeserta(res);
+ setLoading(false);
+ });
+ open();
+ }}
+ >
+ Lihat Peserta
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+ Daftar Peserta
+
+
+ {peserta?.map((e) => (
+
+
+
+
+
+
+
+ {e.User.Profile.name}
+
+
+
+
+
+ ))}
+
+
+
+
+
+
+
+ PUBLISH
+
+
+
+
+
+ Judul
+ Lokasi
+ Tipe Acara
+ Tanggal
+ Jam
+
+ Deskripsi
+
+
+
+ Aksi
+
+
+
+ {TableRows}
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/admin/event/table_status/table_reject.tsx b/src/app_modules/admin/event/table_status/table_reject.tsx
new file mode 100644
index 00000000..67004ccb
--- /dev/null
+++ b/src/app_modules/admin/event/table_status/table_reject.tsx
@@ -0,0 +1,239 @@
+"use client";
+
+import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
+import {
+ ActionIcon,
+ Box,
+ Button,
+ Center,
+ Flex,
+ Group,
+ Modal,
+ ScrollArea,
+ Spoiler,
+ Stack,
+ Table,
+ Text,
+ Textarea,
+ Title,
+} from "@mantine/core";
+import {
+ IconBan,
+ IconChevronLeft,
+ IconEyeCheck,
+ IconEyeShare,
+ IconPencilPlus,
+ IconShare,
+} from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+
+import { useDisclosure } from "@mantine/hooks";
+
+import { useState } from "react";
+import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
+import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
+import { MODEL_EVENT } from "@/app_modules/event/model/interface";
+import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
+import moment from "moment";
+import _ from "lodash";
+import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+
+export default function AdminEvent_TableReject({
+ listReject,
+}: {
+ listReject: MODEL_EVENT[];
+}) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
+ const router = useRouter();
+ const [opened, { open, close }] = useDisclosure(false);
+ const [data, setData] = useState(listReject);
+ const [eventId, setEventId] = useState("");
+ const [catatan, setCatatan] = useState("");
+
+ const TableRows = data.map((e, i) => (
+
+
+ {e.Author.Profile.name}
+
+
+ {e.title}
+
+
+ {e.lokasi}
+
+
+ {e.EventMaster_TipeAcara.name}
+
+
+
+ {e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
+
+
+
+
+ {e.tanggal.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })}
+
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+ {" "}
+
+
+ {e.catatan}
+
+
+
+
+
+ }
+ radius={"xl"}
+ onClick={() => {
+ setEventId(e.id);
+ setCatatan(e.catatan);
+ open();
+ }}
+ >
+ Tambah Catatan
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+ REJECT
+
+
+
+
+
+
+ Author
+ Judul
+ Lokasi
+ Tipe Acara
+ Tanggal
+ Jam
+
+ Deskripsi
+
+
+ Catatan
+
+
+
+ Aksi
+
+
+
+ {TableRows}
+
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
+
+async function onUpdate(
+ eventId: string,
+ catatan: string,
+ close: any,
+ setData: any
+) {
+ const body = {
+ id: eventId,
+ catatan: catatan,
+ };
+ await AdminEvent_funEditCatatanById(body as any, "4").then(async (res) => {
+ if (res.status === 200) {
+ await AdminEvent_getListTableByStatusId("4").then((val) => {
+ setData(val);
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ close();
+ });
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/admin/event/table_status/table_review.tsx b/src/app_modules/admin/event/table_status/table_review.tsx
new file mode 100644
index 00000000..c6c09710
--- /dev/null
+++ b/src/app_modules/admin/event/table_status/table_review.tsx
@@ -0,0 +1,234 @@
+"use client";
+
+import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
+import {
+ ActionIcon,
+ Box,
+ Button,
+ Center,
+ Group,
+ Modal,
+ Spoiler,
+ Stack,
+ Table,
+ Text,
+ TextInput,
+ Textarea,
+ Title,
+} from "@mantine/core";
+import {
+ IconBan,
+ IconChevronLeft,
+ IconEyeCheck,
+ IconEyeShare,
+ IconShare,
+} from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+
+import { useDisclosure } from "@mantine/hooks";
+
+import { useState } from "react";
+import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
+import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
+import { MODEL_EVENT } from "@/app_modules/event/model/interface";
+import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
+import moment from "moment";
+import _ from "lodash";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
+import { AdminEvent_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";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+
+export default function AdminEvent_TableReview({
+ listReview,
+}: {
+ listReview: MODEL_EVENT[];
+}) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
+ const router = useRouter();
+ const [opened, { open, close }] = useDisclosure(false);
+ const [data, setData] = useState(listReview);
+ const [catatan, setCatatan] = useState("");
+ const [eventId, setEventId] = useState("");
+
+ const TableRows = data.map((e, i) => (
+
+ {e.Author.Profile.name}
+ {e.title}
+ {e.lokasi}
+ {e.EventMaster_TipeAcara.name}
+ {e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
+
+ {e.tanggal.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })}
+
+
+
+ {e.deskripsi}
+
+
+
+
+
+ }
+ radius={"xl"}
+ onClick={() => onPublish(e.id, setData)}
+ >
+ Publish
+
+ }
+ radius={"xl"}
+ onClick={() => {
+ open();
+ setEventId(e.id);
+ }}
+ >
+ Reject
+
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+
+
+ {/* {JSON.stringify(data, null, 2)} */}
+
+
+ REVIEW
+
+
+
+
+
+ Author
+ Judul
+ Lokasi
+ Tipe Acara
+ Tanggal
+ Jam
+
+ Deskripsi
+
+
+
+ Aksi
+
+
+
+ {TableRows}
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
+
+async function onPublish(eventId: string, setData: any) {
+ await AdminEvent_funEditStatusPublishById(eventId, "1").then(async (res) => {
+ if (res.status === 200) {
+ await AdminEvent_getListTableByStatusId("2").then((res) => {
+ setData(res);
+ ComponentGlobal_NotifikasiBerhasil("Berhasil update status");
+ });
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
+
+async function onReject(
+ eventId: string,
+ catatan: string,
+ setData: any,
+ close: any
+) {
+ if (catatan === "")
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
+ const body = {
+ id: eventId,
+ catatan: catatan,
+ };
+
+ await AdminEvent_funEditCatatanById(body as any, "4").then(async (res) => {
+ if (res.status === 200) {
+ await AdminEvent_getListTableByStatusId("2").then((val) => {
+ setData(val);
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ close();
+ });
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/admin/global_state/index.ts b/src/app_modules/admin/global_state/index.ts
new file mode 100644
index 00000000..32e642b8
--- /dev/null
+++ b/src/app_modules/admin/global_state/index.ts
@@ -0,0 +1,10 @@
+import { atomWithStorage } from "jotai/utils";
+
+/**
+ * @param index | 0 - 3 | 0: Main dahsboard, 1: Investasi, 2: Donasi, 3: Event
+ * @type number
+ * @
+ */
+export const gs_admin_hotMenu = atomWithStorage("gs_admin_hotMenu", 0)
+
+export const gs_admin_subMenu = atomWithStorage("gs_admin_subMenu",null)
\ No newline at end of file
diff --git a/src/app_modules/admin/main_dashboard/main/layout.tsx b/src/app_modules/admin/layout.tsx
similarity index 62%
rename from src/app_modules/admin/main_dashboard/main/layout.tsx
rename to src/app_modules/admin/layout.tsx
index 3b6d3774..691ec7e5 100644
--- a/src/app_modules/admin/main_dashboard/main/layout.tsx
+++ b/src/app_modules/admin/layout.tsx
@@ -20,7 +20,7 @@ import {
useMantineTheme,
} from "@mantine/core";
import React, { useState } from "react";
-import ComponentGlobal_HeaderTamplate from "../../../component_global/header_tamplate";
+import ComponentGlobal_HeaderTamplate from "../component_global/header_tamplate";
import { useDisclosure } from "@mantine/hooks";
import { IconLetterH, IconLogout } from "@tabler/icons-react";
import {
@@ -33,8 +33,11 @@ import { useRouter } from "next/navigation";
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
import { Logout } from "@/app_modules/auth";
import { useAtom } from "jotai";
-import { gs_adminDonasi_hotMenu } from "../../donasi/global_state";
-import Admin_Logout from "../../component/logout";
+import { gs_admin_hotMenu, gs_admin_subMenu } from "./global_state";
+import Admin_Logout from "./component/logout";
+import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
+import _ from "lodash";
+import { listAdminPage } from "./list_page";
export default function AdminLayout({
children,
@@ -44,25 +47,53 @@ export default function AdminLayout({
const theme = useMantineTheme();
const [opened, setOpened] = useState(false);
const router = useRouter();
- const [active, setActive] = useAtom(gs_adminDonasi_hotMenu);
+ const [active, setActive] = useAtom(gs_admin_hotMenu);
+ const [activeChild, setActiveChild] = useAtom(gs_admin_subMenu);
- const listAdminPage = [
- {
- id: 1,
- name: "Dashboard",
- route: RouterAdminDashboard.main_admin,
- },
- {
- id: 2,
- name: "Investasi",
- route: RouterAdminInvestasi.main_investasi,
- },
- {
- id: 3,
- name: "Donasi",
- route: RouterAdminDonasi.main_donasi,
- },
- ];
+ const navbarItems = listAdminPage.map((e, i) => (
+
+ {e.name}}
+ onClick={() => {
+ setActive(e.id);
+ setActiveChild(null);
+ e.path === "" ? router.push(e.child[0].path) : router.push(e.path);
+ e.path === "" ? setActiveChild(e.child[0].id) : "";
+ }}
+ >
+ {_.isEmpty(e.child) ? (
+ ""
+ ) : (
+
+ {e.child.map((v, ii) => (
+
+ {v.name}}
+ onClick={() => {
+ setActive(e.id);
+ setActiveChild(v.id);
+ router.push(v.path);
+ }}
+ />
+
+ ))}
+
+ )}
+
+
+ ));
return (
<>
@@ -79,25 +110,7 @@ export default function AdminLayout({
p="xs"
bg={"gray.2"}
>
- {listAdminPage.map((e, i) => (
-
- {
- setActive(i);
- router.push(e.route);
- }}
- />
- {active === i ? : ""}
-
- ))}
+ {navbarItems}
}
@@ -135,7 +148,7 @@ export default function AdminLayout({
))}
*/}
-
+
@@ -148,7 +161,7 @@ export default function AdminLayout({
setOpened(false)} size={"50%"}>
{listAdminPage.map((e) => (
- router.push(e.route)}>
+ router.push(e.path)}>
{e.name}
))}
diff --git a/src/app_modules/admin/list_page.ts b/src/app_modules/admin/list_page.ts
new file mode 100644
index 00000000..94cd618d
--- /dev/null
+++ b/src/app_modules/admin/list_page.ts
@@ -0,0 +1,97 @@
+import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
+import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote";
+import {
+ RouterAdminDashboard,
+ RouterAdminDonasi,
+ RouterAdminInvestasi,
+} from "@/app/lib/router_hipmi/router_admin";
+
+export const listAdminPage = [
+ {
+ id: 1,
+ name: "Main Dashboard",
+ path: RouterAdminDashboard.main_admin,
+ child: [],
+ },
+ {
+ id: 2,
+ name: "Investasi",
+ path: RouterAdminInvestasi.main_investasi,
+ child: [],
+ },
+ {
+ id: 3,
+ name: "Donasi",
+ path: RouterAdminDonasi.main_donasi,
+ child: [],
+ },
+ {
+ id: 4,
+ name: "Event",
+ path: "",
+ child: [
+ {
+ id: 41,
+ name: "Dashboard",
+ path: RouterAdminEvent.main_event,
+ },
+ {
+ id: 42,
+ name: "Table Publish",
+ path: RouterAdminEvent.table_publish,
+ },
+ {
+ id: 43,
+ name: "Table Review",
+ path: RouterAdminEvent.table_review,
+ },
+ {
+ id: 44,
+ name: "Table Reject",
+ path: RouterAdminEvent.table_reject,
+ },
+ {
+ id: 45,
+ name: "Tipe Acara",
+ path: RouterAdminEvent.detail_tipe_acara,
+ },
+ {
+ id: 6,
+ name: "Riwayat",
+ path: RouterAdminEvent.detail_riwayat,
+ },
+ ],
+ },
+ {
+ id: 5,
+ name: "Voting",
+ path: "",
+ child: [
+ {
+ id: 51,
+ name: "Dashboard",
+ path: RouterAdminVote.main,
+ },
+ {
+ id: 52,
+ name: "Table Publish",
+ path: RouterAdminVote.table_publish,
+ },
+ {
+ id: 53,
+ name: "Table Review",
+ path: RouterAdminVote.table_review,
+ },
+ {
+ id: 54,
+ name: "Table Reject",
+ path: RouterAdminVote.table_reject,
+ },
+ {
+ id: 55,
+ name: "Riwayat",
+ path: RouterAdminVote.riwayat,
+ },
+ ],
+ },
+];
diff --git a/src/app_modules/admin/main_dashboard/index.tsx b/src/app_modules/admin/main_dashboard/index.tsx
index 415381b9..31206a44 100644
--- a/src/app_modules/admin/main_dashboard/index.tsx
+++ b/src/app_modules/admin/main_dashboard/index.tsx
@@ -1,5 +1,5 @@
import AdminMain from "./main/view";
-import AdminLayout from "./main/layout";
-import SplashDashboardAdmin from "./splash";
+import AdminLayout from "../layout";
+import SplashDashboardAdmin from "../splash/splash";
export { AdminMain, AdminLayout, SplashDashboardAdmin };
diff --git a/src/app_modules/admin/main_dashboard/splash.tsx b/src/app_modules/admin/main_dashboard/splash.tsx
deleted file mode 100644
index c492bb09..00000000
--- a/src/app_modules/admin/main_dashboard/splash.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-"use client";
-
-import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
-import { AspectRatio, Center, Image, Stack, Text, Title } from "@mantine/core";
-import { useShallowEffect } from "@mantine/hooks";
-import { useRouter } from "next/navigation";
-
-export default function SplashDashboardAdmin() {
- const router = useRouter();
- useShallowEffect(() => {
- setTimeout(() => router.push(RouterAdminDashboard.main_admin), 2000)
- }, []);
- return (
- <>
- {/*
-
- Selamat Datang, ADMIN
-
- HIPMI
-
- */}
-
-
-
-
- Welcome Admin
-
- >
- );
-}
diff --git a/src/app_modules/admin/splash/splash.tsx b/src/app_modules/admin/splash/splash.tsx
new file mode 100644
index 00000000..19f513f4
--- /dev/null
+++ b/src/app_modules/admin/splash/splash.tsx
@@ -0,0 +1,33 @@
+"use client";
+
+import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
+import { AspectRatio, Center, Image, Stack, Text, Title } from "@mantine/core";
+import { useShallowEffect } from "@mantine/hooks";
+import { useAtom } from "jotai";
+import { useRouter } from "next/navigation";
+import { gs_admin_hotMenu } from "../global_state";
+
+export default function SplashDashboardAdmin() {
+ const router = useRouter();
+ const [active, setActive] = useAtom(gs_admin_hotMenu);
+
+ useShallowEffect(() => {
+ setTimeout(() => {
+ router.push(RouterAdminDashboard.main_admin);
+ setActive(0);
+ }, 2000);
+ }, []);
+ return (
+ <>
+
+
+ Welcome Admin
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/admin/vote/child/riwayat/index.tsx b/src/app_modules/admin/vote/child/riwayat/index.tsx
new file mode 100644
index 00000000..e4de050e
--- /dev/null
+++ b/src/app_modules/admin/vote/child/riwayat/index.tsx
@@ -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 (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
+ const router = useRouter();
+ const [opened, { open, close }] = useDisclosure(false);
+ const [data, setData] = useState(listPublish);
+ const [peserta, setPeserta] = useState();
+ const [eventId, setEventId] = useState("");
+ const [loading, setLoading] = useState(false);
+
+ const TableRows = data.map((e, i) => (
+
+
+
+ }
+ onClick={() => ComponentGlobal_NotifikasiPeringatan("On Process")}
+ >
+ Hasil Voting
+
+
+
+
+ {e.title}
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+
+ {e.Voting_DaftarNamaVote.map((v) => (
+
+ - {v.value}
+
+ ))}
+
+
+
+
+ {e.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+
+ {e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+ Daftar Peserta
+
+
+ {peserta?.map((e) => (
+
+
+
+
+
+
+
+ {e.User.Profile.name}
+
+
+
+
+
+ ))}
+
+
+
+
+
+
+
+ RIWAYAT
+
+
+
+
+
+
+ Aksi
+
+
+ Judul
+
+
+ Deskripsi
+
+
+ Pilihan
+
+
+ Mulai Vote
+
+
+ Selesai Vote
+
+
+
+ {TableRows}
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/admin/vote/child/table_publish/index.tsx b/src/app_modules/admin/vote/child/table_publish/index.tsx
new file mode 100644
index 00000000..0c9236ec
--- /dev/null
+++ b/src/app_modules/admin/vote/child/table_publish/index.tsx
@@ -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 (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
+ const router = useRouter();
+ const [opened, { open, close }] = useDisclosure(false);
+ const [data, setData] = useState(listPublish);
+ const [peserta, setPeserta] = useState();
+ const [eventId, setEventId] = useState("");
+ const [loading, setLoading] = useState(false);
+
+ const TableRows = data.map((e, i) => (
+
+
+
+ }
+ onClick={() => ComponentGlobal_NotifikasiPeringatan("On Process")}
+ >
+ Lihat Hasil
+
+
+
+
+ {e.title}
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+
+ {e.Voting_DaftarNamaVote.map((v) => (
+
+ - {v.value}
+
+ ))}
+
+
+
+
+ {e.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+
+ {e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+ Daftar Peserta
+
+
+ {peserta?.map((e) => (
+
+
+
+
+
+
+
+ {e.User.Profile.name}
+
+
+
+
+
+ ))}
+
+
+
+
+
+
+
+ PUBLISH
+
+
+
+
+
+
+ Aksi
+
+
+ Judul
+
+
+ Deskripsi
+
+
+ Pilihan
+
+
+ Mulai Vote
+
+
+ Selesai Vote
+
+
+
+ {TableRows}
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/admin/vote/child/table_reject/index.tsx b/src/app_modules/admin/vote/child/table_reject/index.tsx
new file mode 100644
index 00000000..7f5f28d1
--- /dev/null
+++ b/src/app_modules/admin/vote/child/table_reject/index.tsx
@@ -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 (
+ <>
+
+
+
+
+ >
+ );
+}
+
+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) => (
+
+
+
+ }
+ radius={"xl"}
+ onClick={() => {
+ open();
+ setVotingId(e.id);
+ setCatatan(e.catatan);
+ }}
+ >
+
+ Tambah
+ Catatan
+
+
+
+
+
+
+
+ {e.catatan}
+
+
+
+
+ {e.title}
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+
+ {e.Voting_DaftarNamaVote.map((v) => (
+
+ - {v.value}
+
+ ))}
+
+
+
+
+ {e.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+
+ {e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+ REJECT
+
+
+
+
+
+
+
+
+ Aksi
+
+
+ Catatan
+
+
+
+ Judul
+
+
+ Deskripsi
+
+
+ Pilihan
+
+
+ Mulai Vote
+
+
+ Selesai Vote
+
+
+
+ {TableRows}
+
+
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
+
+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);
+ }
+ }
+ );
+}
diff --git a/src/app_modules/admin/vote/child/table_review/index.tsx b/src/app_modules/admin/vote/child/table_review/index.tsx
new file mode 100644
index 00000000..35dbce85
--- /dev/null
+++ b/src/app_modules/admin/vote/child/table_review/index.tsx
@@ -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 (
+ <>
+
+
+
+
+ >
+ );
+}
+
+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) => (
+
+
+ {e.title}
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+
+ {e.Voting_DaftarNamaVote.map((v) => (
+
+ - {v.value}
+
+ ))}
+
+
+
+
+ {e.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+
+ {e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
+
+
+
+
+
+ }
+ radius={"xl"}
+ onClick={() => onPublish(e.id, setData)}
+ >
+ Publish
+
+ }
+ radius={"xl"}
+ onClick={() => {
+ open();
+ setVotingId(e.id);
+ }}
+ >
+ Reject
+
+
+
+
+ ));
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+ REVIEW
+
+
+
+
+
+
+
+
+ Judul
+
+
+ Deskripsi
+
+
+ Pilihan
+
+
+ Mulai Vote
+
+
+ Selesai Vote
+
+
+
+ Aksi
+
+
+
+ {TableRows}
+
+
+
+
+ {_.isEmpty(TableRows) ? (
+
+ Tidak Ada Data
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
+
+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);
+ }
+ });
+}
diff --git a/src/app_modules/admin/vote/fun/count/fun_count_vote_by_status_id.ts b/src/app_modules/admin/vote/fun/count/fun_count_vote_by_status_id.ts
new file mode 100644
index 00000000..02fb1b3f
--- /dev/null
+++ b/src/app_modules/admin/vote/fun/count/fun_count_vote_by_status_id.ts
@@ -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",
+ };
+ }
+}
diff --git a/src/app_modules/admin/vote/fun/edit/fun_edit_catatan_reject_by_id.ts b/src/app_modules/admin/vote/fun/edit/fun_edit_catatan_reject_by_id.ts
new file mode 100644
index 00000000..ab52bf2f
--- /dev/null
+++ b/src/app_modules/admin/vote/fun/edit/fun_edit_catatan_reject_by_id.ts
@@ -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" };
+}
diff --git a/src/app_modules/admin/vote/fun/edit/fun_edit_status_publish_by_id.ts b/src/app_modules/admin/vote/fun/edit/fun_edit_status_publish_by_id.ts
new file mode 100644
index 00000000..1614b610
--- /dev/null
+++ b/src/app_modules/admin/vote/fun/edit/fun_edit_status_publish_by_id.ts
@@ -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",
+ };
+}
diff --git a/src/app_modules/admin/vote/fun/edit/fun_edit_status_reject_by_id.ts b/src/app_modules/admin/vote/fun/edit/fun_edit_status_reject_by_id.ts
new file mode 100644
index 00000000..5cb8cd46
--- /dev/null
+++ b/src/app_modules/admin/vote/fun/edit/fun_edit_status_reject_by_id.ts
@@ -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",
+ };
+}
diff --git a/src/app_modules/admin/vote/fun/get/get_list_table_by_status_id.ts b/src/app_modules/admin/vote/fun/get/get_list_table_by_status_id.ts
new file mode 100644
index 00000000..412090f7
--- /dev/null
+++ b/src/app_modules/admin/vote/fun/get/get_list_table_by_status_id.ts
@@ -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;
+ }
+
+
+}
diff --git a/src/app_modules/admin/vote/index.ts b/src/app_modules/admin/vote/index.ts
new file mode 100644
index 00000000..03485606
--- /dev/null
+++ b/src/app_modules/admin/vote/index.ts
@@ -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,
+};
diff --git a/src/app_modules/admin/vote/main/index.tsx b/src/app_modules/admin/vote/main/index.tsx
new file mode 100644
index 00000000..e0a757d0
--- /dev/null
+++ b/src/app_modules/admin/vote/main/index.tsx
@@ -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 (
+ <>
+
+
+
+
+ {listStatus.map((e, i) => (
+
+
+
+ {e.name}
+ {e.jumlah ? e.jumlah : 0}
+
+
+
+ ))}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/auth/logout/view.tsx b/src/app_modules/auth/logout/view.tsx
index 6faa0604..58ffe935 100644
--- a/src/app_modules/auth/logout/view.tsx
+++ b/src/app_modules/auth/logout/view.tsx
@@ -8,6 +8,7 @@ import { gs_nomor, gs_otp } from "../state/state";
import { IconLogout } from "@tabler/icons-react";
import { Warna } from "@/app/lib/warna";
import { useDisclosure } from "@mantine/hooks";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
export default function User_Logout() {
const router = useRouter();
@@ -24,6 +25,7 @@ export default function User_Logout() {
setnomor(null);
setCode(null);
+ ComponentGlobal_NotifikasiBerhasil("Anda Berhasil Logout")
return router.push("/dev/auth/login");
}
});
diff --git a/src/app_modules/component_global/author_name_on_header.tsx b/src/app_modules/component_global/author_name_on_header.tsx
new file mode 100644
index 00000000..a6a42a24
--- /dev/null
+++ b/src/app_modules/component_global/author_name_on_header.tsx
@@ -0,0 +1,56 @@
+"use client";
+
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import { Stack, Grid, Avatar, Divider, Text } from "@mantine/core";
+import { useRouter } from "next/navigation";
+import { ComponentGlobal_NotifikasiPeringatan } from "./notif_global/notifikasi_peringatan";
+
+export default function ComponentGlobal_AuthorNameOnHeader({
+ profileId,
+ imagesId,
+ authorName,
+}: {
+ profileId?: string;
+ imagesId?: string;
+ authorName?: string;
+}) {
+ const router = useRouter();
+ return (
+ <>
+
+
+ {
+ if (profileId) {
+ router.push(RouterProfile.katalog + profileId);
+ } else {
+ ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan");
+ }
+ }}
+ >
+
+
+
+
+
+ {authorName ? authorName : "Nama author"}
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/component_global/notif_global/notifikasi_berhasil.tsx b/src/app_modules/component_global/notif_global/notifikasi_berhasil.tsx
index 6635a173..e60f1099 100644
--- a/src/app_modules/component_global/notif_global/notifikasi_berhasil.tsx
+++ b/src/app_modules/component_global/notif_global/notifikasi_berhasil.tsx
@@ -1,14 +1,23 @@
import { Center, Text } from "@mantine/core";
import { notifications } from "@mantine/notifications";
-import { IconAlertTriangle, IconChecklist, IconCircleCheck } from "@tabler/icons-react";
+import {
+ IconAlertTriangle,
+ IconChecklist,
+ IconCircleCheck,
+} from "@tabler/icons-react";
/**
- *
+ *
* @param text | masukan text untuk peringatan
* @type string
- * @returns notifikasi peringatan
+ * @param durasi | durasi autoClose
+ * @type number
+ * @returns notifikasi berhasil warna hijau
*/
-export async function ComponentGlobal_NotifikasiBerhasil(text: string) {
+export async function ComponentGlobal_NotifikasiBerhasil(
+ text: string,
+ durasi?: number
+) {
return notifications.show({
message: (
@@ -17,7 +26,7 @@ export async function ComponentGlobal_NotifikasiBerhasil(text: string) {
),
color: "green",
radius: "md",
- autoClose: 1000,
+ autoClose: durasi ? durasi : 1000,
icon: ,
withCloseButton: false,
diff --git a/src/app_modules/donasi/fun/get/get_notif_by_user_id.ts b/src/app_modules/donasi/fun/get/get_notif_by_user_id.ts
index 75411f84..f7c05c8e 100644
--- a/src/app_modules/donasi/fun/get/get_notif_by_user_id.ts
+++ b/src/app_modules/donasi/fun/get/get_notif_by_user_id.ts
@@ -3,12 +3,6 @@
import prisma from "@/app/lib/prisma";
export async function Donasi_getNotifByUserId(userId: string) {
- const dataInvoice = await prisma.donasi_Invoice.findFirst({
- where: {
- authorId: userId
- }
- })
-
// console.log(dataInvoice)
// return null
@@ -22,10 +16,10 @@ export async function Donasi_getNotifByUserId(userId: string) {
select: {
id: true,
isRead: true,
- active: true,
- createdAt: true,
- donasi_KabarId: true,
- Donasi_Kabar: true,
+ // active: true,
+ // createdAt: true,
+ // donasi_KabarId: true,
+ // Donasi_Kabar: true,
},
});
return dataNotif;
diff --git a/src/app_modules/donasi/main/notif/notif_page.tsx b/src/app_modules/donasi/main/notif/notif_page.tsx
index 87542a88..2aa9922f 100644
--- a/src/app_modules/donasi/main/notif/notif_page.tsx
+++ b/src/app_modules/donasi/main/notif/notif_page.tsx
@@ -50,16 +50,16 @@ export default function Donasi_NotifPage({
- {e.Donasi_Kabar.title}
+ {e.Donasi_Kabar?.title}
{moment(e.createdAt).format("ll")}
- {e.Donasi_Kabar.deskripsi}
+ {e.Donasi_Kabar?.deskripsi}
- onClick(router as any, e.Donasi_Kabar.id, e.id)
+ onClick(router as any, e.Donasi_Kabar?.id, e.id)
}
>
Buka Kabar
diff --git a/src/app_modules/donasi/model/interface.ts b/src/app_modules/donasi/model/interface.ts
index 8bfac74d..282e1d02 100644
--- a/src/app_modules/donasi/model/interface.ts
+++ b/src/app_modules/donasi/model/interface.ts
@@ -1,6 +1,6 @@
import { MODEL_USER } from "@/app_modules/home/model/interface";
import { Model_Nama_Bank } from "@/app_modules/investasi/model/model_investasi";
-import { MODEL_IMAGES } from "@/app_modules/models/interface";
+import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
export interface MODEL_DONASI {
id: string;
diff --git a/src/app_modules/event/component/box_list_status.tsx b/src/app_modules/event/component/box_list_status.tsx
new file mode 100644
index 00000000..a53c04d7
--- /dev/null
+++ b/src/app_modules/event/component/box_list_status.tsx
@@ -0,0 +1,48 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { Paper, Stack, Group, Title, Text, Grid } from "@mantine/core";
+import moment from "moment";
+import { MODEL_EVENT } from "../model/interface";
+import { useRouter } from "next/navigation";
+
+export default function ComponentEvent_BoxListStatus({
+ data,
+ path,
+}: {
+ data: MODEL_EVENT;
+ path: string;
+}) {
+ const router = useRouter();
+ return (
+ <>
+ router.push(path + data.id)}
+ >
+
+
+
+
+ {data.title}
+
+
+
+
+ {moment(data.tanggal).format("ll")}
+
+
+
+
+
+ {data.deskripsi}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/component/catatan_reject.tsx b/src/app_modules/event/component/catatan_reject.tsx
new file mode 100644
index 00000000..2196f607
--- /dev/null
+++ b/src/app_modules/event/component/catatan_reject.tsx
@@ -0,0 +1,18 @@
+"use client"
+
+import { Paper, Stack, Text } from "@mantine/core"
+
+export default function ComponentEvent_CatatanReject({catatan}: {catatan:string}){
+ return<>
+
+
+
+ * Alasan Penolakan
+
+
+ {catatan}
+
+
+
+ >
+}
\ No newline at end of file
diff --git a/src/app_modules/event/component/detail/detail_data.tsx b/src/app_modules/event/component/detail/detail_data.tsx
new file mode 100644
index 00000000..be67a372
--- /dev/null
+++ b/src/app_modules/event/component/detail/detail_data.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { Stack, Title, Grid, Text, Paper, Spoiler } from "@mantine/core";
+import moment from "moment";
+import { MODEL_EVENT } from "../../model/interface";
+
+export default function ComponentEvent_DetailData({
+ data,
+}: {
+ data: MODEL_EVENT;
+}) {
+ const tgl = data.tanggal;
+ const hari = tgl.toLocaleString("id-ID", { dateStyle: "full" });
+
+ const jam = tgl.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ });
+
+ return (
+ <>
+
+
+ {data ? data?.title : null}
+
+
+
+ Lokasi
+
+
+ :
+
+ {data ? data?.lokasi : null}
+
+
+
+
+
+ Tipe Acara
+
+
+ :
+
+ {data ? data.EventMaster_TipeAcara?.name : null}
+
+
+
+
+
+ Tanggal
+
+
+ :
+ {hari}
+
+
+
+
+ Jam
+
+
+ :
+ {jam}
+
+
+
+ Deskripsi
+
+
+ {data ? data?.deskripsi : null}
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/component/detail/detail_main.tsx b/src/app_modules/event/component/detail/detail_main.tsx
new file mode 100644
index 00000000..08d49828
--- /dev/null
+++ b/src/app_modules/event/component/detail/detail_main.tsx
@@ -0,0 +1,90 @@
+"use client";
+
+import { Stack, Title, Grid, Text, Paper, Spoiler } from "@mantine/core";
+import moment from "moment";
+import { MODEL_EVENT } from "../../model/interface";
+import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
+
+export default function ComponentEvent_DetailMainData({
+ data,
+}: {
+ data: MODEL_EVENT;
+}) {
+ const tgl = data.tanggal;
+ const hari = tgl.toLocaleString("id-ID", { dateStyle: "full" });
+
+ const jam = tgl.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ });
+
+ return (
+ <>
+
+
+
+
+ {data ? data.title : null}
+
+
+
+ Lokasi
+
+
+ :
+
+ {data ? data.lokasi : null}
+
+
+
+
+
+ Tipe Acara
+
+
+ :
+
+ {data ? data.EventMaster_TipeAcara.name : null}
+
+
+
+
+
+ Tanggal
+
+
+ :
+ {hari}
+
+
+
+
+ Jam
+
+
+ :
+ {jam}
+
+
+
+ Deskripsi
+
+
+ {data ? data.deskripsi : null}
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/component/detail/list_peserta.tsx b/src/app_modules/event/component/detail/list_peserta.tsx
new file mode 100644
index 00000000..6bf23b29
--- /dev/null
+++ b/src/app_modules/event/component/detail/list_peserta.tsx
@@ -0,0 +1,79 @@
+"use client";
+
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import {
+ Paper,
+ Stack,
+ Center,
+ Title,
+ Grid,
+ Avatar,
+ Divider,
+ Text,
+} from "@mantine/core";
+import _ from "lodash";
+
+import peserta from "../../main/kontribusi/peserta";
+import { MODEL_EVENT_PESERTA } from "../../model/interface";
+import { useRouter } from "next/navigation";
+
+export default function ComponentEvent_ListPeserta({
+ listPeserta,
+ total,
+}: {
+ listPeserta: MODEL_EVENT_PESERTA[];
+ total: number;
+}) {
+ const router = useRouter()
+ return (
+ <>
+
+
+
+ Daftar Peserta ({total})
+
+
+ {_.isEmpty(listPeserta) ? (
+
+
+ - Tidak ada peserta -
+
+
+ ) : (
+
+ {listPeserta.map((e, i) => (
+
+
+ {
+ router.push(RouterProfile.katalog + e.User.Profile.id);
+ }}
+ >
+
+
+
+
+ {e.User.Profile.name}
+
+
+
+
+
+ ))}
+
+ )}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/component/error_maksimal_input.tsx b/src/app_modules/event/component/error_maksimal_input.tsx
new file mode 100644
index 00000000..2118cc1d
--- /dev/null
+++ b/src/app_modules/event/component/error_maksimal_input.tsx
@@ -0,0 +1,17 @@
+"use client"
+
+import { Group, Text } from "@mantine/core";
+import { IconAlertTriangle } from "@tabler/icons-react";
+
+export default function ComponentEvent_ErrorMaximalInput({max}:{max: number}){
+ return (
+ <>
+
+
+
+ Maksimal {max} karakter !
+
+
+ >
+ );
+}
\ No newline at end of file
diff --git a/src/app_modules/event/component/header_tamplate.tsx b/src/app_modules/event/component/header_tamplate.tsx
new file mode 100644
index 00000000..51d8ac70
--- /dev/null
+++ b/src/app_modules/event/component/header_tamplate.tsx
@@ -0,0 +1,69 @@
+"use client";
+
+import { Header, Group, ActionIcon, Text, Title } from "@mantine/core";
+import { IconArrowLeft, IconChevronLeft } from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+
+export default function ComponentEvent_HeaderTamplate({
+ hideBack,
+ changeIconBack,
+ route,
+ route2,
+ title,
+ icon,
+ bg,
+}: {
+ hideBack?: boolean;
+ changeIconBack?: any
+ route?: any;
+ route2?: any;
+ title: string;
+ icon?: any;
+ bg?: any;
+}) {
+ const router = useRouter();
+ return (
+ <>
+
+
+ {hideBack ? (
+
+ ) : (
+ {
+ if (route === null || route === undefined) {
+ return router.back();
+ } else {
+ return router.push(route);
+ }
+ }}
+ >
+ {changeIconBack ? changeIconBack: }
+
+ )}
+ {title}
+ {(() => {
+ if (route2 === null || route2 === undefined) {
+ return ;
+ } else {
+ return (
+ router.push(route2)}
+ >
+ {icon}
+
+ );
+ }
+ })()}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/create/create.tsx b/src/app_modules/event/create/create.tsx
new file mode 100644
index 00000000..0edcb1ec
--- /dev/null
+++ b/src/app_modules/event/create/create.tsx
@@ -0,0 +1,199 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { MODEL_USER } from "@/app_modules/home/model/interface";
+import {
+ AspectRatio,
+ Avatar,
+ Box,
+ Button,
+ Center,
+ FileButton,
+ Image,
+ MultiSelect,
+ Paper,
+ Select,
+ Stack,
+ Text,
+ TextInput,
+ Textarea,
+} from "@mantine/core";
+import { DateInput, DatePicker, DateTimePicker } from "@mantine/dates";
+import { TimeInput } from "@mantine/dates";
+import { IconCamera } from "@tabler/icons-react";
+import { useAtom } from "jotai";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { gs_event_hotMenu, gs_event_status } from "../global_state";
+import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
+import { Event_funCreate } from "../fun/create/fun_create";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import { kMaxLength } from "buffer";
+import _ from "lodash";
+import toast from "react-simple-toasts";
+import moment from "moment";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
+
+export default function Event_Create({
+ listTipeAcara,
+ authorId,
+}: {
+ listTipeAcara: MODEL_DEFAULT_MASTER[];
+ authorId: string;
+}) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
+ const [listTipe, setListTipe] = useState(listTipeAcara);
+ const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
+
+ // Masimal karakter state
+ const [maxTitle, setMaxTitle] = useState("");
+ const [maxLokasi, setMaxLokasi] = useState("");
+ const [maxDeskripsi, setMaxDeskripsi] = useState("");
+
+ const [value, setValue] = useState({
+ title: "",
+ lokasi: "",
+ deskripsi: "",
+ tanggal: Date,
+ eventMaster_TipeAcaraId: 0,
+ authorId: authorId,
+ });
+
+ return (
+ <>
+
+ = 100 ? (
+
+ ) : (
+ ""
+ )
+ }
+ onChange={(val) => {
+ setMaxTitle(val.target.value);
+ setValue({
+ ...value,
+ title: val.target.value,
+ });
+ }}
+ />
+
+ ({
+ value: e.id,
+ label: e.name,
+ }))}
+ onChange={(val: any) =>
+ setValue({
+ ...value,
+ eventMaster_TipeAcaraId: val,
+ })
+ }
+ />
+
+ = 200 ? (
+
+ ) : (
+ ""
+ )
+ }
+ onChange={(val) => {
+ setMaxLokasi(val.target.value);
+ setValue({
+ ...value,
+ lokasi: val.target.value,
+ });
+ }}
+ />
+ {
+ // console.log(moment().diff(moment("2024-02-01"), "days"));
+ // }}
+ excludeDate={(date) => {
+ return moment(date).diff(Date.now(), "days") < 0;
+ }}
+ withAsterisk
+ label="Tanggal & Waktu "
+ placeholder="Masukan tangal dan waktu acara"
+ onChange={(val: any) =>
+ setValue({
+ ...value,
+ tanggal: val,
+ })
+ }
+ />
+
+ >
+ );
+}
+
+async function onSave(
+ router: AppRouterInstance,
+ setTabsStatus: any,
+ value: any,
+ setHotMenu: any
+) {
+ if (_.values(value).includes(""))
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
+ if (value.eventMaster_TipeAcaraId === 0)
+ return ComponentGlobal_NotifikasiPeringatan("Pilih Tipe Acara");
+ if (moment(value.tanggal).format() === "Invalid date")
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Tanggal");
+ await Event_funCreate(value).then((res) => {
+ if (res.status === 201) {
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ setTabsStatus("Review");
+ setHotMenu(1);
+ router.push(RouterEvent.status_page);
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/create/layout.tsx b/src/app_modules/event/create/layout.tsx
new file mode 100644
index 00000000..7833add2
--- /dev/null
+++ b/src/app_modules/event/create/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../component/header_tamplate";
+
+export default function LayoutEvent_Create({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/draft/index.tsx b/src/app_modules/event/detail/draft/index.tsx
new file mode 100644
index 00000000..804dcd77
--- /dev/null
+++ b/src/app_modules/event/detail/draft/index.tsx
@@ -0,0 +1,61 @@
+"use client";
+
+import { Button, Stack } from "@mantine/core";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { useRouter } from "next/navigation";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useAtom } from "jotai";
+import { gs_event_status } from "../../global_state";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { MODEL_EVENT } from "../../model/interface";
+import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import { useState } from "react";
+import ComponentEvent_CatatanReject from "../../component/catatan_reject";
+
+export default function Event_DetailDraft({
+ dataEvent,
+}: {
+ dataEvent: MODEL_EVENT;
+}) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
+ return (
+ <>
+ {/* {JSON.stringify(dataEvent.catatan)} */}
+
+ {dataEvent.catatan ? (
+
+ ) : (
+ ""
+ )}
+
+ {
+ onClick(router, setTabsStatus, dataEvent.id);
+ }}
+ >
+ Ajukan Review
+
+
+ >
+ );
+}
+
+async function onClick(
+ router: AppRouterInstance,
+ setTabsStatus: any,
+ eventId: string
+) {
+ await Event_funEditStatusById("2", eventId).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
+ setTabsStatus("Review");
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/detail/draft/layout.tsx b/src/app_modules/event/detail/draft/layout.tsx
new file mode 100644
index 00000000..30b68d10
--- /dev/null
+++ b/src/app_modules/event/detail/draft/layout.tsx
@@ -0,0 +1,25 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+import { IconEdit } from "@tabler/icons-react";
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+
+export default function LayoutEvent_DetailDraft({
+ children,
+ eventId
+}: {
+ children: React.ReactNode;
+ eventId: string
+}) {
+ return (
+ <>
+ } route2={RouterEvent.edit + eventId}/>}
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/kontribusi/index.tsx b/src/app_modules/event/detail/kontribusi/index.tsx
new file mode 100644
index 00000000..ef4c67f0
--- /dev/null
+++ b/src/app_modules/event/detail/kontribusi/index.tsx
@@ -0,0 +1,63 @@
+"use client";
+
+import {
+ Avatar,
+ Center,
+ Divider,
+ Grid,
+ Paper,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { MODEL_EVENT, MODEL_EVENT_PESERTA } from "../../model/interface";
+import { useState } from "react";
+import ComponentEvent_DetailMainData from "../../component/detail/detail_main";
+import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
+
+export default function Event_DetailKontribusi({
+ dataEvent,
+ listKontributor,
+ totalPeserta,
+}: {
+ dataEvent: MODEL_EVENT;
+ listKontributor: MODEL_EVENT_PESERTA[];
+ totalPeserta: number;
+}) {
+ return (
+ <>
+
+
+
+ {/*
+
+
+ Daftar Peserta
+
+
+ {peserta
+ .map((e, i) => (
+
+
+
+
+
+
+
+ Nama peserta
+
+
+
+
+
+ ))}
+
+ */}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/kontribusi/layout.tsx b/src/app_modules/event/detail/kontribusi/layout.tsx
new file mode 100644
index 00000000..eacf0262
--- /dev/null
+++ b/src/app_modules/event/detail/kontribusi/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutEvent_DetailKontribusi({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/main_detail/index.tsx b/src/app_modules/event/detail/main_detail/index.tsx
new file mode 100644
index 00000000..0d25d48c
--- /dev/null
+++ b/src/app_modules/event/detail/main_detail/index.tsx
@@ -0,0 +1,145 @@
+"use client";
+
+import {
+ Avatar,
+ Box,
+ Button,
+ Center,
+ Divider,
+ Grid,
+ Paper,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { MODEL_EVENT, MODEL_EVENT_PESERTA } from "../../model/interface";
+import _ from "lodash";
+import { Event_funJoinEvent } from "../../fun/create/fun_join_event";
+import { useState } from "react";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { Event_getListPesertaById } from "../../fun/get/get_list_peserta_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import ComponentEvent_DetailMainData from "../../component/detail/detail_main";
+import { useRouter } from "next/navigation";
+import { Event_countTotalPesertaById } from "../../fun/count/count_total_peserta_by_id";
+import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
+
+export default function Event_DetailMain({
+ dataEvent,
+ listPeserta,
+ userLoginId,
+ isJoin,
+ totalPeserta,
+}: {
+ dataEvent: MODEL_EVENT;
+ listPeserta: MODEL_EVENT_PESERTA[];
+ userLoginId: string;
+ isJoin: boolean;
+ totalPeserta: number;
+}) {
+ const router = useRouter();
+ const [total, setTotal] = useState(totalPeserta);
+ const [peserta, setPeserta] = useState(listPeserta);
+ return (
+ <>
+
+
+ {isJoin ? (
+
+ Anda Telah Ikut Serta
+
+ ) : (
+ {
+ onJoin(userLoginId, dataEvent.id, setPeserta, setTotal);
+ }}
+ >
+ JOIN
+
+ )}
+
+
+ {/*
+
+
+ Daftar Peserta ({total})
+
+
+ {_.isEmpty(peserta) ? (
+
+
+ - Tidak ada peserta -
+
+
+ ) : (
+
+ {peserta.map((e, i) => (
+
+
+ {
+ router.push(
+ RouterProfile.katalog + e.User.Profile.id
+ );
+ }}
+ >
+
+
+
+
+ {e.User.Profile.name}
+
+
+
+
+
+ ))}
+
+ )}
+
+ */}
+
+ >
+ );
+}
+
+async function onJoin(
+ userId: string,
+ eventId: string,
+ setPeserta: any,
+ setTotal: any
+) {
+ const body = {
+ userId: userId,
+ eventId: eventId,
+ };
+
+ await Event_funJoinEvent(body as any).then(async (res) => {
+ if (res.status === 200) {
+ await Event_getListPesertaById(eventId).then(async (val) => {
+ await Event_countTotalPesertaById(eventId).then((ttl) => {
+ setPeserta(val);
+ setTotal(ttl);
+ ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
+ });
+ });
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/detail/main_detail/layout.tsx b/src/app_modules/event/detail/main_detail/layout.tsx
new file mode 100644
index 00000000..0f21855e
--- /dev/null
+++ b/src/app_modules/event/detail/main_detail/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutEvent_DetailMain({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/publish/index.tsx b/src/app_modules/event/detail/publish/index.tsx
new file mode 100644
index 00000000..006013de
--- /dev/null
+++ b/src/app_modules/event/detail/publish/index.tsx
@@ -0,0 +1,18 @@
+"use client";
+
+import { Button, Grid, Group, Stack, Text, Title } from "@mantine/core";
+import moment from "moment";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { MODEL_EVENT } from "../../model/interface";
+
+export default function Event_DetailPublish({
+ dataEvent,
+}: {
+ dataEvent: MODEL_EVENT;
+}) {
+ return (
+ <>
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/publish/layout.tsx b/src/app_modules/event/detail/publish/layout.tsx
new file mode 100644
index 00000000..8b599304
--- /dev/null
+++ b/src/app_modules/event/detail/publish/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutEvent_DetailPublish({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/reject/index.tsx b/src/app_modules/event/detail/reject/index.tsx
new file mode 100644
index 00000000..0470468c
--- /dev/null
+++ b/src/app_modules/event/detail/reject/index.tsx
@@ -0,0 +1,109 @@
+"use client";
+
+import {
+ Box,
+ Button,
+ Grid,
+ Group,
+ Modal,
+ Paper,
+ SimpleGrid,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { useRouter } from "next/navigation";
+import { useAtom } from "jotai";
+import { gs_event_status } from "../../global_state";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { useDisclosure } from "@mantine/hooks";
+import { MODEL_EVENT } from "../../model/interface";
+import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import ComponentEvent_CatatanReject from "../../component/catatan_reject";
+import { Event_funDeleteById } from "../../fun/delete/fun_delete";
+
+export default function Event_DetailReject({
+ dataEvent,
+}: {
+ dataEvent: MODEL_EVENT;
+}) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
+ const [opened, { open, close }] = useDisclosure(false);
+
+ return (
+ <>
+
+
+
+
+ onUpdate(router, setTabsStatus, dataEvent.id)}
+ >
+ Edit Kembali
+
+ open()}>
+ Hapus
+
+
+
+
+
+ Yakin akan menghapus event ini?
+
+
+ Batal
+
+ {
+ onDelete(router, dataEvent.id, close);
+ close();
+ router.back();
+ }}
+ color="red"
+ >
+ Hapus
+
+
+
+
+ >
+ );
+}
+
+async function onUpdate(
+ router: AppRouterInstance,
+ setTabsStatus: any,
+ eventId: string
+) {
+ await Event_funEditStatusById("3", eventId).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ setTabsStatus("Draft");
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
+
+async function onDelete(
+ router: AppRouterInstance,
+ eventId: string,
+ close: any
+) {
+ await Event_funDeleteById(eventId).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/detail/reject/layout.tsx b/src/app_modules/event/detail/reject/layout.tsx
new file mode 100644
index 00000000..dcac00c7
--- /dev/null
+++ b/src/app_modules/event/detail/reject/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutEvent_DetailReject({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/review/index.tsx b/src/app_modules/event/detail/review/index.tsx
new file mode 100644
index 00000000..466299f5
--- /dev/null
+++ b/src/app_modules/event/detail/review/index.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import { Button, Stack } from "@mantine/core";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { useRouter } from "next/navigation";
+import { useAtom } from "jotai";
+import { gs_event_status } from "../../global_state";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { MODEL_EVENT } from "../../model/interface";
+import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import ComponentEvent_CatatanReject from "../../component/catatan_reject";
+
+export default function Event_DetailReview({
+ dataEvent,
+}: {
+ dataEvent: MODEL_EVENT;
+}) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
+
+ return (
+ <>
+
+
+ onClick(router, setTabsStatus, dataEvent.id)}
+ >
+ Batalkan Review
+
+
+ >
+ );
+}
+
+async function onClick(
+ router: AppRouterInstance,
+ setTabsStatus: any,
+ eventId: string
+) {
+ await Event_funEditStatusById("3", eventId).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
+ setTabsStatus("Draft");
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/detail/review/layout.tsx b/src/app_modules/event/detail/review/layout.tsx
new file mode 100644
index 00000000..3f5ba81d
--- /dev/null
+++ b/src/app_modules/event/detail/review/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutEvent_DetailReview({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/detail/riwayat/index.tsx b/src/app_modules/event/detail/riwayat/index.tsx
new file mode 100644
index 00000000..e8715392
--- /dev/null
+++ b/src/app_modules/event/detail/riwayat/index.tsx
@@ -0,0 +1,76 @@
+"use client";
+
+import {
+ Avatar,
+ Box,
+ Button,
+ Center,
+ Divider,
+ Grid,
+ Paper,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import ComponentEvent_DetailData from "../../component/detail/detail_data";
+import { MODEL_EVENT, MODEL_EVENT_PESERTA } from "../../model/interface";
+import _ from "lodash";
+import { Event_funJoinEvent } from "../../fun/create/fun_join_event";
+import { useState } from "react";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { Event_getListPesertaById } from "../../fun/get/get_list_peserta_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import ComponentEvent_DetailMainData from "../../component/detail/detail_main";
+import { useRouter } from "next/navigation";
+import { Event_countTotalPesertaById } from "../../fun/count/count_total_peserta_by_id";
+import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
+
+export default function Event_DetailRiwayat({
+ dataEvent,
+ listPeserta,
+ totalPeserta,
+}: {
+ dataEvent: MODEL_EVENT;
+ listPeserta: MODEL_EVENT_PESERTA[];
+ totalPeserta: number;
+}) {
+ const router = useRouter();
+ const [total, setTotal] = useState(totalPeserta);
+ const [peserta, setPeserta] = useState(listPeserta);
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+async function onJoin(
+ userId: string,
+ eventId: string,
+ setPeserta: any,
+ setTotal: any
+) {
+ const body = {
+ userId: userId,
+ eventId: eventId,
+ };
+
+ await Event_funJoinEvent(body as any).then(async (res) => {
+ if (res.status === 200) {
+ await Event_getListPesertaById(eventId).then(async (val) => {
+ await Event_countTotalPesertaById(eventId).then((ttl) => {
+ setPeserta(val);
+ setTotal(ttl);
+ ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
+ });
+ });
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/detail/riwayat/layout.tsx b/src/app_modules/event/detail/riwayat/layout.tsx
new file mode 100644
index 00000000..189f3554
--- /dev/null
+++ b/src/app_modules/event/detail/riwayat/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutEvent_DetailRiwayat({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/edit/index.tsx b/src/app_modules/event/edit/index.tsx
new file mode 100644
index 00000000..7f121764
--- /dev/null
+++ b/src/app_modules/event/edit/index.tsx
@@ -0,0 +1,166 @@
+"use client";
+
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import {
+ Stack,
+ TextInput,
+ Textarea,
+ Button,
+ Select,
+ Text,
+ Group,
+} from "@mantine/core";
+import { DateTimePicker } from "@mantine/dates";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useRouter } from "next/navigation";
+import { MODEL_EVENT } from "../model/interface";
+import { useState } from "react";
+import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
+import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import moment from "moment";
+import _ from "lodash";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+import { IconAlertTriangle } from "@tabler/icons-react";
+import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
+
+export default function Event_Edit({
+ dataEvent,
+ listTipeAcara,
+}: {
+ dataEvent: MODEL_EVENT;
+ listTipeAcara: MODEL_DEFAULT_MASTER[];
+}) {
+ const router = useRouter();
+ const [value, setValue] = useState(dataEvent);
+ const [tipe, setTipe] = useState(listTipeAcara);
+
+ // Masimal karakter state
+ const [maxTitle, setMaxTitle] = useState("");
+ const [maxLokasi, setMaxLokasi] = useState("");
+ const [maxDeskripsi, setMaxDeskripsi] = useState("");
+ return (
+ <>
+ {/* {JSON.stringify(value, null, 2)} */}
+
+ = 100 ? (
+
+ ) : (
+ ""
+ )
+ }
+ onChange={(val) => {
+ setMaxTitle(val.target.value);
+ setValue({
+ ...value,
+ title: val.target.value,
+ });
+ }}
+ />
+
+ ({
+ value: e.id,
+ label: e.name,
+ }))}
+ value={value.EventMaster_TipeAcara.id}
+ onChange={(val) => {
+ setValue({
+ ...(value as any),
+ EventMaster_TipeAcara: {
+ id: val,
+ },
+ });
+ }}
+ />
+
+ = 200 ? (
+
+ ) : (
+ ""
+ )
+ }
+ onChange={(val) => {
+ setMaxLokasi(val.target.value);
+ setValue({
+ ...value,
+ lokasi: val.target.value,
+ });
+ }}
+ />
+ {
+ return moment(date).diff(Date.now(), "days") < 0;
+ }}
+ withAsterisk
+ label="Tanggal & Waktu "
+ placeholder="Masukan tangal dan waktu acara"
+ value={value.tanggal}
+ onChange={(val) => {
+ setValue({
+ ...(value as any),
+ tanggal: val,
+ });
+ }}
+ />
+
+ >
+ );
+}
+
+async function onUpdate(router: AppRouterInstance, value: MODEL_EVENT) {
+ if (_.values(value).includes(""))
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
+
+ await Event_funEditById(value).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/event/edit/layout.tsx b/src/app_modules/event/edit/layout.tsx
new file mode 100644
index 00000000..2d883e16
--- /dev/null
+++ b/src/app_modules/event/edit/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentEvent_HeaderTamplate from "../component/header_tamplate";
+
+export default function LayoutEvent_Edit({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/fun/count/count_total_peserta_by_id.ts b/src/app_modules/event/fun/count/count_total_peserta_by_id.ts
new file mode 100644
index 00000000..2b806008
--- /dev/null
+++ b/src/app_modules/event/fun/count/count_total_peserta_by_id.ts
@@ -0,0 +1,13 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Event_countTotalPesertaById(eventId: string) {
+ const data = await prisma.event_Peserta.count({
+ where: {
+ eventId: eventId,
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/create/fun_create.ts b/src/app_modules/event/fun/create/fun_create.ts
new file mode 100644
index 00000000..327c0e82
--- /dev/null
+++ b/src/app_modules/event/fun/create/fun_create.ts
@@ -0,0 +1,25 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { MODEL_EVENT } from "../../model/interface";
+import { revalidatePath } from "next/cache";
+
+export async function Event_funCreate(req: MODEL_EVENT) {
+ const res = await prisma.event.create({
+ data: {
+ title: req.title,
+ lokasi: req.lokasi,
+ deskripsi: req.deskripsi,
+ eventMaster_TipeAcaraId: req.eventMaster_TipeAcaraId,
+ tanggal: req.tanggal,
+ authorId: req.authorId,
+ },
+ });
+
+ if (!res) return { status: 400, message: "Gagal Disimpan" };
+ revalidatePath("/dev/event/main/status_page");
+ return {
+ status: 201,
+ message: "Berhasil Disimpan",
+ };
+}
diff --git a/src/app_modules/event/fun/create/fun_join_event.ts b/src/app_modules/event/fun/create/fun_join_event.ts
new file mode 100644
index 00000000..1575f228
--- /dev/null
+++ b/src/app_modules/event/fun/create/fun_join_event.ts
@@ -0,0 +1,21 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { MODEL_EVENT_PESERTA } from "../../model/interface";
+import { revalidatePath } from "next/cache";
+
+export async function Event_funJoinEvent(data: MODEL_EVENT_PESERTA) {
+ const crt = await prisma.event_Peserta.create({
+ data: {
+ eventId: data.eventId,
+ userId: data.userId,
+ },
+ });
+
+ if (!crt) return { status: 400, message: "Gagal Join" };
+ revalidatePath("/dev/event/detail/main");
+ return {
+ status: 200,
+ message: "Berhasil Join",
+ };
+}
diff --git a/src/app_modules/event/fun/delete/fun_delete.ts b/src/app_modules/event/fun/delete/fun_delete.ts
new file mode 100644
index 00000000..f2a891d0
--- /dev/null
+++ b/src/app_modules/event/fun/delete/fun_delete.ts
@@ -0,0 +1,19 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { revalidatePath } from "next/cache";
+
+export async function Event_funDeleteById(eventId: string) {
+ const del = await prisma.event.delete({
+ where: {
+ id: eventId,
+ },
+ });
+
+ if (!del) return { status: 400, message: "Gagal hapus data" };
+ revalidatePath("/dev/event/main/status_page");
+ return {
+ status: 200,
+ message: "Hapus data berhasil",
+ };
+}
diff --git a/src/app_modules/event/fun/edit/fun_edit_by_id.ts b/src/app_modules/event/fun/edit/fun_edit_by_id.ts
new file mode 100644
index 00000000..b23c8253
--- /dev/null
+++ b/src/app_modules/event/fun/edit/fun_edit_by_id.ts
@@ -0,0 +1,27 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { MODEL_EVENT } from "../../model/interface";
+import { revalidatePath } from "next/cache";
+
+export async function Event_funEditById(data: MODEL_EVENT) {
+ const updt = await prisma.event.update({
+ where: {
+ id: data.id,
+ },
+ data: {
+ title: data.title,
+ lokasi: data.lokasi,
+ deskripsi: data.deskripsi,
+ tanggal: data.tanggal,
+ eventMaster_TipeAcaraId: data.EventMaster_TipeAcara.id as any,
+ },
+ });
+
+ if (!updt) return { status: 400, message: "Update Gagal" };
+ revalidatePath("/dev/event/detail/event");
+ return {
+ status: 200,
+ message: "Berhasil Update",
+ };
+}
diff --git a/src/app_modules/event/fun/edit/fun_edit_status_by_id.ts b/src/app_modules/event/fun/edit/fun_edit_status_by_id.ts
new file mode 100644
index 00000000..64e01170
--- /dev/null
+++ b/src/app_modules/event/fun/edit/fun_edit_status_by_id.ts
@@ -0,0 +1,29 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { revalidatePath } from "next/cache";
+
+/**
+ *
+ * @param statusid | Review: 2, Draft: 3, Reject: 4
+ * @param eventId
+ * @type string
+ * @returns Update status id dari setiap event
+ */
+export async function Event_funEditStatusById(statusid: string, eventId: string) {
+ const updt = await prisma.event.update({
+ where: {
+ id: eventId,
+ },
+ data: {
+ eventMaster_StatusId: statusid,
+ },
+ });
+
+ if (!updt) return { status: 400, message: "Gagal Update Status" };
+ revalidatePath("/dev/event/main/status_page");
+ return {
+ status: 200,
+ message: "Berhasil Update Status",
+ };
+}
diff --git a/src/app_modules/event/fun/get/cek_user_join_by_id.ts b/src/app_modules/event/fun/get/cek_user_join_by_id.ts
new file mode 100644
index 00000000..086eb574
--- /dev/null
+++ b/src/app_modules/event/fun/get/cek_user_join_by_id.ts
@@ -0,0 +1,18 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Event_CekUserJoinById(eventId: string, userId: string) {
+ const cek = await prisma.event_Peserta.count({
+ where: {
+ eventId: eventId,
+ userId: userId,
+ },
+ });
+
+ if (cek > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
diff --git a/src/app_modules/event/fun/get/get_event_by_status_id.ts b/src/app_modules/event/fun/get/get_event_by_status_id.ts
new file mode 100644
index 00000000..3fb432d4
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_event_by_status_id.ts
@@ -0,0 +1,75 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Event_getByStatusId(statusId: string, authorId: string) {
+ if (statusId === "1") {
+ const data = await prisma.event.findMany({
+ orderBy: {
+ tanggal: "desc",
+ },
+ where: {
+ eventMaster_StatusId: "1",
+ authorId: authorId,
+ tanggal: {
+ gte: new Date(),
+ },
+ },
+ select: {
+ id: true,
+ title: true,
+ deskripsi: true,
+ tanggal: true,
+ },
+ });
+ return data;
+ }
+ if (statusId === "2") {
+ const data = await prisma.event.findMany({
+ orderBy: {
+ createdAt: "desc",
+ },
+ where: {
+ eventMaster_StatusId: "2",
+ authorId: authorId,
+ },
+ select: {
+ id: true,
+ title: true,
+ deskripsi: true,
+ tanggal: true,
+ },
+ });
+ return data;
+ }
+ if (statusId === "3") {
+ const data = await prisma.event.findMany({
+ where: {
+ eventMaster_StatusId: "3",
+ authorId: authorId,
+ },
+ select: {
+ id: true,
+ title: true,
+ deskripsi: true,
+ tanggal: true,
+ },
+ });
+ return data;
+ }
+ if (statusId === "4") {
+ const data = await prisma.event.findMany({
+ where: {
+ eventMaster_StatusId: "4",
+ authorId: authorId,
+ },
+ select: {
+ id: true,
+ title: true,
+ deskripsi: true,
+ tanggal: true,
+ },
+ });
+ return data;
+ }
+}
diff --git a/src/app_modules/event/fun/get/get_list_all_publish.ts b/src/app_modules/event/fun/get/get_list_all_publish.ts
new file mode 100644
index 00000000..e00c09f1
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_list_all_publish.ts
@@ -0,0 +1,35 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import _ from "lodash";
+
+export async function Event_getListAllPublish() {
+ const data = await prisma.event.findMany({
+ orderBy: {
+ tanggal: "desc",
+ },
+ where: {
+ eventMaster_StatusId: "1",
+ tanggal: {
+ gte: new Date(),
+ },
+ },
+ select: {
+ id: true,
+ title: true,
+ lokasi: true,
+ tanggal: true,
+ deskripsi: true,
+ active: true,
+ catatan: true,
+ authorId: true,
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/get/get_list_kontribusi_by_user_id.ts b/src/app_modules/event/fun/get/get_list_kontribusi_by_user_id.ts
new file mode 100644
index 00000000..47b92f9d
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_list_kontribusi_by_user_id.ts
@@ -0,0 +1,45 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Event_getListKontibusiByUserId(userId: string) {
+ const data = await prisma.event_Peserta.findMany({
+ where: {
+ userId: userId,
+ },
+ select: {
+ id: true,
+ Event: {
+ select: {
+ id: true,
+ title: true,
+ tanggal: true,
+ deskripsi: true,
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ Event_Peserta: {
+ take: 5,
+ orderBy: {
+ createdAt: "desc",
+ },
+ select: {
+ id: true,
+ userId: true,
+ User: {
+ select: {
+ Profile: true
+ }
+ },
+ },
+ },
+ },
+ },
+ },
+ });
+// console.log(data);
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/get/get_list_peserta_by_id.ts b/src/app_modules/event/fun/get/get_list_peserta_by_id.ts
new file mode 100644
index 00000000..1b490246
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_list_peserta_by_id.ts
@@ -0,0 +1,27 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Event_getListPesertaById(eventId: string) {
+ const data = await prisma.event_Peserta.findMany({
+ where: {
+ eventId: eventId,
+ },
+ select: {
+ id: true,
+ active: true,
+ createdAt: true,
+ updatedAt: true,
+ userId: true,
+ User: {
+ select: {
+ Profile: true,
+ },
+ },
+ // Event: true,
+ eventId: true,
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/get/get_list_riwayat_saya.ts b/src/app_modules/event/fun/get/get_list_riwayat_saya.ts
new file mode 100644
index 00000000..ded4f8c1
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_list_riwayat_saya.ts
@@ -0,0 +1,34 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import _ from "lodash";
+
+export async function Event_getListRiwayatSaya(authorId: string) {
+ const data = await prisma.event.findMany({
+ orderBy: {
+ tanggal: "desc",
+ },
+ where: {
+ authorId: authorId,
+ eventMaster_StatusId: "1",
+ tanggal: {
+ lte: new Date(),
+ },
+ },
+ select: {
+ id: true,
+ title: true,
+ tanggal: true,
+ deskripsi: true,
+ active: true,
+ authorId: true,
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/get/get_list_semua_riwayat.ts b/src/app_modules/event/fun/get/get_list_semua_riwayat.ts
new file mode 100644
index 00000000..c2f56204
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_list_semua_riwayat.ts
@@ -0,0 +1,33 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import _ from "lodash";
+
+export async function Event_getListSemuaRiwayat() {
+ const data = await prisma.event.findMany({
+ orderBy: {
+ tanggal: "desc",
+ },
+ where: {
+ eventMaster_StatusId: "1",
+ tanggal: {
+ lte: new Date(),
+ },
+ },
+ select: {
+ id: true,
+ title: true,
+ tanggal: true,
+ deskripsi: true,
+ active: true,
+ authorId: true,
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/get/get_one_by_id.ts b/src/app_modules/event/fun/get/get_one_by_id.ts
new file mode 100644
index 00000000..9c8da72a
--- /dev/null
+++ b/src/app_modules/event/fun/get/get_one_by_id.ts
@@ -0,0 +1,35 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Event_getOneById(eventId: string) {
+ const data = await prisma.event.findFirst({
+ where: {
+ id: eventId,
+ },
+ select: {
+ id: true,
+ title: true,
+ lokasi: true,
+ tanggal: true,
+ deskripsi: true,
+ active: true,
+ createdAt: true,
+ updatedAt: true,
+ catatan: true,
+ authorId: true,
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ eventMaster_StatusId: true,
+ EventMaster_Status: true,
+ eventMaster_TipeAcaraId: true,
+ EventMaster_TipeAcara: true,
+ // Event_Peserta: true,
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/event/fun/master/get_tipe_acara.ts b/src/app_modules/event/fun/master/get_tipe_acara.ts
new file mode 100644
index 00000000..7b5f1683
--- /dev/null
+++ b/src/app_modules/event/fun/master/get_tipe_acara.ts
@@ -0,0 +1,15 @@
+"use server"
+
+import prisma from "@/app/lib/prisma"
+
+export async function Event_getMasterTipeAcara(){
+ const data = await prisma.eventMaster_TipeAcara.findMany({
+ orderBy: {
+ id: "asc"
+ },
+ where: {
+ active: true
+ }
+ })
+ return data
+}
\ No newline at end of file
diff --git a/src/app_modules/event/global_state/index.ts b/src/app_modules/event/global_state/index.ts
new file mode 100644
index 00000000..952831e3
--- /dev/null
+++ b/src/app_modules/event/global_state/index.ts
@@ -0,0 +1,10 @@
+import { atomWithStorage } from "jotai/utils";
+
+export const gs_event_hotMenu = atomWithStorage("gs_event_hotMenu", 0)
+
+/**
+ * @param status | "Publish", "Review", "Draft", "Reject"
+ * @type string
+ */
+export const gs_event_status = atomWithStorage("gs_status_event", "Publish")
+export const gs_event_riwayat = atomWithStorage("gs_event_riwayat", "Semua")
\ No newline at end of file
diff --git a/src/app_modules/event/index.ts b/src/app_modules/event/index.ts
new file mode 100644
index 00000000..1465e41a
--- /dev/null
+++ b/src/app_modules/event/index.ts
@@ -0,0 +1,51 @@
+import Event_SplashScreen from "./splash";
+import Event_Beranda from "./main/beranda";
+import LayoutEvent_Main from "./main/layout";
+import Event_Kontribusi from "./main/kontribusi";
+import Event_Create from "./create/create";
+import LayoutEvent_Create from "./create/layout";
+import Event_StatusPage from "./main/status_page";
+import Event_DetailPublish from "./detail/publish";
+import Event_DetailReview from "./detail/review";
+import Event_DetailDraft from "./detail/draft";
+import Event_DetailReject from "./detail/reject";
+import LayoutEvent_DetailPublish from "./detail/publish/layout";
+import LayoutEvent_DetailReview from "./detail/review/layout";
+import LayoutEvent_DetailDraft from "./detail/draft/layout";
+import LayoutEvent_DetailReject from "./detail/reject/layout";
+import Event_Edit from "./edit";
+import LayoutEvent_Edit from "./edit/layout";
+import Event_DetailMain from "./detail/main_detail";
+import LayoutEvent_DetailMain from "./detail/main_detail/layout";
+import Event_DetailKontribusi from "./detail/kontribusi";
+import LayoutEvent_DetailKontribusi from "./detail/kontribusi/layout";
+import Event_Riwayat from "./main/riwayat";
+import Event_DetailRiwayat from "./detail/riwayat";
+import LayoutEvent_DetailRiwayat from "./detail/riwayat/layout";
+
+export {
+ Event_SplashScreen,
+ Event_Beranda,
+ LayoutEvent_Main,
+ Event_Kontribusi,
+ Event_Create,
+ LayoutEvent_Create,
+ Event_StatusPage,
+ Event_DetailPublish,
+ Event_DetailReview,
+ Event_DetailDraft,
+ Event_DetailReject,
+ LayoutEvent_DetailPublish,
+ LayoutEvent_DetailReview,
+ LayoutEvent_DetailDraft,
+ LayoutEvent_DetailReject,
+ Event_Edit,
+ LayoutEvent_Edit,
+ Event_DetailMain,
+ LayoutEvent_DetailMain,
+ Event_DetailKontribusi,
+ LayoutEvent_DetailKontribusi,
+ Event_Riwayat ,
+ Event_DetailRiwayat ,
+ LayoutEvent_DetailRiwayat ,
+};
diff --git a/src/app_modules/event/main/beranda.tsx b/src/app_modules/event/main/beranda.tsx
new file mode 100644
index 00000000..5f5a31df
--- /dev/null
+++ b/src/app_modules/event/main/beranda.tsx
@@ -0,0 +1,109 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import {
+ ActionIcon,
+ Affix,
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ Card,
+ Center,
+ Divider,
+ Grid,
+ Group,
+ Image,
+ Paper,
+ Skeleton,
+ Stack,
+ Text,
+ Title,
+ rem,
+} from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+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,
+}: {
+ dataEvent: MODEL_EVENT[];
+}) {
+ const router = useRouter();
+
+ // if (_.isEmpty(dataEvent))
+ // return (
+ //
+ //
+ // Tidak Ada Event
+ //
+ //
+ // );
+ return (
+ <>
+
+ router.push(RouterEvent.create)}
+ >
+
+
+
+
+ {_.isEmpty(dataEvent) ? (
+
+
+ Tidak Ada Event
+
+
+ ) : (
+
+ {dataEvent.map((e, i) => (
+
+
+
+
+ router.push(RouterEvent.detail_main + e.id)}
+ >
+
+
+
+
+ {e.title}
+
+
+
+
+ {moment(e.tanggal).format("ll")}
+
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+ ))}
+
+ )}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/kontribusi/index.tsx b/src/app_modules/event/main/kontribusi/index.tsx
new file mode 100644
index 00000000..0e6043da
--- /dev/null
+++ b/src/app_modules/event/main/kontribusi/index.tsx
@@ -0,0 +1,145 @@
+"use client";
+
+import {
+ Avatar,
+ Box,
+ Card,
+ Center,
+ Flex,
+ Grid,
+ Group,
+ Stack,
+ Tabs,
+ Text,
+ Title,
+} from "@mantine/core";
+import { useState } from "react";
+import Event_KontribusiPanitia from "./panitia";
+import Event_KontribusiPeserta from "./peserta";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+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,
+}: {
+ listKontribusi: MODEL_EVENT_PESERTA[];
+}) {
+ const router = useRouter();
+ const [tabsKontribusi, setTabsKontribusi] = useState("Panitia");
+ const listTabs = [
+ {
+ id: 1,
+ path: ,
+ value: "Panitia",
+ },
+ {
+ id: 2,
+ path: ,
+ value: "Peserta",
+ },
+ ];
+
+ if (_.isEmpty(listKontribusi))
+ return (
+
+
+ Tidak Ada Kontribusi
+
+
+ );
+
+ return (
+ <>
+ {/* {JSON.stringify(listKontribusi, null,2)} */}
+ {listKontribusi.map((e, i) => (
+
+
+
+
+
+ router.push(RouterEvent.detail_kontribusi + e.Event.id)
+ }
+ >
+
+
+
+
+ {e.Event.title}
+
+
+
+
+ {moment(e.Event.tanggal).format("ll")}
+
+
+
+
+ {/*
+ {e.Event.deskripsi}
+ */}
+
+
+ {e.Event.Event_Peserta.map((val) => (
+
+
+
+ ))}
+
+
+
+
+ ))}
+ >
+ );
+
+ // return (
+ // <>
+ //
+ //
+ //
+ // {listTabs.map((e) => (
+ //
+ // Sebagai {e.value}
+ //
+ // ))}
+ //
+ // {listTabs.map((e) => (
+ //
+ // {e.path}
+ //
+ // ))}
+ //
+ //
+ // >
+ // );
+}
diff --git a/src/app_modules/event/main/kontribusi/panitia.tsx b/src/app_modules/event/main/kontribusi/panitia.tsx
new file mode 100644
index 00000000..42a66733
--- /dev/null
+++ b/src/app_modules/event/main/kontribusi/panitia.tsx
@@ -0,0 +1,48 @@
+"use client";
+import { Card, Group, Button, Text, Avatar, Stack } from "@mantine/core";
+import moment from "moment";
+
+export default function Event_KontribusiPanitia() {
+ return (
+ <>
+ {Array(5)
+ .fill(0)
+ .map((e, i) => (
+
+ {/*
+
+ */}
+
+
+
+ Nama Event
+ {moment(new Date()).format("ll")}
+
+
+
+ Deskripsi: Lorem ipsum dolor sit amet consectetur adipisicing
+ elit. Nisi non ducimus voluptatibus vel, officiis assumenda
+ explicabo reiciendis consequatur consequuntur expedita maiores
+ fugit natus est rem sapiente iusto earum dicta labore.
+
+
+
+ {Array(5)
+ .fill(0)
+ .map((e, i) => (
+
+ ))}
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/kontribusi/peserta.tsx b/src/app_modules/event/main/kontribusi/peserta.tsx
new file mode 100644
index 00000000..7afeac64
--- /dev/null
+++ b/src/app_modules/event/main/kontribusi/peserta.tsx
@@ -0,0 +1,48 @@
+"use client";
+import { Card, Group, Button, Text, Stack, Avatar } from "@mantine/core";
+import moment from "moment";
+
+export default function Event_KontribusiPeserta() {
+ return (
+ <>
+ {Array(5)
+ .fill(0)
+ .map((e, i) => (
+
+ {/*
+
+ */}
+
+
+
+ Nama Event
+ {moment(new Date()).format("ll")}
+
+
+
+ Deskripsi: Lorem ipsum dolor sit amet consectetur adipisicing
+ elit. Nisi non ducimus voluptatibus vel, officiis assumenda
+ explicabo reiciendis consequatur consequuntur expedita maiores
+ fugit natus est rem sapiente iusto earum dicta labore.
+
+
+
+ {Array(5)
+ .fill(0)
+ .map((e, i) => (
+
+ ))}
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/layout.tsx b/src/app_modules/event/main/layout.tsx
new file mode 100644
index 00000000..31500431
--- /dev/null
+++ b/src/app_modules/event/main/layout.tsx
@@ -0,0 +1,109 @@
+"use client";
+
+import {
+ ActionIcon,
+ AppShell,
+ Center,
+ Footer,
+ Grid,
+ Group,
+ Stack,
+ Text,
+} from "@mantine/core";
+import { useRouter } from "next/navigation";
+import React, { useState } from "react";
+import ComponentEvent_HeaderTamplate from "../component/header_tamplate";
+import {
+ IconCalendarEvent,
+ IconCirclePlus,
+ IconHistory,
+ IconHome,
+ IconTimelineEvent,
+ IconTimelineEventText,
+} from "@tabler/icons-react";
+import { useAtom } from "jotai";
+import { gs_event_hotMenu, gs_event_status } from "../global_state";
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { RouterHome } from "@/app/lib/router_hipmi/router_home";
+
+export default function LayoutEvent_Main({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const router = useRouter();
+ const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
+ const listFooter = [
+ {
+ id: "1",
+ name: "Beranda",
+ path: RouterEvent.beranda,
+ icon: ,
+ },
+
+ {
+ id: "2",
+ name: "Status Event",
+ path: RouterEvent.status_page,
+ icon: ,
+ },
+ {
+ id: "3",
+ name: "Kontribusi",
+ path: RouterEvent.kontribusi,
+ icon: ,
+ },
+ {
+ id: "4",
+ name: "Riwayat",
+ path: RouterEvent.riwayat,
+ icon: ,
+ },
+ ];
+ return (
+ <>
+
+ }
+ footer={
+
+
+
+ {listFooter.map((e, i) => (
+ {
+ router.replace(e.path);
+ setHotMenu(i);
+ }}
+ >
+
+
+
+ {e.icon}
+
+
+ {e.name}
+
+
+
+
+ ))}
+
+
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/event/main/riwayat/index.tsx b/src/app_modules/event/main/riwayat/index.tsx
new file mode 100644
index 00000000..abffdcd6
--- /dev/null
+++ b/src/app_modules/event/main/riwayat/index.tsx
@@ -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: ,
+ },
+ {
+ id: 2,
+ label: "Riwayat Saya",
+ value: "Saya",
+ path: ,
+ },
+ ];
+
+ return (
+ <>
+
+
+
+ {listTabs.map((e) => (
+
+ {e.label}
+
+ ))}
+
+ {listTabs.map((e) => (
+
+ {e.path}
+
+ ))}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/main/riwayat/saya.tsx b/src/app_modules/event/main/riwayat/saya.tsx
new file mode 100644
index 00000000..0b75c092
--- /dev/null
+++ b/src/app_modules/event/main/riwayat/saya.tsx
@@ -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 (
+
+
+ Tidak Ada Event
+
+
+ );
+
+ return (
+ <>
+ {data.map((e, i) => (
+
+
+
+
+ router.push(RouterEvent.detail_riwayat + e.id)}
+ >
+
+
+
+
+ {e.title}
+
+
+
+
+ {moment(e.tanggal).format("ll")}
+
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/riwayat/semua.tsx b/src/app_modules/event/main/riwayat/semua.tsx
new file mode 100644
index 00000000..e9ff6cf7
--- /dev/null
+++ b/src/app_modules/event/main/riwayat/semua.tsx
@@ -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 (
+
+
+ Tidak Ada Event
+
+
+ );
+
+ return (
+ <>
+ {data.map((e, i) => (
+
+
+
+
+ router.push(RouterEvent.detail_riwayat + e.id)}
+ >
+
+
+
+
+ {e.title}
+
+
+
+
+ {moment(e.tanggal).format("ll")}
+
+
+
+
+
+ {e.deskripsi}
+
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/status_page/draft.tsx b/src/app_modules/event/main/status_page/draft.tsx
new file mode 100644
index 00000000..e9f4714d
--- /dev/null
+++ b/src/app_modules/event/main/status_page/draft.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+import { MODEL_EVENT } from "../../model/interface";
+import { useState } from "react";
+import ComponentEvent_BoxListStatus from "../../component/box_list_status";
+import _ from "lodash";
+
+export default function Event_StatusDraft({
+ listDraft,
+}: {
+ listDraft: MODEL_EVENT[];
+}) {
+ const router = useRouter();
+
+ if (_.isEmpty(listDraft))
+ return (
+
+ Tidak Ada Event
+
+ );
+ return (
+ <>
+ {listDraft
+ .map((e, i) => (
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/status_page/index.tsx b/src/app_modules/event/main/status_page/index.tsx
new file mode 100644
index 00000000..50fcbf7b
--- /dev/null
+++ b/src/app_modules/event/main/status_page/index.tsx
@@ -0,0 +1,87 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { Affix, Button, Stack, Tabs, rem } from "@mantine/core";
+import { IconCirclePlus } from "@tabler/icons-react";
+import { useAtom } from "jotai";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { gs_event_status } from "../../global_state";
+import Event_StatusPublish from "./publish";
+import Event_StatusReview from "./review";
+import Event_StatusDraft from "./draft";
+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;
+ listReject: any;
+}) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
+ const listTabs = [
+ {
+ id: 1,
+ path: ,
+ value: "Publish",
+ },
+ {
+ id: 2,
+ path: ,
+ value: "Review",
+ },
+ {
+ id: 3,
+ path: ,
+ value: "Draft",
+ },
+ {
+ id: 4,
+ path: ,
+ value: "Reject",
+ },
+ ];
+ return (
+ <>
+
+
+
+
+
+ {listTabs.map((e) => (
+
+ {e.value}
+
+ ))}
+
+ {listTabs.map((e) => (
+
+ {e.path}
+
+ ))}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/main/status_page/publish.tsx b/src/app_modules/event/main/status_page/publish.tsx
new file mode 100644
index 00000000..aeba83b7
--- /dev/null
+++ b/src/app_modules/event/main/status_page/publish.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+import { MODEL_EVENT } from "../../model/interface";
+import ComponentEvent_BoxListStatus from "../../component/box_list_status";
+import _ from "lodash";
+
+export default function Event_StatusPublish({
+ listPublish,
+}: {
+ listPublish: MODEL_EVENT[];
+}) {
+ const router = useRouter();
+
+ if (_.isEmpty(listPublish))
+ return (
+
+ Tidak Ada Event
+
+ );
+
+ return (
+ <>
+ {listPublish
+ .map((e, i) => (
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/status_page/reject.tsx b/src/app_modules/event/main/status_page/reject.tsx
new file mode 100644
index 00000000..a3be6d89
--- /dev/null
+++ b/src/app_modules/event/main/status_page/reject.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+import { MODEL_EVENT } from "../../model/interface";
+import ComponentEvent_BoxListStatus from "../../component/box_list_status";
+import _ from "lodash";
+
+export default function Event_StatusReject({
+ listReject,
+}: {
+ listReject: MODEL_EVENT[];
+}) {
+ const router = useRouter();
+ if (_.isEmpty(listReject))
+ return (
+
+ Tidak Ada Event
+
+ );
+ return (
+ <>
+ {listReject.map((e, i) => (
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/main/status_page/review.tsx b/src/app_modules/event/main/status_page/review.tsx
new file mode 100644
index 00000000..c14d91a2
--- /dev/null
+++ b/src/app_modules/event/main/status_page/review.tsx
@@ -0,0 +1,42 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+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();
+
+
+ if (_.isEmpty(listReview))
+ return (
+
+ Tidak Ada Event
+
+ );
+ return (
+ <>
+ {listReview.map((e, i) => (
+
+
+
+ ))}
+ >
+ );
+}
diff --git a/src/app_modules/event/model/interface.ts b/src/app_modules/event/model/interface.ts
new file mode 100644
index 00000000..c259b147
--- /dev/null
+++ b/src/app_modules/event/model/interface.ts
@@ -0,0 +1,32 @@
+import { MODEL_USER } from "@/app_modules/home/model/interface";
+import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
+
+export interface MODEL_EVENT {
+ id: string;
+ title: string;
+ lokasi: string;
+ tanggal: Date;
+ deskripsi: string;
+ active: boolean;
+ createdAt: Date;
+ updatedAt: Date;
+ catatan: string;
+ authorId: string;
+ Author: MODEL_USER;
+ eventMaster_StatusId: string;
+ EventMaster_Status: MODEL_DEFAULT_MASTER;
+ eventMaster_TipeAcaraId: number;
+ EventMaster_TipeAcara: MODEL_DEFAULT_MASTER;
+ Event_Peserta: MODEL_EVENT_PESERTA[];
+}
+
+export interface MODEL_EVENT_PESERTA {
+ id: string;
+ active: boolean;
+ createdAt: Date;
+ updatedAt: Date;
+ userId: string;
+ User: MODEL_USER;
+ eventId: string;
+ Event: MODEL_EVENT;
+}
diff --git a/src/app_modules/event/splash/index.tsx b/src/app_modules/event/splash/index.tsx
new file mode 100644
index 00000000..5c5e49d0
--- /dev/null
+++ b/src/app_modules/event/splash/index.tsx
@@ -0,0 +1,34 @@
+"use client";
+
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { AspectRatio, Center, Image, Paper, Stack, Title } from "@mantine/core";
+import { useShallowEffect, useTimeout } from "@mantine/hooks";
+import { useAtom } from "jotai";
+import { useRouter } from "next/navigation";
+import { gs_event_hotMenu, gs_event_status } from "../global_state";
+
+export default function Event_SplashScreen() {
+ const router = useRouter();
+ const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
+ const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
+
+ useShallowEffect(() => {
+ setTimeout(() => {
+ router.replace(RouterEvent.beranda);
+ setHotMenu(0);
+ setTabsStatus("Publish");
+ }, 2000);
+ }, []);
+ return (
+ <>
+
+
+ Welcome to
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/home/layout.tsx b/src/app_modules/home/layout.tsx
index cf561605..9d98cbc8 100644
--- a/src/app_modules/home/layout.tsx
+++ b/src/app_modules/home/layout.tsx
@@ -59,20 +59,20 @@ export default function HomeLayout({
-
-
+
+ {/*
-
+ */}
HIPMI
-
+ {/*
-
+ */}
}
diff --git a/src/app_modules/home/model/user_profile.ts b/src/app_modules/home/model/user_profile.ts
index b5470d73..f605e181 100644
--- a/src/app_modules/home/model/user_profile.ts
+++ b/src/app_modules/home/model/user_profile.ts
@@ -1,4 +1,4 @@
-import { MODEL_IMAGES } from "@/app_modules/models/interface";
+import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
export interface MODEL_PROFILE_OLD {
id: string;
diff --git a/src/app_modules/home/view.tsx b/src/app_modules/home/view.tsx
index d88fa2bd..d2142f49 100644
--- a/src/app_modules/home/view.tsx
+++ b/src/app_modules/home/view.tsx
@@ -30,6 +30,8 @@ import toast from "react-simple-toasts";
import { useRouter } from "next/navigation";
import { MODEL_PROFILE_OLD } from "./model/user_profile";
import AppNotif from "../notif";
+import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
+import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
// export const dynamic = "force-dynamic"
// export const revalidate = 0
@@ -49,20 +51,21 @@ export default function HomeView() {
id: 2,
name: "Event",
icon: ,
- link: "",
+ link: RouterEvent.splash,
},
{
id: 3,
name: "Voting",
icon: ,
- link: "",
+ link: RouterVote.splash,
},
{
id: 4,
- name: "Project Collaboration",
- icon: ,
+ name: "Job Vacancy",
+ icon: ,
link: "",
},
+
{
id: 5,
name: "Forums",
@@ -77,8 +80,8 @@ export default function HomeView() {
},
{
id: 7,
- name: "Job Vacancy",
- icon: ,
+ name: "Project Collaboration",
+ icon: ,
link: "",
},
{
@@ -92,27 +95,6 @@ export default function HomeView() {
return (
<>
- {/*
- {
- if (stateUser.Profile === null) {
- return router.push(`/dev/profile/create/${stateUser.id}`);
- } else {
- return router.push(`/dev/katalog/${stateUser.Profile.id}`);
- }
- }}
- >
-
-
-
-
- Welcome to ,{" "}
- {stateUser.username ? stateUser.username : }
-
- */}
-
@@ -120,22 +102,21 @@ export default function HomeView() {
{/* {JSON.stringify(stateUser, null, 2)} */}
-
+
{listHalaman.map((e, i) => (
{
- // if (stateUser.Profile === null) {
- // return toast("Lengkapi Profile Anda !");
- // } else {
- // if (e.link === "") {
- // toast(e.name);
- // } else {
- // return router.push(e.link);
- // }
- // }
if (e.link === "") {
toast("Cooming Soon !!");
} else {
diff --git a/src/app_modules/investasi/create/view.tsx b/src/app_modules/investasi/create/view.tsx
index e90c0344..39597c82 100644
--- a/src/app_modules/investasi/create/view.tsx
+++ b/src/app_modules/investasi/create/view.tsx
@@ -2,7 +2,7 @@
import { ApiHipmi } from "@/app/lib/api";
import { Warna } from "@/app/lib/warna";
-import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
+import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
import {
AspectRatio,
Box,
@@ -37,9 +37,9 @@ export default function InvestasiCreate({
pembagianDeviden,
}: {
id: string;
- pencarianInvestor: MODEL_DEFAULT_MASTER[];
- periodeDeviden: MODEL_DEFAULT_MASTER[];
- pembagianDeviden: MODEL_DEFAULT_MASTER[];
+ pencarianInvestor: MODEL_DEFAULT_MASTER_OLD[];
+ periodeDeviden: MODEL_DEFAULT_MASTER_OLD[];
+ pembagianDeviden: MODEL_DEFAULT_MASTER_OLD[];
}) {
const router = useRouter();
const [fl, setFl] = useState(null);
diff --git a/src/app_modules/investasi/edit_intro/view.tsx b/src/app_modules/investasi/edit_intro/view.tsx
index 9f99708b..73a25083 100644
--- a/src/app_modules/investasi/edit_intro/view.tsx
+++ b/src/app_modules/investasi/edit_intro/view.tsx
@@ -29,7 +29,7 @@ import toast from "react-simple-toasts";
import { MODEL_Investasi } from "../model/model_investasi";
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import _ from "lodash";
-import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
+import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
import funEditInvestasi from "../fun/fun_edit_investasi";
import { useDisclosure, useWindowScroll } from "@mantine/hooks";
@@ -40,9 +40,9 @@ export default function EditIntroInvestasi({
listPembagian,
}: {
dataInvestasi: MODEL_Investasi;
- listPencarian: MODEL_DEFAULT_MASTER[];
- listPeriode: MODEL_DEFAULT_MASTER[];
- listPembagian: MODEL_DEFAULT_MASTER[];
+ listPencarian: MODEL_DEFAULT_MASTER_OLD[];
+ listPeriode: MODEL_DEFAULT_MASTER_OLD[];
+ listPembagian: MODEL_DEFAULT_MASTER_OLD[];
}) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
diff --git a/src/app_modules/investasi/main/view.tsx b/src/app_modules/investasi/main/view.tsx
index 62b23b7c..6d6ffaf3 100644
--- a/src/app_modules/investasi/main/view.tsx
+++ b/src/app_modules/investasi/main/view.tsx
@@ -1,7 +1,7 @@
"use client";
import { ApiHipmi } from "@/app/lib/api";
-import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
+import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
import {
AspectRatio,
Badge,
diff --git a/src/app_modules/katalog/main/view.tsx b/src/app_modules/katalog/main/view.tsx
index 083d7de4..fd07a886 100644
--- a/src/app_modules/katalog/main/view.tsx
+++ b/src/app_modules/katalog/main/view.tsx
@@ -17,7 +17,7 @@ import {
import { ProfileView } from "../profile";
import { ListPortofolioView } from "../portofolio";
import { MODEL_PROFILE_OLD } from "@/app_modules/home/model/user_profile";
-import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
+import { LIST_PORTOFOLIO } from "@/app_modules/model_global/portofolio";
import User_Logout from "@/app_modules/auth/logout/view";
import { MODEL_PORTOFOLIO } from "../portofolio/model/interface";
import { MODEL_PROFILE } from "../profile/model/interface";
diff --git a/src/app_modules/katalog/portofolio/create/view.tsx b/src/app_modules/katalog/portofolio/create/view.tsx
index 99d9ef53..fe950fdf 100644
--- a/src/app_modules/katalog/portofolio/create/view.tsx
+++ b/src/app_modules/katalog/portofolio/create/view.tsx
@@ -6,7 +6,7 @@ import { Warna } from "@/app/lib/warna";
import {
BIDANG_BISNIS_OLD,
MODEL_PORTOFOLIO_OLD,
-} from "@/app_modules/models/portofolio";
+} from "@/app_modules/model_global/portofolio";
import {
AspectRatio,
Button,
diff --git a/src/app_modules/katalog/portofolio/fun/fun_create_portofolio.ts b/src/app_modules/katalog/portofolio/fun/fun_create_portofolio.ts
index fd2f2e75..2706f4c5 100644
--- a/src/app_modules/katalog/portofolio/fun/fun_create_portofolio.ts
+++ b/src/app_modules/katalog/portofolio/fun/fun_create_portofolio.ts
@@ -1,7 +1,7 @@
"use server";
import prisma from "@/app/lib/prisma";
-import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/models/portofolio";
+import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/model_global/portofolio";
import { revalidatePath } from "next/cache";
import { MODEL_PORTOFOLIO, MODEL_PORTOFOLIO_MEDSOS } from "../model/interface";
import _ from "lodash";
diff --git a/src/app_modules/katalog/portofolio/list_view/view.tsx b/src/app_modules/katalog/portofolio/list_view/view.tsx
index 11418a0c..c2b16149 100644
--- a/src/app_modules/katalog/portofolio/list_view/view.tsx
+++ b/src/app_modules/katalog/portofolio/list_view/view.tsx
@@ -6,6 +6,7 @@ import {
Grid,
Group,
Paper,
+ SimpleGrid,
Stack,
Text,
Title,
@@ -14,12 +15,15 @@ import { useShallowEffect } from "@mantine/hooks";
import { useState } from "react";
import _ from "lodash";
import {
+ IconCaretRight,
IconCaretRightFilled,
+ IconChevronRight,
IconCirclePlus,
+ IconEyeCheck,
IconPencilPlus,
} from "@tabler/icons-react";
-import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
+import { LIST_PORTOFOLIO } from "@/app_modules/model_global/portofolio";
import { useRouter } from "next/navigation";
import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
import { Warna } from "@/app/lib/warna";
@@ -39,8 +43,8 @@ export default function ListPortofolioView({
return (
<>
{/* {JSON.stringify(porto, null, 2)} */}
-
-
+
+
Portofolio
@@ -65,31 +69,43 @@ export default function ListPortofolioView({
) : (
-
- {porto.map((e: any) => (
- router.push(`/dev/portofolio/main/${e.id}/`)}
- >
-
-
- {e.namaBisnis}
-
-
-
-
-
-
- ))}
-
+
+ {porto.map((e: any) => (
+ router.push(`/dev/portofolio/main/${e.id}/`)}
+ >
+
+
+
+ {e.namaBisnis}
+
+
+
+
+
+
+
+
+
+ ))}
+
)}
+
+
>
);
}
diff --git a/src/app_modules/katalog/portofolio/main/view.tsx b/src/app_modules/katalog/portofolio/main/view.tsx
index 4ecb90fe..7cf28b70 100644
--- a/src/app_modules/katalog/portofolio/main/view.tsx
+++ b/src/app_modules/katalog/portofolio/main/view.tsx
@@ -5,7 +5,7 @@ import {
RouterProfile,
} from "@/app/lib/router_hipmi/router_katalog";
import { Warna } from "@/app/lib/warna";
-import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/models/portofolio";
+import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/model_global/portofolio";
import {
AspectRatio,
Box,
diff --git a/src/app_modules/katalog/portofolio/model/interface.ts b/src/app_modules/katalog/portofolio/model/interface.ts
index 09c3da16..bfaecf0a 100644
--- a/src/app_modules/katalog/portofolio/model/interface.ts
+++ b/src/app_modules/katalog/portofolio/model/interface.ts
@@ -1,4 +1,4 @@
-import { MODEL_IMAGES } from "@/app_modules/models/interface";
+import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
export interface MODEL_PORTOFOLIO {
id: string;
diff --git a/src/app_modules/katalog/profile/main/view.tsx b/src/app_modules/katalog/profile/main/view.tsx
index c6ad551d..ec735d8b 100644
--- a/src/app_modules/katalog/profile/main/view.tsx
+++ b/src/app_modules/katalog/profile/main/view.tsx
@@ -13,6 +13,7 @@ import {
Group,
Image,
Paper,
+ Stack,
Text,
} from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
@@ -50,6 +51,8 @@ export default function ProfileView({
{/* {JSON.stringify(profile, null,2)} */}
{/* Background dan foto */}
+
+ {/* Upload Background Profile */}
@@ -64,31 +67,36 @@ export default function ProfileView({
/>
+
+ {/* Upload Background Profile */}
{profile.User.id === userLoginId ? (
-
- router.push(
- RouterProfile.update_foto_background + `${profile.id}`
- )
- }
- sx={{
- position: "absolute",
- zIndex: 2,
- border: "1px",
- borderStyle: "solid",
- }}
- >
-
-
+
+
+ router.push(
+ RouterProfile.update_foto_background + `${profile.id}`
+ )
+ }
+ sx={{
+ position: "relative",
+ // zIndex: 2,
+ border: "1px",
+ borderStyle: "solid",
+ }}
+ >
+
+
+
) : (
""
)}
+ {/* Foto Profile */}
+ {/* Upload Foto Profile */}
{profile.User.id === userLoginId ? (
+
+
{profile.name}
@@ -163,7 +173,7 @@ export default function ProfileView({
{/* Info user: nomor, email dll */}
-
+
@@ -226,7 +236,7 @@ export default function ProfileView({
);
}
})()}
-
+
{/* {JSON.stringify(profile, null, 2)} */}
diff --git a/src/app_modules/katalog/profile/model/interface.ts b/src/app_modules/katalog/profile/model/interface.ts
index 304da175..3a4d2ad1 100644
--- a/src/app_modules/katalog/profile/model/interface.ts
+++ b/src/app_modules/katalog/profile/model/interface.ts
@@ -1,5 +1,5 @@
import { MODEL_USER } from "@/app_modules/home/model/interface";
-import { MODEL_IMAGES } from "@/app_modules/models/interface";
+import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
export interface MODEL_PROFILE {
userId: string;
diff --git a/src/app_modules/models/interface.ts b/src/app_modules/model_global/interface.ts
similarity index 59%
rename from src/app_modules/models/interface.ts
rename to src/app_modules/model_global/interface.ts
index 634d9cec..88ad2d94 100644
--- a/src/app_modules/models/interface.ts
+++ b/src/app_modules/model_global/interface.ts
@@ -6,3 +6,9 @@ export interface MODEL_IMAGES {
createdAt: Date;
updatedAt: Date;
}
+
+export interface MODEL_DEFAULT_MASTER {
+ id: string,
+ name: string,
+ active: boolean,
+}
diff --git a/src/app_modules/models/model_default_master.ts b/src/app_modules/model_global/model_default_master.ts
similarity index 56%
rename from src/app_modules/models/model_default_master.ts
rename to src/app_modules/model_global/model_default_master.ts
index 9ba96d40..fb46154a 100644
--- a/src/app_modules/models/model_default_master.ts
+++ b/src/app_modules/model_global/model_default_master.ts
@@ -1,4 +1,4 @@
-export interface MODEL_DEFAULT_MASTER {
+export interface MODEL_DEFAULT_MASTER_OLD {
id: string,
name: string,
active: boolean,
diff --git a/src/app_modules/models/portofolio.ts b/src/app_modules/model_global/portofolio.ts
similarity index 100%
rename from src/app_modules/models/portofolio.ts
rename to src/app_modules/model_global/portofolio.ts
diff --git a/src/app_modules/vote/component/card_view_publish.tsx b/src/app_modules/vote/component/card_view_publish.tsx
new file mode 100644
index 00000000..308c9bac
--- /dev/null
+++ b/src/app_modules/vote/component/card_view_publish.tsx
@@ -0,0 +1,142 @@
+"use client";
+
+import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
+import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
+import {
+ Card,
+ Stack,
+ Grid,
+ Avatar,
+ Divider,
+ Badge,
+ Group,
+ Text,
+ Title,
+ Box,
+} from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+import { MODEL_VOTING } from "../model/interface";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+
+export default function ComponentVote_CardViewPublish({
+ data,
+ path,
+ pilihanSaya,
+ authorName,
+ namaPilihan,
+}: {
+ data?: MODEL_VOTING;
+ path: string;
+ pilihanSaya?: boolean;
+ authorName?: boolean;
+ namaPilihan?: string;
+}) {
+ const router = useRouter();
+ return (
+ <>
+
+ {/* Header name */}
+ {authorName ? (
+
+
+
+ ) : (
+ ""
+ )}
+ {/* Isi deskripsi */}
+ {
+ if (data?.id === undefined) {
+ ComponentGlobal_NotifikasiPeringatan("Path tidak ditemukan");
+ } else {
+ router.push(path + data?.id);
+ }
+ }}
+ >
+
+ {data ? data.title : "Judul Voting"}
+
+
+
+ {data
+ ? data?.awalVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })
+ : "tgl awal voting"}
+
+ -
+
+ {data
+ ? data?.akhirVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })
+ : "tgl akhir voting"}
+
+
+
+ {data ? (
+
+
+ {data?.Voting_DaftarNamaVote.map((v) => (
+
+
+
+ {v.value}
+
+
+
+ {v.jumlah}
+
+
+
+ ))}
+
+
+ ) : (
+
+
+
+
+ Voting A
+
+ 2
+
+
+
+
+
+ Voting B
+
+ 3
+
+
+
+
+
+ )}
+
+ {pilihanSaya ? (
+
+
+ Pilihan anda:
+
+
+
+ {namaPilihan}
+
+
+
+ ) : (
+ ""
+ )}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/card_view_status.tsx b/src/app_modules/vote/component/card_view_status.tsx
new file mode 100644
index 00000000..e14eca35
--- /dev/null
+++ b/src/app_modules/vote/component/card_view_status.tsx
@@ -0,0 +1,68 @@
+"use client";
+
+import {
+ Card,
+ Stack,
+ Title,
+ Badge,
+ Group,
+ Radio,
+ Grid,
+ Center,
+ Text,
+} from "@mantine/core";
+import moment from "moment";
+import { useRouter } from "next/navigation";
+import { MODEL_VOTING } from "../model/interface";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+
+export default function ComponentVote_CardViewStatus({
+ path,
+ data,
+}: {
+ path?: string;
+ data?: MODEL_VOTING;
+}) {
+ const router = useRouter();
+ return (
+ <>
+ {
+ if (data?.id === undefined) {
+ ComponentGlobal_NotifikasiPeringatan("Path tidak ditemukan");
+ } else {
+ router.push((path as string) + data?.id);
+ }
+ }}
+ >
+ {/* Isi deskripsi */}
+
+
+
+ {data?.title}
+
+
+
+
+ {data?.awalVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+ -
+
+ {data?.akhirVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/detail/detail_daftar_kontributor.tsx b/src/app_modules/vote/component/detail/detail_daftar_kontributor.tsx
new file mode 100644
index 00000000..989f1fbd
--- /dev/null
+++ b/src/app_modules/vote/component/detail/detail_daftar_kontributor.tsx
@@ -0,0 +1,92 @@
+"use client";
+import {
+ Card,
+ Stack,
+ Center,
+ Title,
+ Badge,
+ Group,
+ Radio,
+ Grid,
+ Text,
+ Avatar,
+ Divider,
+ Box,
+} from "@mantine/core";
+import moment from "moment";
+import { MODEL_VOTE_KONTRIBUTOR } from "../../model/interface";
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import _ from "lodash";
+import { useRouter } from "next/navigation";
+
+export default function ComponentVote_DaftarKontributorVoter({
+ listKontributor,
+}: {
+ listKontributor?: MODEL_VOTE_KONTRIBUTOR[];
+}) {
+ const router = useRouter()
+ return (
+ <>
+
+
+
+
+ Daftar Voting
+
+
+ {_.isEmpty(listKontributor) ? (
+
+ - Tidak ada voting -
+
+ ) : (
+
+ {listKontributor?.map((e, i) => (
+
+
+ router.push(RouterProfile.katalog + e.Author.Profile.id)}
+ >
+
+
+
+
+
+ {e ? e.Author.Profile.name : "Nama author"}
+
+
+
+
+
+ 10 ? 8 : 10
+ }
+ >
+ {e.Voting_DaftarNamaVote.value}
+
+
+
+
+
+
+ ))}
+
+ )}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/detail/detail_data_sebelum_publish.tsx b/src/app_modules/vote/component/detail/detail_data_sebelum_publish.tsx
new file mode 100644
index 00000000..6429526a
--- /dev/null
+++ b/src/app_modules/vote/component/detail/detail_data_sebelum_publish.tsx
@@ -0,0 +1,77 @@
+"use client";
+import {
+ Card,
+ Stack,
+ Center,
+ Title,
+ Badge,
+ Group,
+ Radio,
+ Grid,
+ Text,
+} from "@mantine/core";
+import moment from "moment";
+import { MODEL_VOTING } from "../../model/interface";
+import { IconCircle } from "@tabler/icons-react";
+import _ from "lodash";
+
+export default function ComponentVote_DetailDataSebelumPublish
+({
+ data,
+}: {
+ data?: MODEL_VOTING;
+}) {
+
+ return (
+ <>
+
+
+
+
+ {data?.title}
+
+ {data?.deskripsi}
+
+
+
+
+ Batas Voting
+
+
+
+
+
+ {data?.awalVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+ -
+
+ {data?.akhirVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+
+
+
+
+
+
+
+ Pilihan :
+
+
+ {data?.Voting_DaftarNamaVote.map((e) => (
+
+
+
+
+ {e.value}
+
+ ))}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/detail/detail_data_setelah_publish.tsx b/src/app_modules/vote/component/detail/detail_data_setelah_publish.tsx
new file mode 100644
index 00000000..b9667c52
--- /dev/null
+++ b/src/app_modules/vote/component/detail/detail_data_setelah_publish.tsx
@@ -0,0 +1,74 @@
+"use client";
+import {
+ Card,
+ Stack,
+ Center,
+ Title,
+ Badge,
+ Group,
+ Radio,
+ Grid,
+ Text,
+} from "@mantine/core";
+import moment from "moment";
+import { MODEL_VOTING } from "../../model/interface";
+import { IconCircle } from "@tabler/icons-react";
+import _ from "lodash";
+import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
+
+export default function ComponentVote_DetailDataSetelahPublish({
+ data,
+ authorName,
+}: {
+ data?: MODEL_VOTING;
+ authorName?: boolean;
+}) {
+ return (
+ <>
+
+ {authorName ? (
+
+
+
+ ) : (
+ ""
+ )}
+
+
+
+ {data?.title}
+
+ {data?.deskripsi}
+
+
+
+
+ Batas Voting
+
+
+
+
+
+ {data?.awalVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+ -
+
+ {data?.akhirVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/detail/detail_data_tanpa_vote.tsx b/src/app_modules/vote/component/detail/detail_data_tanpa_vote.tsx
new file mode 100644
index 00000000..9d942625
--- /dev/null
+++ b/src/app_modules/vote/component/detail/detail_data_tanpa_vote.tsx
@@ -0,0 +1,51 @@
+import { Badge, Card, Center, Group, Stack, Text, Title } from "@mantine/core";
+import moment from "moment";
+
+
+export default function ComponentVote_DetailDataTanpaVote() {
+ return (
+ <>
+
+
+
+
+ Judul voting
+
+
+ Deskripsi: Lorem, ipsum dolor sit amet consectetur adipisicing
+ elit. Mollitia possimus repellendus in, iste voluptatibus sit
+ laborum voluptates aliquam nisi? Earum quas ea quaerat veniam
+ porro, magni nulla consequuntur distinctio at.
+
+
+
+
+
+
+
+ Batas Voting
+
+
+
+
+
+ {new Date().toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+ -
+
+ {new Date(
+ moment(Date.now()).add(10, "days").calendar()
+ ).toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/detail/detail_hasil_voting.tsx b/src/app_modules/vote/component/detail/detail_hasil_voting.tsx
new file mode 100644
index 00000000..74b4113b
--- /dev/null
+++ b/src/app_modules/vote/component/detail/detail_hasil_voting.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import {
+ Avatar,
+ Box,
+ Card,
+ Center,
+ Grid,
+ Group,
+ List,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import { MODEL_VOTING_DAFTAR_NAMA_VOTE } from "../../model/interface";
+
+export default function ComponentVote_HasilVoting({
+ data,
+}: {
+ data?: MODEL_VOTING_DAFTAR_NAMA_VOTE[];
+}) {
+ return (
+ <>
+
+
+
+
+ Hasil Voting
+
+
+
+ {data?.map((e) => (
+ = 4 ? 6 : 4}>
+
+
+ {e.jumlah}
+
+ {e.value}
+
+
+ ))}
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/header_tamplate.tsx b/src/app_modules/vote/component/header_tamplate.tsx
new file mode 100644
index 00000000..386c4007
--- /dev/null
+++ b/src/app_modules/vote/component/header_tamplate.tsx
@@ -0,0 +1,69 @@
+"use client";
+
+import { Header, Group, ActionIcon, Text, Title } from "@mantine/core";
+import { IconArrowLeft, IconChevronLeft } from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+
+export default function ComponentVote_HeaderTamplate({
+ hideBack,
+ changeIconBack,
+ route,
+ route2,
+ title,
+ icon,
+ bg,
+}: {
+ hideBack?: boolean;
+ changeIconBack?: any;
+ route?: any;
+ route2?: any;
+ title: string;
+ icon?: any;
+ bg?: any;
+}) {
+ const router = useRouter();
+ return (
+ <>
+
+
+ {hideBack ? (
+
+ ) : (
+ {
+ if (route === null || route === undefined) {
+ return router.back();
+ } else {
+ return router.push(route);
+ }
+ }}
+ >
+ {changeIconBack ? changeIconBack : }
+
+ )}
+ {title}
+ {(() => {
+ if (route2 === null || route2 === undefined) {
+ return ;
+ } else {
+ return (
+ router.push(route2)}
+ >
+ {icon}
+
+ );
+ }
+ })()}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/component/is_empty_data.tsx b/src/app_modules/vote/component/is_empty_data.tsx
new file mode 100644
index 00000000..053a90d1
--- /dev/null
+++ b/src/app_modules/vote/component/is_empty_data.tsx
@@ -0,0 +1,13 @@
+"use client";
+
+import { Center } from "@mantine/core";
+
+export default function ComponentVote_IsEmptyData({ text }: { text: string }) {
+ return (
+ <>
+
+ {text}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/create/index.tsx b/src/app_modules/vote/create/index.tsx
new file mode 100644
index 00000000..ed23e60b
--- /dev/null
+++ b/src/app_modules/vote/create/index.tsx
@@ -0,0 +1,228 @@
+"use client";
+
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import {
+ Box,
+ Button,
+ Center,
+ Grid,
+ Group,
+ Stack,
+ Text,
+ TextInput,
+ Textarea,
+ Title,
+} from "@mantine/core";
+import { DatePickerInput } from "@mantine/dates";
+import { useCounter } from "@mantine/hooks";
+import { IconHome, IconMinus, IconPlus } from "@tabler/icons-react";
+import { useAtom } from "jotai";
+import moment from "moment";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { gs_vote_hotMenu, gs_vote_status } from "../global_state";
+import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
+import _ from "lodash";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+import { data } from "autoprefixer";
+import { Vote_funCreate } from "../fun/create/create_vote";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import { MODEL_VOTING } from "../model/interface";
+
+export default function Vote_Create() {
+ const router = useRouter();
+ const [hotMenu, setHotMenu] = useAtom(gs_vote_hotMenu);
+ const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
+
+ const [data, setData] = useState({
+ title: "",
+ deskripsi: "",
+ awalVote: Date,
+ akhirVote: Date,
+ });
+
+ // const [range, setRange] = useState({
+ // });
+
+ const [listVote, setListVote] = useState([
+ {
+ name: "Nama Voting",
+ value: "",
+ },
+ {
+ name: "Nama Voting",
+ value: "",
+ },
+ ]);
+
+ return (
+ <>
+
+
+ {
+ setData({
+ ...data,
+ title: val.target.value,
+ });
+ }}
+ />
+
+
+
+
+
+ Daftar Voting
+
+
+
+
+
+ {listVote.map((e, index) => (
+
+ {
+ const val = _.clone(listVote);
+ val[index].value = v.currentTarget.value;
+ setListVote([...val]);
+ }}
+ />
+
+ ))}
+
+
+
+ {listVote.length >= 4 ? (
+ ""
+ ) : (
+ }
+ variant="outline"
+ onClick={() => {
+ // if (listVote.length >= 4)
+ // return ComponentGlobal_NotifikasiPeringatan(
+ // "Daftar Voting Maksimal 4"
+ // );
+ setListVote([
+ ...listVote,
+ { name: "Nama Voting", value: "" },
+ ]);
+ }}
+ >
+ Tambah List
+
+ )}
+
+ {listVote.length <= 2 ? (
+ ""
+ ) : (
+ }
+ variant="outline"
+ onClick={() => {
+ if (listVote.length <= 2)
+ return ComponentGlobal_NotifikasiPeringatan(
+ "Daftar Voting Minimal 2"
+ );
+ setListVote([...listVote.slice(0, -1)]);
+ }}
+ >
+ Kurangi List
+
+ )}
+
+
+
+
+ {
+ onSave(router, setHotMenu, setTabsStatus, data as any, listVote);
+ }}
+ >
+ Simpan
+
+
+ >
+ );
+}
+
+async function onSave(
+ router: AppRouterInstance,
+ setHotMenu: any,
+ setTabsStatus: any,
+ data: MODEL_VOTING,
+ listVote: any[]
+) {
+ if (_.values(data).includes(""))
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
+
+ const cekAwalVote = moment(data.awalVote).format();
+ if (cekAwalVote === "Invalid date")
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Tanggal");
+
+ const cekAkhirVote = moment(data.akhirVote).format();
+ if (cekAkhirVote === "Invalid date")
+ return ComponentGlobal_NotifikasiPeringatan("Lengkapi Tanggal");
+
+ if (_.values(listVote.map((e) => e.value)).includes(""))
+ return ComponentGlobal_NotifikasiPeringatan("Isi Semua Nama Voting");
+
+ await Vote_funCreate(data, listVote).then((res) => {
+ if (res.status === 201) {
+ setHotMenu(1);
+ setTabsStatus("Review");
+ router.replace(RouterVote.status);
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/vote/create/layout.tsx b/src/app_modules/vote/create/layout.tsx
new file mode 100644
index 00000000..89058911
--- /dev/null
+++ b/src/app_modules/vote/create/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../component/header_tamplate";
+
+export default function LayoutVote_Create({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/draft/index.tsx b/src/app_modules/vote/detail/draft/index.tsx
new file mode 100644
index 00000000..fd952104
--- /dev/null
+++ b/src/app_modules/vote/detail/draft/index.tsx
@@ -0,0 +1,118 @@
+"use client";
+
+import { Button, Group, Modal, SimpleGrid, Stack, Title } from "@mantine/core";
+import ComponentVote_DetailDataSebelumPublish from "../../component/detail/detail_data_sebelum_publish";
+import { useRouter } from "next/navigation";
+import { useAtom } from "jotai";
+import { gs_vote_status } from "../../global_state";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { useDisclosure } from "@mantine/hooks";
+import { MODEL_VOTING } from "../../model/interface";
+import { Vote_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import { Vote_funDeleteById } from "../../fun/delete/fun_delete_by_id";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+
+export default function Vote_DetailDraft({
+ dataVote,
+}: {
+ dataVote: MODEL_VOTING;
+}) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function ButtonAction({
+ voteId,
+ awalVote,
+}: {
+ voteId: string;
+ awalVote: Date;
+}) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
+ const [opened, { open, close }] = useDisclosure(false);
+
+ async function onUpdate() {
+ const hariIni = new Date();
+ if (awalVote < hariIni) return ComponentGlobal_NotifikasiPeringatan("Tanggal Voting Lewat");
+
+ await Vote_funEditStatusByStatusId(voteId, "2").then((res) => {
+ if (res.status === 200) {
+ setTabsStatus("Review");
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Ajukan Review", 2000);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+ }
+
+ async function onDelete() {
+ await Vote_funDeleteById(voteId).then((res) => {
+ if (res.status === 200) {
+ setTabsStatus("Draft");
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Vote", 2000);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+ }
+
+ return (
+ <>
+
+ {
+ onUpdate();
+ }}
+ >
+ Ajukan Review
+
+ {
+ open();
+ }}
+ >
+ Hapus
+
+
+
+
+
+ Yakin menghapus vote ini ?
+
+ {
+ close();
+ }}
+ >
+ Kembali
+
+ {
+ onDelete();
+ }}
+ color="red"
+ >
+ Hapus
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/draft/layout.tsx b/src/app_modules/vote/detail/draft/layout.tsx
new file mode 100644
index 00000000..59cc24c6
--- /dev/null
+++ b/src/app_modules/vote/detail/draft/layout.tsx
@@ -0,0 +1,31 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+import { IconEdit } from "@tabler/icons-react";
+import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
+
+export default function LayoutVote_DetailDraft({
+ children,
+ voteId
+}: {
+ children: React.ReactNode;
+ voteId: string
+}) {
+ return (
+ <>
+ }
+ route2={RouterVote.edit + voteId}
+ />
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/kontribusi/index.tsx b/src/app_modules/vote/detail/kontribusi/index.tsx
new file mode 100644
index 00000000..16854181
--- /dev/null
+++ b/src/app_modules/vote/detail/kontribusi/index.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import {
+ Badge,
+ Card,
+ Center,
+ Grid,
+ Group,
+ Radio,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import moment from "moment";
+import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
+import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
+import { MODEL_VOTING } from "../../model/interface";
+import ComponentVote_DetailDataSetelahPublish from "../../component/detail/detail_data_setelah_publish";
+
+export default function Vote_DetailKontribusi({
+ dataVote,
+ listKontributor,
+}: {
+ dataVote: MODEL_VOTING;
+ listKontributor: any
+}) {
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+}
+
+
diff --git a/src/app_modules/vote/detail/kontribusi/layout.tsx b/src/app_modules/vote/detail/kontribusi/layout.tsx
new file mode 100644
index 00000000..f1485bc4
--- /dev/null
+++ b/src/app_modules/vote/detail/kontribusi/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_DetailKontribusi({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/main/index.tsx b/src/app_modules/vote/detail/main/index.tsx
new file mode 100644
index 00000000..76832920
--- /dev/null
+++ b/src/app_modules/vote/detail/main/index.tsx
@@ -0,0 +1,315 @@
+"use client";
+
+import {
+ Card,
+ Stack,
+ Center,
+ Title,
+ Badge,
+ Group,
+ Radio,
+ Grid,
+ Text,
+ Box,
+ Button,
+ Avatar,
+ Divider,
+} from "@mantine/core";
+import moment from "moment";
+import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
+import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
+import {
+ MODEL_VOTE_KONTRIBUTOR,
+ MODEL_VOTING,
+ MODEL_VOTING_DAFTAR_NAMA_VOTE,
+} from "../../model/interface";
+import { useState } from "react";
+import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
+import _ from "lodash";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
+import { Vote_funCreatePilihanVotingById } from "../../fun/create/create_pilihan_voting";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { Vote_funCreateHasil } from "../../fun/create/create_hasil";
+import { Vote_getOnebyId } from "../../fun/get/get_one_by_id";
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+
+export default function Vote_MainDetail({
+ dataVote,
+ hasilVoting,
+ isKontributor,
+ pilihanKontributor,
+ listKontributor,
+}: {
+ dataVote: MODEL_VOTING;
+ hasilVoting: any;
+ isKontributor: boolean;
+ pilihanKontributor: string;
+ listKontributor: any[];
+}) {
+ const [data, setData] = useState(dataVote);
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+}
+
+function TampilanDataVoting({
+ dataVote,
+ setData,
+ isKontributor,
+ pilihanKontributor,
+}: {
+ dataVote?: MODEL_VOTING;
+ setData: any;
+ isKontributor: boolean;
+ pilihanKontributor: any;
+}) {
+ const [votingNameId, setVotingNameId] = useState("");
+ return (
+ <>
+
+
+
+
+
+
+
+ {dataVote?.title}
+
+ {dataVote?.deskripsi}
+
+
+
+
+ Batas Voting
+
+
+
+
+
+ {dataVote?.awalVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+ -
+
+ {dataVote?.akhirVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "medium",
+ })}
+
+
+
+
+
+
+
+ {/* Voting View */}
+
+ {isKontributor ? (
+
+
+ Pilihan anda:
+
+
+ {pilihanKontributor.Voting_DaftarNamaVote.value}
+
+
+ ) : (
+
+ {
+ setVotingNameId(val);
+ }}
+ label={
+
+ Pilihan :
+
+ }
+ >
+
+ {dataVote?.Voting_DaftarNamaVote.map((v) => (
+
+
+
+ ))}
+
+
+
+ {_.isEmpty(votingNameId) ? (
+
+ Vote
+
+ ) : (
+
+ onVote(votingNameId, dataVote?.id as any, setData)
+ }
+ >
+ Vote
+
+ )}
+
+
+ )}
+
+
+ >
+ );
+}
+
+async function onVote(pilihanVotingId: string, voteId: string, setData: any) {
+ await Vote_funCreateHasil(pilihanVotingId, voteId).then(async (res) => {
+ if (res.status === 201) {
+ await Vote_getOnebyId(voteId).then((val) => {
+ setData(val);
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ });
+ } else {
+ ComponentGlobal_NotifikasiPeringatan(res.message);
+ }
+ });
+}
+
+function TampilanHasil({
+ data,
+ hasil,
+}: {
+ data: MODEL_VOTING_DAFTAR_NAMA_VOTE[];
+ hasil: any;
+}) {
+ return (
+ <>
+
+
+
+
+ Hasil Voting
+
+
+ {/* {JSON.stringify(data, null,2)} */}
+
+
+ {data.map((e) => (
+ = 4 ? 6 : 4}>
+
+
+
+ {e.jumlah}
+ {/* {hasil.filter((i: any) => i.idDaftarNama == "clsijw6ur0002x5loqsq6g4id")} */}
+
+
+ {e.value}
+
+
+ ))}
+
+
+
+
+ >
+ );
+}
+
+function TampilanListKontributor({
+ lisKontributor,
+}: {
+ lisKontributor: MODEL_VOTE_KONTRIBUTOR[];
+}) {
+ return (
+ <>
+
+
+
+
+ Daftar Voting
+
+ {lisKontributor.map((e, i) => (
+
+
+
+
+
+
+
+
+ {e ? e.Author.Profile.name : "Nama author"}
+
+
+
+
+
+ {e.Voting_DaftarNamaVote.value}
+
+
+
+
+
+ ))}
+ {/* {lisKontributor.map((e) => (
+
+
+
+
+
+ {e ? e.Author.Profile.name : "Nama author"}
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Harum minus libero, ullam ipsum quasi labore iure doloremque sunt et mollitia dolorem laborum quisquam, dolores quis deserunt id. Ipsa, minus temporibus.
+
+
+
+
+ ))} */}
+
+
+
+ {/* {JSON.stringify(lisKontributor, null, 2)} */}
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/main/layout.tsx b/src/app_modules/vote/detail/main/layout.tsx
new file mode 100644
index 00000000..543062a9
--- /dev/null
+++ b/src/app_modules/vote/detail/main/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_MainDetail({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/publish/index.tsx b/src/app_modules/vote/detail/publish/index.tsx
new file mode 100644
index 00000000..de2b416a
--- /dev/null
+++ b/src/app_modules/vote/detail/publish/index.tsx
@@ -0,0 +1,81 @@
+"use client";
+
+import {
+ Badge,
+ Card,
+ Center,
+ Grid,
+ Group,
+ Radio,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import ComponentVote_DetailDataSebelumPublish from "../../component/detail/detail_data_sebelum_publish";
+import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
+import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
+import moment from "moment";
+import { MODEL_VOTE_KONTRIBUTOR, MODEL_VOTING } from "../../model/interface";
+import ComponentVote_DetailDataSetelahPublish from "../../component/detail/detail_data_setelah_publish";
+
+export default function Vote_DetailPublish({
+ dataVote,
+ listKontributor,
+}: {
+ dataVote: MODEL_VOTING;
+ listKontributor: MODEL_VOTE_KONTRIBUTOR;
+}) {
+ return (
+ <>
+
+ {/* */}
+
+
+
+
+ >
+ );
+}
+
+function TampilanDataVoting({ data }: { data: MODEL_VOTING }) {
+ return (
+ <>
+
+
+
+
+ {data.title}
+
+ {data.deskripsi}
+
+
+
+
+
+
+ Batas Voting
+
+
+
+
+
+ {data.awalVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "long",
+ })}
+
+ -
+
+ {data.akhirVote.toLocaleDateString(["id-ID"], {
+ dateStyle: "long",
+ })}
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/publish/layout.tsx b/src/app_modules/vote/detail/publish/layout.tsx
new file mode 100644
index 00000000..0ce32506
--- /dev/null
+++ b/src/app_modules/vote/detail/publish/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_DetailPublish({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/reject/index.tsx b/src/app_modules/vote/detail/reject/index.tsx
new file mode 100644
index 00000000..43a8faa8
--- /dev/null
+++ b/src/app_modules/vote/detail/reject/index.tsx
@@ -0,0 +1,116 @@
+"use client";
+
+import {
+ Button,
+ Group,
+ Modal,
+ SimpleGrid,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import ComponentVote_DetailDataSebelumPublish from "../../component/detail/detail_data_sebelum_publish";
+import { useRouter } from "next/navigation";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { useAtom } from "jotai";
+import { gs_vote_status } from "../../global_state";
+import { useDisclosure } from "@mantine/hooks";
+import { MODEL_VOTING } from "../../model/interface";
+import { Vote_funDeleteById } from "../../fun/delete/fun_delete_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+import { Vote_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_id";
+
+export default function Vote_DetailReject({
+ dataVote,
+}: {
+ dataVote: MODEL_VOTING;
+}) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function ButtonAction({ voteId }: { voteId: string }) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
+ const [opened, { open, close }] = useDisclosure(false);
+
+ async function onUpdate() {
+ await Vote_funEditStatusByStatusId(voteId, "3").then((res) => {
+ if (res.status === 200) {
+ setTabsStatus("Draft");
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Masuk Draft", 2000);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+ }
+
+ async function onDelete() {
+ await Vote_funDeleteById(voteId).then((res) => {
+ if (res.status === 200) {
+ setTabsStatus("Draft");
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Vote", 2000);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+ }
+
+ return (
+ <>
+
+ {
+ onUpdate();
+ }}
+ >
+ Edit Kembali
+ {" "}
+ {
+ open();
+ }}
+ >
+ Hapus
+
+
+
+
+
+ Yakin menghapus vote ini ?
+
+ {
+ close();
+ }}
+ >
+ Kembali
+
+ {
+ onDelete();
+ }}
+ color="red"
+ >
+ Hapus
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/reject/layout.tsx b/src/app_modules/vote/detail/reject/layout.tsx
new file mode 100644
index 00000000..29ff87f7
--- /dev/null
+++ b/src/app_modules/vote/detail/reject/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_DetailReject({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/review/index.tsx b/src/app_modules/vote/detail/review/index.tsx
new file mode 100644
index 00000000..f13b446f
--- /dev/null
+++ b/src/app_modules/vote/detail/review/index.tsx
@@ -0,0 +1,69 @@
+"use client";
+
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import {
+ Badge,
+ Button,
+ Card,
+ Center,
+ Grid,
+ Group,
+ Radio,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import { useAtom } from "jotai";
+import moment from "moment";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useRouter } from "next/navigation";
+import { gs_vote_status } from "../../global_state";
+import ComponentVote_DetailDataSebelumPublish from "../../component/detail/detail_data_sebelum_publish";
+import { Vote_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_id";
+import { MODEL_VOTING } from "../../model/interface";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+
+export default function Vote_DetailReview({
+ dataVote,
+}: {
+ dataVote: MODEL_VOTING;
+}) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function ButtonAction({ voteId }: { voteId: string }) {
+ const router = useRouter();
+ const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
+
+ async function onUpdate() {
+ await Vote_funEditStatusByStatusId(voteId, "3").then((res) => {
+ if (res.status === 200) {
+ setTabsStatus("Draft");
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Batalkan Review", 2000);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+ }
+ return (
+ <>
+ {
+ onUpdate();
+ }}
+ >
+ Batalkan Review
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/review/layout.tsx b/src/app_modules/vote/detail/review/layout.tsx
new file mode 100644
index 00000000..7e506590
--- /dev/null
+++ b/src/app_modules/vote/detail/review/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_DetailReview({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/riwayat_saya/layout.tsx b/src/app_modules/vote/detail/riwayat_saya/layout.tsx
new file mode 100644
index 00000000..83609c4d
--- /dev/null
+++ b/src/app_modules/vote/detail/riwayat_saya/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_DetailRiwayatSaya({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/riwayat_saya/page.tsx b/src/app_modules/vote/detail/riwayat_saya/page.tsx
new file mode 100644
index 00000000..2f1bbb48
--- /dev/null
+++ b/src/app_modules/vote/detail/riwayat_saya/page.tsx
@@ -0,0 +1,30 @@
+"use client";
+
+import { Stack } from "@mantine/core";
+import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
+import ComponentVote_DetailDataSetelahPublish from "../../component/detail/detail_data_setelah_publish";
+import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
+import { MODEL_VOTING } from "../../model/interface";
+
+export default function Vote_DetailRiwayatSaya({
+ dataVote,
+ listKontributor,
+}: {
+ dataVote: MODEL_VOTING;
+ listKontributor: any[];
+}) {
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/semua_riwayat/layout.tsx b/src/app_modules/vote/detail/semua_riwayat/layout.tsx
new file mode 100644
index 00000000..759fb5a6
--- /dev/null
+++ b/src/app_modules/vote/detail/semua_riwayat/layout.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
+
+export default function LayoutVote_DetailSemuaRiwayat({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/detail/semua_riwayat/page.tsx b/src/app_modules/vote/detail/semua_riwayat/page.tsx
new file mode 100644
index 00000000..ed83c15b
--- /dev/null
+++ b/src/app_modules/vote/detail/semua_riwayat/page.tsx
@@ -0,0 +1,29 @@
+"use client";
+
+import { Stack } from "@mantine/core";
+import ComponentVote_DetailDataTanpaVote from "../../component/detail/detail_data_tanpa_vote";
+import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
+import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
+import ComponentVote_DetailDataSetelahPublish from "../../component/detail/detail_data_setelah_publish";
+import { MODEL_VOTE_KONTRIBUTOR, MODEL_VOTING } from "../../model/interface";
+
+export default function Vote_DetailSemuaRiwayat({
+ dataVote,
+ listKontributor,
+}: {
+ dataVote: MODEL_VOTING;
+ listKontributor:MODEL_VOTE_KONTRIBUTOR[]
+}) {
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/edit/index.tsx b/src/app_modules/vote/edit/index.tsx
new file mode 100644
index 00000000..4369a632
--- /dev/null
+++ b/src/app_modules/vote/edit/index.tsx
@@ -0,0 +1,162 @@
+"use client";
+
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import {
+ Box,
+ Button,
+ Center,
+ Grid,
+ Group,
+ Stack,
+ Text,
+ TextInput,
+ Textarea,
+ Title,
+} from "@mantine/core";
+import { DatePickerInput } from "@mantine/dates";
+import { useCounter } from "@mantine/hooks";
+import { IconHome, IconPlus } from "@tabler/icons-react";
+import { useAtom } from "jotai";
+import moment from "moment";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { gs_vote_hotMenu, gs_vote_status } from "../global_state";
+import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
+import {
+ MODEL_VOTING,
+ MODEL_VOTING_DAFTAR_NAMA_VOTE,
+} from "../model/interface";
+import _ from "lodash";
+import { Vote_funEditById } from "../fun/edit/fun_edit_by_id";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+
+export default function Vote_Edit({
+ dataVote,
+ listDaftarVote,
+}: {
+ dataVote: MODEL_VOTING;
+ listDaftarVote: MODEL_VOTING_DAFTAR_NAMA_VOTE[];
+}) {
+ const [data, setData] = useState(dataVote);
+ const [listVoting, setListVoting] = useState(listDaftarVote);
+
+ return (
+ <>
+
+ {
+ setData({
+ ...data,
+ title: val.target.value,
+ });
+ }}
+ />
+
+ >
+ );
+}
+
+function ButtonAction({
+ data,
+ listVoting,
+}: {
+ data: MODEL_VOTING;
+ listVoting: MODEL_VOTING_DAFTAR_NAMA_VOTE[];
+}) {
+ const router = useRouter();
+ const [hotMenu, setHotMenu] = useAtom(gs_vote_hotMenu);
+ const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
+
+ async function onUpdate() {
+ await Vote_funEditById(data, listVoting).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Update");
+ // setHotMenu(1);
+ // setTabsStatus("Draft");
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+ }
+
+ return (
+ <>
+ onUpdate()}>
+ Update
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/edit/layout.tsx b/src/app_modules/vote/edit/layout.tsx
new file mode 100644
index 00000000..6dc6905f
--- /dev/null
+++ b/src/app_modules/vote/edit/layout.tsx
@@ -0,0 +1,19 @@
+"use client";
+
+import { AppShell } from "@mantine/core";
+import React from "react";
+import ComponentVote_HeaderTamplate from "../component/header_tamplate";
+
+export default function LayoutVote_Edit({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }>
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/fun/create/create_hasil.ts b/src/app_modules/vote/fun/create/create_hasil.ts
new file mode 100644
index 00000000..aae5f4cc
--- /dev/null
+++ b/src/app_modules/vote/fun/create/create_hasil.ts
@@ -0,0 +1,46 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+import { revalidatePath } from "next/cache";
+
+export async function Vote_funCreateHasil(
+ pilihanVotingId: string,
+ votingId: string
+) {
+ const authorId = await User_getUserId();
+
+ const get = await prisma.voting_DaftarNamaVote.findFirst({
+ where: {
+ id: pilihanVotingId,
+ },
+ select: {
+ jumlah: true,
+ },
+ });
+
+ if (!get) return { status: 400, message: "Gagal Voting" };
+
+ const updt = await prisma.voting_DaftarNamaVote.update({
+ where: {
+ id: pilihanVotingId,
+ },
+ data: {
+ jumlah: get.jumlah + 1,
+ },
+ });
+ if (!updt) return { status: 400, message: "Gagal Update" };
+
+ const create = await prisma.voting_Kontributor.create({
+ data: {
+ voting_DaftarNamaVoteId: pilihanVotingId,
+ votingId: votingId,
+ authorId: authorId,
+ },
+ });
+ if (!create) return { status: 400, message: "Gagal Menjadi Kontributor" };
+
+
+ revalidatePath("/dev/vote/detail/main/");
+ return { status: 201, message: "Berhasil Voting" };
+}
diff --git a/src/app_modules/vote/fun/create/create_pilihan_voting.ts b/src/app_modules/vote/fun/create/create_pilihan_voting.ts
new file mode 100644
index 00000000..56d3c01a
--- /dev/null
+++ b/src/app_modules/vote/fun/create/create_pilihan_voting.ts
@@ -0,0 +1,24 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+import { revalidatePath } from "next/cache";
+
+export async function Vote_funCreatePilihanVotingById(
+ namaVotingId: string,
+ votingId: string
+) {
+ const authorId = await User_getUserId();
+
+ const create = await prisma.voting_Kontributor.create({
+ data: {
+ voting_DaftarNamaVoteId: namaVotingId,
+ votingId: votingId,
+ authorId: authorId,
+ },
+ });
+
+ if(!create) return {status: 400, message: "Gagal Voting"}
+ revalidatePath("/dev/vote/detail/main/");
+ return {status: 201, message: "Berhasil Voting"}
+}
diff --git a/src/app_modules/vote/fun/create/create_vote.ts b/src/app_modules/vote/fun/create/create_vote.ts
new file mode 100644
index 00000000..af605612
--- /dev/null
+++ b/src/app_modules/vote/fun/create/create_vote.ts
@@ -0,0 +1,41 @@
+"use server";
+
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+import { MODEL_VOTING } from "../../model/interface";
+import prisma from "@/app/lib/prisma";
+import { revalidatePath } from "next/cache";
+
+export async function Vote_funCreate(req: MODEL_VOTING, listVote: any[]) {
+ const authorId = await User_getUserId();
+
+ const create = await prisma.voting.create({
+ data: {
+ title: req.title,
+ deskripsi: req.deskripsi,
+ awalVote: req.awalVote,
+ akhirVote: req.akhirVote,
+ authorId: authorId,
+ },
+ });
+
+ if (!create) return { status: 400, message: "Gagal Membuat Vote" };
+
+ for (let v of listVote) {
+ const val = v.value;
+
+ const namaVote = await prisma.voting_DaftarNamaVote.createMany({
+ data: {
+ value: val,
+ votingId: create.id,
+ },
+ });
+
+ if (!namaVote) return { status: 400, message: "Gagal Membuat List" };
+ }
+ revalidatePath("/dev/vote/main/status");
+
+ return {
+ status: 201,
+ message: "Berhasil Membuat Vote",
+ };
+}
diff --git a/src/app_modules/vote/fun/delete/fun_delete_by_id.ts b/src/app_modules/vote/fun/delete/fun_delete_by_id.ts
new file mode 100644
index 00000000..990613c5
--- /dev/null
+++ b/src/app_modules/vote/fun/delete/fun_delete_by_id.ts
@@ -0,0 +1,26 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { revalidatePath } from "next/cache";
+
+/**
+ * @param voteId
+ * @returns isActive berubah menjadi false
+ */
+export async function Vote_funDeleteById(voteId: string) {
+ const del = await prisma.voting.update({
+ where: {
+ id: voteId,
+ },
+ data: {
+ isActive: false,
+ },
+ });
+
+ if (!del) return { status: 400, message: "Gagal Hapus Data" };
+ revalidatePath("/dev/vote/main/status");
+ return {
+ status: 200,
+ message: "Hapus Berhasil",
+ };
+}
diff --git a/src/app_modules/vote/fun/edit/fun_edit_by_id.ts b/src/app_modules/vote/fun/edit/fun_edit_by_id.ts
new file mode 100644
index 00000000..4a1d686a
--- /dev/null
+++ b/src/app_modules/vote/fun/edit/fun_edit_by_id.ts
@@ -0,0 +1,48 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import {
+ MODEL_VOTING,
+ MODEL_VOTING_DAFTAR_NAMA_VOTE,
+} from "../../model/interface";
+import { revalidatePath } from "next/cache";
+
+export async function Vote_funEditById(
+ data: MODEL_VOTING,
+ listVoting: MODEL_VOTING_DAFTAR_NAMA_VOTE[]
+) {
+ // console.log(listVoting)
+ const updtVoting = await prisma.voting.update({
+ where: {
+ id: data.id,
+ },
+ data: {
+ title: data.title,
+ deskripsi: data.deskripsi,
+ awalVote: data.awalVote,
+ akhirVote: data.akhirVote,
+ },
+ });
+
+ if (!updtVoting) return { status: 400, message: "Gagal Update" };
+
+ for (let e of listVoting) {
+ const updtListVoting = await prisma.voting_DaftarNamaVote.updateMany({
+ where: {
+ id: e.id,
+ },
+ data: {
+ value: e.value,
+ },
+ });
+
+ if (!updtListVoting)
+ return { status: 400, message: "Gagal Update Daftar Vote" };
+ }
+
+ revalidatePath("/dev/vote/detail/draft");
+ return {
+ status: 200,
+ message: "Berhasil Update",
+ };
+}
diff --git a/src/app_modules/vote/fun/edit/fun_edit_status_by_id.ts b/src/app_modules/vote/fun/edit/fun_edit_status_by_id.ts
new file mode 100644
index 00000000..af53f490
--- /dev/null
+++ b/src/app_modules/vote/fun/edit/fun_edit_status_by_id.ts
@@ -0,0 +1,26 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+import { revalidatePath } from "next/cache";
+
+export async function Vote_funEditStatusByStatusId(
+ voteId: string,
+ statusId: string
+) {
+ const updt = await prisma.voting.update({
+ where: {
+ id: voteId,
+ },
+ data: {
+ voting_StatusId: statusId,
+ },
+ });
+
+ if (!updt) return { status: 400, message: "Gagal Update" };
+ revalidatePath("/dev/vote/main/status");
+ return {
+ status: 200,
+ message: "Update Berhasil",
+ };
+}
diff --git a/src/app_modules/vote/fun/get/cek_kontributor_by_id.ts b/src/app_modules/vote/fun/get/cek_kontributor_by_id.ts
new file mode 100644
index 00000000..53b4e57f
--- /dev/null
+++ b/src/app_modules/vote/fun/get/cek_kontributor_by_id.ts
@@ -0,0 +1,21 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+
+export async function Vote_cekKontributorById(votingId: string) {
+ const UserId = await User_getUserId()
+
+ const cek = await prisma.voting_Kontributor.count({
+ where: {
+ authorId: UserId,
+ votingId: votingId,
+ },
+ });
+
+ if (cek > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
diff --git a/src/app_modules/vote/fun/get/get_all_list_publish.ts b/src/app_modules/vote/fun/get/get_all_list_publish.ts
new file mode 100644
index 00000000..bb1f5a6e
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_all_list_publish.ts
@@ -0,0 +1,47 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+
+export async function Vote_getAllListPublish() {
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ updatedAt: "desc",
+ },
+ 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,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ Author: {
+ select: {
+ id: true,
+ username: true,
+ nomor: true,
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/vote/fun/get/get_all_list_riwayat.ts b/src/app_modules/vote/fun/get/get_all_list_riwayat.ts
new file mode 100644
index 00000000..b92fa6f5
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_all_list_riwayat.ts
@@ -0,0 +1,46 @@
+"use server"
+
+import prisma from "@/app/lib/prisma"
+
+export async function Vote_getAllListRiwayat() {
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ createdAt: "asc",
+ },
+ 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,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ Author: {
+ select: {
+ id: true,
+ username: true,
+ nomor: true,
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data
+}
\ No newline at end of file
diff --git a/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts b/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts
new file mode 100644
index 00000000..2d24a87a
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts
@@ -0,0 +1,49 @@
+"use server";
+
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+import prisma from "@/app/lib/prisma";
+
+export async function Vote_getAllListRiwayatSaya() {
+ const authorId = await User_getUserId();
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ createdAt: "asc",
+ },
+ where: {
+ voting_StatusId: "1",
+ authorId: authorId,
+ 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,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ Author: {
+ select: {
+ id: true,
+ username: true,
+ nomor: true,
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/vote/fun/get/get_list_daftar_vote_by_id.ts b/src/app_modules/vote/fun/get/get_list_daftar_vote_by_id.ts
new file mode 100644
index 00000000..e09d4b8a
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_list_daftar_vote_by_id.ts
@@ -0,0 +1,13 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Vote_getListDaftarNamaById(voteId: string) {
+ const data = await prisma.voting_DaftarNamaVote.findMany({
+ where: {
+ votingId: voteId,
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/vote/fun/get/get_list_hasil_by_id.ts b/src/app_modules/vote/fun/get/get_list_hasil_by_id.ts
new file mode 100644
index 00000000..bdc856e3
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_list_hasil_by_id.ts
@@ -0,0 +1,42 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { MODEL_VOTING_DAFTAR_NAMA_VOTE } from "../../model/interface";
+import _ from "lodash";
+
+export async function Vote_getHasilVoteById(
+ daftarPilihanVoting: MODEL_VOTING_DAFTAR_NAMA_VOTE[]
+) {
+ // console.log(daftarPilihanVoting)
+
+ // for (let e of daftarPilihanVoting) {
+ // const get = await prisma.voting_Kontributor.count({
+ // where: {
+ // voting_DaftarNamaVoteId: e.id,
+ // },
+ // });
+
+ // console.log(get);
+ // return get
+ // }
+
+ const data = await prisma.voting_Kontributor.findMany({
+ where: {
+ votingId: "clsijw6uf0001x5logh7msuh1",
+ },
+ });
+
+ const hitung = _.map(
+ _.groupBy(data, "voting_DaftarNamaVoteId"),
+ (v: any) => ({
+ jumlah: v.length,
+ idDaftarNama: v[0].voting_DaftarNamaVoteId,
+ })
+ );
+
+// const filter = hitung.filter(
+// (i: any) => i.idDaftarNama == "clsijw6ur0002x5loqsq6g4id"
+// );
+
+ return hitung
+}
diff --git a/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts b/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts
new file mode 100644
index 00000000..6c9a5738
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts
@@ -0,0 +1,41 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+
+export async function Vote_getAllListKontribusiByAuthorId() {
+ const authorId = await User_getUserId();
+ const data = await prisma.voting_Kontributor.findMany({
+ orderBy: {
+ createdAt: "asc",
+ },
+ where: {
+ authorId: authorId,
+ },
+ select: {
+ id: true,
+ Voting: {
+ select: {
+ id: true,
+ title: true,
+ isActive: true,
+ awalVote: true,
+ akhirVote: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ },
+ },
+ Voting_DaftarNamaVote: true,
+ Author: true,
+ },
+ });
+ return data;
+}
diff --git a/src/app_modules/vote/fun/get/get_list_kontributor_by_id.ts b/src/app_modules/vote/fun/get/get_list_kontributor_by_id.ts
new file mode 100644
index 00000000..7fcd1f3c
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_list_kontributor_by_id.ts
@@ -0,0 +1,26 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Vote_getListKontributorById(votingId: string) {
+ const data = await prisma.voting_Kontributor.findMany({
+ where: {
+ votingId: votingId,
+ },
+ select: {
+ id: true,
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ Voting_DaftarNamaVote: {
+ select: {
+ value: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/vote/fun/get/get_list_status_by_status_id.ts b/src/app_modules/vote/fun/get/get_list_status_by_status_id.ts
new file mode 100644
index 00000000..f38ac9b9
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_list_status_by_status_id.ts
@@ -0,0 +1,89 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+
+export async function Vote_getListByStatusId(statusId: string) {
+ const authorId = await User_getUserId();
+
+ if (statusId === "1") {
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ updatedAt: "desc",
+ },
+ where: {
+ voting_StatusId: "1",
+ authorId: authorId,
+ 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,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ },
+ });
+
+ return data;
+ }
+
+ if (statusId === "2") {
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ updatedAt: "desc",
+ },
+ where: {
+ voting_StatusId: "2",
+ authorId: authorId,
+ isActive: true,
+ },
+ });
+
+ return data;
+ }
+
+ if (statusId === "3") {
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ updatedAt: "desc",
+ },
+ where: {
+ voting_StatusId: "3",
+ authorId: authorId,
+ isActive: true,
+ },
+ });
+
+ return data;
+ }
+
+ if (statusId === "4") {
+ const data = await prisma.voting.findMany({
+ orderBy: {
+ updatedAt: "desc",
+ },
+ where: {
+ voting_StatusId: "4",
+ authorId: authorId,
+ isActive: true,
+ },
+ });
+
+ return data;
+ }
+}
diff --git a/src/app_modules/vote/fun/get/get_one_by_id.ts b/src/app_modules/vote/fun/get/get_one_by_id.ts
new file mode 100644
index 00000000..7ba3106b
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_one_by_id.ts
@@ -0,0 +1,37 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Vote_getOnebyId(voteId: string) {
+ const data = await prisma.voting.findFirst({
+ where: {
+ id: voteId,
+ },
+ select: {
+ id: true,
+ title: true,
+ isActive: true,
+ createdAt: true,
+ updatedAt: true,
+ deskripsi: true,
+ awalVote: true,
+ akhirVote: true,
+ catatan: true,
+ authorId: true,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc"
+ }
+ },
+ Author: {
+ select: {
+ Profile: true
+ }
+ }
+
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/vote/fun/get/get_one_pilihan_voting_by_user_id.ts b/src/app_modules/vote/fun/get/get_one_pilihan_voting_by_user_id.ts
new file mode 100644
index 00000000..f1b67d95
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_one_pilihan_voting_by_user_id.ts
@@ -0,0 +1,23 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
+
+export async function Vote_getOnePilihanVotingByUserId(votingId: string) {
+ const userId = await User_getUserId();
+ const get = await prisma.voting_Kontributor.findFirst({
+ where: {
+ authorId: userId,
+ votingId: votingId,
+ },
+ select: {
+ Voting_DaftarNamaVote: {
+ select: {
+ value: true,
+ },
+ },
+ },
+ });
+
+ return get;
+}
diff --git a/src/app_modules/vote/fun/get/get_one_publish_by_id.ts b/src/app_modules/vote/fun/get/get_one_publish_by_id.ts
new file mode 100644
index 00000000..73295884
--- /dev/null
+++ b/src/app_modules/vote/fun/get/get_one_publish_by_id.ts
@@ -0,0 +1,36 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+
+export async function Vote_getOnePublishbyId(voteId: string) {
+ const data = await prisma.voting.findFirst({
+ where: {
+ id: voteId,
+ },
+ select: {
+ id: true,
+ title: true,
+ isActive: true,
+ createdAt: true,
+ updatedAt: true,
+ deskripsi: true,
+ awalVote: true,
+ akhirVote: true,
+ catatan: true,
+ authorId: true,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ Author: {
+ select: {
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/vote/global_state/index.ts b/src/app_modules/vote/global_state/index.ts
new file mode 100644
index 00000000..29fe5ac5
--- /dev/null
+++ b/src/app_modules/vote/global_state/index.ts
@@ -0,0 +1,13 @@
+import { atomWithStorage } from "jotai/utils";
+
+export const gs_vote_hotMenu = atomWithStorage("gs_vote_hotMenu", 0);
+
+export const gs_vote_status = atomWithStorage(
+ "gs_vote_status",
+ "Publish"
+);
+
+export const gs_vote_riwayat = atomWithStorage(
+ "gs_vote_riwayat",
+ "Semua"
+);
diff --git a/src/app_modules/vote/index.tsx b/src/app_modules/vote/index.tsx
new file mode 100644
index 00000000..dd913f3c
--- /dev/null
+++ b/src/app_modules/vote/index.tsx
@@ -0,0 +1,55 @@
+import LayoutVote_Main from "./main/layout";
+import Vote_Beranda from "./main/beranda";
+import Vote_Status from "./main/status";
+import Vote_Kontribusi from "./main/kontribusi";
+import Vote_Riwayat from "./main/riwayat";
+import Vote_Splash from "./splash";
+import Vote_Create from "./create";
+import LayoutVote_Create from "./create/layout";
+import Vote_DetailPublish from "./detail/publish";
+import Vote_DetailReview from "./detail/review";
+import Vote_DetailDraft from "./detail/draft";
+import Vote_DetailReject from "./detail/reject";
+import LayoutVote_DetailPublish from "./detail/publish/layout";
+import LayoutVote_DetailReview from "./detail/review/layout";
+import LayoutVote_DetailDraft from "./detail/draft/layout";
+import LayoutVote_DetailReject from "./detail/reject/layout";
+import Vote_Edit from "./edit";
+import LayoutVote_Edit from "./edit/layout";
+import Vote_MainDetail from "./detail/main";
+import LayoutVote_MainDetail from "./detail/main/layout";
+import Vote_DetailKontribusi from "./detail/kontribusi";
+import LayoutVote_DetailKontribusi from "./detail/kontribusi/layout";
+import Vote_DetailSemuaRiwayat from "./detail/semua_riwayat/page";
+import LayoutVote_DetailSemuaRiwayat from "./detail/semua_riwayat/layout";
+import Vote_DetailRiwayatSaya from "./detail/riwayat_saya/page";
+import LayoutVote_DetailRiwayatSaya from "./detail/riwayat_saya/layout";
+
+export {
+ LayoutVote_Main,
+ Vote_Beranda,
+ Vote_Status,
+ Vote_Kontribusi,
+ Vote_Riwayat,
+ Vote_Splash,
+ Vote_Create,
+ LayoutVote_Create,
+ Vote_DetailPublish,
+ Vote_DetailReview,
+ Vote_DetailDraft,
+ Vote_DetailReject,
+ LayoutVote_DetailPublish,
+ LayoutVote_DetailReview,
+ LayoutVote_DetailDraft,
+ LayoutVote_DetailReject,
+ Vote_Edit,
+ LayoutVote_Edit,
+ Vote_MainDetail,
+ LayoutVote_MainDetail,
+ Vote_DetailKontribusi,
+ LayoutVote_DetailKontribusi,
+ Vote_DetailSemuaRiwayat,
+ LayoutVote_DetailSemuaRiwayat,
+ Vote_DetailRiwayatSaya,
+ LayoutVote_DetailRiwayatSaya,
+};
diff --git a/src/app_modules/vote/main/beranda.tsx b/src/app_modules/vote/main/beranda.tsx
new file mode 100644
index 00000000..3a8190b5
--- /dev/null
+++ b/src/app_modules/vote/main/beranda.tsx
@@ -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 (
+ <>
+
+ {
+ router.push(RouterVote.create);
+ }}
+ >
+
+
+
+
+
+ {dataVote.map((e, i) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/kontribusi.tsx b/src/app_modules/vote/main/kontribusi.tsx
new file mode 100644
index 00000000..bb165431
--- /dev/null
+++ b/src/app_modules/vote/main/kontribusi.tsx
@@ -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 (
+ <>
+
+ {dataKontribusi.map((e, i) => (
+
+
+
+ ))}
+
+ {/* {JSON.stringify(dataKontribusi, null, 2)} */}
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/layout.tsx b/src/app_modules/vote/main/layout.tsx
new file mode 100644
index 00000000..bd8c9461
--- /dev/null
+++ b/src/app_modules/vote/main/layout.tsx
@@ -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: ,
+ },
+
+ {
+ id: 2,
+ name: "Status",
+ path: RouterVote.status,
+ icon: ,
+ },
+ {
+ id: 3,
+ name: "Kontribusi",
+ path: RouterVote.kontribusi,
+ icon: ,
+ },
+ {
+ id: 4,
+ name: "Riwayat",
+ path: RouterVote.riwayat,
+ icon: ,
+ },
+ ];
+
+ return (
+ <>
+
+ }
+ footer={
+
+
+ {listFooter.map((e, i) => (
+ {
+ router.replace(e.path);
+ setHotMenu(i);
+ }}
+ >
+
+
+
+ {e.icon}
+
+
+ {e.name}
+
+
+
+
+ ))}
+
+
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/riwayat/index.tsx b/src/app_modules/vote/main/riwayat/index.tsx
new file mode 100644
index 00000000..0efbb358
--- /dev/null
+++ b/src/app_modules/vote/main/riwayat/index.tsx
@@ -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: ,
+ value: "Semua",
+ label: "Semua Riwayat",
+ },
+ {
+ id: 2,
+ path: ,
+ value: "Saya",
+ label: "Riwayat Saya",
+ },
+ ];
+
+ return (
+ <>
+
+
+
+ {listTabs.map((e, i) => (
+
+ {e.label}
+
+ ))}
+
+ {listTabs.map((e) => (
+
+ {e.path}
+
+ ))}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/riwayat/saya.tsx b/src/app_modules/vote/main/riwayat/saya.tsx
new file mode 100644
index 00000000..76bce80a
--- /dev/null
+++ b/src/app_modules/vote/main/riwayat/saya.tsx
@@ -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 (
+ <>
+
+ {listRiwayatSaya.map((e, i) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/riwayat/semua.tsx b/src/app_modules/vote/main/riwayat/semua.tsx
new file mode 100644
index 00000000..cb382560
--- /dev/null
+++ b/src/app_modules/vote/main/riwayat/semua.tsx
@@ -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 (
+ <>
+
+ {listRiwayat.map((e, i) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/status/draft.tsx b/src/app_modules/vote/main/status/draft.tsx
new file mode 100644
index 00000000..916a3c12
--- /dev/null
+++ b/src/app_modules/vote/main/status/draft.tsx
@@ -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 ;
+ return (
+ <>
+
+ {listDraft.map((e) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/status/index.tsx b/src/app_modules/vote/main/status/index.tsx
new file mode 100644
index 00000000..8184f75b
--- /dev/null
+++ b/src/app_modules/vote/main/status/index.tsx
@@ -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: ,
+ value: "Publish",
+ },
+ {
+ id: 2,
+ path: ,
+ value: "Review",
+ },
+ {
+ id: 3,
+ path: ,
+ value: "Draft",
+ },
+ {
+ id: 4,
+ path: ,
+ value: "Reject",
+ },
+ ];
+ return (
+ <>
+
+
+
+ {listTabs.map((e) => (
+
+ {e.value}
+
+ ))}
+
+ {listTabs.map((e) => (
+
+ {e.path}
+
+ ))}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/status/publish.tsx b/src/app_modules/vote/main/status/publish.tsx
new file mode 100644
index 00000000..255f03bc
--- /dev/null
+++ b/src/app_modules/vote/main/status/publish.tsx
@@ -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 (
+ <>
+
+ >
+ );
+
+ return (
+ <>
+
+ {listPublish.map((e) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/status/reject.tsx b/src/app_modules/vote/main/status/reject.tsx
new file mode 100644
index 00000000..9a00439b
--- /dev/null
+++ b/src/app_modules/vote/main/status/reject.tsx
@@ -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 ;
+ return (
+ <>
+
+ {listReject.map((e) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/main/status/review.tsx b/src/app_modules/vote/main/status/review.tsx
new file mode 100644
index 00000000..9771d354
--- /dev/null
+++ b/src/app_modules/vote/main/status/review.tsx
@@ -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 ;
+
+ return (
+ <>
+
+ {listReview.map((e) => (
+
+
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/app_modules/vote/model/interface.ts b/src/app_modules/vote/model/interface.ts
new file mode 100644
index 00000000..3de4348a
--- /dev/null
+++ b/src/app_modules/vote/model/interface.ts
@@ -0,0 +1,38 @@
+import { MODEL_USER } from "@/app_modules/home/model/interface";
+
+export interface MODEL_VOTING {
+ id: string;
+ title: string;
+ deskripsi: string;
+ awalVote: Date;
+ akhirVote: Date;
+ isActive: boolean;
+ createdAt: Date;
+ updateAt: Date;
+ catatan: string;
+ authorId: string;
+ Author: MODEL_USER;
+ Voting_DaftarNamaVote: MODEL_VOTING_DAFTAR_NAMA_VOTE[];
+}
+
+export interface MODEL_VOTING_DAFTAR_NAMA_VOTE {
+ id: string;
+ value: string;
+ jumlah: number;
+ isActive: boolean;
+ createdAt: Date;
+ updatedAt: Date;
+ votingId: string;
+}
+
+export interface MODEL_VOTE_KONTRIBUTOR {
+ id: string;
+ isActive: boolean;
+ createdAt: Date;
+ updatedAt: Date;
+ Author: MODEL_USER;
+ votingId: string;
+ Voting: MODEL_VOTING;
+ Voting_DaftarNamaVote: MODEL_VOTING_DAFTAR_NAMA_VOTE;
+ voting_DaftarNamaVoteId: string;
+}
diff --git a/src/app_modules/vote/splash/index.tsx b/src/app_modules/vote/splash/index.tsx
new file mode 100644
index 00000000..6783a262
--- /dev/null
+++ b/src/app_modules/vote/splash/index.tsx
@@ -0,0 +1,30 @@
+"use client";
+
+import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
+import { Center, Image, Paper, Stack, Text } from "@mantine/core";
+import { useShallowEffect } from "@mantine/hooks";
+import { useAtom } from "jotai";
+import { useRouter } from "next/navigation";
+import { gs_vote_hotMenu } from "../global_state";
+
+export default function Vote_Splash() {
+ const router = useRouter();
+ const [hotMenu, setHotMenu] = useAtom(gs_vote_hotMenu);
+
+ useShallowEffect(() => {
+ setTimeout(() => {
+ setHotMenu(0)
+ router.replace(RouterVote.beranda);
+ }, 2000);
+ }, []);
+
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/bin/seeder/event/master_status.json b/src/bin/seeder/event/master_status.json
new file mode 100644
index 00000000..fd8ea0bb
--- /dev/null
+++ b/src/bin/seeder/event/master_status.json
@@ -0,0 +1,19 @@
+[
+ {
+ "id": "1",
+ "name": "Publish"
+ },
+ {
+ "id": "2",
+ "name": "Review"
+ },
+ {
+ "id": "3",
+ "name": "Draft"
+ },
+ {
+ "id": "4",
+ "name": "Reject"
+ }
+ ]
+
\ No newline at end of file
diff --git a/src/bin/seeder/event/master_tipe_acara.json b/src/bin/seeder/event/master_tipe_acara.json
new file mode 100644
index 00000000..44e20d94
--- /dev/null
+++ b/src/bin/seeder/event/master_tipe_acara.json
@@ -0,0 +1,22 @@
+[
+ {
+ "id": 1,
+ "name": "Seminar"
+ },
+ {
+ "id": 2,
+ "name": "Workshop"
+ },
+ {
+ "id": 3,
+ "name": "Konferensi"
+ },
+ {
+ "id": 4,
+ "name": "Musyawarah Anggota"
+ },
+ {
+ "id": 5,
+ "name": "Kegiatan Sosial"
+ }
+]
diff --git a/src/bin/seeder/voting/master_status.json b/src/bin/seeder/voting/master_status.json
new file mode 100644
index 00000000..b42a57b4
--- /dev/null
+++ b/src/bin/seeder/voting/master_status.json
@@ -0,0 +1,18 @@
+[
+ {
+ "id": "1",
+ "name": "Publish"
+ },
+ {
+ "id": "2",
+ "name": "Review"
+ },
+ {
+ "id": "3",
+ "name": "Draft"
+ },
+ {
+ "id": "4",
+ "name": "Reject"
+ }
+]
diff --git a/yarn.lock b/yarn.lock
index 83e1f980..b2657f61 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -308,6 +308,13 @@
react-remove-scroll "^2.5.5"
react-textarea-autosize "8.3.4"
+"@mantine/dates@^6.0.17":
+ version "6.0.21"
+ resolved "https://registry.yarnpkg.com/@mantine/dates/-/dates-6.0.21.tgz#a140da22bd4188aff446ddb5d3bcf37b658b0608"
+ integrity sha512-nSX7MxNkHyyDJqEJOT7Wg930jBfgWz+3pnoWo601cYDvFjh5GgcRz66v36rnMJFK1/56k5G9rWzUOzuM94j6hg==
+ dependencies:
+ "@mantine/utils" "6.0.21"
+
"@mantine/dropzone@^7.1.3":
version "7.3.2"
resolved "https://registry.yarnpkg.com/@mantine/dropzone/-/dropzone-7.3.2.tgz#358d99089318e62bc520040a55708a31b0ab7259"
@@ -1306,6 +1313,11 @@ damerau-levenshtein@^1.0.8:
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7"
integrity sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==
+dayjs@^1.11.10:
+ version "1.11.10"
+ resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0"
+ integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==
+
debug@^3.2.7:
version "3.2.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
diff --git a/zCoba.js b/zCoba.js
index c5d7a3b9..bef80072 100644
--- a/zCoba.js
+++ b/zCoba.js
@@ -1,5 +1,6 @@
const moment = require("moment");
var fs = require("fs");
+const _ = require("lodash");
// function Coba() {
// let total = 100;
@@ -26,15 +27,40 @@ var fs = require("fs");
// fs.unlinkSync('coba.sh');
// console.log('File deleted!');
-function CobaProgress() {
- const t = 560000000;
- const b = 180000000
+// function CobaProgress() {
+// const t = 560000000;
+// const b = 180000000
- const progress = (b / t) * 100;
- const pembulatan = Math.round(progress);
- console.log(progress, "progres");
- console.log(pembulatan, "pembulatan");
- // console.log(t/2)
+// const progress = (b / t) * 100;
+// const pembulatan = Math.round(progress);
+// console.log(progress, "progres");
+// console.log(pembulatan, "pembulatan");
+// // console.log(t/2)
+// }
+
+// CobaProgress();
+
+// function randomNumberPerSecond(){
+// let lower = 0;
+// let upper = 100;
+
+// // Printing 5 random values
+// // in range 2 and 11
+// for (let i = 0; i < 1; i++) {
+// setInterval(() => console.log("Hello" + " " + _.random(lower, upper)), 1000);
+// }
+// }
+
+// randomNumberPerSecond()
+
+function CobaTanggal() {
+ const tgl = "2024-01-25T12:00:24.008Z";
+ const i = _.random(0, 100);
+ // setInterval(() => console.log("hello" + i), 1000);
+ const waktu = Date.now()
+const dt = moment(waktu).locale("fr").format()
+ console.log(dt)
+
}
-CobaProgress();
+CobaTanggal();