# Forum Report
## feat - Repot posting - Report komentar ### No issuee
This commit is contained in:
@@ -26,7 +26,7 @@ export async function ComponentGlobal_NotifikasiBerhasil(
|
||||
),
|
||||
color: "green",
|
||||
radius: "md",
|
||||
autoClose: durasi ? durasi : 1000,
|
||||
autoClose: durasi ? durasi : 2000,
|
||||
icon: <IconCircleCheck color="white" />,
|
||||
withCloseButton: false,
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function ComponentGlobal_NotifikasiGagal(text: string) {
|
||||
),
|
||||
color: "red",
|
||||
radius: "md",
|
||||
autoClose: 1000,
|
||||
autoClose: 2000,
|
||||
icon: <IconAlertTriangle color="white" />,
|
||||
withCloseButton: false,
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function ComponentGlobal_NotifikasiPeringatan(
|
||||
),
|
||||
color: "yellow.1",
|
||||
radius: "md",
|
||||
autoClose: durasi ? durasi : 1000,
|
||||
autoClose: durasi ? durasi : 2000,
|
||||
style: {
|
||||
borderWidth: "0.5px",
|
||||
borderStyle: "solid",
|
||||
|
||||
@@ -31,6 +31,7 @@ export default function ComponentForum_KomentarAuthorNameOnHeader({
|
||||
isMoreButton,
|
||||
setKomentar,
|
||||
postingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
userId?: string;
|
||||
komentarId?: string;
|
||||
@@ -40,7 +41,8 @@ export default function ComponentForum_KomentarAuthorNameOnHeader({
|
||||
isPembatas?: boolean;
|
||||
isMoreButton?: boolean;
|
||||
setKomentar?: any;
|
||||
postingId?: string
|
||||
postingId?: string;
|
||||
userLoginId: string
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
@@ -117,6 +119,7 @@ export default function ComponentForum_KomentarAuthorNameOnHeader({
|
||||
komentarId={komentarId}
|
||||
setKomentar={setKomentar}
|
||||
postingId={postingId}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</Group>
|
||||
) : (
|
||||
|
||||
@@ -37,16 +37,17 @@ export default function ComponentForum_KomentarButtonMore({
|
||||
komentarId,
|
||||
setKomentar,
|
||||
postingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
userId: any;
|
||||
komentarId: any;
|
||||
setKomentar?: any;
|
||||
postingId?: string;
|
||||
userLoginId: string
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [openDel, setOpenDel] = useState(false);
|
||||
const [userLoginId, setUserLoginId] = useState("");
|
||||
|
||||
// loading
|
||||
const [loadingEdit, setLoadingEdit] = useState(false);
|
||||
@@ -54,14 +55,7 @@ export default function ComponentForum_KomentarButtonMore({
|
||||
|
||||
// if (loadingEdit) return <ComponentGlobal_V2_LoadingPage />;
|
||||
|
||||
useShallowEffect(() => {
|
||||
getUserLoginId();
|
||||
}, []);
|
||||
|
||||
async function getUserLoginId() {
|
||||
const getUserLoginId = await User_getUserId();
|
||||
setUserLoginId(getUserLoginId);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -25,7 +25,7 @@ import dynamic from "next/dynamic";
|
||||
import React, { useState } from "react";
|
||||
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 { forum_funCreateKomentar } from "../fun/create/fun_create_komentra";
|
||||
import { forum_funCreateKomentar } from "../fun/create/fun_create_komentar";
|
||||
const ReactQuill = dynamic(
|
||||
() => {
|
||||
return import("react-quill");
|
||||
@@ -39,10 +39,12 @@ export default function Forum_Detail({
|
||||
dataPosting,
|
||||
listKomentar,
|
||||
totalKomentar,
|
||||
userLoginId,
|
||||
}: {
|
||||
dataPosting: MODEL_FORUM_POSTING;
|
||||
listKomentar: MODEL_FORUM_KOMENTAR[];
|
||||
totalKomentar: number
|
||||
totalKomentar: number;
|
||||
userLoginId: string
|
||||
}) {
|
||||
const [komentar, setKomentar] = useState(listKomentar);
|
||||
|
||||
@@ -55,6 +57,7 @@ export default function Forum_Detail({
|
||||
listKomentar={komentar}
|
||||
setKomentar={setKomentar}
|
||||
postingId={dataPosting?.id}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
@@ -194,10 +197,12 @@ function KomentarView({
|
||||
listKomentar,
|
||||
setKomentar,
|
||||
postingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
listKomentar: MODEL_FORUM_KOMENTAR[];
|
||||
setKomentar: any;
|
||||
postingId: string
|
||||
postingId: string;
|
||||
userLoginId: string
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
@@ -221,6 +226,7 @@ function KomentarView({
|
||||
isMoreButton={true}
|
||||
setKomentar={setKomentar}
|
||||
postingId={postingId}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section sx={{ zIndex: 0 }} p={"sm"}>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportKomentar(
|
||||
komentarId: string,
|
||||
value: string
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
|
||||
const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
where: {
|
||||
title: value,
|
||||
},
|
||||
});
|
||||
|
||||
const createReport = await prisma.forum_ReportKomentar.create({
|
||||
data: {
|
||||
userId: authorId,
|
||||
forumMaster_KategoriReportId: cekId?.id,
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createReport)
|
||||
return { status: 400, message: "Gagal menambahkan report komentar !" };
|
||||
return { status: 201, message: "Berhasil me-report komentar !" };
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportKomentarLainnya(
|
||||
komentarId: string,
|
||||
deskripsi: string
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
const create = await prisma.forum_ReportKomentar.create({
|
||||
data: {
|
||||
forum_KomentarId: komentarId,
|
||||
deskripsi: deskripsi,
|
||||
userId: authorId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal menambah report !" };
|
||||
return { status: 201, message: "Berhasil menambah report !" };
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function forum_funCreateReportPosting(
|
||||
postingId: string,
|
||||
value: string,
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
where: {
|
||||
title: value,
|
||||
},
|
||||
});
|
||||
|
||||
const createReport = await prisma.forum_ReportPosting.create({
|
||||
data: {
|
||||
userId: authorId,
|
||||
forum_PostingId: postingId,
|
||||
forumMaster_KategoriReportId: cekId?.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createReport)
|
||||
return { status: 400, message: "Gagal menambahkan report posting!" };
|
||||
return { status: 201, message: "Berhasil me-report posting!" };
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportPostingLainnya(
|
||||
postingId: string,
|
||||
deskripsi: string
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
const create = await prisma.forum_ReportPosting.create({
|
||||
data: {
|
||||
forum_PostingId: postingId,
|
||||
deskripsi: deskripsi,
|
||||
userId: authorId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal menambah report !" };
|
||||
return { status: 201, message: "Berhasil menambah report !" };
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function forum_getMasterKategoriReport() {
|
||||
const data = await prisma.forumMaster_KategoriReport.findMany({});
|
||||
|
||||
const changeType = JSON.stringify(data, null,2)
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import Forum_EditKomentar from "./edit/komentar";
|
||||
import LayoutForum_EditKomentar from "./edit/komentar/layout";
|
||||
import Forum_ReportKomentar from "./report/komentar";
|
||||
import LayoutForum_ReportKomentar from "./report/komentar/layout";
|
||||
import Forum_ReportPostingLainnya from "./report/posting/lainnya";
|
||||
import Forum_ReportKomentarLainnya from "./report/komentar/lainnya";
|
||||
|
||||
export {
|
||||
Forum_Splash,
|
||||
@@ -38,4 +40,6 @@ export {
|
||||
LayoutForum_EditKomentar as LaoyoutForum_EditKomentar,
|
||||
Forum_ReportKomentar,
|
||||
LayoutForum_ReportKomentar,
|
||||
Forum_ReportPostingLainnya,
|
||||
Forum_ReportKomentarLainnya,
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ import "react-quill/dist/quill.bubble.css";
|
||||
import { IconPhotoUp } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_FORUM_POSTING } from "../model/interface";
|
||||
import { forum_funCreateKomentar } from "../fun/create/fun_create_komentra";
|
||||
import { forum_funCreateKomentar } from "../fun/create/fun_create_komentar";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export interface MODEL_FORUM_POSTING {
|
||||
diskusi: string;
|
||||
authorId: string;
|
||||
Author: MODEL_USER;
|
||||
_count: number
|
||||
_count: number;
|
||||
}
|
||||
|
||||
export interface MODEL_FORUM_KOMENTAR {
|
||||
@@ -20,5 +20,14 @@ export interface MODEL_FORUM_KOMENTAR {
|
||||
komentar: string;
|
||||
forum_PostingId: string;
|
||||
authorId: string;
|
||||
Author: MODEL_USER
|
||||
Author: MODEL_USER;
|
||||
}
|
||||
|
||||
export interface MODEL_FORUM_REPORT {
|
||||
id: string;
|
||||
isActive: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
title: string;
|
||||
deskripsi: string;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,88 @@
|
||||
"use client"
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core"
|
||||
import { Box, Button, Paper, Radio, Stack, Text, Title } from "@mantine/core";
|
||||
import { MODEL_FORUM_REPORT } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report_posting";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import { forum_funCreateReportKomentar } from "../../fun/create/fun_create_report_komentar";
|
||||
|
||||
export default function Forum_ReportKomentar({id}: {id: string}){
|
||||
return <>
|
||||
<Stack>
|
||||
ini laporan
|
||||
</Stack>
|
||||
export default function Forum_ReportKomentar({
|
||||
komentarId,
|
||||
listReport,
|
||||
}: {
|
||||
komentarId: string;
|
||||
listReport: MODEL_FORUM_REPORT[];
|
||||
}) {
|
||||
const [reportValue, setReportValue] = useState("Kebencian");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack px={"sm"}>
|
||||
<Radio.Group value={reportValue as any} onChange={setReportValue}>
|
||||
<Stack spacing={"xl"}>
|
||||
{listReport.map((e) => (
|
||||
<Stack key={e.id}>
|
||||
<Radio
|
||||
value={e.title}
|
||||
label={<Title order={5}>{e.title}</Title>}
|
||||
/>
|
||||
<Text>{e.deskripsi}</Text>
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>
|
||||
</Radio.Group>
|
||||
<ButtonAction value={reportValue} komentarId={komentarId} />
|
||||
</Stack>
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonAction({
|
||||
value,
|
||||
komentarId,
|
||||
}: {
|
||||
value: string;
|
||||
komentarId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function onReport() {
|
||||
await forum_funCreateReportKomentar(komentarId, value).then((res) => {
|
||||
if (res.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
setLoading(true);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Stack mt={"md"}>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.replace(RouterForum.report_komentar_lainnya + komentarId)
|
||||
}
|
||||
>
|
||||
Lainnya
|
||||
</Button>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
loaderPosition="center"
|
||||
loading={loading ? true : false}
|
||||
onClick={() => onReport()}
|
||||
>
|
||||
Report
|
||||
</Button>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
70
src/app_modules/forum/report/komentar/lainnya.tsx
Normal file
70
src/app_modules/forum/report/komentar/lainnya.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
"use client";
|
||||
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import { Button, Group, Stack, Textarea } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report_posting";
|
||||
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 { forum_funCreateReportPostingLainnya } from "../../fun/create/fun_create_report_posting_lainnya";
|
||||
import { forum_funCreateReportKomentarLainnya } from "../../fun/create/fun_create_report_komentar_lainnya";
|
||||
|
||||
export default function Forum_ReportKomentarLainnya({ komentarId }: { komentarId: string }) {
|
||||
const [deskripsi, setDeskripsi] = useState("");
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Textarea
|
||||
label={"Kirimkan Laporan"}
|
||||
placeholder="Ketik laporan anda tentang komentar ini ..."
|
||||
minRows={5}
|
||||
onChange={(val) => {
|
||||
setDeskripsi(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
<ButtonAction komentarId={komentarId} deskripsi={deskripsi} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonAction({
|
||||
komentarId,
|
||||
deskripsi,
|
||||
}: {
|
||||
komentarId: string;
|
||||
deskripsi: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
async function onReport() {
|
||||
await forum_funCreateReportKomentarLainnya(komentarId, deskripsi).then(
|
||||
(res) => {
|
||||
if (res.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Group position="apart" grow>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.replace(RouterForum.report_komentar + komentarId)
|
||||
}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button radius={"xl"} color="red" onClick={() => onReport()}>
|
||||
Report
|
||||
</Button>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,85 @@
|
||||
"use client"
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core"
|
||||
import { Box, Button, Paper, Radio, Stack, Text, Title } from "@mantine/core";
|
||||
import { MODEL_FORUM_REPORT } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report_posting";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
|
||||
export default function Forum_ReportPosting({id}: {id: string}){
|
||||
return <>
|
||||
<Stack>
|
||||
ini laporan
|
||||
</Stack>
|
||||
export default function Forum_ReportPosting({
|
||||
postingId,
|
||||
listReport,
|
||||
}: {
|
||||
postingId: string;
|
||||
listReport: MODEL_FORUM_REPORT[];
|
||||
}) {
|
||||
const [reportValue, setReportValue] = useState("Kebencian");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack px={"sm"}>
|
||||
<Radio.Group value={reportValue as any} onChange={setReportValue}>
|
||||
<Stack spacing={"xl"}>
|
||||
{listReport.map((e) => (
|
||||
<Stack key={e.id}>
|
||||
<Radio
|
||||
value={e.title}
|
||||
label={<Title order={5}>{e.title}</Title>}
|
||||
/>
|
||||
<Text>{e.deskripsi}</Text>
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>
|
||||
</Radio.Group>
|
||||
<ButtonAction value={reportValue} postingId={postingId} />
|
||||
</Stack>
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonAction({
|
||||
value,
|
||||
postingId,
|
||||
}: {
|
||||
value: string;
|
||||
postingId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function onReport() {
|
||||
await forum_funCreateReportPosting(postingId, value).then((res) => {
|
||||
if (res.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
setLoading(true);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Stack mt={"md"}>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => router.replace(RouterForum.report_posting_lainnya + postingId)}
|
||||
>
|
||||
Lainnya
|
||||
</Button>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
loaderPosition="center"
|
||||
loading={loading ? true : false}
|
||||
onClick={() => onReport()}
|
||||
>
|
||||
Report
|
||||
</Button>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
71
src/app_modules/forum/report/posting/lainnya.tsx
Normal file
71
src/app_modules/forum/report/posting/lainnya.tsx
Normal file
@@ -0,0 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import { Button, Group, Stack, Textarea } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report_posting";
|
||||
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 { forum_funCreateReportPostingLainnya } from "../../fun/create/fun_create_report_posting_lainnya";
|
||||
|
||||
export default function Forum_ReportPostingLainnya({
|
||||
postingIg,
|
||||
}: {
|
||||
postingIg: string;
|
||||
}) {
|
||||
const [deskripsi, setDeskripsi] = useState("");
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Textarea
|
||||
label={"Kirimkan Laporan"}
|
||||
placeholder="Ketik laporan anda tentang postingan ini ..."
|
||||
minRows={5}
|
||||
onChange={(val) => {
|
||||
setDeskripsi(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
<ButtonAction postingIg={postingIg} deskripsi={deskripsi} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonAction({
|
||||
postingIg,
|
||||
deskripsi,
|
||||
}: {
|
||||
postingIg: string;
|
||||
deskripsi: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
async function onReport() {
|
||||
await forum_funCreateReportPostingLainnya(postingIg, deskripsi).then(
|
||||
(res) => {
|
||||
if (res.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Group position="apart" grow>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => router.replace(RouterForum.report_posting + postingIg)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button radius={"xl"} color="red" onClick={() => onReport()}>
|
||||
Report
|
||||
</Button>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export default function LayoutForum_ReportPosting({
|
||||
<>
|
||||
<AppShell
|
||||
header={
|
||||
<ComponentForum_HeaderRataKiri title="Mengumpulkan Informasi Posting"/>
|
||||
<ComponentForum_HeaderRataKiri title="Mengumpulkan Informasi Posting" />
|
||||
}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user