# fix
## Deskripsi : - Prisma seeder ### No Issue
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -25,12 +25,12 @@ npm-debug.log*
|
||||
rn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# env
|
||||
.env
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# env
|
||||
.env
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
|
||||
@@ -11,9 +11,8 @@ export async function AdminEvent_getListTableByStatusId(statudId: string) {
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
gte: new Date
|
||||
}
|
||||
|
||||
gte: new Date(),
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
@@ -52,10 +51,11 @@ export async function AdminEvent_getListTableByStatusId(statudId: string) {
|
||||
if (statudId === "2") {
|
||||
const getReview = await prisma.event.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "2",
|
||||
active: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
@@ -52,6 +52,7 @@ import adminNotifikasi_funUpdateIsReadById from "./notifikasi/fun/update/fun_upd
|
||||
import adminNotifikasi_findRouterJob from "./notifikasi/route_setting/job";
|
||||
import adminNotifikasi_findRouterForum from "./notifikasi/route_setting/forum";
|
||||
import { adminNotifikasi_findRouterVoting } from "./notifikasi/route_setting/voting";
|
||||
import { adminNotifikasi_findRouterEvent } from "./notifikasi/route_setting/event";
|
||||
|
||||
export default function AdminLayout({
|
||||
children,
|
||||
@@ -428,6 +429,18 @@ function DrawerNotifikasi({
|
||||
},
|
||||
});
|
||||
|
||||
e?.kategoriApp === "EVENT" &&
|
||||
adminNotifikasi_findRouterEvent({
|
||||
data: e,
|
||||
router: router,
|
||||
onChangeNavbar(val) {
|
||||
onChangeNavbar(val);
|
||||
},
|
||||
onToggleNavbar(val) {
|
||||
onToggleNavbar(val);
|
||||
},
|
||||
});
|
||||
|
||||
const updateIsRead = await adminNotifikasi_funUpdateIsReadById({
|
||||
notifId: e?.id,
|
||||
});
|
||||
|
||||
@@ -9,24 +9,20 @@ import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote";
|
||||
import { RouterAdminUserAccess } from "@/app/lib/router_admin/router_admn_user_acces";
|
||||
import { RouterAdminAppInformation } from "@/app/lib/router_admin/router_app_information";
|
||||
import {
|
||||
RouterAdminDashboard,
|
||||
RouterAdminDonasi_OLD,
|
||||
RouterAdminInvestasi_OLD,
|
||||
RouterAdminDashboard
|
||||
} from "@/app/lib/router_hipmi/router_admin";
|
||||
import {
|
||||
IconAffiliate,
|
||||
IconBriefcase,
|
||||
IconDashboard,
|
||||
IconDeviceMobile,
|
||||
IconMessages,
|
||||
IconUserCog,
|
||||
} from "@tabler/icons-react";
|
||||
import {
|
||||
IconHeartHandshake,
|
||||
IconHome,
|
||||
IconMessages,
|
||||
IconMoneybag,
|
||||
IconPackageImport,
|
||||
IconPresentation,
|
||||
IconUserCog,
|
||||
} from "@tabler/icons-react";
|
||||
|
||||
export const listAdminPage = [
|
||||
|
||||
28
src/app_modules/admin/notifikasi/route_setting/event.ts
Normal file
28
src/app_modules/admin/notifikasi/route_setting/event.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote";
|
||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
|
||||
export async function adminNotifikasi_findRouterEvent({
|
||||
data,
|
||||
router,
|
||||
onChangeNavbar,
|
||||
onToggleNavbar,
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
router: AppRouterInstance;
|
||||
onChangeNavbar: (val: any) => void;
|
||||
onToggleNavbar: (val: any) => void;
|
||||
}) {
|
||||
const path = RouterAdminEvent.table_review
|
||||
|
||||
if (data.status === "Review") {
|
||||
router.push(path, { scroll: false });
|
||||
onChangeNavbar({
|
||||
id: 4,
|
||||
childId: 43,
|
||||
});
|
||||
}
|
||||
|
||||
onToggleNavbar(true);
|
||||
}
|
||||
@@ -16,6 +16,8 @@ import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input"
|
||||
import { Event_funCreate } from "../fun/create/fun_create";
|
||||
import { gs_event_hotMenu, gs_event_status } from "../global_state";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
|
||||
export default function Event_Create({
|
||||
listTipeAcara,
|
||||
@@ -175,7 +177,7 @@ export default function Event_Create({
|
||||
radius={"xl"}
|
||||
mt={"xl"}
|
||||
onClick={() => {
|
||||
onSave(router, setTabsStatus, value, setHotMenu, setLoading)
|
||||
onSave(router, setTabsStatus, value, setHotMenu, setLoading);
|
||||
}}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
@@ -205,15 +207,36 @@ async function onSave(
|
||||
// )
|
||||
// return null;
|
||||
|
||||
await Event_funCreate(value).then((res) => {
|
||||
if (res.status === 201) {
|
||||
const res = await Event_funCreate(value);
|
||||
if (res.status === 201) {
|
||||
const dataNotif: any = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event baru",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"ADMIN",
|
||||
JSON.stringify({
|
||||
count: 1,
|
||||
})
|
||||
);
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setTabsStatus("Review");
|
||||
setHotMenu(1);
|
||||
setLoading(true);
|
||||
router.push(RouterEvent.status_page);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Group, Modal, Stack, Title } from "@mantine/core";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||
|
||||
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/_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/_global/notif_global/notifikasi_gagal";
|
||||
import React, { useState } from "react";
|
||||
import ComponentEvent_CatatanReject from "../../component/catatan_reject";
|
||||
import { useRouter } from "next/navigation";
|
||||
import moment from "moment";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import { useAtom } from "jotai";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import { gs_event_status } from "../../global_state";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
|
||||
export default function Event_DetailDraft({
|
||||
dataEvent,
|
||||
@@ -70,16 +68,36 @@ function ButtonAction({ eventId, tanggal }: { eventId: string; tanggal: any }) {
|
||||
if (moment(tanggal.toISOString().toString()).diff(moment(), "minutes") < 0)
|
||||
return ComponentGlobal_NotifikasiPeringatan("Waktu acara telah lewat");
|
||||
|
||||
await Event_funEditStatusById("2", eventId).then((res) => {
|
||||
if (res.status === 200) {
|
||||
const res = await Event_funEditStatusById("2", eventId);
|
||||
if (res.status === 200) {
|
||||
const dataNotif: any = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Mengajukan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"ADMIN",
|
||||
JSON.stringify({
|
||||
count: 1,
|
||||
})
|
||||
);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
setTabsStatus("Review");
|
||||
setLoadingAjukan(true);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
"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/_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/_global/notif_global/notifikasi_gagal";
|
||||
import ComponentEvent_CatatanReject from "../../component/catatan_reject";
|
||||
import { useState } from "react";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
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 ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import { gs_event_status } from "../../global_state";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
|
||||
export default function Event_DetailReview({
|
||||
dataEvent,
|
||||
@@ -75,14 +76,35 @@ async function onClick(
|
||||
eventId: string,
|
||||
setLoading: any
|
||||
) {
|
||||
await Event_funEditStatusById("3", eventId).then((res) => {
|
||||
if (res.status === 200) {
|
||||
const res = await Event_funEditStatusById("3", eventId);
|
||||
if (res.status === 200) {
|
||||
const dataNotif: any = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"ADMIN",
|
||||
JSON.stringify({
|
||||
count: 1,
|
||||
})
|
||||
);
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
|
||||
setTabsStatus("Draft");
|
||||
setLoading(true);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,22 @@ export async function Event_funCreate(req: MODEL_EVENT) {
|
||||
tanggal: req.tanggal,
|
||||
authorId: req.authorId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
EventMaster_Status: {
|
||||
select: {
|
||||
name: true,
|
||||
}
|
||||
},
|
||||
authorId: true,
|
||||
}
|
||||
});
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal Disimpan" };
|
||||
revalidatePath("/dev/event/main/status_page");
|
||||
return {
|
||||
data: res,
|
||||
status: 201,
|
||||
message: "Berhasil Disimpan",
|
||||
};
|
||||
|
||||
@@ -4,13 +4,16 @@ import prisma from "@/app/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param statusid | Review: 2, Draft: 3, Reject: 4
|
||||
* @param eventId
|
||||
* @param eventId
|
||||
* @type string
|
||||
* @returns Update status id dari setiap event
|
||||
*/
|
||||
export async function Event_funEditStatusById(statusid: string, eventId: string) {
|
||||
export async function Event_funEditStatusById(
|
||||
statusid: string,
|
||||
eventId: string
|
||||
) {
|
||||
const updt = await prisma.event.update({
|
||||
where: {
|
||||
id: eventId,
|
||||
@@ -18,11 +21,22 @@ export async function Event_funEditStatusById(statusid: string, eventId: string)
|
||||
data: {
|
||||
eventMaster_StatusId: statusid,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
EventMaster_Status: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update Status" };
|
||||
revalidatePath("/dev/event/main/status_page");
|
||||
return {
|
||||
data: updt,
|
||||
status: 200,
|
||||
message: "Berhasil Update Status",
|
||||
};
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { data } from "autoprefixer";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function Vote_funEditStatusByStatusId(
|
||||
|
||||
Reference in New Issue
Block a user