Merge pull request #305 from bipproduction/Nico/12-feb-25
Fix API Detail Publish Event
This commit is contained in:
50
src/app/api/admin/event/[id]/route.ts
Normal file
50
src/app/api/admin/event/[id]/route.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
const data = await prisma.event.findUnique({
|
||||
where: {
|
||||
id: id
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
alamat: true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
EventMaster_TipeAcara: {
|
||||
select: {
|
||||
name: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data event detail",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data event detail >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data event detail",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
try {
|
||||
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data event detail >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data event detail",
|
||||
reason: (error as Error).message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@ import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { status: string } }
|
||||
{ params }: { params: { name: string } }
|
||||
) {
|
||||
|
||||
|
||||
const { status } = params;
|
||||
|
||||
const { name } = params;
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get("search");
|
||||
const page = searchParams.get("page");
|
||||
@@ -19,7 +19,7 @@ export async function GET(
|
||||
|
||||
try {
|
||||
let fixData;
|
||||
const fixStatus = _.startCase(status);
|
||||
const fixStatus = _.startCase(name);
|
||||
|
||||
if (!page && !search) {
|
||||
fixData = await prisma.event.findMany({
|
||||
@@ -230,9 +230,11 @@ export async function GET(
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: `Success get data table event ${status}`,
|
||||
message: `Success get data table event ${name}`,
|
||||
data: fixData,
|
||||
});
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data table event dashboard >>", error);
|
||||
return NextResponse.json(
|
||||
@@ -243,5 +245,5 @@ export async function GET(
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
115
src/app/api/admin/forum/[id]/report-posting/route.ts
Normal file
115
src/app/api/admin/forum/[id]/report-posting/route.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
import { prisma } from "@/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
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;
|
||||
const { id } = params;
|
||||
const postingId = id
|
||||
|
||||
if (!page) {
|
||||
fixData = await prisma.forum_ReportPosting.findMany({
|
||||
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
deskripsi: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const data = await prisma.forum_ReportPosting.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
deskripsi: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const nCount = await prisma.forum_ReportPosting.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
nCount: _.ceil(nCount / takeData)
|
||||
}
|
||||
}
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Success get data forum posting",
|
||||
data: fixData
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
} catch (error) {
|
||||
backendLogger.error("Error get data forum posting >>", error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: "Error get data forum posting",
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import backendLogger from "@/util/backendLogger";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request,
|
||||
{ postingId }: { postingId: string }) {
|
||||
export async function GET(request: Request) {
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
const search = searchParams.get('search');
|
||||
@@ -22,7 +21,13 @@ export async function GET(request: Request,
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
Forum_Posting: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
contains: search ? search : '',
|
||||
mode: "insensitive"
|
||||
}
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import { AdminColor } from '@/app_modules/_global/color/color_pallet';
|
||||
import CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
||||
import { MODEL_EVENT } from '@/app_modules/event/_lib/interface';
|
||||
import { Grid, Paper, Stack, Text, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
|
||||
function ComponentEvent_DetailDataAuthor() {
|
||||
function ComponentEvent_DetailDataAuthor({ data }: { data: MODEL_EVENT | null }) {
|
||||
return (
|
||||
<>
|
||||
{/* {!data ? (
|
||||
<CustomSkeleton height={"40vh"} width={"100%"} />
|
||||
) : (
|
||||
|
||||
)} */}
|
||||
<Paper bg={AdminColor.softBlue} p={"lg"}>
|
||||
<Stack c={AdminColor.white}>
|
||||
<Title order={3}>Data User</Title>
|
||||
@@ -14,7 +21,11 @@ function ComponentEvent_DetailDataAuthor() {
|
||||
<Text fw={"bold"}>Nama:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>Nico Arya</Text>
|
||||
{data ?
|
||||
<Text>{data?.Author?.Profile?.name}</Text>
|
||||
:
|
||||
<CustomSkeleton height={30} width={"100%"} />
|
||||
}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
@@ -22,7 +33,11 @@ function ComponentEvent_DetailDataAuthor() {
|
||||
<Text fw={"bold"}>Username:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>@NicoArya</Text>
|
||||
{data ?
|
||||
<Text>{data?.Author?.username}</Text>
|
||||
:
|
||||
<CustomSkeleton height={30} width={"100%"} />
|
||||
}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
@@ -30,7 +45,11 @@ function ComponentEvent_DetailDataAuthor() {
|
||||
<Text fw={"bold"}>Nomor:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>+628123456789</Text>
|
||||
{data ?
|
||||
<Text>{data?.Author?.nomor}</Text>
|
||||
:
|
||||
<CustomSkeleton height={30} width={"100%"} />
|
||||
}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
@@ -38,12 +57,16 @@ function ComponentEvent_DetailDataAuthor() {
|
||||
<Text fw={"bold"}>Alamat:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>Jl Raya Sesetan</Text>
|
||||
{data ?
|
||||
<Text>{data?.Author?.Profile?.alamat}</Text>
|
||||
:
|
||||
<CustomSkeleton height={30} width={"100%"} />
|
||||
}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Paper >
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
import { AdminColor } from '@/app_modules/_global/color/color_pallet';
|
||||
import { MODEL_EVENT } from '@/app_modules/event/_lib/interface';
|
||||
import { Box, Grid, Paper, Stack, Text, Title } from '@mantine/core';
|
||||
import moment from 'moment';
|
||||
import React from 'react';
|
||||
import "moment/locale/id";
|
||||
import CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
||||
|
||||
function ComponentEvent_DetailDataEvent({ data }: { data: MODEL_EVENT | null }) {
|
||||
|
||||
function ComponentEvent_DetailDataEvent() {
|
||||
return (
|
||||
<>
|
||||
{/* {!data ? (
|
||||
<CustomSkeleton height={"40vh"} width={"100%"} />
|
||||
) : (
|
||||
|
||||
)
|
||||
} */}
|
||||
<Paper bg={AdminColor.softBlue} p={"lg"}>
|
||||
<Stack c={AdminColor.white}>
|
||||
<Title order={3}>Coba</Title>
|
||||
{data ? <Title order={3}>{data?.title}</Title> : <CustomSkeleton height={30} width={"100%"} />}
|
||||
<Stack spacing={"xs"}>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Lokasi:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>Tuban</Text>
|
||||
{data ? <Text>{data?.lokasi}</Text> : <CustomSkeleton height={30} width={"100%"} />}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
@@ -22,7 +33,7 @@ function ComponentEvent_DetailDataEvent() {
|
||||
<Text fw={"bold"}>Tipe Acara:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>Seminar</Text>
|
||||
{data ? <Text>{data?.EventMaster_TipeAcara?.name}</Text> : <CustomSkeleton height={30} width={"100%"} />}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
@@ -30,28 +41,26 @@ function ComponentEvent_DetailDataEvent() {
|
||||
<Text fw={"bold"}>Tanggal & Waktu Mulai:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>Minggu, 17 Januari 2025</Text>
|
||||
<Text>09:00</Text>
|
||||
{data ? <Text>{moment(data?.tanggal).format("LLLL")}</Text> : <CustomSkeleton height={30} width={"100%"} />}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Tanggal & Waktu Selesai:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text >Minggu, 17 Januari 2025</Text>
|
||||
<Text >15:00</Text>
|
||||
{data ? <Text>{moment(data?.tanggalSelesai).format("LLLL")}</Text> : <CustomSkeleton height={30} width={"100%"} />}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Deskripsi:</Text>
|
||||
<Text >Lorem ipsum dolor sit amet consectetur adipisicing elit. Nihil, natus.</Text>
|
||||
{data ? <Text>{data?.deskripsi}</Text> : <CustomSkeleton height={30} width={"100%"} />}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Paper >
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export {
|
||||
apiGetAdminEventByStatus as apiGetDataEventByStatus,
|
||||
apiGetAdminEventRiwayat,
|
||||
apiGetAdminEventTipeAcara,
|
||||
apiGetAdminDetailEventById
|
||||
};
|
||||
|
||||
const apiGetAdminEventStatusCountDashboard = async ({
|
||||
@@ -63,11 +64,11 @@ const apiGetAdminEventCountTipeAcara = async () => {
|
||||
};
|
||||
|
||||
const apiGetAdminEventByStatus = async ({
|
||||
status,
|
||||
name,
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
status: "Publish" | "Review" | "Reject";
|
||||
name: "Publish" | "Review" | "Reject";
|
||||
page: string;
|
||||
search: string;
|
||||
}) => {
|
||||
@@ -77,7 +78,7 @@ const apiGetAdminEventByStatus = async ({
|
||||
const isPage = page ? `?page=${page}` : "";
|
||||
const isSearch = search ? `&search=${search}` : "";
|
||||
const respone = await fetch(
|
||||
`/api/admin/event/${status}${isPage}${isSearch}`,
|
||||
`/api/admin/event/status/${name}${isPage}${isSearch}`,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -132,3 +133,20 @@ const apiGetAdminEventTipeAcara = async () => {
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
const apiGetAdminDetailEventById = async ({ id }: { id: string }) => {
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/admin/event/${id}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { apiGetDataEventByStatus } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
|
||||
import { apiGetDataEventByStatus } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import {
|
||||
gs_adminEvent_triggerReview,
|
||||
IRealtimeData,
|
||||
@@ -75,7 +75,7 @@ export default function AdminEvent_ComponentTableReview() {
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetDataEventByStatus({
|
||||
status: "Review",
|
||||
name: "Review",
|
||||
page: `${activePage}`,
|
||||
search: isSearch,
|
||||
});
|
||||
@@ -156,17 +156,17 @@ export default function AdminEvent_ComponentTableReview() {
|
||||
|
||||
try {
|
||||
const response = await apiGetDataEventByStatus({
|
||||
status: "Review",
|
||||
name: "Review",
|
||||
page: `${activePage}`,
|
||||
search: isSearch,
|
||||
});
|
||||
|
||||
if (response?.success && response?.data?.data) {
|
||||
|
||||
|
||||
setData(response.data.data);
|
||||
setNPage(response.data.nPage || 1);
|
||||
} else {
|
||||
|
||||
|
||||
setData([]);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -221,13 +221,13 @@ export default function AdminEvent_ComponentTableReview() {
|
||||
|
||||
try {
|
||||
const response = await apiGetDataEventByStatus({
|
||||
status: "Review",
|
||||
name: "Review",
|
||||
page: `${activePage}`,
|
||||
search: isSearch,
|
||||
});
|
||||
|
||||
if (response?.success && response?.data?.data) {
|
||||
|
||||
|
||||
setData(response.data.data);
|
||||
setNPage(response.data.nPage || 1);
|
||||
} else {
|
||||
@@ -387,7 +387,7 @@ export default function AdminEvent_ComponentTableReview() {
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
{!data ? (
|
||||
<CustomSkeleton height={"80vh"} width="100%" />
|
||||
|
||||
@@ -22,7 +22,7 @@ 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 { apiGetAdminEventRiwayat } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
|
||||
import { apiGetAdminEventRiwayat } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
@@ -209,7 +209,7 @@ function DetailRiwayat() {
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -25,7 +25,7 @@ import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_aca
|
||||
import { AdminEvent_funEditActivationTipeAcaraById } from "../fun/edit/fun_edit_activation_tipe_acara";
|
||||
import { AdminEvent_funEditTipeAcara } from "../fun/edit/fun_edit_tipe_acara";
|
||||
import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
|
||||
import { apiGetAdminEventTipeAcara } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
|
||||
import { apiGetAdminEventTipeAcara } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
@@ -168,9 +168,10 @@ function DetailTipeAcara() {
|
||||
|
||||
{openCreate ? (
|
||||
<div>
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Paper p={"sm"} bg={AdminColor.softBlue} shadow="lg" >
|
||||
<Stack>
|
||||
<TextInput
|
||||
<TextInput
|
||||
styles={{ label: { color: AdminColor.white } }}
|
||||
value={name ? name : ""}
|
||||
label="Masukan Tipe"
|
||||
placeholder="Contoh: Seminar, Workshop, dll."
|
||||
|
||||
@@ -1,9 +1,41 @@
|
||||
import { SimpleGrid } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import ComponentEvent_DetailDataAuthor from '../_component/detail_data_author';
|
||||
import ComponentEvent_DetailDataEvent from '../_component/detail_data_event';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { apiGetAdminDetailEventById } from '../_lib/api_fecth_admin_event';
|
||||
import { MODEL_EVENT } from '@/app_modules/event/_lib/interface';
|
||||
import { clientLogger } from '@/util/clientLogger';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
|
||||
function AdminEvent_ViewDetailData({ }) {
|
||||
const params = useParams<{ id: string }>();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [data, setData] = useState<MODEL_EVENT | null>(null);
|
||||
|
||||
useShallowEffect(() => {
|
||||
getDetailData();
|
||||
}, [])
|
||||
async function getDetailData() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetAdminDetailEventById({
|
||||
id: params.id,
|
||||
})
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
setTimeout(() => {
|
||||
setData(response.data);
|
||||
}, 1000)
|
||||
} else {
|
||||
console.error("Invalid data format received:", response);
|
||||
setData(null);
|
||||
}
|
||||
} catch (error) {
|
||||
clientLogger.error("Error get data table detail publish", error);
|
||||
setData(null);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
@@ -14,12 +46,12 @@ function AdminEvent_ViewDetailData({ }) {
|
||||
]}
|
||||
>
|
||||
{/* //Data Author */}
|
||||
<ComponentEvent_DetailDataAuthor />
|
||||
|
||||
{/* Data Event */}
|
||||
<ComponentEvent_DetailDataEvent/>
|
||||
<ComponentEvent_DetailDataAuthor data={data}/>
|
||||
|
||||
</SimpleGrid>
|
||||
{/* Data Event */}
|
||||
<ComponentEvent_DetailDataEvent data={data} />
|
||||
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
apiGetEventRiwayatCount,
|
||||
apiGetEventStatusCountDashboard,
|
||||
apiGetEventTipeAcara,
|
||||
} from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
|
||||
} from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import global_limit from "@/lib/limit";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
@@ -229,7 +229,7 @@ export default function AdminEvent_Main() {
|
||||
shadow="md"
|
||||
radius="md"
|
||||
p="md"
|
||||
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||
>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"} color={AccentColor.white}>
|
||||
@@ -265,7 +265,7 @@ export default function AdminEvent_Main() {
|
||||
shadow="md"
|
||||
radius="md"
|
||||
p="md"
|
||||
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||
>
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"} color={AccentColor.white}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { apiGetDataEventByStatus } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
|
||||
import { apiGetDataEventByStatus } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import { RouterAdminEvent } from "@/lib/router_admin/router_admin_event";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||
@@ -55,7 +55,7 @@ function TableStatus() {
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetDataEventByStatus({
|
||||
status: "Publish",
|
||||
name: "Publish",
|
||||
page: `${activePage}`,
|
||||
search: isSearch,
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ 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 { apiGetDataEventByStatus } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
|
||||
@@ -59,7 +59,7 @@ function TableStatus() {
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetDataEventByStatus({
|
||||
status: "Reject",
|
||||
name: "Reject",
|
||||
page: `${activePage}`,
|
||||
search: isSearch,
|
||||
});
|
||||
@@ -98,7 +98,7 @@ function TableStatus() {
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
const response = await apiGetDataEventByStatus({
|
||||
status: "Reject",
|
||||
name: "Reject",
|
||||
page: `${activePage}`,
|
||||
search: isSearch,
|
||||
});
|
||||
@@ -251,7 +251,7 @@ function TableStatus() {
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface";
|
||||
import {
|
||||
Badge,
|
||||
@@ -21,17 +22,17 @@ export default function ComponentAdminForum_ViewOneDetailPosting({
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"} w={"50%"}>
|
||||
<Paper bg={"gray"} p={"xs"} style={{ borderRadius: "6px" }}>
|
||||
<Paper bg={AdminColor.softBlue} p={"xs"} style={{ borderRadius: "6px" }}>
|
||||
<Title order={4} c={"white"}>
|
||||
Detail Posting
|
||||
</Title>
|
||||
</Paper>
|
||||
|
||||
<Paper withBorder p={"md"} radius={"md"} shadow="sm">
|
||||
<Paper p={"md"} radius={"md"} bg={AdminColor.softBlue} shadow="sm">
|
||||
<Stack>
|
||||
<Stack spacing={5}>
|
||||
<Group position="apart">
|
||||
<Text fw={"bold"}>
|
||||
<Text c={AdminColor.white} fw={"bold"}>
|
||||
Username:{" "}
|
||||
<Text span inherit>
|
||||
{dataPosting?.Author?.username}
|
||||
@@ -53,6 +54,7 @@ export default function ComponentAdminForum_ViewOneDetailPosting({
|
||||
|
||||
<Box>
|
||||
<Spoiler
|
||||
c={AdminColor.white}
|
||||
w={500}
|
||||
hideLabel="sembunyikan"
|
||||
maxHeight={100}
|
||||
|
||||
@@ -109,4 +109,12 @@ const apiGetAdminForumPublish = async ({ page }: { page?: string }) => {
|
||||
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
const apiGetAdminHasilReportPosting = async ({id} : {id: string}) => {
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -152,7 +152,7 @@ function ButtonDeleteKomentar({
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
{data.isActive ? (
|
||||
{data?.isActive ? (
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
radius={"xl"}
|
||||
@@ -184,7 +184,7 @@ function HasilReportPosting({
|
||||
);
|
||||
const [nPage, setNPage] = useState(listReport.nPage);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
@@ -234,6 +234,7 @@ function HasilReportPosting({
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
console.log("Ini data", data);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -33,6 +33,7 @@ import { adminForum_getListReportPostingById } from "../fun/get/get_list_report_
|
||||
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function AdminForum_HasilReportPosting({
|
||||
dataPosting,
|
||||
@@ -177,12 +178,12 @@ function HasilReportPosting({
|
||||
const TableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Text>{e?.User?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Text>
|
||||
{e?.ForumMaster_KategoriReport?.title
|
||||
? e?.ForumMaster_KategoriReport?.title
|
||||
@@ -192,7 +193,7 @@ function HasilReportPosting({
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Center c={AdminColor.white} w={500}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||
@@ -204,7 +205,7 @@ function HasilReportPosting({
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Center c={AdminColor.white} w={500}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||
</Spoiler>
|
||||
@@ -218,12 +219,12 @@ function HasilReportPosting({
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"red.4"}
|
||||
bg={AdminColor.softBlue}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4} c={"white"}>
|
||||
Report Postingan
|
||||
Hasil Report Postingan
|
||||
</Title>
|
||||
{/* <TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
@@ -238,7 +239,7 @@ function HasilReportPosting({
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentAdminGlobal_IsEmptyData />
|
||||
) : (
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
@@ -246,22 +247,21 @@ function HasilReportPosting({
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
h={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
<Center c={AdminColor.white}>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Kategori</Center>
|
||||
<Center c={AdminColor.white}>Kategori</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
<Center c={AdminColor.white}>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi Lainnya</Center>
|
||||
<Center c={AdminColor.white}>Deskripsi Lainnya</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -58,11 +58,11 @@ function TableView() {
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetAdminForumReportPosting({
|
||||
page: `${activePage}`
|
||||
page: `${activePage}`,
|
||||
})
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
setData(response.data);
|
||||
if (response?.success && response?.data.data) {
|
||||
setData(response.data.data);
|
||||
setNPage(response.data.nCount || 1)
|
||||
} else {
|
||||
console.error("Invalid data format recieved", response),
|
||||
|
||||
@@ -34,8 +34,10 @@ const middlewareConfig: MiddlewareConfig = {
|
||||
|
||||
// ADMIN API
|
||||
// >> buat dibawah sini <<
|
||||
"/api/admin/collaboration/*",
|
||||
"/api/admin/investasi/*",
|
||||
// "/api/admin/collaboration/*",
|
||||
// "/api/admin/investasi/*",
|
||||
// "/api/admin/event/*",
|
||||
// "/api/admin/forum/*",
|
||||
|
||||
// Akses awal
|
||||
"/api/get-cookie",
|
||||
|
||||
Reference in New Issue
Block a user