Merge pull request #68 from bipproduction/notifikasi/forum
Fix tampilan admin dan notifikasi to admin
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
import { AdminForum_TableReportKomentar } from "@/app_modules/admin/forum";
|
|
||||||
|
|
||||||
export default async function Page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<AdminForum_TableReportKomentar />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { AdminForum_TableReportPosting } from "@/app_modules/admin/forum";
|
|
||||||
|
|
||||||
export default async function Page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<AdminForum_TableReportPosting />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,25 @@
|
|||||||
import { AdminForum_LihatSemuaKomentar } from "@/app_modules/admin/forum";
|
import { AdminForum_LihatSemuaKomentar } from "@/app_modules/admin/forum";
|
||||||
|
import adminForum_countKomentarByPostingId from "@/app_modules/admin/forum/fun/count/fun_count_komentar_by_id";
|
||||||
import { adminForum_getListKomentarById } from "@/app_modules/admin/forum/fun/get/get_list_komentar_by_id";
|
import { adminForum_getListKomentarById } from "@/app_modules/admin/forum/fun/get/get_list_komentar_by_id";
|
||||||
import { adminForum_getOnePostingById } from "@/app_modules/admin/forum/fun/get/get_one_posting_by_id";
|
import { adminForum_getOnePostingById } from "@/app_modules/admin/forum/fun/get/get_one_posting_by_id";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
let postingId = params.id;
|
let postingId = params.id;
|
||||||
const listKomentar = await adminForum_getListKomentarById(postingId);
|
|
||||||
|
const listKomentar = await adminForum_getListKomentarById({
|
||||||
|
postingId: postingId,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
const dataPosting = await adminForum_getOnePostingById(postingId);
|
const dataPosting = await adminForum_getOnePostingById(postingId);
|
||||||
|
const countKomentar = await adminForum_countKomentarByPostingId({postingId: postingId})
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminForum_LihatSemuaKomentar
|
<AdminForum_LihatSemuaKomentar
|
||||||
listKomentar={listKomentar as any}
|
listKomentar={listKomentar as any}
|
||||||
dataPosting={dataPosting as any}
|
dataPosting={dataPosting as any}
|
||||||
|
countKomentar={countKomentar}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { AdminForum_HasilReportKomentar } from "@/app_modules/admin/forum"
|
|
||||||
import { adminForum_getListReportKomentarbyId } from "@/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id";
|
|
||||||
|
|
||||||
export default async function Page({params}: {params: {id: string}}) {
|
|
||||||
let komentarId = params.id
|
|
||||||
const listReport = await adminForum_getListReportKomentarbyId(komentarId)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<AdminForum_HasilReportKomentar listReport={listReport} komentarId={komentarId} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { AdminForum_HasilReportKomentar } from "@/app_modules/admin/forum";
|
||||||
|
import { adminForum_getListReportKomentarbyId } from "@/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id";
|
||||||
|
|
||||||
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
|
let komentarId = params.id;
|
||||||
|
const listReport = await adminForum_getListReportKomentarbyId({komentarId: komentarId, page: 1});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminForum_HasilReportKomentar
|
||||||
|
listReport={listReport}
|
||||||
|
komentarId={komentarId}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
import { AdminForum_HasilReportPosting } from "@/app_modules/admin/forum";
|
import { AdminForum_HasilReportPosting } from "@/app_modules/admin/forum";
|
||||||
import { adminForum_getListReportPostingById } from "@/app_modules/admin/forum/fun/get/get_list_report_posting_by_id";
|
import { adminForum_getListReportPostingById } from "@/app_modules/admin/forum/fun/get/get_list_report_posting_by_id";
|
||||||
|
import { adminForum_getOnePostingById } from "@/app_modules/admin/forum/fun/get/get_one_posting_by_id";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
let postingId = params.id;
|
let postingId = params.id;
|
||||||
const listReport = await adminForum_getListReportPostingById(postingId);
|
const listReport = await adminForum_getListReportPostingById({
|
||||||
|
postingId: postingId,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
const dataPosting = await adminForum_getOnePostingById(postingId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminForum_HasilReportPosting
|
<AdminForum_HasilReportPosting
|
||||||
postingId={postingId}
|
dataPosting={dataPosting as any}
|
||||||
listReport={listReport}
|
listReport={listReport}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { AdminForum_TablePublish } from "@/app_modules/admin/forum";
|
import { AdminForum_TablePublish } from "@/app_modules/admin/forum";
|
||||||
import { adminForum_getListPublish } from "@/app_modules/admin/forum/fun/get/get_list_publish";
|
import { adminForum_getListPosting } from "@/app_modules/admin/forum/fun/get/get_list_publish";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listPublish = await adminForum_getListPublish();
|
const listPublish = await adminForum_getListPosting({page: 1});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
12
src/app/dev/admin/forum/sub-menu/report-posting/page.tsx
Normal file
12
src/app/dev/admin/forum/sub-menu/report-posting/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { AdminForum_TableReportPosting } from "@/app_modules/admin/forum";
|
||||||
|
import adminForum_funGetAllReportPosting from "@/app_modules/admin/forum/fun/get/get_all_report_posting";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const listData = await adminForum_funGetAllReportPosting({ page: 1 });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminForum_TableReportPosting listData={listData} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,5 +6,9 @@ export default async function Page() {
|
|||||||
const countUser = await AdminMainDashboard_CountUser();
|
const countUser = await AdminMainDashboard_CountUser();
|
||||||
const countPorto = await AdminMainDashboard_CountPOrtofolio();
|
const countPorto = await AdminMainDashboard_CountPOrtofolio();
|
||||||
|
|
||||||
|
// await new Promise((a, b) => {
|
||||||
|
// setTimeout(a, 4000);
|
||||||
|
// });
|
||||||
|
|
||||||
return <AdminMain countUser={countUser} countPorto={countPorto} />;
|
return <AdminMain countUser={countUser} countPorto={countPorto} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import { LayoutValidasi } from "@/app_modules/auth";
|
|
||||||
import { ActionIcon, Button } from "@mantine/core";
|
|
||||||
import Link from "next/link";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export default async function Layout({
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<LayoutValidasi>{children}</LayoutValidasi>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Forum_Beranda } from "@/app_modules/forum";
|
import { Forum_Beranda } from "@/app_modules/forum";
|
||||||
import { forum_new_getAllPosting } from "@/app_modules/forum/fun/get/new_get_all_posting";
|
import { forum_new_getAllPosting } from "@/app_modules/forum/fun/get/new_get_all_posting";
|
||||||
import forum_v2_getAllPosting from "@/app_modules/forum/fun/get/v2_get_all_posting";
|
|
||||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
export const RouterAdminForum = {
|
export const RouterAdminForum = {
|
||||||
|
// main
|
||||||
main: "/dev/admin/forum/main",
|
main: "/dev/admin/forum/main",
|
||||||
publish: "/dev/admin/forum/child/publish",
|
|
||||||
report_komentar: "/dev/admin/forum/child/report-komentar",
|
|
||||||
report_posting: "/dev/admin/forum/child/report-posting",
|
|
||||||
|
|
||||||
//children
|
// sub menu
|
||||||
semua_komentar: "/dev/admin/forum/children/semua-komentar/",
|
table_posting: "/dev/admin/forum/sub-menu/posting",
|
||||||
|
table_report_posting: "/dev/admin/forum/sub-menu/report-posting",
|
||||||
|
|
||||||
// report
|
|
||||||
hasil_report_posting: "/dev/admin/forum/hasil-report/posting/",
|
// detail
|
||||||
hasil_report_komentar: "/dev/admin/forum/hasil-report/komentar/"
|
detail_posting: "/dev/admin/forum/detail/",
|
||||||
|
|
||||||
|
// sub detail
|
||||||
|
report_komentar: "/dev/admin/forum/sub-detail/report-komentar/",
|
||||||
|
report_posting: "/dev/admin/forum/sub-detail/report-posting/",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,44 +1,12 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Grid,
|
|
||||||
Group,
|
|
||||||
Modal,
|
|
||||||
Paper,
|
|
||||||
ScrollArea,
|
|
||||||
Space,
|
Space,
|
||||||
Stack,
|
Stack
|
||||||
Table,
|
|
||||||
Text,
|
|
||||||
TextInput,
|
|
||||||
Title,
|
|
||||||
Tooltip,
|
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { list } from "postcss";
|
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "../../component_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../component_global/header_tamplate";
|
||||||
import { useState } from "react";
|
|
||||||
import {
|
|
||||||
IconEdit,
|
|
||||||
IconEye,
|
|
||||||
IconEyeClosed,
|
|
||||||
IconEyeOff,
|
|
||||||
IconPhone,
|
|
||||||
IconPlus,
|
|
||||||
IconTrack,
|
|
||||||
IconTrash,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import { ComponentGlobalAdmin_NotifikasiPeringatan } from "../../component_global/admin_notifikasi/notifikasi_peringatan";
|
|
||||||
import adminAppInformation_funUpdateNomorAdmin from "../fun/update/fun_update_nomor";
|
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
|
||||||
import adminAppInformation_getNomorAdmin from "../fun/master/get_nomor_admin";
|
|
||||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/model/model_investasi";
|
|
||||||
import _ from "lodash";
|
|
||||||
import InformasiWhatApps from "./info_whatsapp";
|
|
||||||
import InformasiBank from "./info_bank";
|
import InformasiBank from "./info_bank";
|
||||||
|
import InformasiWhatApps from "./info_whatsapp";
|
||||||
|
|
||||||
export default function AdminAppInformation_MainView({
|
export default function AdminAppInformation_MainView({
|
||||||
nomorAdmin,
|
nomorAdmin,
|
||||||
|
|||||||
@@ -2,41 +2,34 @@
|
|||||||
|
|
||||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/model/model_investasi";
|
import { MODEL_DATA_BANK } from "@/app_modules/investasi/model/model_investasi";
|
||||||
import {
|
import {
|
||||||
Center,
|
|
||||||
Stack,
|
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Tooltip,
|
|
||||||
Group,
|
|
||||||
Title,
|
|
||||||
Button,
|
Button,
|
||||||
|
Center,
|
||||||
|
Grid,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
Paper,
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Modal,
|
Stack,
|
||||||
TextInput,
|
|
||||||
Text,
|
|
||||||
Table,
|
|
||||||
SimpleGrid,
|
|
||||||
Grid,
|
|
||||||
Switch,
|
Switch,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
Tooltip
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import {
|
import {
|
||||||
IconEye,
|
|
||||||
IconEyeOff,
|
|
||||||
IconEdit,
|
|
||||||
IconTrash,
|
|
||||||
IconPlus,
|
|
||||||
IconCirclePlus,
|
IconCirclePlus,
|
||||||
|
IconEdit
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import _, { fill } from "lodash";
|
import _ from "lodash";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import adminAppInformation_createBank from "../fun/create/fun_create_new_bank";
|
import adminAppInformation_createBank from "../fun/create/fun_create_new_bank";
|
||||||
import adminAppInformation_getMasterBank from "../fun/master/get_list_bank";
|
import adminAppInformation_getMasterBank from "../fun/master/get_list_bank";
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
|
||||||
import adminAppInformation_getOneBankById from "../fun/get/get_one_bank_by_id";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
|
||||||
import adminAppInformation_updateDataBankById from "../fun/update/fun_update_data_bank";
|
|
||||||
import adminAppInformation_updateStatusBankById from "../fun/update/fun_udpate_status_bank";
|
import adminAppInformation_updateStatusBankById from "../fun/update/fun_udpate_status_bank";
|
||||||
|
import adminAppInformation_updateDataBankById from "../fun/update/fun_update_data_bank";
|
||||||
|
|
||||||
export default function InformasiBank({
|
export default function InformasiBank({
|
||||||
listBank,
|
listBank,
|
||||||
@@ -70,9 +63,9 @@ export default function InformasiBank({
|
|||||||
if (create.status === 200) {
|
if (create.status === 200) {
|
||||||
const loadData = await adminAppInformation_getMasterBank();
|
const loadData = await adminAppInformation_getMasterBank();
|
||||||
setData(loadData);
|
setData(loadData);
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(create.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(create.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(create.message);
|
ComponentAdminGlobal_NotifikasiGagal(create.message);
|
||||||
}
|
}
|
||||||
setIsCreate(false);
|
setIsCreate(false);
|
||||||
}
|
}
|
||||||
@@ -84,10 +77,10 @@ export default function InformasiBank({
|
|||||||
if (updt.status === 200) {
|
if (updt.status === 200) {
|
||||||
const loadData = await adminAppInformation_getMasterBank();
|
const loadData = await adminAppInformation_getMasterBank();
|
||||||
setData(loadData);
|
setData(loadData);
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(updt.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||||
setIsUpdate(false);
|
setIsUpdate(false);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(updt.message);
|
ComponentAdminGlobal_NotifikasiGagal(updt.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,10 +101,10 @@ export default function InformasiBank({
|
|||||||
if (updt.status === 200) {
|
if (updt.status === 200) {
|
||||||
const loadData = await adminAppInformation_getMasterBank();
|
const loadData = await adminAppInformation_getMasterBank();
|
||||||
setData(loadData);
|
setData(loadData);
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(updt.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||||
setIsActivation(false);
|
setIsActivation(false);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(updt.message);
|
ComponentAdminGlobal_NotifikasiGagal(updt.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
" use client";
|
" use client";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Stack,
|
|
||||||
Group,
|
|
||||||
Title,
|
|
||||||
Paper,
|
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
TextInput,
|
|
||||||
Button,
|
Button,
|
||||||
Box,
|
Group,
|
||||||
Tooltip,
|
Paper,
|
||||||
|
Stack,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
Tooltip
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconEdit, IconPhone } from "@tabler/icons-react";
|
import { IconEdit, IconPhone } from "@tabler/icons-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import adminAppInformation_getNomorAdmin from "../fun/master/get_nomor_admin";
|
import adminAppInformation_getNomorAdmin from "../fun/master/get_nomor_admin";
|
||||||
import adminAppInformation_funUpdateNomorAdmin from "../fun/update/fun_update_nomor";
|
import adminAppInformation_funUpdateNomorAdmin from "../fun/update/fun_update_nomor";
|
||||||
|
|
||||||
@@ -39,11 +38,11 @@ export default function InformasiWhatApps({ nomorAdmin }: { nomorAdmin: any }) {
|
|||||||
const loadDdata = await adminAppInformation_getNomorAdmin();
|
const loadDdata = await adminAppInformation_getNomorAdmin();
|
||||||
setDataNomor(loadDdata);
|
setDataNomor(loadDdata);
|
||||||
if (loadDdata) {
|
if (loadDdata) {
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(updt.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(updt.message);
|
ComponentAdminGlobal_NotifikasiGagal(updt.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
* @type number
|
* @type number
|
||||||
* @returns notifikasi berhasil warna hijau
|
* @returns notifikasi berhasil warna hijau
|
||||||
*/
|
*/
|
||||||
export async function ComponentGlobalAdmin_NotifikasiBerhasil(
|
export async function ComponentAdminGlobal_NotifikasiBerhasil(
|
||||||
text: string,
|
text: string,
|
||||||
durasi?: number
|
durasi?: number
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { IconAlertTriangle } from "@tabler/icons-react";
|
|||||||
* @type string
|
* @type string
|
||||||
* @returns notifikasi peringatan
|
* @returns notifikasi peringatan
|
||||||
*/
|
*/
|
||||||
export async function ComponentGlobalAdmin_NotifikasiGagal(text: string) {
|
export async function ComponentAdminGlobal_NotifikasiGagal(text: string) {
|
||||||
return notifications.show({
|
return notifications.show({
|
||||||
message: (
|
message: (
|
||||||
<Center>
|
<Center>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { IconAlertTriangle } from "@tabler/icons-react";
|
|||||||
* @type string
|
* @type string
|
||||||
* @returns notifikasi peringatan
|
* @returns notifikasi peringatan
|
||||||
*/
|
*/
|
||||||
export async function ComponentGlobalAdmin_NotifikasiPeringatan(
|
export async function ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
text: string,
|
text: string,
|
||||||
durasi?: number
|
durasi?: number
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { IconChevronLeft } from "@tabler/icons-react";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export default function ComponentGlobalAdmin_BackButton({path}:{path?:string}) {
|
export default function ComponentAdminGlobal_BackButton({path}:{path?:string}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoading, setLoading] = useState(false);
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
|||||||
19
src/app_modules/admin/component_global/is_empty_data.tsx
Normal file
19
src/app_modules/admin/component_global/is_empty_data.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Center, Text } from "@mantine/core";
|
||||||
|
|
||||||
|
export default function ComponentAdminGlobal_IsEmptyData({
|
||||||
|
text,
|
||||||
|
marginTop,
|
||||||
|
}: {
|
||||||
|
text?: string;
|
||||||
|
marginTop?: number;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Center h={"100%"} mt={marginTop ? marginTop : "xl"}>
|
||||||
|
<Text c={"gray"} fw={"bold"}>{text ? text : "Tidak Ada Data"}</Text>
|
||||||
|
</Center>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ export default function ComponentAdminGlobal_LoadingPage() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
const customLOader = (
|
const customLOader = (
|
||||||
<Center h={"100vh"}>
|
<Center h={"90vh"}>
|
||||||
<Group>
|
<Group>
|
||||||
{listhHuruf.map((e, i) => (
|
{listhHuruf.map((e, i) => (
|
||||||
<Center key={i} h={"100%"}>
|
<Center key={i} h={"100%"}>
|
||||||
@@ -44,7 +44,10 @@ export default function ComponentAdminGlobal_LoadingPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LoadingOverlay visible overlayBlur={1} loader={customLOader} />
|
{/* <LoadingOverlay visible loader={customLOader} /> */}
|
||||||
|
<Box>
|
||||||
|
{customLOader}
|
||||||
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_b
|
|||||||
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
||||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
||||||
import ComponentGlobalAdmin_BackButton from "../../component_global/back_button";
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
||||||
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ function ButtonOnHeader({
|
|||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentGlobalAdmin_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<Button radius={"xl"} bg={"orange"} color="orange" onClick={open}>
|
<Button radius={"xl"} bg={"orange"} color="orange" onClick={open}>
|
||||||
Tambah catatan
|
Tambah catatan
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ import {
|
|||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import { ComponentGlobalAdmin_NotifikasiPeringatan } from "../../component_global/admin_notifikasi/notifikasi_peringatan";
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../component_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
||||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||||
import { AdminDonasi_funUpdateStatusPublish } from "../fun/update/fun_status_publish";
|
import { AdminDonasi_funUpdateStatusPublish } from "../fun/update/fun_status_publish";
|
||||||
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
||||||
import ComponentGlobalAdmin_BackButton from "../../component_global/back_button";
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
||||||
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
||||||
|
|
||||||
@@ -85,12 +85,12 @@ function ButtonOnHeader({
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||||
setData(newData);
|
setData(newData);
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(
|
ComponentAdminGlobal_NotifikasiBerhasil(
|
||||||
"Berhasil Mengubah Status Donasi"
|
"Berhasil Mengubah Status Donasi"
|
||||||
);
|
);
|
||||||
setLoadingPublish(true);
|
setLoadingPublish(true);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiPeringatan(
|
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
"Gagal Mengubah Status Donasi"
|
"Gagal Mengubah Status Donasi"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ function ButtonOnHeader({
|
|||||||
|
|
||||||
async function onReject() {
|
async function onReject() {
|
||||||
if (catatan === "")
|
if (catatan === "")
|
||||||
return ComponentGlobalAdmin_NotifikasiPeringatan(
|
return ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
"Lengkapi Alasan Penolakan"
|
"Lengkapi Alasan Penolakan"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -110,10 +110,10 @@ function ButtonOnHeader({
|
|||||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||||
setData(newData);
|
setData(newData);
|
||||||
close();
|
close();
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(res.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
setLoadingReject(true);
|
setLoadingReject(true);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(res.message);
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -122,7 +122,7 @@ function ButtonOnHeader({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentGlobalAdmin_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
{donasi.donasiMaster_StatusDonasiId === "2" ? (
|
{donasi.donasiMaster_StatusDonasiId === "2" ? (
|
||||||
<Group>
|
<Group>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
||||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||||
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
||||||
import ComponentGlobalAdmin_BackButton from "@/app_modules/admin/component_global/back_button";
|
import ComponentAdminGlobal_BackButton from "@/app_modules/admin/component_global/back_button";
|
||||||
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||||
import { adminDonasi_getListDonatur } from "../../fun/get/get_list_donatur_by_id";
|
import { adminDonasi_getListDonatur } from "../../fun/get/get_list_donatur_by_id";
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
import adminDonasi_funUpdateStatusDanTotal from "../../fun/update/fun_update_status_dan_total";
|
import adminDonasi_funUpdateStatusDanTotal from "../../fun/update/fun_update_status_dan_total";
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_berhasil";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_gagal";
|
||||||
|
|
||||||
export default function AdminDonasi_DetailPublish({
|
export default function AdminDonasi_DetailPublish({
|
||||||
dataPublish,
|
dataPublish,
|
||||||
@@ -86,7 +86,7 @@ export default function AdminDonasi_DetailPublish({
|
|||||||
<>
|
<>
|
||||||
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentGlobalAdmin_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
||||||
<TampilanListDonatur
|
<TampilanListDonatur
|
||||||
donatur={listDonatur}
|
donatur={listDonatur}
|
||||||
@@ -517,9 +517,9 @@ function ButtonAccept({
|
|||||||
});
|
});
|
||||||
onSuccessDonatur(updatelistDonatur);
|
onSuccessDonatur(updatelistDonatur);
|
||||||
|
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(updateStatus.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(updateStatus.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(updateStatus.message);
|
ComponentAdminGlobal_NotifikasiGagal(updateStatus.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ import ComponentAdminDonasi_TombolKembali from "../../component/tombol_kembali";
|
|||||||
import { AdminDonasi_funCreatePencairanDana } from "../../fun/create/fun_create_pencairan_dana";
|
import { AdminDonasi_funCreatePencairanDana } from "../../fun/create/fun_create_pencairan_dana";
|
||||||
import { AdminDonasi_AkumulasiPencairanById } from "../../fun/update/fun_update_akumulasi_pencairan";
|
import { AdminDonasi_AkumulasiPencairanById } from "../../fun/update/fun_update_akumulasi_pencairan";
|
||||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||||
import { ComponentGlobalAdmin_NotifikasiPeringatan } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_peringatan";
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_berhasil";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
||||||
|
|
||||||
export default function AdminDonasi_PencairanDana({
|
export default function AdminDonasi_PencairanDana({
|
||||||
@@ -305,9 +305,9 @@ async function onSave({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_.values(body).includes(""))
|
if (_.values(body).includes(""))
|
||||||
return ComponentGlobalAdmin_NotifikasiPeringatan("Lengkapi Data");
|
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||||
if (!file)
|
if (!file)
|
||||||
return ComponentGlobalAdmin_NotifikasiPeringatan(
|
return ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
"Lampirkan Bukti Transfer"
|
"Lampirkan Bukti Transfer"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -324,9 +324,9 @@ async function onSave({
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const loadData = await AdminDonasi_getOneById(donasiId);
|
const loadData = await AdminDonasi_getOneById(donasiId);
|
||||||
onSuccess1(loadData);
|
onSuccess1(loadData);
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(res.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(res.message);
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
||||||
import ComponentGlobalAdmin_BackButton from "../../component_global/back_button";
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
|
||||||
export default function AdminDonasi_BuktiTransfer({
|
export default function AdminDonasi_BuktiTransfer({
|
||||||
@@ -12,7 +12,7 @@ export default function AdminDonasi_BuktiTransfer({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentGlobalAdmin_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<BuktiTransfer imageId={imageId} />
|
<BuktiTransfer imageId={imageId} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
||||||
import ComponentGlobalAdmin_BackButton from "../../component_global/back_button";
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ export default function AdminDonasi_BuktiTransferPencairan({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentGlobalAdmin_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<BuktiTransfer imageId={imageId} />
|
<BuktiTransfer imageId={imageId} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { IconCirclePlus, IconEdit, IconTrash } from "@tabler/icons-react";
|
import { IconCirclePlus, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||||
import adminDonasi_funCreateKategori from "../fun/create/fun_create_kategori";
|
import adminDonasi_funCreateKategori from "../fun/create/fun_create_kategori";
|
||||||
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../component_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "../../component_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import adminDonasi_getMasterKategori from "../fun/master/get_list_kategori";
|
import adminDonasi_getMasterKategori from "../fun/master/get_list_kategori";
|
||||||
import adminDonasi_funDeleteKategori from "../fun/delete/fun_delete_by_id";
|
import adminDonasi_funDeleteKategori from "../fun/delete/fun_delete_by_id";
|
||||||
import adminDonasi_funUpdatekategoriById from "../fun/update/fun_update_kategori_by_id";
|
import adminDonasi_funUpdatekategoriById from "../fun/update/fun_update_kategori_by_id";
|
||||||
@@ -72,9 +72,9 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
|
|||||||
const loadNewdata = await adminDonasi_getMasterKategori();
|
const loadNewdata = await adminDonasi_getMasterKategori();
|
||||||
setData(loadNewdata);
|
setData(loadNewdata);
|
||||||
setCreate("");
|
setCreate("");
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(tambahData.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(tambahData.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(tambahData.message);
|
ComponentAdminGlobal_NotifikasiGagal(tambahData.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,10 +88,10 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
|
|||||||
if (del.status === 200) {
|
if (del.status === 200) {
|
||||||
const loadNewdata = await adminDonasi_getMasterKategori();
|
const loadNewdata = await adminDonasi_getMasterKategori();
|
||||||
setData(loadNewdata);
|
setData(loadNewdata);
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(del.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(del.message);
|
||||||
setIsChangeStatus(false);
|
setIsChangeStatus(false);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(del.message);
|
ComponentAdminGlobal_NotifikasiGagal(del.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,12 +102,12 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
|
|||||||
});
|
});
|
||||||
if (updt.status === 200) {
|
if (updt.status === 200) {
|
||||||
setUpdateKategori({ kategoriId: "", name: "" });
|
setUpdateKategori({ kategoriId: "", name: "" });
|
||||||
ComponentGlobalAdmin_NotifikasiBerhasil(updt.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||||
const loadData = await adminDonasi_getMasterKategori();
|
const loadData = await adminDonasi_getMasterKategori();
|
||||||
setData(loadData);
|
setData(loadData);
|
||||||
setIsUpdate(false);
|
setIsUpdate(false);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobalAdmin_NotifikasiGagal(updt.message);
|
ComponentAdminGlobal_NotifikasiGagal(updt.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,288 +0,0 @@
|
|||||||
"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_global/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>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Stack } from "@mantine/core";
|
|
||||||
|
|
||||||
export default function AdminForum_TableReportKomentar() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>ini rep komen</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Stack } from "@mantine/core";
|
|
||||||
|
|
||||||
export default function AdminForum_TableReportPosting() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>ini rep pos</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,291 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component_global/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>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
84
src/app_modules/admin/forum/component/button_delete.tsx
Normal file
84
src/app_modules/admin/forum/component/button_delete.tsx
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
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 { Modal, Stack, Title, Group, Button } from "@mantine/core";
|
||||||
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
|
import { IconTrash } from "@tabler/icons-react";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id";
|
||||||
|
|
||||||
|
export default function ComponentAdminForum_ButtonDeletePosting({
|
||||||
|
postingId,
|
||||||
|
onSuccesDelete,
|
||||||
|
}: {
|
||||||
|
postingId: string;
|
||||||
|
onSuccesDelete: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [loadingDel2, setLoadingDel2] = useState(false);
|
||||||
|
|
||||||
|
async function onDelete() {
|
||||||
|
await adminForum_funDeletePostingById(postingId).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
setLoadingDel2(false);
|
||||||
|
close();
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
onSuccesDelete(true);
|
||||||
|
} 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();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={loadingDel2 ? true : false}
|
||||||
|
radius={"xl"}
|
||||||
|
color="red"
|
||||||
|
onClick={() => {
|
||||||
|
onDelete();
|
||||||
|
setLoadingDel2(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
<Button
|
||||||
|
fz={"xs"}
|
||||||
|
loaderPosition="center"
|
||||||
|
radius={"xl"}
|
||||||
|
w={170}
|
||||||
|
color="red"
|
||||||
|
leftIcon={<IconTrash size={15} />}
|
||||||
|
onClick={() => {
|
||||||
|
// onDelete();
|
||||||
|
open();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hapus Posting
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
73
src/app_modules/admin/forum/component/detail_one_posting.tsx
Normal file
73
src/app_modules/admin/forum/component/detail_one_posting.tsx
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface";
|
||||||
|
import {
|
||||||
|
Badge,
|
||||||
|
Box,
|
||||||
|
Divider,
|
||||||
|
Group,
|
||||||
|
Paper,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
|
||||||
|
export default function ComponentAdminForum_ViewOneDetailPosting({
|
||||||
|
dataPosting,
|
||||||
|
}: {
|
||||||
|
dataPosting: MODEL_FORUM_POSTING;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"} w={"50%"}>
|
||||||
|
<Paper bg={"green.4"} p={"xs"} style={{ borderRadius: "6px" }}>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
Detail Posting
|
||||||
|
</Title>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
<Paper withBorder p={"md"} radius={"md"} shadow="sm">
|
||||||
|
<Stack>
|
||||||
|
<Stack spacing={5}>
|
||||||
|
<Group position="apart">
|
||||||
|
<Text>
|
||||||
|
Username:{" "}
|
||||||
|
<Text span inherit fw={"bold"}>
|
||||||
|
{dataPosting?.Author?.username}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Badge
|
||||||
|
color={
|
||||||
|
(dataPosting?.ForumMaster_StatusPosting?.id as any) === 1
|
||||||
|
? "green"
|
||||||
|
: "red"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{dataPosting?.ForumMaster_StatusPosting?.status}
|
||||||
|
</Badge>
|
||||||
|
</Group>
|
||||||
|
<Divider />
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Box>
|
||||||
|
<Spoiler
|
||||||
|
w={500}
|
||||||
|
hideLabel="sembunyikan"
|
||||||
|
maxHeight={100}
|
||||||
|
showLabel="tampilkan"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: dataPosting?.diskusi,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
316
src/app_modules/admin/forum/detail/detail_posting.tsx
Normal file
316
src/app_modules/admin/forum/detail/detail_posting.tsx
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component_global/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,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconSearch, 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";
|
||||||
|
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
|
||||||
|
import { adminForum_getListKomentarById } from "../fun/get/get_list_komentar_by_id";
|
||||||
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
|
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||||
|
|
||||||
|
export default function AdminForum_DetailPosting({
|
||||||
|
listKomentar,
|
||||||
|
dataPosting,
|
||||||
|
countKomentar,
|
||||||
|
}: {
|
||||||
|
listKomentar: any;
|
||||||
|
dataPosting: MODEL_FORUM_POSTING;
|
||||||
|
countKomentar: number;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <pre>{JSON.stringify(listKomentar, null, 2)}</pre> */}
|
||||||
|
<Stack>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Forum: Detail Posting" />
|
||||||
|
<ComponentAdminGlobal_BackButton />
|
||||||
|
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
||||||
|
<TableKomentar
|
||||||
|
listKomentar={listKomentar}
|
||||||
|
postingId={dataPosting.id}
|
||||||
|
countKomentar={countKomentar}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function TableKomentar({
|
||||||
|
listKomentar,
|
||||||
|
postingId,
|
||||||
|
countKomentar,
|
||||||
|
}: {
|
||||||
|
listKomentar: any;
|
||||||
|
postingId: string;
|
||||||
|
countKomentar: number;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [data, setData] = useState<MODEL_FORUM_KOMENTAR[]>(listKomentar.data);
|
||||||
|
const [nPage, setNPage] = useState(listKomentar.nPage);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
const [isLoadingReport, setLoadingReport] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
setActivePage(1);
|
||||||
|
const loadData = await adminForum_getListKomentarById({
|
||||||
|
postingId: postingId,
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminForum_getListKomentarById({
|
||||||
|
postingId: postingId,
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowTable = data?.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text lineClamp={1}>{e?.Author?.username}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Box w={500}>
|
||||||
|
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
|
<div
|
||||||
|
style={{ textAlign: "center" }}
|
||||||
|
dangerouslySetInnerHTML={{ __html: e?.komentar }}
|
||||||
|
/>
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text>
|
||||||
|
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
||||||
|
e.createdAt
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={100}>
|
||||||
|
<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"} w={200}>
|
||||||
|
<Button
|
||||||
|
disabled={e?.Forum_ReportKomentar.length <= 0 ? true : false}
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoadingReport && e?.id === idData ? true : false}
|
||||||
|
radius={"xl"}
|
||||||
|
w={170}
|
||||||
|
fz={"xs"}
|
||||||
|
leftIcon={<IconFlag3 size={15} />}
|
||||||
|
onClick={() => {
|
||||||
|
setIdData(e?.id);
|
||||||
|
setLoadingReport(true);
|
||||||
|
router.push(RouterAdminForum.report_komentar + e?.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Lihat Report
|
||||||
|
</Button>
|
||||||
|
<ButtonDeleteKomentar komentarId={e?.id} />
|
||||||
|
</Stack>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"gray"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Group spacing={5}>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
Komentar
|
||||||
|
</Title>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
{`(${countKomentar})`}
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Cari komentar"
|
||||||
|
onChange={(val) => {
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
{_.isEmpty(data) ? (
|
||||||
|
<ComponentAdminGlobal_IsEmptyData text="Tidak Ada Komentar" />
|
||||||
|
) : (
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={"100%"}
|
||||||
|
h={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center w={200}>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center w={500}>Komentar</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center w={200}>Tgl Komentar</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center w={100}>Total Report</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center w={200}>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{rowTable}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={activePage}
|
||||||
|
total={nPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
|
</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);
|
||||||
|
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={170}
|
||||||
|
color="red"
|
||||||
|
fz={"xs"}
|
||||||
|
leftIcon={<IconTrash size={15} />}
|
||||||
|
onClick={() => {
|
||||||
|
open();
|
||||||
|
setLoadingDel(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hapus Komentar
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function adminForum_countKomentarByPostingId({
|
||||||
|
postingId,
|
||||||
|
}: {
|
||||||
|
postingId: string;
|
||||||
|
}) {
|
||||||
|
const count = await prisma.forum_Komentar.count({
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
forum_PostingId: postingId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
@@ -14,6 +14,5 @@ export async function adminForum_funDeleteKomentarById(komentarId: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!delTemporary) return { status: 400, message: "Gagal Dihapus" };
|
if (!delTemporary) return { status: 400, message: "Gagal Dihapus" };
|
||||||
revalidatePath("/dev/admin/forum/children/semua-komentar");
|
|
||||||
return { status: 200, message: "Berhasil Dihapus" };
|
return { status: 200, message: "Berhasil Dihapus" };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export default async function adminForum_funGetAllReportPosting({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
|
||||||
|
const takeData = 10
|
||||||
|
const skipData = page * takeData - takeData
|
||||||
|
|
||||||
|
const data = await prisma.forum_ReportPosting.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
Forum_Posting: {
|
||||||
|
isActive: true,
|
||||||
|
diskusi: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
isActive: true,
|
||||||
|
createdAt: true,
|
||||||
|
deskripsi: true,
|
||||||
|
forumMaster_KategoriReportId: true,
|
||||||
|
ForumMaster_KategoriReport: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
deskripsi: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
forum_PostingId: true,
|
||||||
|
Forum_Posting: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
diskusi: true,
|
||||||
|
ForumMaster_StatusPosting: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
status: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
userId: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const nCount = await prisma.forum_ReportPosting.count({
|
||||||
|
where: {
|
||||||
|
Forum_Posting: {
|
||||||
|
isActive: true,
|
||||||
|
diskusi: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
@@ -1,15 +1,33 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminForum_getListKomentarById({
|
||||||
|
postingId,
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
postingId: string;
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
export async function adminForum_getListKomentarById(postingId: string) {
|
|
||||||
const data = await prisma.forum_Komentar.findMany({
|
const data = await prisma.forum_Komentar.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
orderBy: {
|
orderBy: {
|
||||||
createdAt: "desc",
|
createdAt: "desc",
|
||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
forum_PostingId: postingId,
|
forum_PostingId: postingId,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
komentar: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
@@ -20,6 +38,7 @@ export async function adminForum_getListKomentarById(postingId: string) {
|
|||||||
Author: {
|
Author: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
username: true,
|
||||||
Profile: {
|
Profile: {
|
||||||
select: {
|
select: {
|
||||||
name: true,
|
name: true,
|
||||||
@@ -28,9 +47,25 @@ export async function adminForum_getListKomentarById(postingId: string) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Forum_ReportKomentar: true
|
Forum_ReportKomentar: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
const nCount = await prisma.forum_Komentar.count({
|
||||||
|
where: {
|
||||||
|
forum_PostingId: postingId,
|
||||||
|
isActive: true,
|
||||||
|
komentar: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,30 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminForum_getListPosting({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
export async function adminForum_getListPublish() {
|
|
||||||
const data = await prisma.forum_Posting.findMany({
|
const data = await prisma.forum_Posting.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
orderBy: {
|
orderBy: {
|
||||||
createdAt: "desc",
|
createdAt: "desc",
|
||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
diskusi: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
@@ -25,12 +41,27 @@ export async function adminForum_getListPublish() {
|
|||||||
Forum_ReportPosting: true,
|
Forum_ReportPosting: true,
|
||||||
Forum_Komentar: {
|
Forum_Komentar: {
|
||||||
where: {
|
where: {
|
||||||
isActive: true
|
isActive: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
ForumMaster_StatusPosting: true
|
ForumMaster_StatusPosting: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
const nCount = await prisma.forum_Posting.count({
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
diskusi: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,26 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminForum_getListReportKomentarbyId({
|
||||||
|
komentarId,
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
komentarId: string;
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
export async function adminForum_getListReportKomentarbyId(komentarId: string) {
|
|
||||||
const data = await prisma.forum_ReportKomentar.findMany({
|
const data = await prisma.forum_ReportKomentar.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc"
|
||||||
|
},
|
||||||
where: {
|
where: {
|
||||||
forum_KomentarId: komentarId,
|
forum_KomentarId: komentarId,
|
||||||
},
|
},
|
||||||
@@ -26,5 +43,16 @@ export async function adminForum_getListReportKomentarbyId(komentarId: string) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
const nCount = await prisma.forum_ReportKomentar.count({
|
||||||
|
where: {
|
||||||
|
forum_KomentarId: komentarId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData)
|
||||||
|
}
|
||||||
|
|
||||||
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,24 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminForum_getListReportPostingById({
|
||||||
|
postingId,
|
||||||
|
page,
|
||||||
|
}: {
|
||||||
|
postingId: string;
|
||||||
|
page: number;
|
||||||
|
}) {
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
export async function adminForum_getListReportPostingById(postingId: string) {
|
|
||||||
const data = await prisma.forum_ReportPosting.findMany({
|
const data = await prisma.forum_ReportPosting.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
where: {
|
where: {
|
||||||
forum_PostingId: postingId,
|
forum_PostingId: postingId,
|
||||||
},
|
},
|
||||||
@@ -13,6 +28,8 @@ export async function adminForum_getListReportPostingById(postingId: string) {
|
|||||||
createdAt: true,
|
createdAt: true,
|
||||||
User: {
|
User: {
|
||||||
select: {
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
Profile: {
|
Profile: {
|
||||||
select: {
|
select: {
|
||||||
name: true,
|
name: true,
|
||||||
@@ -30,5 +47,16 @@ export async function adminForum_getListReportPostingById(postingId: string) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
const nCount = await prisma.forum_ReportPosting.count({
|
||||||
|
where: {
|
||||||
|
forum_PostingId: postingId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,19 @@ export async function adminForum_getOnePostingById(postingId: string) {
|
|||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
diskusi: true,
|
diskusi: true,
|
||||||
|
ForumMaster_StatusPosting: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
Author: {
|
Author: {
|
||||||
select: {
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
Profile: {
|
Profile: {
|
||||||
select: {
|
select: {
|
||||||
name: true
|
name: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -22,7 +30,7 @@ export async function adminForum_getOnePostingById(postingId: string) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
import AdminForum_Main from "./main";
|
import AdminForum_Main from "./main/dashboard";
|
||||||
import AdminForum_TablePublish from "./child/publish";
|
import AdminForum_TablePosting from "./sub_menu/table_posting";
|
||||||
import AdminForum_TableReportKomentar from "./child/report_komentar";
|
import AdminForum_TableReportPosting from "./sub_menu/table_report_posting";
|
||||||
import AdminForum_TableReportPosting from "./child/report_posting";
|
import AdminForum_DetailPosting from "./detail/detail_posting";
|
||||||
import AdminForum_LihatSemuaKomentar from "./children/semua_komentar";
|
import AdminForum_HasilReportPosting from "./sub_detail/hasil_report_posting";
|
||||||
import AdminForum_HasilReportPosting from "./hasil_report/posting";
|
import AdminForum_HasilReportKomentar from "./sub_detail/hasil_report_komentar";
|
||||||
import AdminForum_HasilReportKomentar from "./hasil_report/komentar";
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AdminForum_Main,
|
AdminForum_Main,
|
||||||
AdminForum_TablePublish,
|
AdminForum_TablePosting as AdminForum_TablePublish,
|
||||||
AdminForum_TableReportKomentar,
|
|
||||||
AdminForum_TableReportPosting,
|
AdminForum_TableReportPosting,
|
||||||
AdminForum_LihatSemuaKomentar,
|
AdminForum_DetailPosting as AdminForum_LihatSemuaKomentar,
|
||||||
AdminForum_HasilReportPosting,
|
AdminForum_HasilReportPosting,
|
||||||
AdminForum_HasilReportKomentar,
|
AdminForum_HasilReportKomentar,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function AdminForum_Main({
|
|||||||
countLaporanKomentar={countLaporanKomentar}
|
countLaporanKomentar={countLaporanKomentar}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
{/* <ComponentGlobalAdmin_LoadingPage /> */}
|
{/* <ComponentAdminGlobal_LoadingPage /> */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -46,13 +46,13 @@ function ForumMain({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Laporan Posting",
|
name: "Report Posting",
|
||||||
jumlah: countLaporanPosting,
|
jumlah: countLaporanPosting,
|
||||||
color: "orange",
|
color: "orange",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "Laporan Komentar",
|
name: "Report Komentar",
|
||||||
jumlah: countLaporanKomentar,
|
jumlah: countLaporanKomentar,
|
||||||
color: "red",
|
color: "red",
|
||||||
},
|
},
|
||||||
@@ -16,37 +16,48 @@ import {
|
|||||||
Center,
|
Center,
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Spoiler,
|
Spoiler,
|
||||||
Stack,
|
Stack,
|
||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
|
TextInput,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconMessageCircle, IconFlag3, IconTrash } from "@tabler/icons-react";
|
import {
|
||||||
|
IconMessageCircle,
|
||||||
|
IconFlag3,
|
||||||
|
IconTrash,
|
||||||
|
IconSearch,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id";
|
||||||
import { adminForum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id";
|
import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
|
||||||
|
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
|
||||||
|
import { adminForum_getListReportKomentarbyId } from "../fun/get/get_list_report_komentar_by_id";
|
||||||
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
|
|
||||||
export default function AdminForum_HasilReportKomentar({
|
export default function AdminForum_HasilReportKomentar({
|
||||||
komentarId,
|
komentarId,
|
||||||
listReport,
|
listReport,
|
||||||
}: {
|
}: {
|
||||||
komentarId: string;
|
komentarId: string;
|
||||||
listReport: any[];
|
listReport: any;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Komentar" />
|
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Komentar" />
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<ButtonDeleteKomentar komentarId={komentarId} />
|
<ButtonDeleteKomentar komentarId={komentarId} />
|
||||||
</Group>
|
</Group>
|
||||||
<HasilReportPosting listReport={listReport} />
|
<HasilReportPosting listReport={listReport} komentarId={komentarId} />
|
||||||
{/* <pre>{JSON.stringify(listReport, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(listReport, null, 2)}</pre> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
@@ -56,13 +67,11 @@ export default function AdminForum_HasilReportKomentar({
|
|||||||
function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [loadindDel, setLoadingDel] = useState(false);
|
|
||||||
const [loadingDel2, setLoadingDel2] = useState(false);
|
const [loadingDel2, setLoadingDel2] = useState(false);
|
||||||
|
|
||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
await adminForum_funDeleteKomentarById(komentarId).then((res) => {
|
await adminForum_funDeleteKomentarById(komentarId).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
setLoadingDel(false);
|
|
||||||
setLoadingDel2(false);
|
setLoadingDel2(false);
|
||||||
close();
|
close();
|
||||||
router.back();
|
router.back();
|
||||||
@@ -82,7 +91,6 @@ function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
|||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
close();
|
close();
|
||||||
setLoadingDel(false);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Batal
|
Batal
|
||||||
@@ -104,14 +112,12 @@ function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
|||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
loading={loadindDel ? true : false}
|
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="red"
|
color="red"
|
||||||
leftIcon={<IconTrash size={15} />}
|
leftIcon={<IconTrash size={15} />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
open();
|
open();
|
||||||
setLoadingDel(true);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Hapus Komentar
|
Hapus Komentar
|
||||||
@@ -122,17 +128,32 @@ function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
|
|||||||
|
|
||||||
function HasilReportPosting({
|
function HasilReportPosting({
|
||||||
listReport,
|
listReport,
|
||||||
|
komentarId,
|
||||||
}: {
|
}: {
|
||||||
listReport: MODEL_FORUM_REPORT[];
|
listReport: any;
|
||||||
|
komentarId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [data, setData] = useState(listReport);
|
const [data, setData] = useState<MODEL_FORUM_REPORT[]>(listReport.data);
|
||||||
|
const [nPage, setNPage] = useState(listReport.nPage);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminForum_getListReportKomentarbyId({
|
||||||
|
komentarId: komentarId,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
const TableRows = data?.map((e, i) => (
|
const TableRows = data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center w={200}>
|
||||||
<Text w={200}>{e?.User?.Profile?.name}</Text>
|
<Text>{e?.User?.Profile?.name}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -169,51 +190,72 @@ function HasilReportPosting({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box>
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
<Box bg={"red.1"} p={"xs"}>
|
<Group
|
||||||
<Title order={6} c={"red"}>
|
position="apart"
|
||||||
REPORT KOMENTAR
|
bg={"red.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
Report Komentar
|
||||||
</Title>
|
</Title>
|
||||||
</Box>
|
{/* <TextInput
|
||||||
<ScrollArea w={"100%"}>
|
icon={<IconSearch size={20} />}
|
||||||
<Table
|
radius={"xl"}
|
||||||
withBorder
|
placeholder="Cari postingan"
|
||||||
verticalSpacing={"md"}
|
onChange={(val) => {
|
||||||
horizontalSpacing={"xl"}
|
onSearch(val.currentTarget.value);
|
||||||
p={"md"}
|
}}
|
||||||
striped
|
/> */}
|
||||||
highlightOnHover
|
</Group>
|
||||||
>
|
|
||||||
<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(data) ? (
|
||||||
{_.isEmpty(TableRows) ? (
|
<ComponentAdminGlobal_IsEmptyData />
|
||||||
<Center h={"50vh"}>
|
) : (
|
||||||
<Title order={6}>Tidak Ada Data</Title>
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={"100%"}
|
||||||
|
h={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Username</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 mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={activePage}
|
||||||
|
total={nPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
) : (
|
</Paper>
|
||||||
""
|
)}
|
||||||
)}
|
</Stack>
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,19 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component_global/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_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
import {
|
import {
|
||||||
MODEL_FORUM_MASTER_REPORT,
|
MODEL_FORUM_POSTING,
|
||||||
MODEL_FORUM_REPORT,
|
MODEL_FORUM_REPORT,
|
||||||
} from "@/app_modules/forum/model/interface";
|
} from "@/app_modules/forum/model/interface";
|
||||||
import {
|
import {
|
||||||
Badge,
|
|
||||||
Box,
|
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Spoiler,
|
Spoiler,
|
||||||
Stack,
|
Stack,
|
||||||
@@ -23,29 +21,37 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconMessageCircle, IconFlag3, IconTrash } from "@tabler/icons-react";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
|
import { IconTrash } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
|
||||||
|
import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id";
|
||||||
|
import { adminForum_getListReportPostingById } from "../fun/get/get_list_report_posting_by_id";
|
||||||
|
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||||
|
|
||||||
export default function AdminForum_HasilReportPosting({
|
export default function AdminForum_HasilReportPosting({
|
||||||
postingId,
|
dataPosting,
|
||||||
listReport,
|
listReport,
|
||||||
}: {
|
}: {
|
||||||
postingId: string;
|
dataPosting: MODEL_FORUM_POSTING;
|
||||||
listReport: any[];
|
listReport: any;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Posting" />
|
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Posting" />
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<ButtonDeletePosting postingId={postingId} />
|
<ButtonDeletePosting postingId={dataPosting.id} />
|
||||||
</Group>
|
</Group>
|
||||||
<HasilReportPosting listReport={listReport} />
|
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
||||||
|
<HasilReportPosting
|
||||||
|
listReport={listReport}
|
||||||
|
postingId={dataPosting.id}
|
||||||
|
/>
|
||||||
{/* <pre>{JSON.stringify(listReport, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(listReport, null, 2)}</pre> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
@@ -125,21 +131,35 @@ function ButtonDeletePosting({ postingId }: { postingId: string }) {
|
|||||||
|
|
||||||
function HasilReportPosting({
|
function HasilReportPosting({
|
||||||
listReport,
|
listReport,
|
||||||
|
postingId,
|
||||||
}: {
|
}: {
|
||||||
listReport: MODEL_FORUM_REPORT[];
|
listReport: any;
|
||||||
|
postingId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [data, setData] = useState(listReport);
|
const [data, setData] = useState<MODEL_FORUM_REPORT[]>(listReport.data);
|
||||||
|
const [nPage, setNPage] = useState(listReport.nPage);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminForum_getListReportPostingById({
|
||||||
|
postingId: postingId,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
const TableRows = data?.map((e, i) => (
|
const TableRows = data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center w={200}>
|
||||||
<Text w={200}>{e?.User?.Profile?.name}</Text>
|
<Text>{e?.User?.username}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={100}>
|
<Center w={200}>
|
||||||
<Text>
|
<Text>
|
||||||
{e?.ForumMaster_KategoriReport?.title
|
{e?.ForumMaster_KategoriReport?.title
|
||||||
? e?.ForumMaster_KategoriReport?.title
|
? e?.ForumMaster_KategoriReport?.title
|
||||||
@@ -161,7 +181,7 @@ function HasilReportPosting({
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center w={500}>
|
||||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||||
</Spoiler>
|
</Spoiler>
|
||||||
@@ -172,51 +192,72 @@ function HasilReportPosting({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box>
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
<Box bg={"red.1"} p={"xs"}>
|
<Group
|
||||||
<Title order={6} c={"red"}>
|
position="apart"
|
||||||
REPORT POSTING
|
bg={"red.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
Report Postingan
|
||||||
</Title>
|
</Title>
|
||||||
</Box>
|
{/* <TextInput
|
||||||
<ScrollArea w={"100%"}>
|
icon={<IconSearch size={20} />}
|
||||||
<Table
|
radius={"xl"}
|
||||||
withBorder
|
placeholder="Cari postingan"
|
||||||
verticalSpacing={"md"}
|
onChange={(val) => {
|
||||||
horizontalSpacing={"xl"}
|
onSearch(val.currentTarget.value);
|
||||||
p={"md"}
|
}}
|
||||||
striped
|
/> */}
|
||||||
highlightOnHover
|
</Group>
|
||||||
>
|
|
||||||
<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(data) ? (
|
||||||
{_.isEmpty(TableRows) ? (
|
<ComponentAdminGlobal_IsEmptyData />
|
||||||
<Center h={"50vh"}>
|
) : (
|
||||||
<Title order={6}>Tidak Ada Data</Title>
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={"100%"}
|
||||||
|
h={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Username</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 mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={activePage}
|
||||||
|
total={nPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
) : (
|
</Paper>
|
||||||
""
|
)}
|
||||||
)}
|
</Stack>
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
357
src/app_modules/admin/forum/sub_menu/table_posting.tsx
Normal file
357
src/app_modules/admin/forum/sub_menu/table_posting.tsx
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
"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_global/header_tamplate";
|
||||||
|
import { MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface";
|
||||||
|
import {
|
||||||
|
Badge,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconMessageCircle, IconSearch } from "@tabler/icons-react";
|
||||||
|
import { IconFlag3 } from "@tabler/icons-react";
|
||||||
|
import { IconEyeCheck, IconTrash } from "@tabler/icons-react";
|
||||||
|
import _, { isEmpty } 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";
|
||||||
|
import { adminForum_getListPosting } from "../fun/get/get_list_publish";
|
||||||
|
import adminJob_getListPublish from "@/app_modules/admin/job/fun/get/get_list_publish";
|
||||||
|
import ComponentAdminForum_ButtonDeletePosting from "../component/button_delete";
|
||||||
|
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
|
||||||
|
|
||||||
|
export default function AdminForum_TablePosting({
|
||||||
|
listPublish,
|
||||||
|
}: {
|
||||||
|
listPublish: any;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Forum" />
|
||||||
|
<TablePublish listPublish={listPublish} />
|
||||||
|
{/* <pre>{JSON.stringify(listPublish, null, 2)}</pre> */}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TablePublish({ listPublish }: { listPublish: any }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [data, setData] = useState<MODEL_FORUM_POSTING[]>(listPublish.data);
|
||||||
|
const [nPage, setNPage] = useState(listPublish.nPage);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
setActivePage(1);
|
||||||
|
const loadData = await adminForum_getListPosting({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminForum_getListPosting({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onLoadData() {
|
||||||
|
const loadData = await adminForum_getListPosting({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TableRows = data?.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text lineClamp={1}>{e?.Author?.username}</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>
|
||||||
|
<Box w={400}>
|
||||||
|
<Spoiler
|
||||||
|
// w={400}
|
||||||
|
maxHeight={60}
|
||||||
|
hideLabel="sembunyikan"
|
||||||
|
showLabel="tampilkan"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: e?.diskusi,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
|
</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} />
|
||||||
|
<ComponentAdminForum_ButtonDeletePosting
|
||||||
|
postingId={e?.id}
|
||||||
|
onSuccesDelete={(val) => {
|
||||||
|
if (val) {
|
||||||
|
onLoadData();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"green.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
Posting
|
||||||
|
</Title>
|
||||||
|
<TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Cari postingan"
|
||||||
|
onChange={(val) => {
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
{isEmpty(data) ? (
|
||||||
|
<ComponentAdminGlobal_IsEmptyData />
|
||||||
|
) : (
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={"100%"}
|
||||||
|
h={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Status</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Text>Postingan</Text>
|
||||||
|
</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 mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={activePage}
|
||||||
|
total={nPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ButtonAction({ postingId }: { postingId: string }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [loadingKomentar, setLoadingKomentar] = useState(false);
|
||||||
|
const [loadingReport, setLoadingReport] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
fz={"xs"}
|
||||||
|
loading={loadingKomentar ? true : false}
|
||||||
|
loaderPosition="center"
|
||||||
|
radius={"xl"}
|
||||||
|
w={170}
|
||||||
|
leftIcon={<IconMessageCircle size={15} />}
|
||||||
|
onClick={() => {
|
||||||
|
setLoadingKomentar(true);
|
||||||
|
router.push(RouterAdminForum.detail_posting + postingId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text>Detail & Komentar</Text>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
fz={"xs"}
|
||||||
|
loading={loadingReport ? true : false}
|
||||||
|
loaderPosition="center"
|
||||||
|
radius={"xl"}
|
||||||
|
w={170}
|
||||||
|
leftIcon={<IconFlag3 size={15} />}
|
||||||
|
onClick={() => {
|
||||||
|
setLoadingReport(true);
|
||||||
|
router.push(RouterAdminForum.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
|
||||||
|
// fz={"xs"}
|
||||||
|
// loaderPosition="center"
|
||||||
|
// loading={loadingDel ? true : false}
|
||||||
|
// radius={"xl"}
|
||||||
|
// w={170}
|
||||||
|
// color="red"
|
||||||
|
// leftIcon={<IconTrash size={15} />}
|
||||||
|
// onClick={() => {
|
||||||
|
// // onDelete();
|
||||||
|
// open();
|
||||||
|
// setLoadingDel(true);
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// Hapus Posting
|
||||||
|
// </Button>
|
||||||
|
// </>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
279
src/app_modules/admin/forum/sub_menu/table_report_posting.tsx
Normal file
279
src/app_modules/admin/forum/sub_menu/table_report_posting.tsx
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
"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_global/header_tamplate";
|
||||||
|
import {
|
||||||
|
MODEL_FORUM_POSTING,
|
||||||
|
MODEL_FORUM_REPORT,
|
||||||
|
} from "@/app_modules/forum/model/interface";
|
||||||
|
import {
|
||||||
|
Badge,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconMessageCircle, IconSearch } from "@tabler/icons-react";
|
||||||
|
import { IconFlag3 } from "@tabler/icons-react";
|
||||||
|
import { IconEyeCheck, IconTrash } from "@tabler/icons-react";
|
||||||
|
import _, { isEmpty } 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";
|
||||||
|
import { adminForum_getListPosting } from "../fun/get/get_list_publish";
|
||||||
|
import adminJob_getListPublish from "@/app_modules/admin/job/fun/get/get_list_publish";
|
||||||
|
import ComponentAdminForum_ButtonDeletePosting from "../component/button_delete";
|
||||||
|
import adminForum_funGetAllReportPosting from "../fun/get/get_all_report_posting";
|
||||||
|
import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data";
|
||||||
|
|
||||||
|
export default function AdminForum_TableReportPosting({
|
||||||
|
listData,
|
||||||
|
}: {
|
||||||
|
listData: any;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Forum" />
|
||||||
|
<TableView listData={listData} />
|
||||||
|
{/* <pre>{JSON.stringify(listPublish, null, 2)}</pre> */}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableView({ listData }: { listData: any }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [data, setData] = useState<MODEL_FORUM_REPORT[]>(listData.data);
|
||||||
|
const [nPage, setNPage] = useState(listData.nPage);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
setActivePage(1);
|
||||||
|
const loadData = await adminForum_funGetAllReportPosting({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminForum_funGetAllReportPosting({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onLoadData() {
|
||||||
|
const loadData = await adminForum_funGetAllReportPosting({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TableRows = data?.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text lineClamp={1}>{e?.User.username}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
{e?.forumMaster_KategoriReportId === null ? (
|
||||||
|
<Text>Lainnya</Text>
|
||||||
|
) : (
|
||||||
|
<Text lineClamp={1}>{e?.ForumMaster_KategoriReport.title}</Text>
|
||||||
|
)}
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Text lineClamp={1}>{e?.Forum_Posting.Author.username}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Box w={400}>
|
||||||
|
<Spoiler
|
||||||
|
// w={400}
|
||||||
|
maxHeight={60}
|
||||||
|
hideLabel="sembunyikan"
|
||||||
|
showLabel="tampilkan"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: e?.Forum_Posting.diskusi,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Center w={200}>
|
||||||
|
<Badge
|
||||||
|
color={
|
||||||
|
(e?.Forum_Posting.ForumMaster_StatusPosting?.id as any) === 1
|
||||||
|
? "green"
|
||||||
|
: "red"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{e?.Forum_Posting.ForumMaster_StatusPosting?.status}
|
||||||
|
</Badge>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Center w={150}>
|
||||||
|
<Text>
|
||||||
|
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
||||||
|
e.createdAt
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Stack align="center" spacing={"xs"}>
|
||||||
|
{/* <ButtonAction postingId={e?.id} /> */}
|
||||||
|
<ButtonLihatReportLainnya postingId={e?.forum_PostingId} />
|
||||||
|
<ComponentAdminForum_ButtonDeletePosting
|
||||||
|
postingId={e?.forum_PostingId}
|
||||||
|
onSuccesDelete={(val) => {
|
||||||
|
if (val) {
|
||||||
|
onLoadData();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"orange.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4} c={"white"}>
|
||||||
|
Report Posting
|
||||||
|
</Title>
|
||||||
|
<TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Cari postingan"
|
||||||
|
onChange={(val) => {
|
||||||
|
// console.log(val.currentTarget.value)
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
{isEmpty(data) ? (
|
||||||
|
<ComponentAdminGlobal_IsEmptyData />
|
||||||
|
) : (
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={"100%"}
|
||||||
|
h={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Pelapor</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Jenis Laporan</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Author</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Text>Postingan</Text>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center w={200}>Status Posting</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Tanggal Report</Center>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{TableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={activePage}
|
||||||
|
total={nPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ButtonLihatReportLainnya({ postingId }: { postingId: string }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
fz={"xs"}
|
||||||
|
loading={loading ? true : false}
|
||||||
|
loaderPosition="center"
|
||||||
|
radius={"xl"}
|
||||||
|
w={170}
|
||||||
|
leftIcon={<IconFlag3 size={15} />}
|
||||||
|
onClick={() => {
|
||||||
|
setLoading(true);
|
||||||
|
router.push(RouterAdminForum.report_posting + postingId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text>Lihat Report Lain</Text>
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
||||||
import { Center, Image, Stack } from "@mantine/core";
|
import { Center, Image, Stack } from "@mantine/core";
|
||||||
import ComponentGlobalAdmin_BackButton from "../../component_global/back_button";
|
import ComponentAdminGlobal_BackButton from "../../component_global/back_button";
|
||||||
|
|
||||||
export default function AdminJob_DetailPoster({
|
export default function AdminJob_DetailPoster({
|
||||||
imageId,
|
imageId,
|
||||||
@@ -12,7 +12,7 @@ export default function AdminJob_DetailPoster({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentGlobalAdmin_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<Center>
|
<Center>
|
||||||
<Image
|
<Image
|
||||||
alt="Foto"
|
alt="Foto"
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ import { listAdminPage } from "./list_page";
|
|||||||
import adminNotifikasi_countNotifikasi from "./notifikasi/fun/count/count_is_read";
|
import adminNotifikasi_countNotifikasi from "./notifikasi/fun/count/count_is_read";
|
||||||
import adminNotifikasi_getByUserId from "./notifikasi/fun/get/get_notifikasi_by_user_id";
|
import adminNotifikasi_getByUserId from "./notifikasi/fun/get/get_notifikasi_by_user_id";
|
||||||
import adminNotifikasi_funUpdateIsReadById from "./notifikasi/fun/update/fun_update_is_read_by_id";
|
import adminNotifikasi_funUpdateIsReadById from "./notifikasi/fun/update/fun_update_is_read_by_id";
|
||||||
|
import adminNotifikasi_findRouterJob from "./notifikasi/route_setting/job";
|
||||||
|
import adminNotifikasi_findRouterForum from "./notifikasi/route_setting/forum";
|
||||||
|
|
||||||
export default function AdminLayout({
|
export default function AdminLayout({
|
||||||
children,
|
children,
|
||||||
@@ -388,13 +390,25 @@ function DrawerNotifikasi({
|
|||||||
}}
|
}}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
e?.kategoriApp === "JOB" &&
|
e?.kategoriApp === "JOB" &&
|
||||||
findRouterJob({
|
adminNotifikasi_findRouterJob({
|
||||||
data: e,
|
data: e,
|
||||||
router: router,
|
router: router,
|
||||||
onChangeNavbar2: (val: any) => {
|
onChangeNavbar: (val: any) => {
|
||||||
onChangeNavbar(val);
|
onChangeNavbar(val);
|
||||||
},
|
},
|
||||||
onToggleNavbar2: onToggleNavbar,
|
onToggleNavbar: onToggleNavbar,
|
||||||
|
});
|
||||||
|
|
||||||
|
e?.kategoriApp === "FORUM" &&
|
||||||
|
adminNotifikasi_findRouterForum({
|
||||||
|
data: e,
|
||||||
|
router: router,
|
||||||
|
onChangeNavbar(val) {
|
||||||
|
onChangeNavbar(val);
|
||||||
|
},
|
||||||
|
onToggleNavbar(val) {
|
||||||
|
onToggleNavbar(val);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateIsRead = await adminNotifikasi_funUpdateIsReadById({
|
const updateIsRead = await adminNotifikasi_funUpdateIsReadById({
|
||||||
@@ -480,35 +494,3 @@ function DrawerNotifikasi({
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findRouterJob({
|
|
||||||
data,
|
|
||||||
router,
|
|
||||||
onChangeNavbar2,
|
|
||||||
onToggleNavbar2,
|
|
||||||
}: {
|
|
||||||
data: MODEL_NOTIFIKASI;
|
|
||||||
router: AppRouterInstance;
|
|
||||||
onChangeNavbar2: (val: any) => void;
|
|
||||||
onToggleNavbar2: (val: any) => void;
|
|
||||||
}) {
|
|
||||||
const routeName = "/dev/admin/job/child/";
|
|
||||||
|
|
||||||
if (data.status === "Review") {
|
|
||||||
router.push(routeName + _.lowerCase(data.status));
|
|
||||||
onChangeNavbar2({
|
|
||||||
id: 6,
|
|
||||||
childId: 63,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.status === "Draft") {
|
|
||||||
router.push(routeName + "review");
|
|
||||||
onChangeNavbar2({
|
|
||||||
id: 6,
|
|
||||||
childId: 63,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onToggleNavbar2(true);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -229,13 +229,13 @@ export const listAdminPage = [
|
|||||||
{
|
{
|
||||||
id: 72,
|
id: 72,
|
||||||
name: "Table Posting",
|
name: "Table Posting",
|
||||||
path: RouterAdminForum.publish,
|
path: RouterAdminForum.table_posting,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 73,
|
||||||
|
name: "Report Posting",
|
||||||
|
path: RouterAdminForum.table_report_posting,
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// id: 73,
|
|
||||||
// name: "Laporan Posting",
|
|
||||||
// path: RouterAdminForum.report_posting,
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// id: 74,
|
// id: 74,
|
||||||
// name: "Laporan Komentar",
|
// name: "Laporan Komentar",
|
||||||
|
|||||||
22
src/app_modules/admin/notifikasi/route_setting/forum.ts
Normal file
22
src/app_modules/admin/notifikasi/route_setting/forum.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
|
||||||
|
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||||
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
|
|
||||||
|
export default async function adminNotifikasi_findRouterForum({
|
||||||
|
data,
|
||||||
|
router,
|
||||||
|
onChangeNavbar,
|
||||||
|
onToggleNavbar,
|
||||||
|
}: {
|
||||||
|
data: MODEL_NOTIFIKASI;
|
||||||
|
router: AppRouterInstance;
|
||||||
|
onChangeNavbar: (val: any) => void;
|
||||||
|
onToggleNavbar: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const routeName = RouterAdminForum.table_report_posting;
|
||||||
|
router.push(routeName);
|
||||||
|
onChangeNavbar({
|
||||||
|
id: 7,
|
||||||
|
childId: 73,
|
||||||
|
});
|
||||||
|
}
|
||||||
35
src/app_modules/admin/notifikasi/route_setting/job.ts
Normal file
35
src/app_modules/admin/notifikasi/route_setting/job.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
|
|
||||||
|
export default async function adminNotifikasi_findRouterJob({
|
||||||
|
data,
|
||||||
|
router,
|
||||||
|
onChangeNavbar,
|
||||||
|
onToggleNavbar,
|
||||||
|
}: {
|
||||||
|
data: MODEL_NOTIFIKASI;
|
||||||
|
router: AppRouterInstance;
|
||||||
|
onChangeNavbar: (val: any) => void;
|
||||||
|
onToggleNavbar: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const routeName = "/dev/admin/job/child/";
|
||||||
|
|
||||||
|
if (data.status === "Review") {
|
||||||
|
router.push(routeName + _.lowerCase(data.status));
|
||||||
|
onChangeNavbar({
|
||||||
|
id: 6,
|
||||||
|
childId: 63,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.status === "Draft") {
|
||||||
|
router.push(routeName + "review");
|
||||||
|
onChangeNavbar({
|
||||||
|
id: 6,
|
||||||
|
childId: 63,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onToggleNavbar(true);
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import SplashScreen from "./splash/view";
|
import SplashScreen from "./splash/view";
|
||||||
import Login from "./login/view";
|
import Login from "./login/view";
|
||||||
import Validasi from "./validasi/view";
|
import Validasi from "./validasi/view";
|
||||||
import LayoutValidasi from "./validasi/layout";
|
|
||||||
import Register from "./register/view";
|
import Register from "./register/view";
|
||||||
import User_Logout from "./logout/view";
|
import User_Logout from "./logout/view";
|
||||||
|
|
||||||
@@ -11,5 +10,4 @@ export {
|
|||||||
Validasi,
|
Validasi,
|
||||||
Register,
|
Register,
|
||||||
User_Logout as Logout,
|
User_Logout as Logout,
|
||||||
LayoutValidasi,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export default function Login() {
|
|||||||
|
|
||||||
async function onLogin() {
|
async function onLogin() {
|
||||||
const nomorHp = phone.substring(1);
|
const nomorHp = phone.substring(1);
|
||||||
console.log(nomorHp);
|
|
||||||
|
|
||||||
if (nomorHp.length <= 4) return setError(true);
|
if (nomorHp.length <= 4) return setError(true);
|
||||||
|
|
||||||
@@ -117,6 +116,7 @@ export default function Login() {
|
|||||||
<Button
|
<Button
|
||||||
radius={"md"}
|
radius={"md"}
|
||||||
bg={MainColor.yellow}
|
bg={MainColor.yellow}
|
||||||
|
color={"yellow"}
|
||||||
loading={loading ? true : false}
|
loading={loading ? true : false}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
c={"black"}
|
c={"black"}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
PinInput,
|
PinInput,
|
||||||
Stack,
|
Stack,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconCircleLetterH, IconCloudLockOpen } from "@tabler/icons-react";
|
import { IconCircleLetterH, IconCloudLockOpen, IconUserCircle } from "@tabler/icons-react";
|
||||||
import { gs_nomor } from "../state/state";
|
import { gs_nomor } from "../state/state";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -28,6 +28,7 @@ import { IconPencilCheck } from "@tabler/icons-react";
|
|||||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||||
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||||
|
import { AccentColor, MainColor } from "@/app_modules/component_global/color/color_pallet";
|
||||||
|
|
||||||
export default function Register({ dataOtp }: { dataOtp: any }) {
|
export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -72,8 +73,68 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
|
|||||||
<>
|
<>
|
||||||
{/* <pre>{JSON.stringify(dataOtp,null,2)}</pre> */}
|
{/* <pre>{JSON.stringify(dataOtp,null,2)}</pre> */}
|
||||||
|
|
||||||
<Center>
|
<Center bg={MainColor.darkblue} h={"100vh"}>
|
||||||
<Stack
|
<Stack h={"100%"} align="center" justify="center" spacing={70}>
|
||||||
|
<Title order={2} c={MainColor.yellow}>
|
||||||
|
REGISTRASI
|
||||||
|
</Title>
|
||||||
|
|
||||||
|
<IconUserCircle size={100} color="white" />
|
||||||
|
|
||||||
|
<Stack spacing={"sm"} w={300}>
|
||||||
|
<Text fz={10} c={"white"}>
|
||||||
|
Anda akan terdaftar dengan nomor berikut{" "}
|
||||||
|
<Text inherit span fw={"bold"}>
|
||||||
|
+{nomor}
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
<TextInput
|
||||||
|
ref={focusTrapRef}
|
||||||
|
placeholder="Masukan Username"
|
||||||
|
maxLength={50}
|
||||||
|
error={
|
||||||
|
value.length > 0 && value.length < 5 ? (
|
||||||
|
<ComponentGlobal_ErrorInput text="Minimal 5 karakter !" />
|
||||||
|
) : _.values(value).includes(" ") ? (
|
||||||
|
<Stack spacing={5}>
|
||||||
|
<ComponentGlobal_ErrorInput text="Tidak boleh ada space" />
|
||||||
|
<ComponentGlobal_ErrorInput text="Sambungkan huruf meggunakan karakter _" />
|
||||||
|
</Stack>
|
||||||
|
) : isValue ? (
|
||||||
|
<ComponentGlobal_ErrorInput text="Masukan username anda" />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onChange={(val) => {
|
||||||
|
val.currentTarget.value.length > 0 ? setIsValue(false) : "";
|
||||||
|
setValue(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Stack>
|
||||||
|
<Button
|
||||||
|
loading={loading ? true : false}
|
||||||
|
loaderPosition="center"
|
||||||
|
radius={"md"}
|
||||||
|
compact
|
||||||
|
h={40}
|
||||||
|
c={"black"}
|
||||||
|
bg={MainColor.yellow}
|
||||||
|
color={"yellow"}
|
||||||
|
style={{
|
||||||
|
borderColor: AccentColor.yellow,
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
onRegistarsi();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text>DAFTAR</Text>
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack
|
||||||
px={"lg"}
|
px={"lg"}
|
||||||
spacing={70}
|
spacing={70}
|
||||||
w={{ base: 400 }}
|
w={{ base: 400 }}
|
||||||
@@ -137,7 +198,7 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
</Center>
|
</Center>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { ActionIcon, Box, Stack } from "@mantine/core";
|
|
||||||
import { IconChevronLeft } from "@tabler/icons-react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export default function LayoutValidasi({
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}) {
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack >
|
|
||||||
<Box
|
|
||||||
bg={"white"}
|
|
||||||
p={"md"}
|
|
||||||
style={{
|
|
||||||
position: "sticky",
|
|
||||||
top: 0,
|
|
||||||
zIndex: 99,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ActionIcon variant="transparent" onClick={() => router.back()}>
|
|
||||||
<IconChevronLeft />
|
|
||||||
</ActionIcon>
|
|
||||||
</Box>
|
|
||||||
{children}
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,41 +1,32 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useAtom } from "jotai";
|
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||||
|
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||||
|
import {
|
||||||
|
AccentColor,
|
||||||
|
MainColor,
|
||||||
|
} from "@/app_modules/component_global/color/color_pallet";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Flex,
|
|
||||||
PinInput,
|
PinInput,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
Title,
|
Title
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { gs_nomor, gs_otp } from "../state/state";
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { myConsole } from "@/app/fun/my_console";
|
|
||||||
import {
|
|
||||||
IconChevronLeft,
|
|
||||||
IconCircleLetterH,
|
|
||||||
IconCloudLockOpen,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import { ApiHipmi } from "@/app/lib/api";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { funGetUserProfile } from "@/app_modules/fun_global/get_user_profile";
|
|
||||||
import { useFocusTrap } from "@mantine/hooks";
|
import { useFocusTrap } from "@mantine/hooks";
|
||||||
import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil";
|
import {
|
||||||
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
IconChevronLeft
|
||||||
import { NotifPeringatan } from "@/app_modules/donasi/component/notifikasi/notif_peringatan";
|
} from "@tabler/icons-react";
|
||||||
import Countdown from "react-countdown";
|
import { useRouter } from "next/navigation";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
import { useState } from "react";
|
||||||
import { auth_funValidasi } from "../fun/fun_validasi";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
|
||||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
|
||||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
|
||||||
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
import { auth_funValidasi } from "../fun/fun_validasi";
|
||||||
|
|
||||||
export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -45,37 +36,6 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
|||||||
const focusTrapRef = useFocusTrap();
|
const focusTrapRef = useFocusTrap();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const onValid = async () => {
|
|
||||||
// MyConsole(inputCode)
|
|
||||||
const body = {
|
|
||||||
nomor: nomor,
|
|
||||||
otp: code,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!inputCode) return toast("Lengkapi Kode");
|
|
||||||
if (body.otp != inputCode) return toast("Kode Salah");
|
|
||||||
|
|
||||||
// await fetch(ApiHipmi.validasi, {
|
|
||||||
// method: "POST",
|
|
||||||
// headers: {
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// },
|
|
||||||
// body: JSON.stringify(body),
|
|
||||||
// })
|
|
||||||
// .then((res) => res.json())
|
|
||||||
// .then((val) => {
|
|
||||||
// myConsole(val);
|
|
||||||
// if (val.status == 200) {
|
|
||||||
// setTimeout(() => router.push("/dev/home"), 2000);
|
|
||||||
// funGetUserProfile(val.data.id);
|
|
||||||
// NotifBerhasil("Berhasil Login");
|
|
||||||
// } else {
|
|
||||||
// router.push("/dev/auth/register");
|
|
||||||
// NotifPeringatan("Silahkan Registrasi");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
};
|
|
||||||
|
|
||||||
async function onVerifikasi() {
|
async function onVerifikasi() {
|
||||||
if (!inputCode)
|
if (!inputCode)
|
||||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Kode");
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Kode");
|
||||||
@@ -106,23 +66,32 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Center h={"100vh"}>
|
<Stack bg={MainColor.darkblue} h={"100vh"}>
|
||||||
<Stack px={"lg"} spacing={"xl"} w={{ base: 400 }} justify="center">
|
<Box
|
||||||
<Center>
|
pt={"md"}
|
||||||
<IconCloudLockOpen size={130} />
|
px={"md"}
|
||||||
</Center>
|
style={{
|
||||||
|
position: "sticky",
|
||||||
|
top: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ActionIcon variant="transparent" onClick={() => router.back()}>
|
||||||
|
<IconChevronLeft color="white" />
|
||||||
|
</ActionIcon>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Stack spacing={50}>
|
<Stack align="center" justify="center" h={"100vh"} spacing={70}>
|
||||||
<Stack spacing={0}>
|
<Title order={2} color={MainColor.yellow}>
|
||||||
<Title order={4}>Verifikasi Kode OTP</Title>
|
Verifikasi Kode OTP
|
||||||
<Text fs={"italic"} fz={"xs"}>
|
</Title>
|
||||||
Silahkan masukan 4 digit kode otp yang dikirim ke{" "}
|
|
||||||
<Text span inherit fw={"bold"}>
|
|
||||||
+{nomor}
|
|
||||||
</Text>
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
|
<Stack spacing={0} align="center">
|
||||||
|
<Text fz={"xs"} c={"white"}>
|
||||||
|
Masukan 4 digit kode otp
|
||||||
|
</Text>
|
||||||
|
<Text fz={"xs"} c={"white"}>
|
||||||
|
Yang dikirim ke <Text span inherit fw={"bold"}> +{nomor}</Text>
|
||||||
|
</Text>
|
||||||
<Center>
|
<Center>
|
||||||
<PinInput
|
<PinInput
|
||||||
ref={focusTrapRef}
|
ref={focusTrapRef}
|
||||||
@@ -133,24 +102,28 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
<Stack>
|
|
||||||
<Button
|
|
||||||
loading={loading ? true : false}
|
|
||||||
loaderPosition="center"
|
|
||||||
radius={"md"}
|
|
||||||
compact
|
|
||||||
h={40}
|
|
||||||
color={"teal"}
|
|
||||||
onClick={() => {
|
|
||||||
onVerifikasi();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text>VERIFIKASI</Text>
|
|
||||||
</Button>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<Button
|
||||||
|
w={300}
|
||||||
|
loading={loading ? true : false}
|
||||||
|
loaderPosition="center"
|
||||||
|
radius={"md"}
|
||||||
|
compact
|
||||||
|
h={40}
|
||||||
|
c={"black"}
|
||||||
|
bg={MainColor.yellow}
|
||||||
|
color={"yellow"}
|
||||||
|
style={{
|
||||||
|
borderColor: AccentColor.yellow,
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
onVerifikasi();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text>VERIFIKASI</Text>
|
||||||
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Center>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,11 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
|
import _ from "lodash";
|
||||||
import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||||
import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id";
|
import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id";
|
||||||
import forum_v2_getAllPosting from "../../fun/get/v2_get_all_posting";
|
|
||||||
import { forum_new_getAllPosting } from "../../fun/get/new_get_all_posting";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { MODEL_FORUM_POSTING } from "../../model/interface";
|
import { MODEL_FORUM_POSTING } from "../../model/interface";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
|
||||||
|
|
||||||
export default function ComponentForum_V2_CardMoreButton({
|
export default function ComponentForum_V2_CardMoreButton({
|
||||||
authorId,
|
authorId,
|
||||||
|
|||||||
@@ -4,22 +4,20 @@ import prisma from "@/app/lib/prisma";
|
|||||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function forum_funCreateReportPosting(
|
export async function forum_funCreateReportPosting({
|
||||||
postingId: string,
|
postingId,
|
||||||
value: string,
|
kategoriId,
|
||||||
) {
|
}: {
|
||||||
|
postingId: string;
|
||||||
|
kategoriId: number;
|
||||||
|
}) {
|
||||||
const authorId = await user_getOneUserId();
|
const authorId = await user_getOneUserId();
|
||||||
const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
|
||||||
where: {
|
|
||||||
title: value,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const createReport = await prisma.forum_ReportPosting.create({
|
const createReport = await prisma.forum_ReportPosting.create({
|
||||||
data: {
|
data: {
|
||||||
userId: authorId,
|
userId: authorId,
|
||||||
forum_PostingId: postingId,
|
forum_PostingId: postingId,
|
||||||
forumMaster_KategoriReportId: cekId?.id,
|
forumMaster_KategoriReportId: kategoriId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
17
src/app_modules/forum/fun/get/get_one_kategori_by_id.ts
Normal file
17
src/app_modules/forum/fun/get/get_one_kategori_by_id.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function forum_getOneKategoriById({
|
||||||
|
kategoriId,
|
||||||
|
}: {
|
||||||
|
kategoriId: number;
|
||||||
|
}) {
|
||||||
|
const cekData = await prisma.forumMaster_KategoriReport.findFirst({
|
||||||
|
where: {
|
||||||
|
id: kategoriId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return cekData
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
"use server"
|
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
|
||||||
|
|
||||||
|
|
||||||
export default async function forum_v2_getAllPosting({search}: {search?: string}) {
|
|
||||||
const getData = await prisma.forum_Posting.findMany({
|
|
||||||
// take: takeData,
|
|
||||||
// skip: skipData,
|
|
||||||
orderBy: {
|
|
||||||
createdAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
isActive: true,
|
|
||||||
diskusi: {
|
|
||||||
mode: "insensitive",
|
|
||||||
contains: search,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
diskusi: true,
|
|
||||||
createdAt: true,
|
|
||||||
isActive: true,
|
|
||||||
authorId: true,
|
|
||||||
Author: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
username: true,
|
|
||||||
Profile: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
imagesId: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Forum_Komentar: {
|
|
||||||
where: {
|
|
||||||
isActive: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ForumMaster_StatusPosting: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return getData
|
|
||||||
}
|
|
||||||
@@ -1,50 +1,30 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
|
||||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
|
||||||
import {
|
|
||||||
Affix,
|
|
||||||
rem,
|
|
||||||
ActionIcon,
|
|
||||||
Card,
|
|
||||||
CardSection,
|
|
||||||
Text,
|
|
||||||
Stack,
|
|
||||||
Divider,
|
|
||||||
Group,
|
|
||||||
Box,
|
|
||||||
TextInput,
|
|
||||||
Center,
|
|
||||||
Button,
|
|
||||||
Pagination,
|
|
||||||
Loader,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { useShallowEffect, useTimeout, useWindowScroll } from "@mantine/hooks";
|
|
||||||
import {
|
|
||||||
IconCirclePlus,
|
|
||||||
IconMessageCircle,
|
|
||||||
IconPencilPlus,
|
|
||||||
IconSearch,
|
|
||||||
IconSearchOff,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import ComponentForum_PostingAuthorNameOnHeader from "../component/header/posting_author_header_name";
|
|
||||||
import { useState } from "react";
|
|
||||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2";
|
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import { gs_forum_loading_edit_posting } from "../global_state";
|
|
||||||
import { MODEL_FORUM_POSTING } from "../model/interface";
|
|
||||||
import ComponentForum_MainCardView from "../component/main_card_view";
|
|
||||||
import { forum_getListAllPosting } from "../fun/get/get_list_all_posting";
|
|
||||||
import { forum_funSearchListPosting } from "../fun/search/fun_search_list_posting";
|
|
||||||
import _ from "lodash";
|
|
||||||
import ComponentForum_BerandaCardView from "../component/beranda/beranda_card";
|
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Affix,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Loader,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
rem
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { useShallowEffect, useWindowScroll } from "@mantine/hooks";
|
||||||
|
import {
|
||||||
|
IconPencilPlus,
|
||||||
|
IconSearchOff
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
import ComponentForum_V2_MainCardView from "../component/main_component/card_view";
|
import ComponentForum_V2_MainCardView from "../component/main_component/card_view";
|
||||||
import { forum_new_getAllPosting } from "../fun/get/new_get_all_posting";
|
import { forum_new_getAllPosting } from "../fun/get/new_get_all_posting";
|
||||||
import forum_v2_getAllPosting from "../fun/get/v2_get_all_posting";
|
import { MODEL_FORUM_POSTING } from "../model/interface";
|
||||||
import { ScrollOnly } from "next-scroll-loader";
|
|
||||||
|
|
||||||
export default function Forum_Beranda({
|
export default function Forum_Beranda({
|
||||||
listForum,
|
listForum,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export interface MODEL_FORUM_POSTING {
|
|||||||
Forum_Komentar: MODEL_FORUM_KOMENTAR[];
|
Forum_Komentar: MODEL_FORUM_KOMENTAR[];
|
||||||
Forum_ReportPosting: MODEL_FORUM_MASTER_REPORT[];
|
Forum_ReportPosting: MODEL_FORUM_MASTER_REPORT[];
|
||||||
ForumMaster_StatusPosting: MODEL_FORUM_MASTER_STATUS;
|
ForumMaster_StatusPosting: MODEL_FORUM_MASTER_STATUS;
|
||||||
forumMaster_StatusPostingId: number
|
forumMaster_StatusPostingId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MODEL_FORUM_KOMENTAR {
|
export interface MODEL_FORUM_KOMENTAR {
|
||||||
@@ -53,5 +53,8 @@ export interface MODEL_FORUM_REPORT {
|
|||||||
deskripsi: string;
|
deskripsi: string;
|
||||||
ForumMaster_KategoriReport: MODEL_FORUM_MASTER_REPORT;
|
ForumMaster_KategoriReport: MODEL_FORUM_MASTER_REPORT;
|
||||||
forumMaster_KategoriReportId: string;
|
forumMaster_KategoriReportId: string;
|
||||||
|
forum_PostingId: string;
|
||||||
|
Forum_Posting: MODEL_FORUM_POSTING;
|
||||||
|
userId: string;
|
||||||
User: MODEL_USER;
|
User: MODEL_USER;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
|||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||||
|
import forum_getOneKategoriById from "../../fun/get/get_one_kategori_by_id";
|
||||||
|
import { toNumber } from "lodash";
|
||||||
|
|
||||||
export default function Forum_ReportPosting({
|
export default function Forum_ReportPosting({
|
||||||
postingId,
|
postingId,
|
||||||
@@ -21,17 +23,22 @@ export default function Forum_ReportPosting({
|
|||||||
listReport: MODEL_FORUM_MASTER_REPORT[];
|
listReport: MODEL_FORUM_MASTER_REPORT[];
|
||||||
userLoginId: string;
|
userLoginId: string;
|
||||||
}) {
|
}) {
|
||||||
const [reportValue, setReportValue] = useState("Kebencian");
|
const [reportValue, setReportValue] = useState("1");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={"sm"}>
|
<Stack px={"sm"}>
|
||||||
<Radio.Group value={reportValue as any} onChange={setReportValue}>
|
<Radio.Group
|
||||||
|
value={reportValue as any}
|
||||||
|
onChange={(val: any) => {
|
||||||
|
setReportValue(val);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Stack spacing={"xl"}>
|
<Stack spacing={"xl"}>
|
||||||
{listReport.map((e) => (
|
{listReport.map((e) => (
|
||||||
<Stack key={e.id}>
|
<Stack key={e?.id.toString()}>
|
||||||
<Radio
|
<Radio
|
||||||
value={e.title}
|
value={e.id.toString()}
|
||||||
label={<Title order={5}>{e.title}</Title>}
|
label={<Title order={5}>{e.title}</Title>}
|
||||||
/>
|
/>
|
||||||
<Text>{e.deskripsi}</Text>
|
<Text>{e.deskripsi}</Text>
|
||||||
@@ -40,7 +47,7 @@ export default function Forum_ReportPosting({
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
<ButtonAction
|
<ButtonAction
|
||||||
value={reportValue}
|
kategoriId={toNumber(reportValue)}
|
||||||
postingId={postingId}
|
postingId={postingId}
|
||||||
userLoginId={userLoginId}
|
userLoginId={userLoginId}
|
||||||
/>
|
/>
|
||||||
@@ -50,11 +57,11 @@ export default function Forum_ReportPosting({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ButtonAction({
|
function ButtonAction({
|
||||||
value,
|
kategoriId,
|
||||||
postingId,
|
postingId,
|
||||||
userLoginId,
|
userLoginId,
|
||||||
}: {
|
}: {
|
||||||
value: string;
|
kategoriId: number;
|
||||||
postingId: string;
|
postingId: string;
|
||||||
userLoginId: string;
|
userLoginId: string;
|
||||||
}) {
|
}) {
|
||||||
@@ -62,27 +69,36 @@ function ButtonAction({
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
async function onReport() {
|
async function onReport() {
|
||||||
const report = await forum_funCreateReportPosting(postingId, value);
|
const report = await forum_funCreateReportPosting({
|
||||||
|
postingId: postingId,
|
||||||
|
kategoriId: kategoriId,
|
||||||
|
});
|
||||||
if (report.status === 201) {
|
if (report.status === 201) {
|
||||||
|
const getKategori = await forum_getOneKategoriById({
|
||||||
|
kategoriId: toNumber(kategoriId),
|
||||||
|
});
|
||||||
|
console.log(getKategori);
|
||||||
|
|
||||||
ComponentGlobal_NotifikasiBerhasil(report.message, 2000);
|
ComponentGlobal_NotifikasiBerhasil(report.message, 2000);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
router.back();
|
router.back();
|
||||||
|
|
||||||
// const dataNotif = {
|
const dataNotif = {
|
||||||
// appId: postingId,
|
appId: postingId,
|
||||||
// pesan: value,
|
pesan: getKategori?.deskripsi,
|
||||||
// kategoriApp: "FORUM",
|
kategoriApp: "FORUM",
|
||||||
// title: "Report Posting",
|
title: getKategori?.title,
|
||||||
// userId: userLoginId,
|
userId: userLoginId,
|
||||||
// };
|
status: "Report Posting",
|
||||||
|
};
|
||||||
|
|
||||||
// const notif = await notifikasiToAdmin_funCreate({
|
const createNotifikasi = await notifikasiToAdmin_funCreate({
|
||||||
// data: dataNotif as any,
|
data: dataNotif as any,
|
||||||
// });
|
});
|
||||||
|
|
||||||
// if (notif.status === 201) {
|
if (createNotifikasi.status === 201) {
|
||||||
// mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||||
// }
|
}
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(report.message);
|
ComponentGlobal_NotifikasiGagal(report.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user