Fix: Event
Deskripsi: - Fix database event - Fix style detal
This commit is contained in:
@@ -573,16 +573,19 @@ model Donasi_PencairanDana {
|
|||||||
// ========================================= EVENT ========================================= //
|
// ========================================= EVENT ========================================= //
|
||||||
|
|
||||||
model Event {
|
model Event {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
title String
|
title String
|
||||||
lokasi String
|
lokasi String
|
||||||
tanggal DateTime
|
tanggal DateTime?
|
||||||
deskripsi String
|
deskripsi String
|
||||||
active Boolean @default(true)
|
active Boolean @default(true)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
catatan String?
|
catatan String?
|
||||||
|
|
||||||
|
tanggalSelesai DateTime?
|
||||||
|
isArsip Boolean? @default(false)
|
||||||
|
|
||||||
Author User? @relation(fields: [authorId], references: [id])
|
Author User? @relation(fields: [authorId], references: [id])
|
||||||
authorId String?
|
authorId String?
|
||||||
EventMaster_Status EventMaster_Status? @relation(fields: [eventMaster_StatusId], references: [id])
|
EventMaster_Status EventMaster_Status? @relation(fields: [eventMaster_StatusId], references: [id])
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { AdminEvent_TablePublish } from "@/app_modules/admin/event";
|
import { AdminEvent_TablePublish } from "@/app_modules/admin/event";
|
||||||
import { adminEvent_funGetListPublish } from "@/app_modules/admin/event/fun";
|
import { adminEvent_funGetListPublish } from "@/app_modules/admin/event/fun";
|
||||||
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
|
|
||||||
|
|
||||||
export default async function Page() {
|
async function Page() {
|
||||||
const listPublish = await adminEvent_funGetListPublish({page: 1});
|
const listPublish = await adminEvent_funGetListPublish({ page: 1 });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -11,3 +10,5 @@ export default async function Page() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Page;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { CheckCookies_UiLayout } from "@/app_modules/check_cookies";
|
|
||||||
import { RealtimeProvider } from "../lib";
|
|
||||||
import { funCheckCookies } from "@/app_modules/_global/fun/get/fun_check_cookies";
|
|
||||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||||
|
import { funCheckCookies } from "@/app_modules/_global/fun/get/fun_check_cookies";
|
||||||
|
import { permanentRedirect, redirect } from "next/navigation";
|
||||||
|
import { RealtimeProvider } from "../lib";
|
||||||
import { ServerEnv } from "../lib/server_env";
|
import { ServerEnv } from "../lib/server_env";
|
||||||
import { funGlobal_getUserById } from "@/app_modules/_global/fun/get/fun_get_user_by_id";
|
import { funGlobal_getUserById } from "@/app_modules/_global/fun/get/fun_get_user_by_id";
|
||||||
import { RouterHome } from "../lib/router_hipmi/router_home";
|
import { RouterHome } from "../lib/router_hipmi/router_home";
|
||||||
import { RouterAdminDashboard } from "../lib/router_hipmi/router_admin";
|
import { CheckCookies_UiLayout } from "@/app_modules/check_cookies";
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
|
|
||||||
export default async function Layout({
|
export default async function Layout({
|
||||||
children,
|
children,
|
||||||
@@ -14,10 +13,14 @@ export default async function Layout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const checkCookies = await funCheckCookies();
|
const checkCookies = await funCheckCookies();
|
||||||
if (!checkCookies) return redirect("/");
|
|
||||||
|
|
||||||
const userLoginId = await funGetUserIdByToken();
|
const userLoginId = await funGetUserIdByToken();
|
||||||
const WIBU_REALTIME_TOKEN = process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN;
|
if (!checkCookies) return redirect("/");
|
||||||
|
|
||||||
|
// const dataUser = await funGlobal_getUserById({ userId: userLoginId });
|
||||||
|
// console.log(dataUser?.active, dataUser?.username, "ini di layout");
|
||||||
|
|
||||||
|
// if(dataUser?.active == false) return permanentRedirect(RouterHome.home_user_non_active);
|
||||||
|
// const WIBU_REALTIME_TOKEN = process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN;
|
||||||
// console.log(WIBU_REALTIME_TOKEN, "check cookies di layout dalam");
|
// console.log(WIBU_REALTIME_TOKEN, "check cookies di layout dalam");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,18 +1,7 @@
|
|||||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
|
||||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
|
||||||
import { Home_UserNonActive } from "@/app_modules/home";
|
import { Home_UserNonActive } from "@/app_modules/home";
|
||||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
|
||||||
// import { redirect } from "next/navigation";
|
// import { redirect } from "next/navigation";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const userLoginId = await funGetUserIdByToken();
|
|
||||||
|
|
||||||
const dataUser = await user_getOneByUserId(userLoginId as string);
|
|
||||||
|
|
||||||
// if (dataUser?.active === true) {
|
|
||||||
// return redirect(RouterHome.main_home);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Home_UserNonActive />
|
<Home_UserNonActive />
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_cre
|
|||||||
import { adminEvent_funGetListReview } from "../fun";
|
import { adminEvent_funGetListReview } from "../fun";
|
||||||
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
||||||
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
||||||
|
import { event_checkStatus } from "@/app_modules/event/fun/get/fun_check_status_by_id";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
|
|
||||||
export default function AdminEvent_ComponentTableReview({
|
export default function AdminEvent_ComponentTableReview({
|
||||||
listData,
|
listData,
|
||||||
@@ -104,51 +106,65 @@ export default function AdminEvent_ComponentTableReview({
|
|||||||
setIsAdminTriggerReview(false);
|
setIsAdminTriggerReview(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onPublish(eventId: string, tanggal: Date) {
|
async function onPublish({
|
||||||
if (moment(tanggal).diff(Date.now(), "minutes") < 0)
|
eventId,
|
||||||
return ComponentGlobal_NotifikasiPeringatan(
|
tanggalSelesai,
|
||||||
"Waktu acara telah lewat, Report untuk memberitahu user !"
|
}: {
|
||||||
);
|
eventId: string;
|
||||||
|
tanggalSelesai: Date;
|
||||||
|
}) {
|
||||||
|
const checkStatus = await event_checkStatus({ id: eventId });
|
||||||
|
|
||||||
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
|
if (checkStatus) {
|
||||||
if (res.status === 200) {
|
if (moment(tanggalSelesai).diff(Date.now(), "minutes") < 0)
|
||||||
const dataNotifikasi: IRealtimeData = {
|
return ComponentGlobal_NotifikasiPeringatan(
|
||||||
appId: res.data?.id as any,
|
"Waktu acara telah lewat, Report untuk memberitahu user !"
|
||||||
status: res.data?.EventMaster_Status?.name as any,
|
);
|
||||||
userId: res.data?.authorId as any,
|
|
||||||
pesan: res.data?.title as any,
|
|
||||||
kategoriApp: "EVENT",
|
|
||||||
title: "Event publish",
|
|
||||||
};
|
|
||||||
|
|
||||||
const notif = await adminNotifikasi_funCreateToUser({
|
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
|
||||||
data: dataNotifikasi as any,
|
if (res.status === 200) {
|
||||||
});
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
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 publish",
|
||||||
|
};
|
||||||
|
|
||||||
if (notif.status === 201) {
|
const notif = await adminNotifikasi_funCreateToUser({
|
||||||
WibuRealtime.setData({
|
data: dataNotifikasi as any,
|
||||||
type: "notification",
|
|
||||||
pushNotificationTo: "USER",
|
|
||||||
dataMessage: dataNotifikasi,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
WibuRealtime.setData({
|
if (notif.status === 201) {
|
||||||
type: "trigger",
|
WibuRealtime.setData({
|
||||||
pushNotificationTo: "USER",
|
type: "notification",
|
||||||
dataMessage: dataNotifikasi,
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "trigger",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadData = await adminEvent_funGetListReview({
|
||||||
|
search: isSearch,
|
||||||
|
page: isActivePage,
|
||||||
});
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
|
||||||
|
ComponentAdminGlobal_NotifikasiBerhasil("Berhasil update status");
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadData = await adminEvent_funGetListReview({
|
|
||||||
search: isSearch,
|
|
||||||
page: isActivePage,
|
|
||||||
});
|
|
||||||
setData(loadData.data as any);
|
|
||||||
setNPage(loadData.nPage);
|
|
||||||
|
|
||||||
ComponentAdminGlobal_NotifikasiBerhasil("Berhasil update status");
|
|
||||||
} else {
|
} else {
|
||||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
|
"Review di batalkan oleh user, reload halaman review !"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,19 +234,40 @@ export default function AdminEvent_ComponentTableReview({
|
|||||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
<Text align="center">
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
{e.tanggal.toLocaleTimeString([], {
|
<Text align="center">
|
||||||
timeStyle: "short",
|
{" "}
|
||||||
hourCycle: "h24",
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
})}
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={400}>
|
<Center w={400}>
|
||||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||||
@@ -246,7 +283,12 @@ export default function AdminEvent_ComponentTableReview({
|
|||||||
color={"green"}
|
color={"green"}
|
||||||
leftIcon={<IconCircleCheck />}
|
leftIcon={<IconCircleCheck />}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => onPublish(e.id, e.tanggal)}
|
onClick={() =>
|
||||||
|
onPublish({
|
||||||
|
eventId: e.id,
|
||||||
|
tanggalSelesai: e.tanggalSelesai,
|
||||||
|
})
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Publish
|
Publish
|
||||||
</Button>
|
</Button>
|
||||||
@@ -254,9 +296,17 @@ export default function AdminEvent_ComponentTableReview({
|
|||||||
color={"red"}
|
color={"red"}
|
||||||
leftIcon={<IconBan />}
|
leftIcon={<IconBan />}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
open();
|
const checkStatus = await event_checkStatus({ id: eventId });
|
||||||
setEventId(e.id);
|
|
||||||
|
if (checkStatus) {
|
||||||
|
open();
|
||||||
|
setEventId(e.id);
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
|
"Review di batalkan oleh user, muat kembali halaman ini !"
|
||||||
|
);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Reject
|
Reject
|
||||||
@@ -334,10 +384,10 @@ export default function AdminEvent_ComponentTableReview({
|
|||||||
<Center>Tipe Acara</Center>
|
<Center>Tipe Acara</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Tanggal</Center>
|
<Center>Tanggal & Waktu Mulai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Jam</Center>
|
<Center>Tanggal & Waktu Selesai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Deskripsi</Center>
|
<Center>Deskripsi</Center>
|
||||||
|
|||||||
@@ -1,19 +1,11 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
||||||
import {
|
import {
|
||||||
MODEL_EVENT,
|
|
||||||
MODEL_EVENT_PESERTA,
|
|
||||||
} from "@/app_modules/event/model/interface";
|
|
||||||
import {
|
|
||||||
Avatar,
|
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
|
||||||
Pagination,
|
Pagination,
|
||||||
Paper,
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
@@ -24,7 +16,6 @@ import {
|
|||||||
TextInput,
|
TextInput,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
|
||||||
import { IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
import { IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -80,11 +71,14 @@ function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
|
|||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Button
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
loading={e.id === eventId && loading ? true : false}
|
loading={e.id === eventId && loading ? true : false}
|
||||||
color={"green"}
|
color={"green"}
|
||||||
leftIcon={<IconCircleCheck />}
|
leftIcon={<IconCircleCheck />}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
setEventId(e.id);
|
||||||
|
setLoading(true);
|
||||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -112,19 +106,40 @@ function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
|
|||||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
<Text align="center">
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
{e.tanggal.toLocaleTimeString([], {
|
<Text align="center">
|
||||||
timeStyle: "short",
|
{" "}
|
||||||
hourCycle: "h24",
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
})}
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={400}>
|
<Center w={400}>
|
||||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||||
@@ -183,10 +198,10 @@ function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
|
|||||||
<Center>Tipe Acara</Center>
|
<Center>Tipe Acara</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Tanggal</Center>
|
<Center>Tanggal & Waktu Mulai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Jam</Center>
|
<Center>Tanggal & Waktu Selesai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Deskripsi</Center>
|
<Center>Deskripsi</Center>
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ export default async function AdminEvent_funCountByStatusId(statusId: string) {
|
|||||||
const count = await prisma.event.count({
|
const count = await prisma.event.count({
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: false
|
||||||
gte: new Date
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ export async function AdminEvent_funCountRiwayat() {
|
|||||||
const data = await prisma.event.count({
|
const data = await prisma.event.count({
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: true,
|
||||||
lte: new Date(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ export async function adminEvent_funGetListAllRiwayat({
|
|||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: true,
|
||||||
lte: new Date(),
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
@@ -49,9 +47,7 @@ export async function adminEvent_funGetListAllRiwayat({
|
|||||||
const nCount = await prisma.event.count({
|
const nCount = await prisma.event.count({
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: true,
|
||||||
lte: new Date(),
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
"use server";
|
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
|
||||||
|
|
||||||
export async function AdminEvent_getListTableByStatusId(statudId: string) {
|
|
||||||
if (statudId === "1") {
|
|
||||||
const getPublish = 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,
|
|
||||||
Author: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
username: true,
|
|
||||||
Profile: {
|
|
||||||
select: {
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
EventMaster_Status: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
EventMaster_TipeAcara: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Event_Peserta: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getPublish;
|
|
||||||
}
|
|
||||||
if (statudId === "2") {
|
|
||||||
const getReview = await prisma.event.findMany({
|
|
||||||
orderBy: {
|
|
||||||
updatedAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
eventMaster_StatusId: "2",
|
|
||||||
active: true,
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
lokasi: true,
|
|
||||||
tanggal: true,
|
|
||||||
deskripsi: true,
|
|
||||||
Author: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
username: true,
|
|
||||||
Profile: {
|
|
||||||
select: {
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
EventMaster_Status: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
EventMaster_TipeAcara: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getReview;
|
|
||||||
}
|
|
||||||
if (statudId === "3") {
|
|
||||||
const getDraft = await prisma.event.findMany({
|
|
||||||
orderBy: {
|
|
||||||
updatedAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
eventMaster_StatusId: "3",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getDraft;
|
|
||||||
}
|
|
||||||
if (statudId === "4") {
|
|
||||||
const getReject = await prisma.event.findMany({
|
|
||||||
orderBy: {
|
|
||||||
updatedAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
eventMaster_StatusId: "4",
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
lokasi: true,
|
|
||||||
tanggal: true,
|
|
||||||
deskripsi: true,
|
|
||||||
Author: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
username: true,
|
|
||||||
Profile: {
|
|
||||||
select: {
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
EventMaster_Status: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
EventMaster_TipeAcara: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
catatan: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getReject;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import { ceil } from "lodash";
|
import { ceil } from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
export async function adminEvent_funGetListPublish({
|
export async function adminEvent_funGetListPublish({
|
||||||
page,
|
page,
|
||||||
@@ -10,6 +12,27 @@ export async function adminEvent_funGetListPublish({
|
|||||||
page: number;
|
page: number;
|
||||||
search?: string;
|
search?: string;
|
||||||
}) {
|
}) {
|
||||||
|
const getAllData = await prisma.event.findMany({
|
||||||
|
where: {
|
||||||
|
active: true,
|
||||||
|
eventMaster_StatusId: "1",
|
||||||
|
isArsip: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i of getAllData) {
|
||||||
|
if (moment(i.tanggalSelesai).diff(moment(), "minutes") < 0) {
|
||||||
|
await prisma.event.update({
|
||||||
|
where: {
|
||||||
|
id: i.id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
isArsip: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let takeData = 10;
|
let takeData = 10;
|
||||||
let skipData = page * takeData - takeData;
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
@@ -21,9 +44,7 @@ export async function adminEvent_funGetListPublish({
|
|||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: false,
|
||||||
gte: new Date(),
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
@@ -49,9 +70,7 @@ export async function adminEvent_funGetListPublish({
|
|||||||
const nCount = await prisma.event.count({
|
const nCount = await prisma.event.count({
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: false,
|
||||||
gte: new Date(),
|
|
||||||
},
|
|
||||||
title: {
|
title: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||||
|
import {
|
||||||
|
MODEL_EVENT
|
||||||
|
} from "@/app_modules/event/model/interface";
|
||||||
import {
|
import {
|
||||||
Avatar,
|
|
||||||
Box,
|
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
|
||||||
Pagination,
|
Pagination,
|
||||||
Paper,
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
@@ -17,22 +16,14 @@ import {
|
|||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
Title,
|
Title
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconCircleCheck, IconEyeShare, IconSearch } from "@tabler/icons-react";
|
import { IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
|
||||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
|
||||||
import {
|
|
||||||
MODEL_EVENT,
|
|
||||||
MODEL_EVENT_PESERTA,
|
|
||||||
} from "@/app_modules/event/model/interface";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||||
import { adminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
|
||||||
import { adminEvent_funGetListPublish } from "../fun";
|
import { adminEvent_funGetListPublish } from "../fun";
|
||||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
|
||||||
|
|
||||||
export default function AdminEvent_TablePublish({
|
export default function AdminEvent_TablePublish({
|
||||||
listPublish,
|
listPublish,
|
||||||
@@ -78,64 +69,102 @@ function TableStatus({ listPublish }: { listPublish: any }) {
|
|||||||
setNPage(loadData.nPage);
|
setNPage(loadData.nPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TableRows = data.map((e, i) => (
|
const TableRows = _.isEmpty(data) ? (
|
||||||
<tr key={i}>
|
<tr>
|
||||||
<td>
|
<td colSpan={12}>
|
||||||
<Center w={200}>
|
<Center>Belum Ada Data</Center>
|
||||||
<Text>{e?.Author?.username}</Text>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center w={200}>
|
|
||||||
<Text lineClamp={2}>{e.title}</Text>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center w={200}>
|
|
||||||
<Text>{e.lokasi}</Text>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center w={200}>
|
|
||||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center w={200}>
|
|
||||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center w={200}>
|
|
||||||
{e.tanggal.toLocaleTimeString([], {
|
|
||||||
timeStyle: "short",
|
|
||||||
hourCycle: "h24",
|
|
||||||
})}
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center w={400}>
|
|
||||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
|
||||||
{e.deskripsi}
|
|
||||||
</Spoiler>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<Button
|
|
||||||
loading={e.id === eventId ? (loading === true ? true : false) : false}
|
|
||||||
color={"green"}
|
|
||||||
leftIcon={<IconCircleCheck />}
|
|
||||||
radius={"xl"}
|
|
||||||
onClick={async () => {
|
|
||||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Lihat Peserta
|
|
||||||
</Button>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
));
|
) : (
|
||||||
|
data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text>{e?.Author?.username}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text lineClamp={2}>{e.title}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text>{e.lokasi}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text align="center">
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text align="center">
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Center w={400}>
|
||||||
|
<Spoiler
|
||||||
|
hideLabel="sembunyikan"
|
||||||
|
maxHeight={50}
|
||||||
|
showLabel="tampilkan"
|
||||||
|
>
|
||||||
|
{e.deskripsi}
|
||||||
|
</Spoiler>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={
|
||||||
|
e.id === eventId ? (loading === true ? true : false) : false
|
||||||
|
}
|
||||||
|
color={"green"}
|
||||||
|
leftIcon={<IconCircleCheck />}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={async () => {
|
||||||
|
setEventId(e.id);
|
||||||
|
setLoading(true);
|
||||||
|
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Lihat Peserta
|
||||||
|
</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -182,10 +211,10 @@ function TableStatus({ listPublish }: { listPublish: any }) {
|
|||||||
<Center>Tipe Acara</Center>
|
<Center>Tipe Acara</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Tanggal</Center>
|
<Center>Tanggal & Waktu Mulai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Jam</Center>
|
<Center>Tanggal & Waktu Selesai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Deskripsi</Center>
|
<Center>Deskripsi</Center>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
Spoiler,
|
Spoiler,
|
||||||
Stack,
|
Stack,
|
||||||
Table,
|
Table,
|
||||||
|
Text,
|
||||||
Textarea,
|
Textarea,
|
||||||
TextInput,
|
TextInput,
|
||||||
Title,
|
Title,
|
||||||
@@ -106,19 +107,40 @@ function TableStatus({ listReject }: { listReject: any }) {
|
|||||||
<td>
|
<td>
|
||||||
<Center w={200}>{e.EventMaster_TipeAcara.name}</Center>
|
<Center w={200}>{e.EventMaster_TipeAcara.name}</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
<Text align="center">
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggal)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={100}>
|
<Center w={200}>
|
||||||
{e.tanggal.toLocaleTimeString([], {
|
<Text align="center">
|
||||||
timeStyle: "short",
|
{" "}
|
||||||
hourCycle: "h24",
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
})}
|
dateStyle: "full",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(e?.tanggalSelesai)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={500}>
|
<Center w={500}>
|
||||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||||
@@ -197,10 +219,10 @@ function TableStatus({ listReject }: { listReject: any }) {
|
|||||||
<Center>Tipe Acara</Center>
|
<Center>Tipe Acara</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Tanggal</Center>
|
<Center>Tanggal & Waktu Mulai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Jam</Center>
|
<Center>Tanggal & Waktu Selesai</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center>Cacatan</Center>
|
<Center>Cacatan</Center>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { redirect, useRouter } from "next/navigation";
|
||||||
import { MODEL_USER } from "../home/model/interface";
|
import { MODEL_USER } from "../home/model/interface";
|
||||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||||
@@ -16,6 +16,12 @@ export function CheckCookies_UiLayout({
|
|||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
// if (dataUser.active == false){
|
||||||
|
// router.push(RouterHome.home_user_non_active, { scroll: false });
|
||||||
|
// return children
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// useShallowEffect(() => {
|
// useShallowEffect(() => {
|
||||||
// onCheckCookies();
|
// onCheckCookies();
|
||||||
// }, []);
|
// }, []);
|
||||||
@@ -38,5 +44,5 @@ export function CheckCookies_UiLayout({
|
|||||||
// router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
// router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return children;
|
return <>{children}</>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { MainColor } from "@/app_modules/_global/color";
|
|||||||
import {
|
import {
|
||||||
ComponentGlobal_NotifikasiBerhasil,
|
ComponentGlobal_NotifikasiBerhasil,
|
||||||
ComponentGlobal_NotifikasiGagal,
|
ComponentGlobal_NotifikasiGagal,
|
||||||
|
ComponentGlobal_NotifikasiPeringatan,
|
||||||
} from "@/app_modules/_global/notif_global";
|
} from "@/app_modules/_global/notif_global";
|
||||||
import { notifikasiToAdmin_funCreate } from "@/app_modules/notifikasi/fun";
|
import { notifikasiToAdmin_funCreate } from "@/app_modules/notifikasi/fun";
|
||||||
import { Button } from "@mantine/core";
|
import { Button } from "@mantine/core";
|
||||||
@@ -14,13 +15,23 @@ import { useState } from "react";
|
|||||||
import { WibuRealtime } from "wibu-pkg";
|
import { WibuRealtime } from "wibu-pkg";
|
||||||
import { Event_funCreate } from "../../fun/create/fun_create";
|
import { Event_funCreate } from "../../fun/create/fun_create";
|
||||||
import { gs_event_hotMenu } from "../../global_state";
|
import { gs_event_hotMenu } from "../../global_state";
|
||||||
|
import { event_checkStatus } from "../../fun/get/fun_check_status_by_id";
|
||||||
|
|
||||||
export default function Event_ComponentCreateButton({ value }: { value: any }) {
|
export default function Event_ComponentCreateButton({
|
||||||
|
value,
|
||||||
|
diffTimeStart,
|
||||||
|
diffTimeEnd,
|
||||||
|
}: {
|
||||||
|
value: any;
|
||||||
|
diffTimeStart: number;
|
||||||
|
diffTimeEnd: number;
|
||||||
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
|
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
|
||||||
const [isLoading, setLoading] = useState(false);
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
async function onSave() {
|
async function onSave() {
|
||||||
|
|
||||||
const res = await Event_funCreate(value);
|
const res = await Event_funCreate(value);
|
||||||
|
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
@@ -71,7 +82,8 @@ export default function Event_ComponentCreateButton({ value }: { value: any }) {
|
|||||||
value.deskripsi === "" ||
|
value.deskripsi === "" ||
|
||||||
value.eventMaster_TipeAcaraId === 0 ||
|
value.eventMaster_TipeAcaraId === 0 ||
|
||||||
value.tanggal === "function Date() { [native code] }" ||
|
value.tanggal === "function Date() { [native code] }" ||
|
||||||
moment(value.tanggal).diff(moment(), "minutes") < 0
|
// moment(value.tanggal).diff(moment(), "minutes") < 0
|
||||||
|
diffTimeEnd - 1 < diffTimeStart
|
||||||
}
|
}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={isLoading ? true : false}
|
loading={isLoading ? true : false}
|
||||||
|
|||||||
@@ -9,26 +9,16 @@ export default function ComponentEvent_DetailData({
|
|||||||
}: {
|
}: {
|
||||||
data: MODEL_EVENT;
|
data: MODEL_EVENT;
|
||||||
}) {
|
}) {
|
||||||
const tgl = data.tanggal;
|
|
||||||
const hari = tgl.toLocaleString("id-ID", { dateStyle: "full" });
|
|
||||||
|
|
||||||
const jam = tgl.toLocaleTimeString([], {
|
|
||||||
timeStyle: "short",
|
|
||||||
hourCycle: "h24",
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ComponentGlobal_CardStyles marginBottom={"16px"}>
|
<ComponentGlobal_CardStyles marginBottom={"16px"}>
|
||||||
<Stack px={"sm"} spacing={"lg"}>
|
<Stack px={"sm"} spacing={"xl"}>
|
||||||
<Title lineClamp={2} align="center" w={"100%"} order={4}>
|
<Title lineClamp={2} align="center" w={"100%"} order={4}>
|
||||||
{data ? data?.title : null}
|
{data ? data?.title : null}
|
||||||
</Title>
|
</Title>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Lokasi</Text>
|
||||||
Lokasi
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
@@ -37,37 +27,59 @@ export default function ComponentEvent_DetailData({
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Tipe Acara</Text>
|
||||||
Tipe Acara
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text>{data ? data.EventMaster_TipeAcara?.name : null}</Text>
|
<Text>{data ? data.EventMaster_TipeAcara?.name : null}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Stack spacing={"xs"}>
|
||||||
<Grid.Col span={4}>
|
<Text fw={"bold"}>Tanggal & Waktu</Text>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Grid>
|
||||||
Tanggal
|
<Grid.Col span={4}>
|
||||||
</Text>
|
<Text fw={"bold"}>Mulai</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>{hari ? hari : ""}</Grid.Col>
|
<Grid.Col span={"auto"}>
|
||||||
</Grid>
|
<Text>
|
||||||
<Grid>
|
{" "}
|
||||||
<Grid.Col span={4}>
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
dateStyle: "full",
|
||||||
Jam
|
}).format(data?.tanggal)}
|
||||||
</Text>
|
,{" "}
|
||||||
</Grid.Col>
|
<Text span inherit>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
<Grid.Col span={"auto"}>{jam ? jam : ""}</Grid.Col>
|
timeStyle: "short",
|
||||||
</Grid>
|
}).format(data?.tanggal)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"}>Selesai</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(data?.tanggalSelesai)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(data?.tanggalSelesai)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Deskripsi</Text>
|
||||||
Deskripsi
|
|
||||||
</Text>
|
|
||||||
<Text>{data ? data?.deskripsi : null}</Text>
|
<Text>{data ? data?.deskripsi : null}</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -28,15 +28,13 @@ export default function ComponentEvent_DetailMainData({
|
|||||||
profile={data?.Author?.Profile as any}
|
profile={data?.Author?.Profile as any}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack>
|
<Stack spacing={"xl"}>
|
||||||
<Title align="center" order={4}>
|
<Title align="center" order={4}>
|
||||||
{data ? data.title : null}
|
{data ? data.title : null}
|
||||||
</Title>
|
</Title>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Lokasi</Text>
|
||||||
Lokasi
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
@@ -45,37 +43,60 @@ export default function ComponentEvent_DetailMainData({
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Tipe Acara</Text>
|
||||||
Tipe Acara
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text>{data ? data.EventMaster_TipeAcara.name : null}</Text>
|
<Text>{data ? data.EventMaster_TipeAcara.name : null}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={4}>
|
<Stack spacing={"xs"}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Tanggal & Waktu</Text>
|
||||||
Tanggal
|
<Grid>
|
||||||
</Text>
|
<Grid.Col span={4}>
|
||||||
</Grid.Col>
|
<Text fw={"bold"}>Mulai</Text>
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>{hari}</Grid.Col>
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
</Grid>
|
<Grid.Col span={"auto"}>
|
||||||
<Grid>
|
<Text>
|
||||||
<Grid.Col span={4}>
|
{" "}
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
Jam
|
dateStyle: "full",
|
||||||
</Text>
|
}).format(data?.tanggal)}
|
||||||
</Grid.Col>
|
,{" "}
|
||||||
<Grid.Col span={1}>:</Grid.Col>
|
<Text span inherit>
|
||||||
<Grid.Col span={"auto"}>{jam}</Grid.Col>
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
</Grid>
|
timeStyle: "short",
|
||||||
|
}).format(data?.tanggal)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"}>Selesai</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>
|
||||||
|
{" "}
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
dateStyle: "full",
|
||||||
|
}).format(data?.tanggalSelesai)}
|
||||||
|
,{" "}
|
||||||
|
<Text span inherit>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(data?.tanggalSelesai)}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"}>Deskripsi</Text>
|
||||||
Deskripsi
|
|
||||||
</Text>
|
|
||||||
<Text>{data ? data?.deskripsi : null}</Text>
|
<Text>{data ? data?.deskripsi : null}</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -2,7 +2,14 @@
|
|||||||
|
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||||
import { Select, Stack, TextInput, Textarea } from "@mantine/core";
|
import {
|
||||||
|
Button,
|
||||||
|
Select,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Textarea,
|
||||||
|
} from "@mantine/core";
|
||||||
import { DateTimePicker } from "@mantine/dates";
|
import { DateTimePicker } from "@mantine/dates";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -17,14 +24,18 @@ export default function Event_Create({
|
|||||||
authorId: string;
|
authorId: string;
|
||||||
}) {
|
}) {
|
||||||
const [listTipe, setListTipe] = useState(listTipeAcara);
|
const [listTipe, setListTipe] = useState(listTipeAcara);
|
||||||
const [isTime, setIsTime] = useState(false);
|
|
||||||
|
|
||||||
|
const [isTimeStart, setIsTimeStart] = useState(false);
|
||||||
|
const [diffTimeStart, setDiffTimeStart] = useState(0);
|
||||||
|
const [isTimeEnd, setIsTimeEnd] = useState(false);
|
||||||
|
const [diffTimeEnd, setDiffTimeEnd] = useState(0);
|
||||||
|
|
||||||
const [value, setValue] = useState({
|
const [value, setValue] = useState({
|
||||||
title: "",
|
title: "",
|
||||||
lokasi: "",
|
lokasi: "",
|
||||||
deskripsi: "",
|
deskripsi: "",
|
||||||
tanggal: Date.toString(),
|
tanggal: Date.toString(),
|
||||||
|
tanggalSelesai: Date.toString(),
|
||||||
eventMaster_TipeAcaraId: 0,
|
eventMaster_TipeAcaraId: 0,
|
||||||
authorId: authorId,
|
authorId: authorId,
|
||||||
});
|
});
|
||||||
@@ -88,6 +99,8 @@ export default function Event_Create({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
styles={{
|
styles={{
|
||||||
label: {
|
label: {
|
||||||
@@ -98,10 +111,10 @@ export default function Event_Create({
|
|||||||
return moment(date).diff(Date.now(), "days") < 0;
|
return moment(date).diff(Date.now(), "days") < 0;
|
||||||
}}
|
}}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
label="Tanggal & Waktu "
|
label="Tanggal & Waktu Mulai"
|
||||||
placeholder="Masukan tangal dan waktu acara"
|
placeholder="Masukan tangal dan waktu"
|
||||||
error={
|
error={
|
||||||
isTime ? (
|
isTimeStart ? (
|
||||||
<ComponentEvent_ErrorMaximalInput text="Invalid Time !" />
|
<ComponentEvent_ErrorMaximalInput text="Invalid Time !" />
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
@@ -111,9 +124,15 @@ export default function Event_Create({
|
|||||||
// console.log(
|
// console.log(
|
||||||
// moment(val?.toISOString().toString()).diff(moment(), "minutes" )
|
// moment(val?.toISOString().toString()).diff(moment(), "minutes" )
|
||||||
// );
|
// );
|
||||||
|
const diffTime = moment(val?.toISOString().toString()).diff(
|
||||||
|
moment(),
|
||||||
|
"minutes"
|
||||||
|
);
|
||||||
|
setDiffTimeStart(diffTime);
|
||||||
|
|
||||||
moment(val?.toISOString().toString()).diff(moment(), "minutes") < 0
|
moment(val?.toISOString().toString()).diff(moment(), "minutes") < 0
|
||||||
? setIsTime(true)
|
? setIsTimeStart(true)
|
||||||
: setIsTime(false);
|
: setIsTimeStart(false);
|
||||||
|
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
@@ -122,6 +141,48 @@ export default function Event_Create({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DateTimePicker
|
||||||
|
styles={{
|
||||||
|
label: {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
excludeDate={(date) => {
|
||||||
|
return moment(date).diff(Date.now(), "days") < 0;
|
||||||
|
}}
|
||||||
|
withAsterisk
|
||||||
|
label="Tanggal & Waktu Berakhir"
|
||||||
|
placeholder="Masukan tangal dan waktu "
|
||||||
|
error={
|
||||||
|
isTimeEnd ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput text="Invalid Time !" />
|
||||||
|
) : diffTimeEnd - 1 < diffTimeStart && diffTimeEnd != 0 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput text="Invalid Time !" />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onChange={(val) => {
|
||||||
|
// console.log(
|
||||||
|
// moment(val?.toISOString().toString()).diff(moment(), "minutes" )
|
||||||
|
// );
|
||||||
|
const diffTime = moment(val?.toISOString().toString()).diff(
|
||||||
|
moment(),
|
||||||
|
"minutes"
|
||||||
|
);
|
||||||
|
setDiffTimeEnd(diffTime);
|
||||||
|
|
||||||
|
moment(val?.toISOString().toString()).diff(moment(), "minutes") < 0
|
||||||
|
? setIsTimeEnd(true)
|
||||||
|
: setIsTimeEnd(false);
|
||||||
|
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
tanggalSelesai: val as any,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
@@ -147,7 +208,11 @@ export default function Event_Create({
|
|||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Event_ComponentCreateButton value={value} />
|
<Event_ComponentCreateButton
|
||||||
|
value={value}
|
||||||
|
diffTimeStart={diffTimeStart}
|
||||||
|
diffTimeEnd={diffTimeEnd}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default function Event_DetailDraft({
|
|||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
<ComponentEvent_DetailData data={data} />
|
<ComponentEvent_DetailData data={data} />
|
||||||
<ButtonAction eventId={data.id} tanggal={data.tanggal} />
|
<ButtonAction eventId={data.id} tanggalSelesai={data.tanggalSelesai} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -54,10 +54,10 @@ export default function Event_DetailDraft({
|
|||||||
|
|
||||||
function ButtonAction({
|
function ButtonAction({
|
||||||
eventId,
|
eventId,
|
||||||
tanggal,
|
tanggalSelesai,
|
||||||
}: {
|
}: {
|
||||||
eventId: string;
|
eventId: string;
|
||||||
tanggal?: any;
|
tanggalSelesai?: any;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoadingDelete, setLoadingDelete] = useState(false);
|
const [isLoadingDelete, setLoadingDelete] = useState(false);
|
||||||
@@ -77,20 +77,16 @@ function ButtonAction({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onAjukan() {
|
async function onAjukan() {
|
||||||
if (moment(tanggal.toISOString().toString()).diff(moment(), "minutes") < 0)
|
if (
|
||||||
|
moment(tanggalSelesai.toISOString().toString()).diff(
|
||||||
|
moment(),
|
||||||
|
"minutes"
|
||||||
|
) < 0
|
||||||
|
)
|
||||||
return ComponentGlobal_NotifikasiPeringatan("Waktu acara telah lewat");
|
return ComponentGlobal_NotifikasiPeringatan("Waktu acara telah lewat");
|
||||||
|
|
||||||
const res = await Event_funEditStatusById("2", eventId);
|
const res = await Event_funEditStatusById("2", eventId);
|
||||||
if (res.status === 200) {
|
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 dataNotifikasi: IRealtimeData = {
|
const dataNotifikasi: IRealtimeData = {
|
||||||
appId: res.data?.id as any,
|
appId: res.data?.id as any,
|
||||||
status: res.data?.EventMaster_Status?.name as any,
|
status: res.data?.EventMaster_Status?.name as any,
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import { useState } from "react";
|
|||||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import { IRealtimeData } from "@/app/lib/global_state";
|
||||||
|
import { WibuRealtime } from "wibu-pkg";
|
||||||
|
import { event_checkStatus } from "../../fun/get/fun_check_status_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
||||||
|
|
||||||
export default function Event_DetailReview({
|
export default function Event_DetailReview({
|
||||||
dataEvent,
|
dataEvent,
|
||||||
@@ -35,11 +39,7 @@ function ButtonAction({ eventId }: { eventId: string }) {
|
|||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button radius={"xl"} color={"orange"} onClick={() => setOpenModal(true)}>
|
||||||
radius={"xl"}
|
|
||||||
color={"orange"}
|
|
||||||
onClick={() => setOpenModal(true)}
|
|
||||||
>
|
|
||||||
Batalkan Review
|
Batalkan Review
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -73,34 +73,44 @@ async function onClick(
|
|||||||
eventId: string,
|
eventId: string,
|
||||||
setLoading: any
|
setLoading: any
|
||||||
) {
|
) {
|
||||||
const res = await Event_funEditStatusById("3", eventId);
|
const checkStatus = await event_checkStatus({ id: 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({
|
if (checkStatus) {
|
||||||
data: dataNotif as any,
|
const res = await Event_funEditStatusById("3", eventId);
|
||||||
});
|
if (res.status === 200) {
|
||||||
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
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",
|
||||||
|
};
|
||||||
|
|
||||||
if (notif.status === 201) {
|
const notif = await notifikasiToAdmin_funCreate({
|
||||||
mqtt_client.publish(
|
data: dataNotifikasi as any,
|
||||||
"ADMIN",
|
});
|
||||||
JSON.stringify({
|
|
||||||
count: 1,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
|
if (notif.status === 201) {
|
||||||
setLoading(true);
|
WibuRealtime.setData({
|
||||||
router.replace(RouterEvent.status({ id: "3" }));
|
type: "notification",
|
||||||
|
pushNotificationTo: "ADMIN",
|
||||||
|
});
|
||||||
|
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "trigger",
|
||||||
|
pushNotificationTo: "ADMIN",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
|
||||||
|
setLoading(true);
|
||||||
|
router.replace(RouterEvent.status({ id: "3" }));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiPeringatan("Event telah direview admin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||||
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
|
import {
|
||||||
|
Button,
|
||||||
|
Select,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Textarea,
|
||||||
|
} from "@mantine/core";
|
||||||
import { DateTimePicker } from "@mantine/dates";
|
import { DateTimePicker } from "@mantine/dates";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -15,7 +23,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
||||||
import { MODEL_EVENT } from "../model/interface";
|
import { MODEL_EVENT } from "../model/interface";
|
||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
||||||
|
|
||||||
export default function Event_Edit({
|
export default function Event_Edit({
|
||||||
dataEvent,
|
dataEvent,
|
||||||
@@ -30,10 +38,11 @@ export default function Event_Edit({
|
|||||||
const [value, setValue] = useState(dataEvent);
|
const [value, setValue] = useState(dataEvent);
|
||||||
const [tipe, setTipe] = useState(listTipeAcara);
|
const [tipe, setTipe] = useState(listTipeAcara);
|
||||||
|
|
||||||
// Masimal karakter state
|
const [isTimeStart, setIsTimeStart] = useState(false);
|
||||||
const [maxTitle, setMaxTitle] = useState("");
|
const [diffTimeStart, setDiffTimeStart] = useState(0);
|
||||||
const [maxLokasi, setMaxLokasi] = useState("");
|
const [isTimeEnd, setIsTimeEnd] = useState(false);
|
||||||
const [maxDeskripsi, setMaxDeskripsi] = useState("");
|
const [diffTimeEnd, setDiffTimeEnd] = useState(0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
||||||
@@ -57,7 +66,6 @@ export default function Event_Edit({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setMaxTitle(val.target.value);
|
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
title: val.target.value,
|
title: val.target.value,
|
||||||
@@ -108,13 +116,23 @@ export default function Event_Edit({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setMaxLokasi(val.target.value);
|
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
lokasi: val.target.value,
|
lokasi: val.target.value,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* <Text c={"green"}>{JSON.stringify(diffTimeStart, null, 2)}</Text>
|
||||||
|
<Text c={"red"}>{JSON.stringify(diffTimeEnd, null, 2)}</Text>
|
||||||
|
<Text c={"yellow"}>
|
||||||
|
{JSON.stringify(
|
||||||
|
moment(value.tanggal.toISOString().toString()),
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}
|
||||||
|
</Text> */}
|
||||||
|
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
styles={{
|
styles={{
|
||||||
label: {
|
label: {
|
||||||
@@ -125,20 +143,27 @@ export default function Event_Edit({
|
|||||||
return moment(date).diff(Date.now(), "days") < 0;
|
return moment(date).diff(Date.now(), "days") < 0;
|
||||||
}}
|
}}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
label="Tanggal & Waktu "
|
label="Tanggal & Waktu Mulai"
|
||||||
placeholder="Masukan tangal dan waktu acara"
|
placeholder="Masukan tangal dan waktu"
|
||||||
value={value.tanggal}
|
value={value.tanggal}
|
||||||
error={
|
error={
|
||||||
moment(value.tanggal.toISOString().toString()).diff(
|
isTimeStart ? (
|
||||||
moment(),
|
<ComponentEvent_ErrorMaximalInput text="Invalid Time !" />
|
||||||
"minutes"
|
|
||||||
) < 0 ? (
|
|
||||||
<ComponentGlobal_ErrorInput text="Invalid Time" />
|
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
|
const diffTime = moment(val?.toISOString().toString()).diff(
|
||||||
|
moment(),
|
||||||
|
"minutes"
|
||||||
|
);
|
||||||
|
setDiffTimeStart(diffTime);
|
||||||
|
|
||||||
|
moment(val?.toISOString().toString()).diff(moment(), "minutes") < 0
|
||||||
|
? setIsTimeStart(true)
|
||||||
|
: setIsTimeStart(false);
|
||||||
|
|
||||||
setValue({
|
setValue({
|
||||||
...(value as any),
|
...(value as any),
|
||||||
tanggal: val,
|
tanggal: val,
|
||||||
@@ -146,6 +171,47 @@ export default function Event_Edit({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DateTimePicker
|
||||||
|
styles={{
|
||||||
|
label: {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
excludeDate={(date) => {
|
||||||
|
return moment(date).diff(Date.now(), "days") < 0;
|
||||||
|
}}
|
||||||
|
withAsterisk
|
||||||
|
label="Tanggal & Waktu Berakhir"
|
||||||
|
placeholder="Masukan tangal dan waktu"
|
||||||
|
value={value.tanggalSelesai}
|
||||||
|
error={
|
||||||
|
isTimeEnd ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput text="Invalid Time !" />
|
||||||
|
) : moment(value.tanggalSelesai?.toISOString().toString()) <
|
||||||
|
moment(value.tanggal.toISOString().toString()) ? (
|
||||||
|
<ComponentGlobal_ErrorInput text="Invalid Time !" />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onChange={(val) => {
|
||||||
|
const diffTime = moment(val?.toISOString().toString()).diff(
|
||||||
|
moment(),
|
||||||
|
"minutes"
|
||||||
|
);
|
||||||
|
setDiffTimeEnd(diffTime);
|
||||||
|
|
||||||
|
moment(val?.toISOString().toString()).diff(moment(), "minutes") < 0
|
||||||
|
? setIsTimeEnd(true)
|
||||||
|
: setIsTimeEnd(false);
|
||||||
|
|
||||||
|
setValue({
|
||||||
|
...(value as any),
|
||||||
|
tanggalSelesai: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
@@ -167,7 +233,6 @@ export default function Event_Edit({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setMaxDeskripsi(val.target.value);
|
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
deskripsi: val.target.value,
|
deskripsi: val.target.value,
|
||||||
@@ -189,9 +254,8 @@ export default function Event_Edit({
|
|||||||
value.lokasi === "" ||
|
value.lokasi === "" ||
|
||||||
value.deskripsi === "" ||
|
value.deskripsi === "" ||
|
||||||
value.eventMaster_TipeAcaraId === 0 ||
|
value.eventMaster_TipeAcaraId === 0 ||
|
||||||
value.tanggal.toISOString.toString() ===
|
moment(value.tanggalSelesai?.toISOString().toString()) <
|
||||||
"function Date() { [native code] }" ||
|
moment(value.tanggal.toISOString().toString())
|
||||||
moment(value.tanggal).diff(moment(), "minutes") < 0
|
|
||||||
}
|
}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={isLoading ? true : false}
|
loading={isLoading ? true : false}
|
||||||
|
|||||||
@@ -3,15 +3,17 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
export async function Event_funCreate(req: MODEL_EVENT) {
|
export async function Event_funCreate(req: MODEL_EVENT) {
|
||||||
const res = await prisma.event.create({
|
const res = await prisma.event.create({
|
||||||
data: {
|
data: {
|
||||||
title: req.title,
|
title: _.startCase(req.title),
|
||||||
lokasi: req.lokasi,
|
lokasi: req.lokasi,
|
||||||
deskripsi: req.deskripsi,
|
deskripsi: req.deskripsi,
|
||||||
eventMaster_TipeAcaraId: req.eventMaster_TipeAcaraId,
|
eventMaster_TipeAcaraId: req.eventMaster_TipeAcaraId,
|
||||||
tanggal: req.tanggal,
|
tanggal: req.tanggal,
|
||||||
|
tanggalSelesai: req.tanggalSelesai,
|
||||||
authorId: req.authorId,
|
authorId: req.authorId,
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
@@ -20,10 +22,10 @@ export async function Event_funCreate(req: MODEL_EVENT) {
|
|||||||
EventMaster_Status: {
|
EventMaster_Status: {
|
||||||
select: {
|
select: {
|
||||||
name: true,
|
name: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
authorId: true,
|
authorId: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!res) return { status: 400, message: "Gagal Disimpan" };
|
if (!res) return { status: 400, message: "Gagal Disimpan" };
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import _ from "lodash";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
|
||||||
export async function Event_funEditById(data: MODEL_EVENT) {
|
export async function Event_funEditById(data: MODEL_EVENT) {
|
||||||
const updt = await prisma.event.update({
|
const updt = await prisma.event.update({
|
||||||
@@ -11,10 +11,11 @@ export async function Event_funEditById(data: MODEL_EVENT) {
|
|||||||
id: data.id,
|
id: data.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: data.title,
|
title: _.startCase(data.title),
|
||||||
lokasi: data.lokasi,
|
lokasi: data.lokasi,
|
||||||
deskripsi: data.deskripsi,
|
deskripsi: data.deskripsi,
|
||||||
tanggal: data.tanggal,
|
tanggal: data.tanggal,
|
||||||
|
tanggalSelesai: data.tanggalSelesai,
|
||||||
eventMaster_TipeAcaraId: data.EventMaster_TipeAcara.id as any,
|
eventMaster_TipeAcaraId: data.EventMaster_TipeAcara.id as any,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
14
src/app_modules/event/fun/get/fun_check_status_by_id.ts
Normal file
14
src/app_modules/event/fun/get/fun_check_status_by_id.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
|
||||||
|
export async function event_checkStatus({ id }: { id: string }) {
|
||||||
|
const checkStatus = await prisma.event.findFirst({
|
||||||
|
where: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (checkStatus?.eventMaster_StatusId == "2") return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -2,14 +2,42 @@
|
|||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
export async function event_getListAllPublish({ page }: { page: number }) {
|
export async function event_getListAllPublish({ page }: { page: number }) {
|
||||||
|
const allData = await prisma.event.findMany({
|
||||||
|
where: {
|
||||||
|
active: true,
|
||||||
|
eventMaster_StatusId: "1",
|
||||||
|
isArsip: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i of allData) {
|
||||||
|
if (moment(i.tanggalSelesai).diff(moment(), "minutes") < 0) {
|
||||||
|
const updateArsip = await prisma.event.update({
|
||||||
|
where: {
|
||||||
|
id: i.id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
isArsip: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!updateArsip) {
|
||||||
|
console.log("gagal update arsip");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const takeData = 10;
|
const takeData = 10;
|
||||||
const skipData = page * takeData - takeData;
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
const data = await prisma.event.findMany({
|
const data = await prisma.event.findMany({
|
||||||
take: takeData,
|
take: takeData,
|
||||||
skip: skipData,
|
skip: skipData,
|
||||||
|
|
||||||
orderBy: [
|
orderBy: [
|
||||||
{
|
{
|
||||||
tanggal: "asc",
|
tanggal: "asc",
|
||||||
@@ -18,9 +46,7 @@ export async function event_getListAllPublish({ page }: { page: number }) {
|
|||||||
where: {
|
where: {
|
||||||
active: true,
|
active: true,
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: false,
|
||||||
gte: new Date(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
Author: {
|
Author: {
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
"use server";
|
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
|
||||||
|
|
||||||
export async function Event_getListByStatusId(
|
|
||||||
statusId: string,
|
|
||||||
authorId: string
|
|
||||||
) {
|
|
||||||
if (statusId === "1") {
|
|
||||||
const data = await prisma.event.findMany({
|
|
||||||
orderBy: {
|
|
||||||
tanggal: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
active: true,
|
|
||||||
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: {
|
|
||||||
updatedAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
active: true,
|
|
||||||
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({
|
|
||||||
orderBy: {
|
|
||||||
updatedAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
active: true,
|
|
||||||
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({
|
|
||||||
orderBy: {
|
|
||||||
updatedAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
active: true,
|
|
||||||
eventMaster_StatusId: "4",
|
|
||||||
authorId: authorId,
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
deskripsi: true,
|
|
||||||
tanggal: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,25 +8,13 @@ export async function event_getOneById(eventId: string) {
|
|||||||
where: {
|
where: {
|
||||||
id: eventId,
|
id: eventId,
|
||||||
},
|
},
|
||||||
select: {
|
include: {
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
lokasi: true,
|
|
||||||
tanggal: true,
|
|
||||||
deskripsi: true,
|
|
||||||
active: true,
|
|
||||||
createdAt: true,
|
|
||||||
updatedAt: true,
|
|
||||||
catatan: true,
|
|
||||||
authorId: true,
|
|
||||||
Author: {
|
Author: {
|
||||||
include: {
|
include: {
|
||||||
Profile: true,
|
Profile: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
eventMaster_StatusId: true,
|
|
||||||
EventMaster_Status: true,
|
EventMaster_Status: true,
|
||||||
eventMaster_TipeAcaraId: true,
|
|
||||||
EventMaster_TipeAcara: true,
|
EventMaster_TipeAcara: true,
|
||||||
// Event_Peserta: true,
|
// Event_Peserta: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ export async function event_getListRiwayatSaya({ page }: { page: number }) {
|
|||||||
where: {
|
where: {
|
||||||
authorId: userLoginId,
|
authorId: userLoginId,
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: true,
|
||||||
lte: new Date(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
|
||||||
export async function event_getListSemuaRiwayat({page}: {page: number}) {
|
export async function event_getListSemuaRiwayat({ page }: { page: number }) {
|
||||||
|
|
||||||
const takeData = 10;
|
const takeData = 10;
|
||||||
const skipData = page * takeData - takeData;
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
@@ -16,9 +15,7 @@ export async function event_getListSemuaRiwayat({page}: {page: number}) {
|
|||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
tanggal: {
|
isArsip: true,
|
||||||
lte: new Date(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ export async function event_getAllByStatusId({
|
|||||||
active: true,
|
active: true,
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
authorId: userLoginId,
|
authorId: userLoginId,
|
||||||
tanggal: {
|
isArsip: false,
|
||||||
gte: new Date(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ export async function event_funGetAllStatusPublish({ page }: { page: number }) {
|
|||||||
active: true,
|
active: true,
|
||||||
eventMaster_StatusId: "1",
|
eventMaster_StatusId: "1",
|
||||||
authorId: userLoginId,
|
authorId: userLoginId,
|
||||||
tanggal: {
|
isArsip: false,
|
||||||
gte: new Date(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useShallowEffect } from "@mantine/hooks";
|
|||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { ScrollOnly } from "next-scroll-loader";
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
import { useEffect, useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentEvent_CardBeranda } from "../component/card_view/card_beranda";
|
import { ComponentEvent_CardBeranda } from "../component/card_view/card_beranda";
|
||||||
import { event_getListAllPublish } from "../fun/get/get_list_all_publish";
|
import { event_getListAllPublish } from "../fun/get/get_list_all_publish";
|
||||||
import { MODEL_EVENT } from "../model/interface";
|
import { MODEL_EVENT } from "../model/interface";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import _ from "lodash";
|
|||||||
import { ScrollOnly } from "next-scroll-loader";
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||||
import { event_funGetAllStatusPublish } from "../../fun/get/status/get_all_status_publish";
|
import { event_getAllByStatusId } from "../../fun";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
|
||||||
export default function Event_StatusPublish({
|
export default function Event_StatusPublish({
|
||||||
@@ -36,8 +36,9 @@ export default function Event_StatusPublish({
|
|||||||
data={data}
|
data={data}
|
||||||
setData={setData}
|
setData={setData}
|
||||||
moreData={async () => {
|
moreData={async () => {
|
||||||
const loadData = await event_funGetAllStatusPublish({
|
const loadData = await event_getAllByStatusId({
|
||||||
page: activePage + 1,
|
page: activePage + 1,
|
||||||
|
statusId: "1"
|
||||||
});
|
});
|
||||||
setActivePage((val) => val + 1);
|
setActivePage((val) => val + 1);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ export interface MODEL_EVENT {
|
|||||||
title: string;
|
title: string;
|
||||||
lokasi: string;
|
lokasi: string;
|
||||||
tanggal: Date;
|
tanggal: Date;
|
||||||
|
tanggalSelesai: Date;
|
||||||
|
isArsip: boolean;
|
||||||
deskripsi: string;
|
deskripsi: string;
|
||||||
active: boolean;
|
active: boolean;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { UIGlobal_LayoutDefault } from "@/app_modules/_global/ui";
|
||||||
import { Logout } from "@/app_modules/auth";
|
import { Logout } from "@/app_modules/auth";
|
||||||
import Component_Logout from "@/app_modules/auth/logout/view";
|
import Component_Logout from "@/app_modules/auth/logout/view";
|
||||||
import { Center, Group, Skeleton, Stack, Text, Title } from "@mantine/core";
|
import { Center, Group, Skeleton, Stack, Text, Title } from "@mantine/core";
|
||||||
@@ -38,15 +39,17 @@ export default function Home_UserNotActive() {
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Center h={"100vh"}>
|
<UIGlobal_LayoutDefault>
|
||||||
<Stack align="center">
|
<Center h={"100vh"}>
|
||||||
{customLOader}
|
<Stack align="center">
|
||||||
<Title order={4} c={"gray"}>
|
{customLOader}
|
||||||
Tunggu Konfirmasi Admin !
|
<Title order={4} c={"gray"}>
|
||||||
</Title>
|
Tunggu Konfirmasi Admin !
|
||||||
<Component_Logout />
|
</Title>
|
||||||
</Stack>
|
<Component_Logout />
|
||||||
</Center>
|
</Stack>
|
||||||
|
</Center>
|
||||||
|
</UIGlobal_LayoutDefault>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user