Fix: event

Deskripsi:
- Create event konfirmasi
This commit is contained in:
2024-12-03 10:24:37 +08:00
parent ff6ebece93
commit fc388133a6
17 changed files with 429 additions and 11 deletions

View File

@@ -0,0 +1,40 @@
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import Ui_Konfirmasi from "@/app_modules/event/_ui/konfirmasi";
import {
event_funCheckKehadiran,
event_funCheckPesertaByUserId,
} from "@/app_modules/event/fun";
import { event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
import { redirect } from "next/navigation";
export default async function Page({ params }: { params: { id: string } }) {
const eventId = params.id;
const userLoginId = await funGetUserIdByToken();
const dataEvent = await event_getOneById(eventId);
const checkPeserta = await event_funCheckPesertaByUserId({
eventId: eventId,
userId: userLoginId as string,
});
if (dataEvent?.isArsip)
return redirect(`/dev/event/detail/riwayat/${dataEvent.id}`);
if (checkPeserta == false)
return redirect(`/dev/event/detail/main/${eventId}`);
// if (checkKehadiran) {
// return redirect(`/dev/event/main/beranda`);
// }
return (
<>
<Ui_Konfirmasi
dataEvent={dataEvent as any}
userLoginId={userLoginId as string}
/>
</>
);
}

View File

@@ -4,8 +4,6 @@ import { HomeView } from "@/app_modules/home";
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
import { job_getTwoForHomeView } from "@/app_modules/job/fun/get/get_two_for_home_view";
import notifikasi_countUserNotifikasi from "@/app_modules/notifikasi/fun/count/fun_count_by_id";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
export default async function PageHome() {
@@ -20,8 +18,8 @@ export default async function PageHome() {
// if (dataUser?.active === false) {
// return redirect(RouterHome.home_user_non_active);
// }
if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
return redirect(RouterAdminDashboard.main_admin);
// if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
// return redirect(RouterAdminDashboard.main_admin);
return (
<>