# Forum
- Tampilan admin untuk komentar - Hapus komentar - Hapus postingan - Lihat report - Search topik forum ## feat ### No issue
This commit is contained in:
50
src/app_modules/admin/component/loading_admin_page.tsx
Normal file
50
src/app_modules/admin/component/loading_admin_page.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Box,
|
||||
Center,
|
||||
Group,
|
||||
LoadingOverlay,
|
||||
Skeleton,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
|
||||
export default function ComponentAdminGlobal_LoadingPage() {
|
||||
const listhHuruf = [
|
||||
{
|
||||
huruf: "H",
|
||||
},
|
||||
{
|
||||
huruf: "I",
|
||||
},
|
||||
{
|
||||
huruf: "P",
|
||||
},
|
||||
{
|
||||
huruf: "M",
|
||||
},
|
||||
{
|
||||
huruf: "I",
|
||||
},
|
||||
];
|
||||
const customLOader = (
|
||||
<Center h={"100vh"}>
|
||||
<Group>
|
||||
{listhHuruf.map((e, i) => (
|
||||
<Center key={i} h={"100%"}>
|
||||
<Skeleton height={50} circle radius={"100%"} />
|
||||
<Text sx={{ position: "absolute" }} c={"gray.4"} fw={"bold"}>
|
||||
{e.huruf}
|
||||
</Text>
|
||||
</Center>
|
||||
))}
|
||||
</Group>
|
||||
</Center>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay visible overlayBlur={1} loader={customLOader} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
288
src/app_modules/admin/forum/child/publish/index.tsx
Normal file
288
src/app_modules/admin/forum/child/publish/index.tsx
Normal file
@@ -0,0 +1,288 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
|
||||
import { MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconMessageCircle } from "@tabler/icons-react";
|
||||
import { IconFlag3 } from "@tabler/icons-react";
|
||||
import { IconEyeCheck, IconTrash } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
export default function AdminForum_TablePublish({
|
||||
listPublish,
|
||||
}: {
|
||||
listPublish: MODEL_FORUM_POSTING[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Table Posting" />
|
||||
<TablePublish listPublish={listPublish} />
|
||||
{/* <pre>{JSON.stringify(listPublish, null, 2)}</pre> */}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TablePublish({ listPublish }: { listPublish: MODEL_FORUM_POSTING[] }) {
|
||||
const router = useRouter();
|
||||
// const [data, setData] = useState(listPublish);
|
||||
|
||||
const TableRows = listPublish?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={100}>
|
||||
<Badge
|
||||
color={
|
||||
(e?.ForumMaster_StatusPosting?.id as any) === 1 ? "green" : "red"
|
||||
}
|
||||
>
|
||||
{e?.ForumMaster_StatusPosting?.status}
|
||||
</Badge>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler
|
||||
// w={400}
|
||||
maxHeight={60}
|
||||
hideLabel="sembunyikan"
|
||||
showLabel="tampilkan"
|
||||
>
|
||||
<div dangerouslySetInnerHTML={{ __html: e.diskusi }} />
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={150}>
|
||||
<Text>
|
||||
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
||||
e.createdAt
|
||||
)}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={150}>
|
||||
<Text fw={"bold"} fz={"lg"}>
|
||||
{e?.Forum_Komentar.length}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={150}>
|
||||
<Text
|
||||
c={e?.Forum_ReportPosting?.length >= 3 ? "red" : "black"}
|
||||
fw={"bold"}
|
||||
fz={"lg"}
|
||||
>
|
||||
{e?.Forum_ReportPosting.length}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<ButtonAction postingId={e?.id} />
|
||||
<ButtonDeletePosting postingId={e?.id} />
|
||||
</Stack>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
<Box bg={"green.1"} p={"xs"}>
|
||||
<Title order={6} c={"green"}>
|
||||
POSTING
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Postingan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal Publish</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Komentar Aktif</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Total Report Posting</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonAction({ postingId }: { postingId: string }) {
|
||||
const router = useRouter();
|
||||
const [loadingKomentar, setLoadingKomentar] = useState(false);
|
||||
const [loadingReport, setLoadingReport] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
loading={loadingKomentar ? true : false}
|
||||
loaderPosition="center"
|
||||
radius={"xl"}
|
||||
w={150}
|
||||
compact
|
||||
leftIcon={<IconMessageCircle size={15} />}
|
||||
onClick={() => {
|
||||
setLoadingKomentar(true);
|
||||
router.push(RouterAdminForum.semua_komentar + postingId);
|
||||
}}
|
||||
>
|
||||
Lihat Komentar
|
||||
</Button>
|
||||
<Button
|
||||
loading={loadingReport ? true : false}
|
||||
loaderPosition="center"
|
||||
radius={"xl"}
|
||||
w={150}
|
||||
compact
|
||||
leftIcon={<IconFlag3 size={15} />}
|
||||
onClick={() => {
|
||||
setLoadingReport(true);
|
||||
router.push(RouterAdminForum.hasil_report_posting + postingId);
|
||||
}}
|
||||
>
|
||||
Hasil Report
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonDeletePosting({ postingId }: { postingId: string }) {
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [loadingDel, setLoadingDel] = useState(false);
|
||||
const [loadingDel2, setLoadingDel2] = useState(false);
|
||||
|
||||
async function onDelete() {
|
||||
await adminForum_funDeletePostingById(postingId).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoadingDel2(false);
|
||||
setLoadingDel(false);
|
||||
close();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
closeOnClickOutside={false}
|
||||
>
|
||||
<Stack>
|
||||
<Title order={5}>Anda yakin menghapus posting ini</Title>
|
||||
<Group position="center">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
close();
|
||||
setLoadingDel(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={loadingDel2 ? true : false}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
setLoadingDel2(true);
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={loadingDel ? true : false}
|
||||
radius={"xl"}
|
||||
w={150}
|
||||
compact
|
||||
color="red"
|
||||
leftIcon={<IconTrash size={15} />}
|
||||
onClick={() => {
|
||||
// onDelete();
|
||||
open();
|
||||
setLoadingDel(true);
|
||||
}}
|
||||
>
|
||||
Hapus Posting
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
11
src/app_modules/admin/forum/child/report_komentar/index.tsx
Normal file
11
src/app_modules/admin/forum/child/report_komentar/index.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
|
||||
export default function AdminForum_TableReportKomentar() {
|
||||
return (
|
||||
<>
|
||||
<Stack>ini rep komen</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
11
src/app_modules/admin/forum/child/report_posting/index.tsx
Normal file
11
src/app_modules/admin/forum/child/report_posting/index.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
|
||||
export default function AdminForum_TableReportPosting() {
|
||||
return (
|
||||
<>
|
||||
<Stack>ini rep pos</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
291
src/app_modules/admin/forum/children/semua_komentar/index.tsx
Normal file
291
src/app_modules/admin/forum/children/semua_komentar/index.tsx
Normal file
@@ -0,0 +1,291 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
|
||||
import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali";
|
||||
import {
|
||||
MODEL_FORUM_KOMENTAR,
|
||||
MODEL_FORUM_POSTING,
|
||||
} from "@/app_modules/forum/model/interface";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconTrash } from "@tabler/icons-react";
|
||||
import { IconFlag3 } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { adminForum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
export default function AdminForum_LihatSemuaKomentar({
|
||||
listKomentar,
|
||||
dataPosting,
|
||||
}: {
|
||||
listKomentar: MODEL_FORUM_KOMENTAR[];
|
||||
dataPosting: MODEL_FORUM_POSTING;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(listKomentar, null, 2)}</pre> */}
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Komentar" />
|
||||
<ComponentAdminDonasi_TombolKembali />
|
||||
<DataPosting dataPosting={dataPosting} />
|
||||
<TableKomentar listKomentar={listKomentar} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function DataPosting({ dataPosting }: { dataPosting: MODEL_FORUM_POSTING }) {
|
||||
return (
|
||||
<>
|
||||
<Stack w={"50%"}>
|
||||
<Box>
|
||||
<Box bg={"green.1"} p={"xs"}>
|
||||
<Title order={6} c={"green"}>
|
||||
POSTING
|
||||
</Title>
|
||||
</Box>
|
||||
<Paper withBorder p={"md"} radius={0}>
|
||||
<Stack spacing={0}>
|
||||
<Grid w={500} fw={"bold"}>
|
||||
<Grid.Col span={"content"}>
|
||||
<Text>Author :</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text lineClamp={1}>
|
||||
{dataPosting?.Author?.Profile?.name}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={"content"}>
|
||||
<Spoiler
|
||||
w={500}
|
||||
hideLabel="sembunyikan"
|
||||
maxHeight={100}
|
||||
showLabel="tampilkan"
|
||||
>
|
||||
<div
|
||||
dangerouslySetInnerHTML={{ __html: dataPosting.diskusi }}
|
||||
/>
|
||||
</Spoiler>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableKomentar({
|
||||
listKomentar,
|
||||
}: {
|
||||
listKomentar: MODEL_FORUM_KOMENTAR[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
// const [data, setData] = useState(listKomentar);
|
||||
|
||||
const TableRows = listKomentar?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={"100%"}>
|
||||
<Text truncate>{e?.Author?.Profile?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Spoiler
|
||||
w={400}
|
||||
maxHeight={50}
|
||||
hideLabel="sembunyikan"
|
||||
showLabel="tampilkan"
|
||||
>
|
||||
<div
|
||||
style={{ textAlign: "center" }}
|
||||
dangerouslySetInnerHTML={{ __html: e.komentar }}
|
||||
/>
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Text w={100}>
|
||||
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
||||
e.createdAt
|
||||
)}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Text
|
||||
c={e?.Forum_ReportKomentar?.length >= 3 ? "red" : "black"}
|
||||
fw={"bold"}
|
||||
fz={"lg"}
|
||||
>
|
||||
{e?.Forum_ReportKomentar.length}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
w={150}
|
||||
compact
|
||||
leftIcon={<IconFlag3 size={15} />}
|
||||
onClick={() =>
|
||||
router.push(RouterAdminForum.hasil_report_komentar + e?.id)
|
||||
}
|
||||
>
|
||||
Hasil Report
|
||||
</Button>
|
||||
<ButtonDeleteKomentar komentarId={e?.id} />
|
||||
</Stack>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
<Box bg={"gray.1"} p={"xs"}>
|
||||
<Title order={6} c={"gray"}>
|
||||
KOMENTAR
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Komentar</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal Komentar</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Total Report Komentar</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [loadindDel, setLoadingDel] = useState(false);
|
||||
const [loadingDel2, setLoadingDel2] = useState(false);
|
||||
|
||||
async function onDelete() {
|
||||
await adminForum_funDeleteKomentarById(komentarId).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoadingDel(false);
|
||||
setLoadingDel2(false);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
||||
<Stack>
|
||||
<Title order={5}>Anda yakin menghapus komentar ini ?</Title>
|
||||
<Group position="center">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
close();
|
||||
setLoadingDel(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={loadingDel2 ? true : false}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
setLoadingDel2(true);
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Button
|
||||
loading={loadindDel ? true : false}
|
||||
loaderPosition="center"
|
||||
radius={"xl"}
|
||||
w={150}
|
||||
fz={"xs"}
|
||||
compact
|
||||
color="red"
|
||||
leftIcon={<IconTrash size={15} />}
|
||||
onClick={() => {
|
||||
open();
|
||||
setLoadingDel(true);
|
||||
}}
|
||||
>
|
||||
Hapus Komentar
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminForum_funDeleteKomentarById(komentarId: string) {
|
||||
const delTemporary = await prisma.forum_Komentar.update({
|
||||
where: {
|
||||
id: komentarId,
|
||||
},
|
||||
data: {
|
||||
isActive: false,
|
||||
},
|
||||
});
|
||||
|
||||
if (!delTemporary) return { status: 400, message: "Gagal Dihapus" };
|
||||
revalidatePath("/dev/admin/forum/children/semua-komentar");
|
||||
return { status: 200, message: "Berhasil Dihapus" };
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminForum_funDeletePostingById(postingId: string) {
|
||||
const delTemporary = await prisma.forum_Posting.update({
|
||||
where: {
|
||||
id: postingId,
|
||||
},
|
||||
data: {
|
||||
isActive: false,
|
||||
},
|
||||
});
|
||||
|
||||
if (!delTemporary) return { status: 400, message: "Gagal Dihapus" };
|
||||
revalidatePath("/dev/admin/forum/child/publish");
|
||||
return { status: 200, message: "Berhasil Dihapus" };
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminForum_getListKomentarById(postingId: string) {
|
||||
const data = await prisma.forum_Komentar.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
isActive: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
komentar: true,
|
||||
createdAt: true,
|
||||
authorId: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
imagesId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Forum_ReportKomentar: true
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
36
src/app_modules/admin/forum/fun/get/get_list_publish.tsx
Normal file
36
src/app_modules/admin/forum/fun/get/get_list_publish.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminForum_getListPublish() {
|
||||
const data = await prisma.forum_Posting.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
Forum_ReportPosting: true,
|
||||
Forum_Komentar: {
|
||||
where: {
|
||||
isActive: true
|
||||
}
|
||||
},
|
||||
ForumMaster_StatusPosting: true
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminForum_getListReportKomentarbyId(komentarId: string) {
|
||||
const data = await prisma.forum_ReportKomentar.findMany({
|
||||
where: {
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
deskripsi: true,
|
||||
ForumMaster_KategoriReport: true,
|
||||
User: {
|
||||
select: {
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminForum_getListReportPostingById(postingId: string) {
|
||||
const data = await prisma.forum_ReportPosting.findMany({
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
deskripsi: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
select: {
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ForumMaster_KategoriReport: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
28
src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts
Normal file
28
src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminForum_getOnePostingById(postingId: string) {
|
||||
const data = await prisma.forum_Posting.findFirst({
|
||||
where: {
|
||||
id: postingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
Author: {
|
||||
select: {
|
||||
Profile: {
|
||||
select: {
|
||||
name: true
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// console.log(data);
|
||||
|
||||
return data;
|
||||
}
|
||||
219
src/app_modules/admin/forum/hasil_report/komentar/index.tsx
Normal file
219
src/app_modules/admin/forum/hasil_report/komentar/index.tsx
Normal file
@@ -0,0 +1,219 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
|
||||
import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import {
|
||||
MODEL_FORUM_MASTER_REPORT,
|
||||
MODEL_FORUM_REPORT,
|
||||
} from "@/app_modules/forum/model/interface";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconMessageCircle, IconFlag3, IconTrash } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||
import { adminForum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
export default function AdminForum_HasilReportKomentar({
|
||||
komentarId,
|
||||
listReport,
|
||||
}: {
|
||||
komentarId: string;
|
||||
listReport: any[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Komentar" />
|
||||
<Group position="apart">
|
||||
<ComponentAdminDonasi_TombolKembali />
|
||||
<ButtonDeleteKomentar komentarId={komentarId} />
|
||||
</Group>
|
||||
<HasilReportPosting listReport={listReport} />
|
||||
{/* <pre>{JSON.stringify(listReport, null, 2)}</pre> */}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [loadindDel, setLoadingDel] = useState(false);
|
||||
const [loadingDel2, setLoadingDel2] = useState(false);
|
||||
|
||||
async function onDelete() {
|
||||
await adminForum_funDeleteKomentarById(komentarId).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoadingDel(false);
|
||||
setLoadingDel2(false);
|
||||
close();
|
||||
router.back();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
||||
<Stack>
|
||||
<Title order={5}>Anda yakin menghapus komentar ini ?</Title>
|
||||
<Group position="center">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
close();
|
||||
setLoadingDel(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={loadingDel2 ? true : false}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
setLoadingDel2(true);
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Button
|
||||
loading={loadindDel ? true : false}
|
||||
loaderPosition="center"
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
leftIcon={<IconTrash size={15} />}
|
||||
onClick={() => {
|
||||
open();
|
||||
setLoadingDel(true);
|
||||
}}
|
||||
>
|
||||
Hapus Komentar
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function HasilReportPosting({
|
||||
listReport,
|
||||
}: {
|
||||
listReport: MODEL_FORUM_REPORT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(listReport);
|
||||
|
||||
const TableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>
|
||||
<Text w={200}>{e?.User?.Profile?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>
|
||||
{e?.ForumMaster_KategoriReport?.title
|
||||
? e?.ForumMaster_KategoriReport?.title
|
||||
: "-"}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||
) : (
|
||||
<Text>-</Text>
|
||||
)}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
<Box bg={"red.1"} p={"xs"}>
|
||||
<Title order={6} c={"red"}>
|
||||
REPORT KOMENTAR
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Title</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi Lainnya</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
222
src/app_modules/admin/forum/hasil_report/posting/index.tsx
Normal file
222
src/app_modules/admin/forum/hasil_report/posting/index.tsx
Normal file
@@ -0,0 +1,222 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
|
||||
import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import {
|
||||
MODEL_FORUM_MASTER_REPORT,
|
||||
MODEL_FORUM_REPORT,
|
||||
} from "@/app_modules/forum/model/interface";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconMessageCircle, IconFlag3, IconTrash } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
export default function AdminForum_HasilReportPosting({
|
||||
postingId,
|
||||
listReport,
|
||||
}: {
|
||||
postingId: string;
|
||||
listReport: any[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Posting" />
|
||||
<Group position="apart">
|
||||
<ComponentAdminDonasi_TombolKembali />
|
||||
<ButtonDeletePosting postingId={postingId} />
|
||||
</Group>
|
||||
<HasilReportPosting listReport={listReport} />
|
||||
{/* <pre>{JSON.stringify(listReport, null, 2)}</pre> */}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonDeletePosting({ postingId }: { postingId: string }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [loadingDel, setLoadingDel] = useState(false);
|
||||
const [loadingDel2, setLoadingDel2] = useState(false);
|
||||
|
||||
async function onDelete() {
|
||||
await adminForum_funDeletePostingById(postingId).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoadingDel2(false);
|
||||
setLoadingDel(false);
|
||||
close();
|
||||
router.back();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
closeOnClickOutside={false}
|
||||
>
|
||||
<Stack>
|
||||
<Title order={5}>Anda yakin menghapus posting ini</Title>
|
||||
<Group position="center">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
close();
|
||||
setLoadingDel(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
setLoadingDel2(true);
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={loadingDel ? true : false}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
leftIcon={<IconTrash size={15} />}
|
||||
onClick={() => {
|
||||
// onDelete();
|
||||
open();
|
||||
setLoadingDel(true);
|
||||
}}
|
||||
>
|
||||
Hapus Posting
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function HasilReportPosting({
|
||||
listReport,
|
||||
}: {
|
||||
listReport: MODEL_FORUM_REPORT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(listReport);
|
||||
|
||||
const TableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>
|
||||
<Text w={200}>{e?.User?.Profile?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={100}>
|
||||
<Text>
|
||||
{e?.ForumMaster_KategoriReport?.title
|
||||
? e?.ForumMaster_KategoriReport?.title
|
||||
: "-"}
|
||||
</Text>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||
) : (
|
||||
<Text>-</Text>
|
||||
)}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
<Box bg={"red.1"} p={"xs"}>
|
||||
<Title order={6} c={"red"}>
|
||||
REPORT POSTING
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Title</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi Lainnya</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
17
src/app_modules/admin/forum/index.tsx
Normal file
17
src/app_modules/admin/forum/index.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import AdminForum_Main from "./main";
|
||||
import AdminForum_TablePublish from "./child/publish";
|
||||
import AdminForum_TableReportKomentar from "./child/report_komentar";
|
||||
import AdminForum_TableReportPosting from "./child/report_posting";
|
||||
import AdminForum_LihatSemuaKomentar from "./children/semua_komentar";
|
||||
import AdminForum_HasilReportPosting from "./hasil_report/posting";
|
||||
import AdminForum_HasilReportKomentar from "./hasil_report/komentar";
|
||||
|
||||
export {
|
||||
AdminForum_Main,
|
||||
AdminForum_TablePublish,
|
||||
AdminForum_TableReportKomentar,
|
||||
AdminForum_TableReportPosting,
|
||||
AdminForum_LihatSemuaKomentar,
|
||||
AdminForum_HasilReportPosting,
|
||||
AdminForum_HasilReportKomentar,
|
||||
};
|
||||
71
src/app_modules/admin/forum/main/index.tsx
Normal file
71
src/app_modules/admin/forum/main/index.tsx
Normal file
@@ -0,0 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import { Group, Paper, SimpleGrid, Stack, Text, Title } from "@mantine/core";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||
import ComponentAdminGlobal_LoadingPage from "../../component/loading_admin_page";
|
||||
|
||||
export default function AdminForum_Main() {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum" />
|
||||
<ForumMain />
|
||||
</Stack>
|
||||
{/* <ComponentGlobalAdmin_LoadingPage /> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ForumMain() {
|
||||
const listBox = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Publish",
|
||||
jumlah: 0,
|
||||
color: "green",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Laporan Posting",
|
||||
jumlah: 0,
|
||||
color: "orange",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Laporan Komentar",
|
||||
jumlah: 0,
|
||||
color: "red",
|
||||
},
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
cols={4}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
|
||||
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
{listBox.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
bg={`${"gray"}.2`}
|
||||
shadow="md"
|
||||
radius="md"
|
||||
p="md"
|
||||
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||
>
|
||||
<Group position="center">
|
||||
<Stack align="center" spacing={0}>
|
||||
<Text>{e.name}</Text>
|
||||
<Title>{e.jumlah ? e.jumlah : 0}</Title>
|
||||
</Stack>
|
||||
</Group>
|
||||
</Paper>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
Footer,
|
||||
Group,
|
||||
Header,
|
||||
Loader,
|
||||
MediaQuery,
|
||||
NavLink,
|
||||
Navbar,
|
||||
@@ -22,7 +23,13 @@ import {
|
||||
import React, { useState } from "react";
|
||||
import ComponentGlobal_HeaderTamplate from "../component_global/header_tamplate";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconCircleDot, IconCircleDotFilled, IconHome, IconLetterH, IconLogout } from "@tabler/icons-react";
|
||||
import {
|
||||
IconCircleDot,
|
||||
IconCircleDotFilled,
|
||||
IconHome,
|
||||
IconLetterH,
|
||||
IconLogout,
|
||||
} from "@tabler/icons-react";
|
||||
import {
|
||||
RouterAdminAward,
|
||||
RouterAdminDashboard,
|
||||
@@ -51,6 +58,7 @@ export default function AdminLayout({
|
||||
const router = useRouter();
|
||||
const [active, setActive] = useAtom(gs_admin_hotMenu);
|
||||
const [activeChild, setActiveChild] = useAtom(gs_admin_subMenu);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const navbarItems = listAdminPage.map((e, i) => (
|
||||
<Box key={e.id}>
|
||||
@@ -61,9 +69,13 @@ export default function AdminLayout({
|
||||
},
|
||||
}}
|
||||
fw={active === e.id ? "bold" : "normal"}
|
||||
icon={e.icon}
|
||||
icon={
|
||||
// active === e.id ? loading ? <Loader size={10} /> : e.icon : e.icon
|
||||
e.icon
|
||||
}
|
||||
label={<Text size={"sm"}>{e.name}</Text>}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
setActive(e.id);
|
||||
setActiveChild(null);
|
||||
e.path === "" ? router.push(e.child[0].path) : router.push(e.path);
|
||||
@@ -84,7 +96,13 @@ export default function AdminLayout({
|
||||
}}
|
||||
fw={activeChild === v.id ? "bold" : "normal"}
|
||||
label={<Text>{v.name}</Text>}
|
||||
icon={activeChild === v.id ? <IconCircleDotFilled size={10}/> : <IconCircleDot size={10}/> }
|
||||
icon={
|
||||
activeChild === v.id ? (
|
||||
<IconCircleDotFilled size={10} />
|
||||
) : (
|
||||
<IconCircleDot size={10} />
|
||||
)
|
||||
}
|
||||
onClick={() => {
|
||||
setActive(e.id);
|
||||
setActiveChild(v.id);
|
||||
@@ -105,7 +123,6 @@ export default function AdminLayout({
|
||||
padding="md"
|
||||
navbarOffsetBreakpoint="md"
|
||||
asideOffsetBreakpoint="sm"
|
||||
|
||||
navbar={
|
||||
<MediaQuery smallerThan={"md"} styles={{ display: "none" }}>
|
||||
<Navbar
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||
import { RouterAdminJob } from "@/app/lib/router_admin/router_admin_job";
|
||||
import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote";
|
||||
import {
|
||||
@@ -6,7 +7,7 @@ import {
|
||||
RouterAdminDonasi,
|
||||
RouterAdminInvestasi,
|
||||
} from "@/app/lib/router_hipmi/router_admin";
|
||||
import { IconBriefcase } from "@tabler/icons-react";
|
||||
import { IconBriefcase, IconMessages } from "@tabler/icons-react";
|
||||
import {
|
||||
IconHeartHandshake,
|
||||
IconHome,
|
||||
@@ -142,4 +143,32 @@ export const listAdminPage = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Forum",
|
||||
path: "",
|
||||
icon: <IconMessages />,
|
||||
child: [
|
||||
{
|
||||
id: 71,
|
||||
name: "Dashboard",
|
||||
path: RouterAdminForum.main,
|
||||
},
|
||||
{
|
||||
id: 72,
|
||||
name: "Table Posting",
|
||||
path: RouterAdminForum.publish,
|
||||
},
|
||||
{
|
||||
id: 73,
|
||||
name: "Laporan Posting",
|
||||
path: RouterAdminForum.report_posting,
|
||||
},
|
||||
{
|
||||
id: 74,
|
||||
name: "Laporan Komentar",
|
||||
path: RouterAdminForum.report_komentar,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user