fix event admin

deskripsi:
- fix server action
This commit is contained in:
2025-01-31 17:52:42 +08:00
parent aa554f1ad6
commit 1ff94ad817
12 changed files with 1131 additions and 707 deletions

View File

@@ -1,6 +1,7 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import _ from "lodash";
import moment from "moment";
import { NextResponse } from "next/server";
export async function GET(
@@ -19,7 +20,7 @@ export async function GET(
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 1;
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
try {
@@ -29,7 +30,7 @@ export async function GET(
if (!page && !search) {
fixData = await prisma.event.findMany({
orderBy: {
createdAt: "desc",
updatedAt: "desc",
},
where: {
active: true,
@@ -38,11 +39,26 @@ export async function GET(
name: fixStatus,
},
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
} else if (!page && search) {
fixData = await prisma.event.findMany({
orderBy: {
createdAt: "desc",
updatedAt: "desc",
},
where: {
active: true,
@@ -55,13 +71,53 @@ export async function GET(
mode: "insensitive",
},
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
} else if (page && !search) {
if (fixStatus === "Publish") {
const getAllData = await prisma.event.findMany({
where: {
active: true,
EventMaster_Status: {
name: fixStatus,
},
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,
},
});
}
}
}
const data = await prisma.event.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "desc",
updatedAt: "desc",
},
where: {
active: true,
@@ -70,12 +126,29 @@ export async function GET(
name: fixStatus,
},
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
const nCount = await prisma.event.count({
where: {
EventMaster_Status: {
name: fixStatus,
},
active: true,
eventMaster_StatusId: "1",
isArsip: false,
},
});
@@ -85,11 +158,36 @@ export async function GET(
nPage: _.ceil(nCount / takeData),
};
} else if (page && search) {
if (fixStatus === "Publish") {
const getAllData = await prisma.event.findMany({
where: {
active: true,
EventMaster_Status: {
name: fixStatus,
},
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,
},
});
}
}
}
const data = await prisma.event.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "desc",
updatedAt: "desc",
},
where: {
active: true,
@@ -102,12 +200,26 @@ export async function GET(
mode: "insensitive",
},
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
const nCount = await prisma.event.count({
where: {
active: true,
eventMaster_StatusId: "1",
isArsip: false,
title: {
contains: search,

View File

@@ -0,0 +1,201 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import _ from "lodash";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json(
{ success: false, message: "Method not allowed" },
{ status: 405 }
);
}
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
try {
let fixData;
if (!page && !search) {
fixData = await prisma.event.findMany({
orderBy: {
createdAt: "desc",
},
where: {
EventMaster_Status: {
name: "Publish",
},
isArsip: true,
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
} else if (!page && search) {
fixData = await prisma.event.findMany({
orderBy: {
createdAt: "desc",
},
where: {
EventMaster_Status: {
name: "Publish",
},
isArsip: true,
title: {
contains: search,
mode: "insensitive",
},
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
} else if (page && !search) {
const data = await prisma.event.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "desc",
},
where: {
EventMaster_Status: {
name: "Publish",
},
isArsip: true,
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
const nCount = await prisma.event.count({
where: {
active: true,
isArsip: true,
EventMaster_Status: {
name: "Publish",
},
},
});
fixData = {
data: data,
nPage: _.ceil(nCount / takeData),
};
} else if (page && search) {
const data = await prisma.event.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "desc",
},
where: {
EventMaster_Status: {
name: "Publish",
},
isArsip: true,
title: {
contains: search,
mode: "insensitive",
},
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: true,
EventMaster_TipeAcara: true,
},
});
const nCount = await prisma.event.count({
where: {
active: true,
isArsip: true,
EventMaster_Status: {
name: "Publish",
},
title: {
contains: search,
mode: "insensitive",
},
},
});
fixData = {
data,
nPage: _.ceil(nCount / takeData),
};
}
return NextResponse.json(
{
success: true,
message: "Success get data riwayat event",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error get data riwayat event >>", error);
return NextResponse.json(
{
success: false,
message: "Error get data riwayat event",
reason: (error as Error).message,
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}

View File

@@ -1,11 +1,12 @@
export {
apiGetEventStatusCountDashboard,
apiGetEventTipeAcara,
apiGetEventRiwayatCount,
apiGetDataEventByStatus,
apiGetAdminEventStatusCountDashboard as apiGetEventStatusCountDashboard,
apiGetAdminEventCountTipeAcara as apiGetEventTipeAcara,
apiGetAdminEventRiwayatCount as apiGetEventRiwayatCount,
apiGetAdminEventByStatus as apiGetDataEventByStatus,
apiGetAdminEventRiwayat,
};
const apiGetEventStatusCountDashboard = async ({
const apiGetAdminEventStatusCountDashboard = async ({
name,
}: {
name: "Publish" | "Review" | "Reject";
@@ -26,7 +27,7 @@ const apiGetEventStatusCountDashboard = async ({
return await response.json().catch(() => null);
};
const apiGetEventRiwayatCount = async () => {
const apiGetAdminEventRiwayatCount = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -43,7 +44,7 @@ const apiGetEventRiwayatCount = async () => {
return await response.json().catch(() => null);
};
const apiGetEventTipeAcara = async () => {
const apiGetAdminEventCountTipeAcara = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -60,7 +61,7 @@ const apiGetEventTipeAcara = async () => {
return await response.json().catch(() => null);
};
const apiGetDataEventByStatus = async ({
const apiGetAdminEventByStatus = async ({
status,
page,
search,
@@ -74,7 +75,35 @@ const apiGetDataEventByStatus = async ({
const isPage = page ? `?page=${page}` : "";
const isSearch = search ? `&search=${search}` : "";
const respone = await fetch(`/api/admin/event/${status}${isPage}${isSearch}`, {
const respone = await fetch(
`/api/admin/event/${status}${isPage}${isSearch}`,
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
}
);
return await respone.json().catch(() => null);
};
const apiGetAdminEventRiwayat = async ({
page,
search,
}: {
page: string;
search: string;
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const isPage = page ? `?page=${page}` : "";
const isSearch = search ? `&search=${search}` : "";
const response = await fetch(`/api/admin/event/riwayat${isPage}${isSearch}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
@@ -83,5 +112,5 @@ const apiGetDataEventByStatus = async ({
},
});
return await respone.json().catch(() => null);
return await response.json().catch(() => null);
};

View File

@@ -2,11 +2,11 @@ import { AdminEvent_Riwayat } from "@/app_modules/admin/event";
import { adminEvent_funGetListAllRiwayat } from "@/app_modules/admin/event/fun/get/get_list_all_riwayat";
export default async function Page() {
const listRiwayat = await adminEvent_funGetListAllRiwayat({ page: 1 });
// const listRiwayat = await adminEvent_funGetListAllRiwayat({ page: 1 });
return (
<>
<AdminEvent_Riwayat listRiwayat={listRiwayat} />
<AdminEvent_Riwayat />
</>
);
}

View File

@@ -1,5 +1,4 @@
import { AdminEvent_TablePublish } from "@/app_modules/admin/event";
import { adminEvent_funGetListPublish } from "@/app_modules/admin/event/fun";
async function Page() {
return (

View File

@@ -2,11 +2,10 @@ import { AdminEvent_TableReject } from "@/app_modules/admin/event";
import { adminEvent_funGetListReject } from "@/app_modules/admin/event/fun";
export default async function Page() {
const listReject = await adminEvent_funGetListReject({ page: 1 });
return (
<>
<AdminEvent_TableReject listReject={listReject as any} />
<AdminEvent_TableReject />
</>
);
}

View File

@@ -1,12 +1,10 @@
import { AdminEvent_TableReview } from "@/app_modules/admin/event";
import { adminEvent_funGetListReview } from "@/app_modules/admin/event/fun";
export default async function Page() {
const listReview = await adminEvent_funGetListReview({ page: 1 });
return (
<>
<AdminEvent_TableReview listData={listReview as any} />
<AdminEvent_TableReview />
</>
);
}

View File

@@ -1,3 +1,4 @@
import { apiGetDataEventByStatus } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
import {
gs_adminEvent_triggerReview,
IRealtimeData,
@@ -8,10 +9,12 @@ import {
ComponentGlobal_NotifikasiGagal,
ComponentGlobal_NotifikasiPeringatan,
} from "@/app_modules/_global/notif_global";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
import { event_checkStatus } from "@/app_modules/event/fun/get/fun_check_status_by_id";
import { clientLogger } from "@/util/clientLogger";
import {
Affix,
Box,
Button,
Center,
Group,
@@ -26,7 +29,6 @@ import {
Text,
Textarea,
TextInput,
Title,
} from "@mantine/core";
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
import {
@@ -39,25 +41,19 @@ import { useAtom } from "jotai";
import moment from "moment";
import { useState } from "react";
import { WibuRealtime } from "wibu-pkg";
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
import { adminEvent_funGetListReview } from "../fun";
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 { event_checkStatus } from "@/app_modules/event/fun/get/fun_check_status_by_id";
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
export default function AdminEvent_ComponentTableReview({
listData,
}: {
listData: any;
}) {
const [data, setData] = useState<MODEL_EVENT[]>(listData.data);
const [isNPage, setNPage] = useState(listData.nPage);
const [isActivePage, setActivePage] = useState(1);
export default function AdminEvent_ComponentTableReview() {
const [data, setData] = useState<MODEL_EVENT[] | null>(null);
const [isNPage, setNPage] = useState<number>(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [isModal, setModal] = useState(false);
@@ -72,37 +68,41 @@ export default function AdminEvent_ComponentTableReview({
const [isShowReload, setIsShowReload] = useState(false);
useShallowEffect(() => {
if (isAdminTriggerReview) {
setIsShowReload(true);
loadInitialData();
}, [activePage, isSearch]);
const loadInitialData = async () => {
try {
const response = await apiGetDataEventByStatus({
status: "Review",
page: `${activePage}`,
search: isSearch,
});
if (response?.success && response?.data?.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format received:", response);
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
}, [isAdminTriggerReview, setIsShowReload]);
};
async function onSearch(s: string) {
setSearch(s);
const loadData = await adminEvent_funGetListReview({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
const onSearch = async (searchTerm: string) => {
setSearch(searchTerm);
setActivePage(1);
};
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminEvent_funGetListReview({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
const onPageClick = (page: number) => {
setActivePage(page);
};
async function onLoadData() {
const loadData = await adminEvent_funGetListReview({
page: 1,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
loadInitialData();
setIsLoading(false);
setIsShowReload(false);
setIsAdminTriggerReview(false);
@@ -125,7 +125,7 @@ export default function AdminEvent_ComponentTableReview({
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
if (res.status === 200) {
setIsLoading(true)
setIsLoading(true);
const dataNotifikasi: IRealtimeData = {
appId: res.data?.id as any,
status: res.data?.EventMaster_Status?.name as any,
@@ -153,21 +153,34 @@ export default function AdminEvent_ComponentTableReview({
});
}
const loadData = await adminEvent_funGetListReview({
search: isSearch,
page: isActivePage,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
try {
const response = await apiGetDataEventByStatus({
status: "Review",
page: `${activePage}`,
search: isSearch,
});
if (response?.success && response?.data?.data) {
console.log("review >>", response.data.data);
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format received:", response);
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
ComponentAdminGlobal_NotifikasiBerhasil("Berhasil update status");
} else {
setModal(false)
setIsLoading(false)
setModal(false);
setIsLoading(false);
ComponentAdminGlobal_NotifikasiGagal(res.message);
}
} else {
setModal(false)
setModal(false);
ComponentAdminGlobal_NotifikasiPeringatan(
"Review di batalkan oleh user, reload halaman review !"
);
@@ -205,12 +218,26 @@ export default function AdminEvent_ComponentTableReview({
});
}
const loadData = await adminEvent_funGetListReview({
search: isSearch,
page: isActivePage,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
try {
const response = await apiGetDataEventByStatus({
status: "Review",
page: `${activePage}`,
search: isSearch,
});
if (response?.success && response?.data?.data) {
console.log("review >>", response.data.data);
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format received:", response);
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
ComponentGlobal_NotifikasiBerhasil(res.message);
close();
} else {
@@ -218,220 +245,224 @@ export default function AdminEvent_ComponentTableReview({
}
}
const TableRows = 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>
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color={"gray"}>Tidak ada data</Text>
</Center>
</td>
</tr>
);
}
<td>
<Center w={200}>
<Text align="center">
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(e?.tanggal)}
,{" "}
<Text span inherit>
return 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", {
timeStyle: "short",
}).format(e?.tanggal)}
dateStyle: "full",
}).format(new Date(e?.tanggal))}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(new Date(e?.tanggal))}
</Text>
</Text>
</Text>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(e?.tanggalSelesai)}
,{" "}
<Text span inherit>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(e?.tanggalSelesai)}
dateStyle: "full",
}).format(new Date(e?.tanggalSelesai))}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(new Date(e?.tanggalSelesai))}
</Text>
</Text>
</Text>
</Center>
</td>
</Center>
</td>
<td>
<Center w={400}>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.deskripsi}
</Spoiler>
</Center>
</td>
<td>
<Center>
<Stack>
<Button
color={"green"}
leftIcon={<IconCircleCheck />}
radius={"xl"}
onClick={() =>
onPublish({
eventId: e.id,
tanggal: e.tanggal,
})
}
<td>
<Center w={400}>
<Spoiler
hideLabel="sembunyikan"
maxHeight={50}
showLabel="tampilkan"
>
Publish
</Button>
<Button
color={"red"}
leftIcon={<IconBan />}
radius={"xl"}
onClick={async () => {
const checkStatus = await event_checkStatus({ id: e.id });
{e.deskripsi}
</Spoiler>
</Center>
</td>
if (checkStatus) {
open();
setEventId(e.id);
} else {
ComponentAdminGlobal_NotifikasiPeringatan(
"Review di batalkan oleh user, muat kembali halaman ini !"
);
<td>
<Center>
<Stack>
<Button
color={"green"}
leftIcon={<IconCircleCheck />}
radius={"xl"}
onClick={() =>
onPublish({
eventId: e.id,
tanggal: e.tanggal,
})
}
}}
>
Reject
</Button>
</Stack>
</Center>
</td>
</tr>
));
>
Publish
</Button>
<Button
color={"red"}
leftIcon={<IconBan />}
radius={"xl"}
onClick={async () => {
const checkStatus = await event_checkStatus({ id: e.id });
if (checkStatus) {
open();
setEventId(e.id);
} else {
ComponentAdminGlobal_NotifikasiPeringatan(
"Review di batalkan oleh user, muat kembali halaman ini !"
);
}
}}
>
Reject
</Button>
</Stack>
</Center>
</td>
</tr>
));
};
return (
<>
<Stack spacing={"xs"} h={"100%"}>
<ComponentAdminGlobal_TitlePage
name="Review"
color={AdminColor.orange}
color={"orange.5"}
component={
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
}
/>
{/* <Group
position="apart"
bg={"orange.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Review</Title>
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
</Group> */}
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
{isShowReload && (
<Affix position={{ top: rem(200) }} w={"100%"}>
<Center>
<Button
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
bg={AccentColor.blue}
loaderPosition="center"
loading={isLoading}
radius={"xl"}
opacity={0.8}
onClick={() => onLoadData()}
leftIcon={<IconRefresh />}
>
Update Data
</Button>
</Center>
</Affix>
)}
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={isActivePage}
total={isNPage}
disabled={!data}
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onPageClick(val);
onSearch(val.currentTarget.value);
}}
/>
</Center>
</Paper>
}
/>
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
{isShowReload && (
<Affix position={{ top: rem(200) }} w={"100%"}>
<Center>
<Button
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
bg={AccentColor.blue}
loaderPosition="center"
loading={isLoading}
radius={"xl"}
opacity={0.8}
onClick={() => onLoadData()}
leftIcon={<IconRefresh />}
>
Update Data
</Button>
</Center>
</Affix>
)}
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={isNPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
<Modal
@@ -468,7 +499,8 @@ export default function AdminEvent_ComponentTableReview({
</Group>
</Stack>
</Modal>
<Modal
{/* <Modal
opened={isModal}
title="Anda Yakin Ingin Mempublish Event Ini?"
onClose={() => setModal(false)}
@@ -491,20 +523,7 @@ export default function AdminEvent_ComponentTableReview({
</Button>
</Group>
</Stack>
</Modal>
</Modal> */}
</>
);
function ModalPublish({
eventId,
tanggal,
}: {
eventId: string;
tanggal: Date;
}) {
return (
<Stack>
</Stack>
)
}
}

View File

@@ -2,6 +2,7 @@
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
import { clientLogger } from "@/util/clientLogger";
import {
Button,
Center,
@@ -16,139 +17,166 @@ import {
TextInput,
Title,
} from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { IconCircleCheck, IconSearch } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
import { adminEvent_funGetListAllRiwayat } from "../fun";
import { apiGetAdminEventRiwayat } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
export default function AdminEvent_Riwayat({
listRiwayat,
}: {
listRiwayat: any;
}) {
export default function AdminEvent_Riwayat() {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event: Riwayat" />
<DetailRiwayat listRiwayat={listRiwayat} />
<DetailRiwayat />
</Stack>
</>
);
}
function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
function DetailRiwayat() {
const router = useRouter();
const [eventId, setEventId] = useState("");
const [loading, setLoading] = useState(false);
const [data, setData] = useState<MODEL_EVENT[]>(listRiwayat.data);
const [isNPage, setNPage] = useState(listRiwayat.nPage);
const [isActivePage, setActivePage] = useState(1);
const [data, setData] = useState<MODEL_EVENT[] | null>(null);
const [isNPage, setNPage] = useState(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
async function onSearch(s: string) {
setSearch(s);
const loadData = await adminEvent_funGetListAllRiwayat({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
useShallowEffect(() => {
const loadInitialData = async () => {
try {
const response = await apiGetAdminEventRiwayat({
page: `${activePage}`,
search: isSearch,
});
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminEvent_funGetListAllRiwayat({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
if (response?.success && response?.data?.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format received:", response);
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
};
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Button
loaderPosition="center"
loading={e.id === eventId && loading ? true : false}
color={"green"}
leftIcon={<IconCircleCheck />}
radius={"xl"}
onClick={() => {
setEventId(e.id);
setLoading(true);
router.push(RouterAdminEvent.detail_peserta + e.id);
}}
>
Lihat Peserta
</Button>
</td>
loadInitialData();
}, [activePage, isSearch]);
<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>
const onSearch = async (searchTerm: string) => {
setSearch(searchTerm);
setActivePage(1);
};
<td>
<Center w={200}>
<Text align="center">
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(e?.tanggal)}
,{" "}
<Text span inherit>
const onPageClick = (page: number) => {
setActivePage(page);
};
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color={"gray"}>Tidak ada data</Text>
</Center>
</td>
</tr>
);
}
return data.map((e, i) => (
<tr key={i}>
<td>
<Button
loaderPosition="center"
loading={e.id === eventId && loading ? true : false}
color={"green"}
leftIcon={<IconCircleCheck />}
radius={"xl"}
onClick={() => {
setEventId(e.id);
setLoading(true);
router.push(RouterAdminEvent.detail_peserta + e.id);
}}
>
Lihat Peserta
</Button>
</td>
<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", {
timeStyle: "short",
}).format(e?.tanggal)}
dateStyle: "full",
}).format(new Date(e?.tanggal))}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(new Date(e?.tanggal))}
</Text>
</Text>
</Text>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(e?.tanggalSelesai)}
,{" "}
<Text span inherit>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(e?.tanggalSelesai)}
dateStyle: "full",
}).format(new Date(e?.tanggalSelesai))}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(new Date(e?.tanggalSelesai))}
</Text>
</Text>
</Text>
</Center>
</td>
</Center>
</td>
<td>
<Center w={400}>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.deskripsi}
</Spoiler>
</Center>
</td>
</tr>
));
<td>
<Center w={400}>
<Spoiler
hideLabel="sembunyikan"
maxHeight={50}
showLabel="tampilkan"
>
{e.deskripsi}
</Spoiler>
</Center>
</td>
</tr>
));
};
return (
<>
@@ -170,58 +198,62 @@ function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
/>
</Group>
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Aksi</Center>
</th>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Aksi</Center>
</th>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={isActivePage}
total={isNPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={isNPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
</>
);

View File

@@ -2,6 +2,7 @@
import { apiGetDataEventByStatus } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
import { clientLogger } from "@/util/clientLogger";
import {
@@ -16,16 +17,13 @@ import {
Text,
TextInput,
} from "@mantine/core";
import { useEffect } from "react";
import { useShallowEffect } from "@mantine/hooks";
import { IconEyeCheck, IconSearch } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import QRCode from "react-qr-code";
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
import { adminEvent_funGetListPublish } from "../fun";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
export default function AdminEvent_TablePublish() {
return (
@@ -46,13 +44,13 @@ function TableStatus() {
const [loading, setLoading] = useState(false);
const [origin, setOrigin] = useState("");
useEffect(() => {
useShallowEffect(() => {
if (typeof window !== "undefined") {
setOrigin(window.location.origin);
}
}, []);
useEffect(() => {
useShallowEffect(() => {
const loadInitialData = async () => {
try {
const response = await apiGetDataEventByStatus({
@@ -61,10 +59,7 @@ function TableStatus() {
search: isSearch,
});
console.log("Received data:", response.data.data);
console.log("Received nPage:", response.data.nPage);
if (response && Array.isArray(response.data)) {
if (response?.success && response?.data?.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
@@ -108,16 +103,14 @@ function TableStatus() {
img.src = `data:image/svg+xml;base64,${btoa(svgData)}`;
};
if (!data) {
return <CustomSkeleton height={100} width="100%" />;
}
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>Belum Ada Data</Center>
<Center>
<Text color={"gray"}>Tidak ada data</Text>
</Center>
</td>
</tr>
);
@@ -158,9 +151,10 @@ function TableStatus() {
</td>
<td>
<Center w={200}>
<Text>{e.EventMaster_TipeAcara.name}</Text>
<Text>{e.EventMaster_TipeAcara?.name}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
@@ -191,6 +185,7 @@ function TableStatus() {
</Text>
</Center>
</td>
<td>
<Center w={400}>
<Spoiler
@@ -202,6 +197,7 @@ function TableStatus() {
</Spoiler>
</Center>
</td>
<td>
<Button
loaderPosition="center"
@@ -229,6 +225,7 @@ function TableStatus() {
color="green"
component={
<TextInput
disabled={!data}
icon={<IconSearch size={20} />}
radius="xl"
placeholder="Masukan judul"
@@ -238,62 +235,66 @@ function TableStatus() {
}
/>
<Paper p="md" withBorder shadow="lg" h="80vh">
<ScrollArea w="100%" h="90%">
<Table
verticalSpacing="md"
horizontalSpacing="md"
p="md"
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>QR Code</Center>
</th>
<th>
<Center>Download QR</Center>
</th>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p="md" withBorder shadow="lg" h="80vh">
<ScrollArea w="100%" h="90%">
<Table
verticalSpacing="md"
horizontalSpacing="md"
p="md"
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>QR Code</Center>
</th>
<th>
<Center>Download QR</Center>
</th>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt="xl">
<Pagination
value={activePage}
total={isNPage}
onChange={onPageClick}
/>
</Center>
</Paper>
<Center mt="xl">
<Pagination
value={activePage}
total={isNPage}
onChange={onPageClick}
/>
</Center>
</Paper>
)}
</Stack>
);
}

View File

@@ -18,7 +18,7 @@ import {
} from "@mantine/core";
import { IconPencilPlus, IconSearch } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useDisclosure } from "@mantine/hooks";
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
@@ -29,52 +29,65 @@ import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_rejec
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import { MainColor } from "@/app_modules/_global/color";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
import { apiGetDataEventByStatus } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
import { clientLogger } from "@/util/clientLogger";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
export default function AdminEvent_TableReject({
listReject,
}: {
listReject: any;
}) {
export default function AdminEvent_TableReject() {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event" />
<TableStatus listReject={listReject} />
<TableStatus />
</Stack>
</>
);
}
function TableStatus({ listReject }: { listReject: any }) {
function TableStatus() {
const router = useRouter();
const [data, setData] = useState<MODEL_EVENT[]>(listReject.data);
const [isNPage, setNPage] = useState(listReject.nPage);
const [isActivePage, setActivePage] = useState(1);
const [data, setData] = useState<MODEL_EVENT[] | null>(null);
const [isNPage, setNPage] = useState(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
const [opened, { open, close }] = useDisclosure(false);
const [eventId, setEventId] = useState("");
const [catatan, setCatatan] = useState("");
async function onSearch(s: string) {
setSearch(s);
const loadData = await adminEvent_funGetListReject({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
useShallowEffect(() => {
const loadInitialData = async () => {
try {
const response = await apiGetDataEventByStatus({
status: "Reject",
page: `${activePage}`,
search: isSearch,
});
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminEvent_funGetListReject({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
if (response?.success && response?.data?.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format received:", response);
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
};
loadInitialData();
}, [activePage, isSearch]);
const onSearch = async (searchTerm: string) => {
setSearch(searchTerm);
setActivePage(1);
};
const onPageClick = (page: number) => {
setActivePage(page);
};
async function onUpdate(eventId: string, catatan: string) {
const body = {
@@ -83,12 +96,24 @@ function TableStatus({ listReject }: { listReject: any }) {
};
const res = await AdminEvent_funEditCatatanById(body as any, "4");
if (res.status === 200) {
const loadData = await adminEvent_funGetListReject({
search: isSearch,
page: isActivePage,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
try {
const response = await apiGetDataEventByStatus({
status: "Reject",
page: `${activePage}`,
search: isSearch,
});
if (response?.success && response?.data?.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format received:", response);
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
ComponentGlobal_NotifikasiBerhasil(res.message);
close();
} else {
@@ -96,176 +121,185 @@ function TableStatus({ listReject }: { listReject: any }) {
}
}
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Center w={200}>{e?.Author?.username}</Center>
</td>
<td>
<Center w={200}>{e.title}</Center>
</td>
<td>
<Center w={200}>{e.lokasi}</Center>
</td>
<td>
<Center w={200}>{e.EventMaster_TipeAcara.name}</Center>
</td>
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color={"gray"}>Tidak ada data</Text>
</Center>
</td>
</tr>
);
}
<td>
<Center w={200}>
<Text align="center">
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(e?.tanggal)}
,{" "}
<Text span inherit>
return data.map((e, i) => (
<tr key={i}>
<td>
<Center w={200}>{e?.Author?.username}</Center>
</td>
<td>
<Center w={200}>{e.title}</Center>
</td>
<td>
<Center w={200}>{e.lokasi}</Center>
</td>
<td>
<Center w={200}>{e.EventMaster_TipeAcara.name}</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(e?.tanggal)}
dateStyle: "full",
}).format(new Date(e?.tanggal))}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(new Date(e?.tanggal))}
</Text>
</Text>
</Text>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(e?.tanggalSelesai)}
,{" "}
<Text span inherit>
</Center>
</td>
<td>
<Center w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(e?.tanggalSelesai)}
dateStyle: "full",
}).format(new Date(e?.tanggalSelesai))}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(new Date(e?.tanggalSelesai))}
</Text>
</Text>
</Text>
</Center>
</td>
</Center>
</td>
<td>
<Center w={500}>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.deskripsi}
</Spoiler>
</Center>
</td>
<td>
{" "}
<Center w={400}>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.catatan}
</Spoiler>
</Center>
</td>
<td>
<Center w={500}>
<Spoiler
hideLabel="sembunyikan"
maxHeight={50}
showLabel="tampilkan"
>
{e.deskripsi}
</Spoiler>
</Center>
</td>
<td>
{" "}
<Center w={400}>
<Spoiler
hideLabel="sembunyikan"
maxHeight={50}
showLabel="tampilkan"
>
{e.catatan}
</Spoiler>
</Center>
</td>
<td>
<Button
color={"red"}
leftIcon={<IconPencilPlus />}
radius={"xl"}
onClick={() => {
setEventId(e.id);
setCatatan(e.catatan);
open();
}}
>
Tambah Catatan
</Button>
</td>
</tr>
));
<td>
<Button
color={"red"}
leftIcon={<IconPencilPlus />}
radius={"xl"}
onClick={() => {
setEventId(e.id);
setCatatan(e.catatan);
open();
}}
>
Tambah Catatan
</Button>
</td>
</tr>
));
};
return (
<>
<Stack spacing={"xs"} h={"100%"}>
<ComponentAdminGlobal_TitlePage
name="Reject"
color={AdminColor.red}
color={"red.5"}
component={
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
}
/>
{/* <Group
position="apart"
bg={"red.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Reject</Title>
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
</Group> */}
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Cacatan</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={isActivePage}
total={isNPage}
disabled={!data}
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onPageClick(val);
onSearch(val.currentTarget.value);
}}
/>
</Center>
</Paper>
}
/>
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Cacatan</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={isNPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
<Modal

View File

@@ -7,15 +7,15 @@ import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamp
import { AdminEvent_ComponentTableReview } from "../_view";
export default function AdminEvent_TableReview({
listData,
}: {
listData: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event" />
<AdminEvent_ComponentTableReview listData={listData} />
<AdminEvent_ComponentTableReview />
</Stack>
</>
);