| {e.title} |
{e.lokasi} |
{e.EventMaster_TipeAcara.name} |
+ {e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })} |
- {moment(e.tanggal).format("dddd")}, {moment(e.tanggal).format("ll")}
+ {e.tanggal.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })}
|
- {moment(e.tanggal).format("LT")} |
{e.deskripsi}
@@ -80,10 +91,20 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
}
radius={"xl"}
- onClick={() => console.log("cooming soon")}
+ 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
@@ -93,6 +114,39 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
return (
<>
+
+
+
+
+ Daftar Peserta
+
+
+ {peserta?.map((e) => (
+
+
+
+
+
+
+
+ {e.User.Profile.name}
+
+
+
+
+
+ ))}
+
+
+
+
@@ -138,5 +192,3 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
>
);
}
-
-
diff --git a/src/app_modules/admin/event/table_status/table_reject.tsx b/src/app_modules/admin/event/table_status/table_reject.tsx
index 7adb15d7..67004ccb 100644
--- a/src/app_modules/admin/event/table_status/table_reject.tsx
+++ b/src/app_modules/admin/event/table_status/table_reject.tsx
@@ -52,8 +52,7 @@ export default function AdminEvent_TableReject({
return (
<>
-
-
+
>
@@ -83,11 +82,17 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
- {moment(e.tanggal).format("dddd")}, {moment(e.tanggal).format("ll")}
+ {e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
- {moment(e.tanggal).format("LT")}
+
+ {e.tanggal.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })}
+
|
diff --git a/src/app_modules/admin/event/table_status/table_review.tsx b/src/app_modules/admin/event/table_status/table_review.tsx
index f6afd27b..c6c09710 100644
--- a/src/app_modules/admin/event/table_status/table_review.tsx
+++ b/src/app_modules/admin/event/table_status/table_review.tsx
@@ -50,8 +50,7 @@ export default function AdminEvent_TableReview({
return (
<>
-
-
+
>
@@ -71,10 +70,14 @@ function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
| {e.title} |
{e.lokasi} |
{e.EventMaster_TipeAcara.name} |
+ {e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })} |
- {moment(e.tanggal).format("dddd")}, {moment(e.tanggal).format("ll")}
+ {e.tanggal.toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })}
|
- {moment(e.tanggal).format("LT")} |
{e.deskripsi}
@@ -133,7 +136,7 @@ function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
radius={"xl"}
onClick={() => {
onReject(eventId, catatan, setData, close);
-
+
// console.log("hehe")
}}
>
@@ -204,7 +207,12 @@ async function onPublish(eventId: string, setData: any) {
});
}
-async function onReject(eventId: string, catatan: string, setData: any, close: any) {
+async function onReject(
+ eventId: string,
+ catatan: string,
+ setData: any,
+ close: any
+) {
if (catatan === "")
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
const body = {
@@ -217,7 +225,7 @@ async function onReject(eventId: string, catatan: string, setData: any, close: a
await AdminEvent_getListTableByStatusId("2").then((val) => {
setData(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
- close()
+ 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/main_dashboard/main/layout.tsx
index 1f9b4337..f173171e 100644
--- a/src/app_modules/admin/main_dashboard/main/layout.tsx
+++ b/src/app_modules/admin/main_dashboard/main/layout.tsx
@@ -33,9 +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 { 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,
@@ -45,30 +47,54 @@ 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,
- },
- {
- id: 4,
- name: "Event",
- route: RouterAdminEvent.main_event,
- },
- ];
+ const navbarItems = listAdminPage.map((e, i) => (
+
+ {e.name}}
+ onClick={() => {
+ setActive(i);
+ setActiveChild(null);
+ e.path === "" ? router.push(e.child[0].path) : router.push(e.path);
+ e.path === "" ? setActiveChild(0) : ""
+ }}
+ >
+ {_.isEmpty(e.child) ? (
+ ""
+ ) : (
+
+ {e.child.map((v, ii) => (
+
+ {v.name}}
+ onClick={() => {
+ setActive(i);
+ setActiveChild(ii)
+ router.push(v.path);
+ }}
+ />
+
+ ))}
+
+ )}
+
+
+ ));
return (
<>
@@ -85,25 +111,7 @@ export default function AdminLayout({
p="xs"
bg={"gray.2"}
>
- {listAdminPage.map((e, i) => (
-
- {
- setActive(i);
- router.push(e.route);
- }}
- />
- {active === i ? : ""}
-
- ))}
+ {navbarItems}
}
@@ -141,7 +149,7 @@ export default function AdminLayout({
))}
*/}
-
+
@@ -154,7 +162,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/main_dashboard/main/list_page.ts b/src/app_modules/admin/main_dashboard/main/list_page.ts
new file mode 100644
index 00000000..63316732
--- /dev/null
+++ b/src/app_modules/admin/main_dashboard/main/list_page.ts
@@ -0,0 +1,64 @@
+import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
+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: 1,
+ name: "Dashboard",
+ path: RouterAdminEvent.main_event,
+ },
+ {
+ id: 2,
+ name: "Table Publish",
+ path: RouterAdminEvent.table_publish,
+ },
+ {
+ id: 3,
+ name: "Table Review",
+ path: RouterAdminEvent.table_review,
+ },
+ {
+ id: 4,
+ name: "Table Reject",
+ path: RouterAdminEvent.table_reject,
+ },
+ {
+ id: 5,
+ name: "Tipe Acara",
+ path: RouterAdminEvent.detail_tipe_acara,
+ },
+ {
+ id: 6,
+ name: "Riwayat",
+ path: RouterAdminEvent.detail_riwayat,
+ },
+ ],
+ },
+];
diff --git a/src/app_modules/admin/splash/splash.tsx b/src/app_modules/admin/splash/splash.tsx
index addfed27..19f513f4 100644
--- a/src/app_modules/admin/splash/splash.tsx
+++ b/src/app_modules/admin/splash/splash.tsx
@@ -5,11 +5,11 @@ 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_adminDonasi_hotMenu } from "../donasi/global_state";
+import { gs_admin_hotMenu } from "../global_state";
export default function SplashDashboardAdmin() {
const router = useRouter();
- const [active, setActive] = useAtom(gs_adminDonasi_hotMenu);
+ const [active, setActive] = useAtom(gs_admin_hotMenu);
useShallowEffect(() => {
setTimeout(() => {
diff --git a/src/app_modules/event/create/create.tsx b/src/app_modules/event/create/create.tsx
index 39f96ae1..effe4274 100644
--- a/src/app_modules/event/create/create.tsx
+++ b/src/app_modules/event/create/create.tsx
@@ -30,6 +30,10 @@ 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";
export default function Event_Create({
listTipeAcara,
@@ -43,7 +47,6 @@ export default function Event_Create({
const [listTipe, setListTipe] = useState(listTipeAcara);
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
-
const [value, setValue] = useState({
title: "",
lokasi: "",
@@ -95,6 +98,12 @@ export default function Event_Create({
}
/>
{
+ // 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"
@@ -137,6 +146,10 @@ async function onSave(
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);
diff --git a/src/app_modules/event/edit/index.tsx b/src/app_modules/event/edit/index.tsx
index d8688a74..9c8b3fe3 100644
--- a/src/app_modules/event/edit/index.tsx
+++ b/src/app_modules/event/edit/index.tsx
@@ -10,6 +10,9 @@ 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";
export default function Event_Edit({
dataEvent,
@@ -69,6 +72,9 @@ export default function Event_Edit({
}}
/>
{
+ return moment(date).diff(Date.now(), "days") < 0;
+ }}
withAsterisk
label="Tanggal & Waktu "
placeholder="Masukan tangal dan waktu acara"
@@ -104,6 +110,8 @@ export default function Event_Edit({
}
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);
diff --git a/src/app_modules/event/main/status_page/review.tsx b/src/app_modules/event/main/status_page/review.tsx
index cef34274..1ecaec0e 100644
--- a/src/app_modules/event/main/status_page/review.tsx
+++ b/src/app_modules/event/main/status_page/review.tsx
@@ -21,14 +21,6 @@ export default function Event_StatusReview({
const router = useRouter();
const [data, setData] = useState(listReview);
- useShallowEffect(() => {
- setTimeout(() => loadData(authorId), 1000)
- }, []);
-
- async function loadData(authorId: string) {
- const res : any = await Event_getByStatusId("2", authorId);
- setData(res);
- }
if (_.isEmpty(data))
return (
diff --git a/src/app_modules_admin/READ_ADMIN.md b/src/app_modules_admin/READ_ADMIN.md
new file mode 100644
index 00000000..c31073a5
--- /dev/null
+++ b/src/app_modules_admin/READ_ADMIN.md
@@ -0,0 +1 @@
+# Admin here
\ No newline at end of file
diff --git a/src/app_modules_admin/main/index.ts b/src/app_modules_admin/main/index.ts
index e69de29b..23bb16c0 100644
--- a/src/app_modules_admin/main/index.ts
+++ b/src/app_modules_admin/main/index.ts
@@ -0,0 +1,4 @@
+import AdminMain_Dashboard from "./main";
+import AdminMain_Layout from "./layout";
+
+export { AdminMain_Dashboard, AdminMain_Layout };
diff --git a/src/app_modules_admin/main/layout.tsx b/src/app_modules_admin/main/layout.tsx
index 3f1be5b9..688aceb1 100644
--- a/src/app_modules_admin/main/layout.tsx
+++ b/src/app_modules_admin/main/layout.tsx
@@ -1,5 +1,178 @@
-"use client"
+"use client";
-export default function Admin_Layout(){
-
-}
\ No newline at end of file
+import {
+ AppShell,
+ Navbar,
+ MediaQuery,
+ Aside,
+ Footer,
+ Header,
+ Burger,
+ Text,
+ useMantineTheme,
+ Box,
+ NavLink,
+ Divider,
+ Group,
+ Title,
+ ActionIcon,
+} from "@mantine/core";
+import { IconLogout } from "@tabler/icons-react";
+import _ from "lodash";
+import { useRouter } from "next/navigation";
+import React, { useState } from "react";
+import toast from "react-simple-toasts";
+
+export default function AdminMain_Layout({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const router = useRouter();
+ const theme = useMantineTheme();
+ const [opened, setOpened] = useState(false);
+ const [active, setActive] = useState(0);
+
+ const listAdminPage = [
+ {
+ id: 1,
+ name: "Dashboard",
+ // route: RouterAdminDashboard.main_admin,
+ child: [
+
+ ],
+ },
+ {
+ id: 2,
+ name: "Investasi",
+ // route: RouterAdminInvestasi.main_investasi,
+ child: [
+ {
+ id: 1,
+ name: "Child Investasi",
+ },
+ ],
+ },
+ {
+ id: 3,
+ name: "Donasi",
+ // route: RouterAdminDonasi.main_donasi,
+ child: [
+ {
+ id: 1,
+ name: "Child Don 1",
+ },
+ {
+ id: 1,
+ name: "Child DOn 2",
+ },
+ ],
+ },
+ {
+ id: 4,
+ name: "Event",
+ // route: RouterAdminEvent.main_event,
+ child: [
+ {
+ id: 1,
+ name: "Child Event",
+ },
+ ],
+ },
+ ];
+
+ return (
+ <>
+
+
+ {listAdminPage.map((e, i) => (
+
+ {
+ setActive(i);
+ // router.push(e.route);
+ toast(e.name);
+ }}
+ >
+ {_.isEmpty(e.child) ? (
+ ""
+ ) : (
+
+ {e.child.map((v, ii) => (
+
+
+
+ ))}
+
+ )}
+
+
+ ))}
+
+
+ }
+ header={
+
+ {/* Mobile View */}
+
+
+ setOpened((o) => !o)}
+ size="sm"
+ color={theme.colors.gray[6]}
+ mr="xl"
+ />
+ Dashboard Admin
+ router.push(RouterHome.main_home)}
+ >
+ {/* */}
+
+
+
+
+
+ {/* Web View */}
+
+
+ Dashboard Admin
+ HIPMI
+ {/*
+ {listAdminPage.map((e) => (
+ router.push(e.route)}>
+ {e.name}
+
+ ))}
+ */}
+ {/* */}
+
+
+
+
+ }
+ >
+ {children}
+
+ >
+ );
+}
diff --git a/src/app_modules_admin/main/main/index.tsx b/src/app_modules_admin/main/main/index.tsx
new file mode 100644
index 00000000..14a5fcdc
--- /dev/null
+++ b/src/app_modules_admin/main/main/index.tsx
@@ -0,0 +1,8 @@
+"use client"
+
+export default function AdminMain_Dashboard(){
+ return <>
+ ini main
+
+ >
+}
\ No newline at end of file
diff --git a/src/app_modules_admin/main/main_dashboard/index.tsx b/src/app_modules_admin/main/main_dashboard/index.tsx
deleted file mode 100644
index 139597f9..00000000
--- a/src/app_modules_admin/main/main_dashboard/index.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
| | |