diff --git a/package.json b/package.json index 53ba7399..c1cd1e9b 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "@types/node": "20.4.5", "@types/react": "18.2.17", "@types/react-dom": "18.2.7", - "@types/react-virtualized": "^9.21.30", "@types/uuid": "^9.0.4", "autoprefixer": "10.4.14", "bufferutil": "^4.0.8", @@ -67,7 +66,6 @@ "react-responsive-carousel": "^3.2.23", "react-simple-toasts": "^5.10.0", "react-toastify": "^9.1.3", - "react-virtualized": "^9.22.5", "socket.io-client": "^4.7.2", "tailwindcss": "3.3.3", "ts-node": "^10.9.2", diff --git a/public/job/80b01061-3161-414e-980e-2fc3ac8ee1d3.jpg b/public/job/80b01061-3161-414e-980e-2fc3ac8ee1d3.jpg new file mode 100644 index 00000000..bad7a539 Binary files /dev/null and b/public/job/80b01061-3161-414e-980e-2fc3ac8ee1d3.jpg differ diff --git a/public/job/a2486cad-442a-4f4b-b09c-9c0aa7a54cab.jpg b/public/job/a2486cad-442a-4f4b-b09c-9c0aa7a54cab.jpg new file mode 100644 index 00000000..eeda6691 Binary files /dev/null and b/public/job/a2486cad-442a-4f4b-b09c-9c0aa7a54cab.jpg differ diff --git a/public/job/e5700057-a462-4085-84a4-c2a5acb36b4c.png b/public/job/e5700057-a462-4085-84a4-c2a5acb36b4c.png new file mode 100644 index 00000000..f1aa5b43 Binary files /dev/null and b/public/job/e5700057-a462-4085-84a4-c2a5acb36b4c.png differ diff --git a/src/app/dev/admin/forum/sub-detail/report-komentar/[id]/page.tsx b/src/app/dev/admin/forum/sub-detail/report-komentar/[id]/page.tsx index 32d1107c..94f2bd0f 100644 --- a/src/app/dev/admin/forum/sub-detail/report-komentar/[id]/page.tsx +++ b/src/app/dev/admin/forum/sub-detail/report-komentar/[id]/page.tsx @@ -1,15 +1,23 @@ import { AdminForum_HasilReportKomentar } from "@/app_modules/admin/forum"; import { adminForum_getListReportKomentarbyId } from "@/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id"; +import adminForum_funGetOneKomentarById from "@/app_modules/admin/forum/fun/get/get_one_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}); + const listReport = await adminForum_getListReportKomentarbyId({ + komentarId: komentarId, + page: 1, + }); + const dataKomentar = await adminForum_funGetOneKomentarById({ + komentarId: komentarId, + }); return ( <> ); diff --git a/src/app/dev/admin/forum/sub-menu/report-komentar/page.tsx b/src/app/dev/admin/forum/sub-menu/report-komentar/page.tsx new file mode 100644 index 00000000..dfff6d5b --- /dev/null +++ b/src/app/dev/admin/forum/sub-menu/report-komentar/page.tsx @@ -0,0 +1,12 @@ +import adminForum_funGetAllReportKomentar from "@/app_modules/admin/forum/fun/get/get_all_report_komentar"; +import AdminForum_TableReportKomentar from "@/app_modules/admin/forum/sub_menu/table_report_komentar"; + +export default async function Page() { + const listData = await adminForum_funGetAllReportKomentar({ page: 1 }); + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/create/loading.tsx b/src/app/dev/forum/create/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/create/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/detail/[id]/loading.tsx b/src/app/dev/forum/detail/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/detail/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/detail/[id]/layout.tsx b/src/app/dev/forum/detail/main-detail/[id]/layout.tsx similarity index 100% rename from src/app/dev/forum/detail/[id]/layout.tsx rename to src/app/dev/forum/detail/main-detail/[id]/layout.tsx diff --git a/src/app/dev/forum/detail/[id]/page.tsx b/src/app/dev/forum/detail/main-detail/[id]/page.tsx similarity index 62% rename from src/app/dev/forum/detail/[id]/page.tsx rename to src/app/dev/forum/detail/main-detail/[id]/page.tsx index 106c53ea..0c764797 100644 --- a/src/app/dev/forum/detail/[id]/page.tsx +++ b/src/app/dev/forum/detail/main-detail/[id]/page.tsx @@ -1,26 +1,33 @@ -import Forum_Detail from "@/app_modules/forum/detail"; -import { forum_getKomentarById } from "@/app_modules/forum/fun/get/get_komentar_by_id"; +import Forum_MainDetail from "@/app_modules/forum/detail/main_detail"; +import { forum_funGetAllKomentarById } from "@/app_modules/forum/fun/get/get_all_komentar_by_id"; import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id"; import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id"; import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import { redirect } from "next/navigation"; +import { forum_countTotalKomenById } from "@/app_modules/forum/fun/count/count_total_komentar_by_id"; export default async function Page({ params }: { params: { id: string } }) { let postingId = params.id; const userLoginId = await user_getOneUserId(); const dataPosting = await forum_getOnePostingById(postingId); - const listKomentar = await forum_getKomentarById(postingId); + const listKomentar = await forum_funGetAllKomentarById({ + postingId: postingId, + page: 1, + }); dataPosting?.isActive === false && redirect(RouterForum.beranda); + const countKomentar = await forum_countTotalKomenById(postingId); + return ( <> - ); diff --git a/src/app/dev/forum/detail/report-komentar/[id]/page.tsx b/src/app/dev/forum/detail/report-komentar/[id]/page.tsx new file mode 100644 index 00000000..afb7f262 --- /dev/null +++ b/src/app/dev/forum/detail/report-komentar/[id]/page.tsx @@ -0,0 +1,13 @@ +import { Forum_DetailReportKomentar } from "@/app_modules/forum"; +import forum_funGetOneReportKomentarById from "@/app_modules/forum/fun/get/get_one_report_komentar_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + const komentarId = params.id; + const dataKomentar = await forum_funGetOneReportKomentarById({ komentarId: komentarId }); + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/detail/report-posting/[id]/page.tsx b/src/app/dev/forum/detail/report-posting/[id]/page.tsx new file mode 100644 index 00000000..faa3d24a --- /dev/null +++ b/src/app/dev/forum/detail/report-posting/[id]/page.tsx @@ -0,0 +1,12 @@ +import { Forum_DetailReportPosting } from "@/app_modules/forum"; +import forum_funGetOneReportedPostingById from "@/app_modules/forum/fun/get/get_one_posting_reported_by_id"; + +export default async function Page({params}: {params: {id: string}}) { + const postingId = params.id + const dataPosting = await forum_funGetOneReportedPostingById({postingId: postingId}) + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/edit/posting/[id]/loading.tsx b/src/app/dev/forum/edit/posting/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/edit/posting/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/forumku/[id]/loading.tsx b/src/app/dev/forum/forumku/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/forumku/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/forumku/[id]/page.tsx b/src/app/dev/forum/forumku/[id]/page.tsx index ca9e99b3..2432252d 100644 --- a/src/app/dev/forum/forumku/[id]/page.tsx +++ b/src/app/dev/forum/forumku/[id]/page.tsx @@ -1,5 +1,5 @@ import { Forum_Forumku } from "@/app_modules/forum"; -import { forum_getListPostingByAuhtorId } from "@/app_modules/forum/fun/get/get_list_posting_by_author_id"; +import { forum_getAllPostingByAuhtorId } from "@/app_modules/forum/fun/get/get_list_posting_by_author_id"; import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id"; import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id"; @@ -25,7 +25,7 @@ export default async function Page({ params }: { params: { id: string } }) { // setTimeout(a, 1000); // }); - const dataPosting = await forum_getListPostingByAuhtorId(authorId); + const dataPosting = await forum_getAllPostingByAuhtorId({authorId: authorId, page: 1}); const totalPosting = await forum_countPostingByAuthorId(authorId); return ( diff --git a/src/app/dev/forum/main/loading.tsx b/src/app/dev/forum/main/loading.tsx deleted file mode 100644 index 874bc4a9..00000000 --- a/src/app/dev/forum/main/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx index 1f34498e..4c4b9439 100644 --- a/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx +++ b/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx @@ -1,11 +1,16 @@ import { Forum_ReportKomentarLainnya } from "@/app_modules/forum"; +import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; export default async function Page({ params }: { params: { id: string } }) { let komentarId = params.id; + const userLoginId = await user_getOneUserId(); return ( <> - + ); } diff --git a/src/app/dev/forum/report/komentar/[id]/loading.tsx b/src/app/dev/forum/report/komentar/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/komentar/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/komentar/[id]/page.tsx b/src/app/dev/forum/report/komentar/[id]/page.tsx index 64e4a7b4..88717b66 100644 --- a/src/app/dev/forum/report/komentar/[id]/page.tsx +++ b/src/app/dev/forum/report/komentar/[id]/page.tsx @@ -1,15 +1,19 @@ import { Forum_ReportKomentar } from "@/app_modules/forum"; import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report"; +import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; export default async function Page({ params }: { params: { id: string } }) { let komentarId = params.id; const listReport = await forum_getMasterKategoriReport(); + const userLoginId = await user_getOneUserId(); + return ( <> ); diff --git a/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx b/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx b/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx index 0d5b8cbd..3039aef6 100644 --- a/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx +++ b/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx @@ -1,11 +1,16 @@ import { Forum_ReportPostingLainnya } from "@/app_modules/forum"; +import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; export default async function Page({ params }: { params: { id: string } }) { - let postingIg = params.id; + let postingId = params.id; + const userLoginId = await user_getOneUserId() return ( <> - + ); } diff --git a/src/app/dev/forum/report/posting/[id]/loading.tsx b/src/app/dev/forum/report/posting/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/posting/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/posting/[id]/page.tsx b/src/app/dev/forum/report/posting/[id]/page.tsx index aa172433..d52c5827 100644 --- a/src/app/dev/forum/report/posting/[id]/page.tsx +++ b/src/app/dev/forum/report/posting/[id]/page.tsx @@ -1,13 +1,11 @@ import { Forum_ReportPosting } from "@/app_modules/forum"; -import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id"; import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report"; import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; export default async function Page({ params }: { params: { id: string } }) { let postingId = params.id; const listReport = await forum_getMasterKategoriReport(); - const userLoginId = await user_getOneUserId() - const dataPosting = await forum_getOnePostingById(postingId) + const userLoginId = await user_getOneUserId(); return ( <> diff --git a/src/app/dev/forum/splash/loading.tsx b/src/app/dev/forum/splash/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/splash/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/home/page.tsx b/src/app/dev/home/page.tsx index e70705ff..3469f504 100644 --- a/src/app/dev/home/page.tsx +++ b/src/app/dev/home/page.tsx @@ -26,7 +26,7 @@ export default async function Page() { return ( <> - + ); } diff --git a/src/app/dev/job/create/loading.tsx b/src/app/dev/job/create/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/create/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/arsip/[id]/loading.tsx b/src/app/dev/job/detail/arsip/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/detail/arsip/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/arsip/[id]/page.tsx b/src/app/dev/job/detail/arsip/[id]/page.tsx index e8fd9290..b37f2fd6 100644 --- a/src/app/dev/job/detail/arsip/[id]/page.tsx +++ b/src/app/dev/job/detail/arsip/[id]/page.tsx @@ -1,9 +1,9 @@ import { Job_DetailArsip } from "@/app_modules/job"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; export default async function Page({params}:{params: {id: string}}) { let jobId = params.id - const dataJob = await Job_getOneById(jobId) + const dataJob = await job_getOneById(jobId) return ( <> diff --git a/src/app/dev/job/detail/draft/[id]/loading.tsx b/src/app/dev/job/detail/draft/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/detail/draft/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/draft/[id]/page.tsx b/src/app/dev/job/detail/draft/[id]/page.tsx index eaff874d..15d14b24 100644 --- a/src/app/dev/job/detail/draft/[id]/page.tsx +++ b/src/app/dev/job/detail/draft/[id]/page.tsx @@ -1,10 +1,10 @@ import Job_DetailDraft from "@/app_modules/job/detail/draft/view"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; export default async function Page({params}: {params: {id: string}}) { let jobId = params.id - const dataJob = await Job_getOneById(jobId) + const dataJob = await job_getOneById(jobId) return ( <> diff --git a/src/app/dev/job/detail/main/[id]/loading.tsx b/src/app/dev/job/detail/main/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/detail/main/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/main/[id]/page.tsx b/src/app/dev/job/detail/main/[id]/page.tsx index 00e3a6a4..bfe9b192 100644 --- a/src/app/dev/job/detail/main/[id]/page.tsx +++ b/src/app/dev/job/detail/main/[id]/page.tsx @@ -1,11 +1,11 @@ "use server"; import { Job_MainDetail } from "@/app_modules/job"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; import app_config from "@/util/app_config"; export default async function Page({ params }: { params: { id: string } }) { const idJob = params.id; - const dataJob = await Job_getOneById(idJob); + const dataJob = await job_getOneById(idJob); return ( <> diff --git a/src/app/dev/job/detail/publish/[id]/loading.tsx b/src/app/dev/job/detail/publish/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/detail/publish/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/publish/[id]/page.tsx b/src/app/dev/job/detail/publish/[id]/page.tsx index 1558f947..6dd30830 100644 --- a/src/app/dev/job/detail/publish/[id]/page.tsx +++ b/src/app/dev/job/detail/publish/[id]/page.tsx @@ -1,9 +1,9 @@ import { Job_DetailPublish } from "@/app_modules/job"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; export default async function Page({params}: {params: {id: string}}) { let jobId = params.id - const dataJob = await Job_getOneById(jobId) + const dataJob = await job_getOneById(jobId) return ( <> diff --git a/src/app/dev/job/detail/reject/[id]/loading.tsx b/src/app/dev/job/detail/reject/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/detail/reject/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/reject/[id]/page.tsx b/src/app/dev/job/detail/reject/[id]/page.tsx index 0645612e..cd6f0206 100644 --- a/src/app/dev/job/detail/reject/[id]/page.tsx +++ b/src/app/dev/job/detail/reject/[id]/page.tsx @@ -1,10 +1,10 @@ import Job_DetailReject from "@/app_modules/job/detail/reject/view"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; export default async function Page({params}: {params: {id: string}}) { let jobId = params.id - const dataJob = await Job_getOneById(jobId) + const dataJob = await job_getOneById(jobId) return ( <> diff --git a/src/app/dev/job/detail/review/[id]/loading.tsx b/src/app/dev/job/detail/review/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/detail/review/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/detail/review/[id]/page.tsx b/src/app/dev/job/detail/review/[id]/page.tsx index 67463ad7..6dda171e 100644 --- a/src/app/dev/job/detail/review/[id]/page.tsx +++ b/src/app/dev/job/detail/review/[id]/page.tsx @@ -1,5 +1,5 @@ import Job_DetailReview from "@/app_modules/job/detail/review/view"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; import React from "react"; export default async function Page({ @@ -8,7 +8,7 @@ export default async function Page({ params: { id: React.ReactNode }; }) { let jobId = params.id; - const dataJob = await Job_getOneById(jobId) + const dataJob = await job_getOneById(jobId) return ( <> diff --git a/src/app/dev/job/edit/[id]/loading.tsx b/src/app/dev/job/edit/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/edit/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/edit/[id]/page.tsx b/src/app/dev/job/edit/[id]/page.tsx index 76da710e..baba6e04 100644 --- a/src/app/dev/job/edit/[id]/page.tsx +++ b/src/app/dev/job/edit/[id]/page.tsx @@ -1,9 +1,9 @@ import { Job_Edit } from "@/app_modules/job"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; export default async function Page({ params }: { params: { id: string } }) { let jobId = params.id; - const dataJob = await Job_getOneById(jobId); + const dataJob = await job_getOneById(jobId); return ( <> diff --git a/src/app/dev/job/main/arsip/page.tsx b/src/app/dev/job/main/arsip/page.tsx index fcd2d063..f46dce88 100644 --- a/src/app/dev/job/main/arsip/page.tsx +++ b/src/app/dev/job/main/arsip/page.tsx @@ -1,12 +1,12 @@ import { Job_Arsip } from "@/app_modules/job"; -import { Job_getListAllArsipById } from "@/app_modules/job/fun/get/get_list_all_arsip"; +import { job_getAllArsipById } from "@/app_modules/job/fun/get/get_all_arsip"; export default async function Page() { - const dataJob = await Job_getListAllArsipById() + const dataJob = await job_getAllArsipById({ page: 1 }); return ( <> - + ); } diff --git a/src/app/dev/job/main/beranda/page.tsx b/src/app/dev/job/main/beranda/page.tsx index c16c9453..1a4bce82 100644 --- a/src/app/dev/job/main/beranda/page.tsx +++ b/src/app/dev/job/main/beranda/page.tsx @@ -1,12 +1,12 @@ -import { Job_Beranda } from "@/app_modules/job"; -import { Job_getAllListPublish } from "@/app_modules/job/fun/get/get_list_all_publish"; +import { Job_ViewBeranda } from "@/app_modules/job"; +import { job_getAllListPublish } from "@/app_modules/job/fun/get/get_all_publish"; export default async function Page() { - const listJob = await Job_getAllListPublish(); + const listJob = await job_getAllListPublish({ page: 1 }); return ( <> - + ); } diff --git a/src/app/dev/job/main/loading.tsx b/src/app/dev/job/main/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/main/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/main/status/page.tsx b/src/app/dev/job/main/status/page.tsx index 3ce708be..767d88b1 100644 --- a/src/app/dev/job/main/status/page.tsx +++ b/src/app/dev/job/main/status/page.tsx @@ -1,13 +1,14 @@ import { Job_Status } from "@/app_modules/job"; -import { Job_getListStatusByStatusId } from "@/app_modules/job/fun/get/get_list_status_by_status_id"; +import job_getAllStatusDraft from "@/app_modules/job/fun/get/status/get_list_draft"; +import job_getAllStatusPublish from "@/app_modules/job/fun/get/status/get_list_publish"; +import job_getAllStatusReject from "@/app_modules/job/fun/get/status/get_list_reject"; +import job_getAllStatusReview from "@/app_modules/job/fun/get/status/get_list_review"; export default async function Page() { - const listPublish = await Job_getListStatusByStatusId("1"); - const listReview = await Job_getListStatusByStatusId("2"); - const listDraft = await Job_getListStatusByStatusId("3"); - const listReject = await Job_getListStatusByStatusId("4"); - - + const listPublish = await job_getAllStatusPublish({page: 1}); + const listReview = await job_getAllStatusReview({ page: 1 }); + const listDraft = await job_getAllStatusDraft({ page: 1 }); + const listReject = await job_getAllStatusReject({page: 1}); return ( <> diff --git a/src/app/dev/job/non_user_view/[id]/loading.tsx b/src/app/dev/job/non_user_view/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/non_user_view/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/non_user_view/[id]/page.tsx b/src/app/dev/job/non_user_view/[id]/page.tsx index 0a2a00cf..f69c2288 100644 --- a/src/app/dev/job/non_user_view/[id]/page.tsx +++ b/src/app/dev/job/non_user_view/[id]/page.tsx @@ -1,11 +1,9 @@ -"use server"; import { Job_NonUserView } from "@/app_modules/job"; -import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; -import os from "os"; +import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id"; export default async function Page({ params }: { params: { id: string } }) { let jobId = params.id; - const dataJob = await Job_getOneById(jobId); + const dataJob = await job_getOneById(jobId); // const platform = os.platform(); // const hostName = // platform === "darwin" diff --git a/src/app/dev/job/splash/loading.tsx b/src/app/dev/job/splash/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/job/splash/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/job/splash/page.tsx b/src/app/dev/job/splash/page.tsx index 5286f7dc..9e3d7f07 100644 --- a/src/app/dev/job/splash/page.tsx +++ b/src/app/dev/job/splash/page.tsx @@ -1,9 +1,9 @@ -import { Job_Splash } from "@/app_modules/job"; +import { Job_ViewSplash } from "@/app_modules/job"; export default async function Page() { return ( <> - + ); } diff --git a/src/app/emotion.tsx b/src/app/emotion.tsx index 478edabf..e8464dc0 100644 --- a/src/app/emotion.tsx +++ b/src/app/emotion.tsx @@ -1,11 +1,16 @@ "use client"; -import AppNotif from "@/app_modules/notif"; +import { MainColor } from "@/app_modules/component_global/color/color_pallet"; // import './globals.css' import { CacheProvider } from "@emotion/react"; -import { Image, MantineProvider, useEmotionCache } from "@mantine/core"; +import { + Box, + Container, + MantineProvider, + rem, + useEmotionCache, +} from "@mantine/core"; import { Notifications } from "@mantine/notifications"; import { useServerInsertedHTML } from "next/navigation"; -import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; export default function RootStyleRegistry({ @@ -35,8 +40,24 @@ export default function RootStyleRegistry({ {children} - {/* - */} + {/* + + + + */} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1e7f4898..60515f79 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,6 @@ import MqttLoader from "@/util/mqtt_loader"; import RootStyleRegistry from "./emotion"; +import { Container } from "@mantine/core"; export default function RootLayout({ children, diff --git a/src/app/lib/router_admin/router_admin_forum.ts b/src/app/lib/router_admin/router_admin_forum.ts index 9b68b6f9..0957a7b2 100644 --- a/src/app/lib/router_admin/router_admin_forum.ts +++ b/src/app/lib/router_admin/router_admin_forum.ts @@ -5,7 +5,7 @@ export const RouterAdminForum = { // sub menu table_posting: "/dev/admin/forum/sub-menu/posting", table_report_posting: "/dev/admin/forum/sub-menu/report-posting", - + table_report_komentar: "/dev/admin/forum/sub-menu/report-komentar", // detail detail_posting: "/dev/admin/forum/detail/", diff --git a/src/app/lib/router_hipmi/router_forum.ts b/src/app/lib/router_hipmi/router_forum.ts index ee955887..2666cc4b 100644 --- a/src/app/lib/router_hipmi/router_forum.ts +++ b/src/app/lib/router_hipmi/router_forum.ts @@ -13,9 +13,11 @@ export const RouterForum = { edit_komentar: "/dev/forum/edit/komentar/", //detail - main_detail: "/dev/forum/detail/", + main_detail: "/dev/forum/detail/main-detail/", + detail_report_komentar: "/dev/forum/detail/report-komentar/", + detail_report_posting: "/dev/forum/detail/report-posting/", - // komentra + // komentar komentar: "/dev/forum/komentar/", //report diff --git a/src/app/makuro/page.tsx b/src/app/makuro/page.tsx index adb83ece..62e9732c 100644 --- a/src/app/makuro/page.tsx +++ b/src/app/makuro/page.tsx @@ -47,5 +47,5 @@ export default function App() { padding: 8, }; - return ; + return <>; } diff --git a/src/app/zCoba/page.tsx b/src/app/zCoba/page.tsx index d171ef0a..6cccd737 100644 --- a/src/app/zCoba/page.tsx +++ b/src/app/zCoba/page.tsx @@ -1,16 +1,17 @@ +import ComponentGlobal_HeaderTamplate from "@/app_modules/component_global/header_tamplate"; +import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; import Coba_TestLoading from "@/app_modules/zCoba"; +import { Text } from "@mantine/core"; export default async function Page() { - - - await new Promise((a, b) => { - setTimeout(a, 3000); - }); + await new Promise((a, b) => { + setTimeout(a, 3000); + }); return ( <> - + {/* */} ); } diff --git a/src/app_modules/admin/forum/component/detail_one_komentar.tsx b/src/app_modules/admin/forum/component/detail_one_komentar.tsx new file mode 100644 index 00000000..a2ff9e49 --- /dev/null +++ b/src/app_modules/admin/forum/component/detail_one_komentar.tsx @@ -0,0 +1,64 @@ +"use client"; + +import { MODEL_FORUM_KOMENTAR, 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_ViewOneDetailKomentar({ + dataKomentar, +}: { + dataKomentar: MODEL_FORUM_KOMENTAR; +}) { + return ( + <> + + + + Detail Komentar + + + + + + + + + Username:{" "} + + {dataKomentar?.Author?.username} + + + + + {/* */} + + + + +
+ + + + + + + ); +} diff --git a/src/app_modules/admin/forum/component/detail_one_posting.tsx b/src/app_modules/admin/forum/component/detail_one_posting.tsx index 74fe370f..13312433 100644 --- a/src/app_modules/admin/forum/component/detail_one_posting.tsx +++ b/src/app_modules/admin/forum/component/detail_one_posting.tsx @@ -21,7 +21,7 @@ export default function ComponentAdminForum_ViewOneDetailPosting({ return ( <> - + Detail Posting @@ -31,9 +31,9 @@ export default function ComponentAdminForum_ViewOneDetailPosting({ - + Username:{" "} - + {dataPosting?.Author?.username} @@ -48,7 +48,7 @@ export default function ComponentAdminForum_ViewOneDetailPosting({ {dataPosting?.ForumMaster_StatusPosting?.status} - + {/* */} diff --git a/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts b/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts index 9402b709..c78daf1b 100644 --- a/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts +++ b/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts @@ -6,6 +6,9 @@ export async function adminForum_countLaporanKomentar() { const count = await prisma.forum_ReportKomentar.count({ where: { isActive: true, + Forum_Komentar: { + isActive: true, + }, }, }); diff --git a/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts b/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts index fa673c48..9e88da10 100644 --- a/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts +++ b/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts @@ -6,6 +6,9 @@ export async function adminForum_countLaporanPosting() { const count = await prisma.forum_ReportPosting.count({ where: { isActive: true, + Forum_Posting: { + isActive: true, + }, }, }); diff --git a/src/app_modules/admin/forum/fun/count/fun_count_publish.ts b/src/app_modules/admin/forum/fun/count/fun_count_publish.ts index c5fde5de..2042cc7e 100644 --- a/src/app_modules/admin/forum/fun/count/fun_count_publish.ts +++ b/src/app_modules/admin/forum/fun/count/fun_count_publish.ts @@ -6,7 +6,9 @@ export async function adminForum_countPublish() { const count = await prisma.forum_Posting.count({ where: { isActive: true, + }, + }); return count; diff --git a/src/app_modules/admin/forum/fun/get/get_all_report_komentar.ts b/src/app_modules/admin/forum/fun/get/get_all_report_komentar.ts new file mode 100644 index 00000000..e365a254 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_all_report_komentar.ts @@ -0,0 +1,98 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { ceil } from "lodash"; + +export default async function adminForum_funGetAllReportKomentar({ + page, + search, +}: { + page: number; + search?: string; +}) { + const takeData = 10; + const skipData = page * takeData - takeData; + + const data = await prisma.forum_ReportKomentar.findMany({ + take: takeData, + skip: skipData, + orderBy: { + createdAt: "desc", + }, + where: { + Forum_Komentar: { + isActive: true, + komentar: { + 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_KomentarId: true, + Forum_Komentar: { + select: { + id: true, + komentar: 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_ReportKomentar.count({ + where: { + Forum_Komentar: { + isActive: true, + komentar: { + contains: search, + mode: "insensitive", + }, + }, + }, + }); + + const allData = { + data: data, + nPage: ceil(nCount / takeData), + }; + + return allData; +} diff --git a/src/app_modules/admin/forum/fun/get/get_all_report_posting.tsx b/src/app_modules/admin/forum/fun/get/get_all_report_posting.ts similarity index 100% rename from src/app_modules/admin/forum/fun/get/get_all_report_posting.tsx rename to src/app_modules/admin/forum/fun/get/get_all_report_posting.ts diff --git a/src/app_modules/admin/forum/fun/get/get_one_komentar_by_id.ts b/src/app_modules/admin/forum/fun/get/get_one_komentar_by_id.ts new file mode 100644 index 00000000..f1f0ff57 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_one_komentar_by_id.ts @@ -0,0 +1,31 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export default async function adminForum_funGetOneKomentarById({ + komentarId, +}: { + komentarId: string; +}) { + + const data = await prisma.forum_Komentar.findFirst({ + where: { + id: komentarId, + }, + select: { + id: true, + isActive: true, + authorId: true, + Author: { + select: { + id: true, + username: true, + }, + }, + komentar: true, + forum_PostingId: true, + }, + }); + + return data; +} diff --git a/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts b/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts index 2170f4f5..a84c0949 100644 --- a/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts +++ b/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts @@ -16,6 +16,7 @@ export async function adminForum_getOnePostingById(postingId: string) { status: true, }, }, + authorId: true, Author: { select: { id: true, diff --git a/src/app_modules/admin/forum/index.tsx b/src/app_modules/admin/forum/index.tsx index 199053be..df3d8971 100644 --- a/src/app_modules/admin/forum/index.tsx +++ b/src/app_modules/admin/forum/index.tsx @@ -4,6 +4,7 @@ import AdminForum_TableReportPosting from "./sub_menu/table_report_posting"; import AdminForum_DetailPosting from "./detail/detail_posting"; import AdminForum_HasilReportPosting from "./sub_detail/hasil_report_posting"; import AdminForum_HasilReportKomentar from "./sub_detail/hasil_report_komentar"; +import AdminForum_TableReportKomentar from "./sub_menu/table_report_komentar"; export { AdminForum_Main, @@ -12,4 +13,5 @@ export { AdminForum_DetailPosting as AdminForum_LihatSemuaKomentar, AdminForum_HasilReportPosting, AdminForum_HasilReportKomentar, + AdminForum_TableReportKomentar, }; diff --git a/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx b/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx index 7ec2e6b9..3e65bfb8 100644 --- a/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx +++ b/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx @@ -1,17 +1,14 @@ "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 { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { - MODEL_FORUM_MASTER_REPORT, - MODEL_FORUM_REPORT, + MODEL_FORUM_KOMENTAR, + MODEL_FORUM_REPORT_POSTING } from "@/app_modules/forum/model/interface"; +import mqtt_client from "@/util/mqtt_client"; import { - Badge, - Box, Button, Center, Group, @@ -23,40 +20,50 @@ import { Stack, Table, Text, - TextInput, - Title, + Title } from "@mantine/core"; +import { useDisclosure } from "@mantine/hooks"; import { - IconMessageCircle, - IconFlag3, - IconTrash, - IconSearch, + IconTrash } from "@tabler/icons-react"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; -import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id"; -import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id"; -import { useDisclosure, 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"; +import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data"; +import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user"; +import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_komentar"; +import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id"; +import { adminForum_getListReportKomentarbyId } from "../fun/get/get_list_report_komentar_by_id"; +import adminForum_funGetOneKomentarById from "../fun/get/get_one_komentar_by_id"; export default function AdminForum_HasilReportKomentar({ komentarId, listReport, + dataKomentar, }: { komentarId: string; listReport: any; + dataKomentar: MODEL_FORUM_KOMENTAR; }) { + const [data, setData] = useState(dataKomentar); + console.log(komentarId); + return ( <> - + { + setData(val); + }} + /> + {/*
{JSON.stringify(listReport, null, 2)}
*/}
@@ -64,23 +71,57 @@ export default function AdminForum_HasilReportKomentar({ ); } -function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) { +function ButtonDeleteKomentar({ + komentarId, + data, + onSuccess, +}: { + komentarId: string; + data: MODEL_FORUM_KOMENTAR; + onSuccess: (val: any) => void; +}) { const router = useRouter(); const [opened, { open, close }] = useDisclosure(false); const [loadingDel2, setLoadingDel2] = useState(false); async function onDelete() { - await adminForum_funDeleteKomentarById(komentarId).then((res) => { + await adminForum_funDeleteKomentarById(komentarId).then(async (res) => { if (res.status === 200) { setLoadingDel2(false); close(); - router.back(); + + const dataKomentar = await adminForum_funGetOneKomentarById({ + komentarId: komentarId, + }); + onSuccess(dataKomentar); + + const dataNotif = { + appId: data.id, + status: "Report Komentar", + // userId harus sama seperti author + userId: data.authorId, + pesan: data.komentar, + kategoriApp: "FORUM", + title: "Komentar anda telah di laporkan", + }; + + const notif = await adminNotifikasi_funCreateToUser({ + data: dataNotif as any, + }); + if (notif.status === 201) { + mqtt_client.publish( + "USER", + JSON.stringify({ userId: data.authorId, count: 1 }) + ); + } + ComponentGlobal_NotifikasiBerhasil(res.message); } else { ComponentGlobal_NotifikasiGagal(res.message); } }); } + return ( <> @@ -111,17 +152,21 @@ function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) {
- + {data.isActive ? ( + + ) : ( + "" + )} ); } @@ -134,7 +179,9 @@ function HasilReportPosting({ komentarId: string; }) { const router = useRouter(); - const [data, setData] = useState(listReport.data); + const [data, setData] = useState( + listReport.data + ); const [nPage, setNPage] = useState(listReport.nPage); const [activePage, setActivePage] = useState(1); const [isSearch, setSearch] = useState(""); @@ -230,7 +277,7 @@ function HasilReportPosting({
Username
-
Title
+
Kategori
Deskripsi
diff --git a/src/app_modules/admin/forum/sub_detail/hasil_report_posting.tsx b/src/app_modules/admin/forum/sub_detail/hasil_report_posting.tsx index bea6c1f9..2f3bcdf5 100644 --- a/src/app_modules/admin/forum/sub_detail/hasil_report_posting.tsx +++ b/src/app_modules/admin/forum/sub_detail/hasil_report_posting.tsx @@ -5,7 +5,7 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { MODEL_FORUM_POSTING, - MODEL_FORUM_REPORT, + MODEL_FORUM_REPORT_POSTING, } from "@/app_modules/forum/model/interface"; import { Button, @@ -31,6 +31,8 @@ import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_da 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"; +import mqtt_client from "@/util/mqtt_client"; +import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user"; export default function AdminForum_HasilReportPosting({ dataPosting, @@ -45,7 +47,7 @@ export default function AdminForum_HasilReportPosting({ - + { - if (res.status === 200) { - setLoadingDel2(false); - setLoadingDel(false); - close(); - router.back(); - ComponentGlobal_NotifikasiBerhasil(res.message); - } else { - ComponentGlobal_NotifikasiGagal(res.message); + const del = await adminForum_funDeletePostingById(dataPosting.id); + if (del.status === 200) { + setLoadingDel2(false); + close(); + router.back(); + + const dataNotif = { + appId: dataPosting.id, + status: "Report Posting", + userId: dataPosting.authorId, + pesan: dataPosting.diskusi, + kategoriApp: "FORUM", + title: "Postingan anda telah di laporkan", + }; + const notif = await adminNotifikasi_funCreateToUser({ + data: dataNotif as any, + }); + if (notif.status === 201) { + mqtt_client.publish( + "USER", + JSON.stringify({ userId: dataPosting.authorId, count: 1 }) + ); } - }); + + ComponentGlobal_NotifikasiBerhasil(del.message); + } else { + ComponentGlobal_NotifikasiGagal(del.message); + } } return ( <> @@ -93,12 +116,13 @@ function ButtonDeletePosting({ postingId }: { postingId: string }) { radius={"xl"} onClick={() => { close(); - setLoadingDel(false); }} > Batal + + ); +} diff --git a/src/app_modules/admin/forum/sub_menu/table_report_posting.tsx b/src/app_modules/admin/forum/sub_menu/table_report_posting.tsx index 481dc1d7..0dac9b93 100644 --- a/src/app_modules/admin/forum/sub_menu/table_report_posting.tsx +++ b/src/app_modules/admin/forum/sub_menu/table_report_posting.tsx @@ -1,11 +1,9 @@ "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, + MODEL_FORUM_REPORT_POSTING } from "@/app_modules/forum/model/interface"; import { Badge, @@ -13,7 +11,6 @@ import { Button, Center, Group, - Modal, Pagination, Paper, ScrollArea, @@ -22,23 +19,15 @@ import { Table, Text, TextInput, - Title, + 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 { IconFlag3, IconSearch } 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 ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data"; 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, @@ -58,7 +47,7 @@ export default function AdminForum_TableReportPosting({ function TableView({ listData }: { listData: any }) { const router = useRouter(); - const [data, setData] = useState(listData.data); + const [data, setData] = useState(listData.data); const [nPage, setNPage] = useState(listData.nPage); const [activePage, setActivePage] = useState(1); const [isSearch, setSearch] = useState(""); @@ -109,7 +98,7 @@ function TableView({ listData }: { listData: any }) { - + {/*
{e?.Forum_Posting.Author.username}
@@ -130,7 +119,7 @@ function TableView({ listData }: { listData: any }) { /> - + */}
@@ -160,14 +149,14 @@ function TableView({ listData }: { listData: any }) { {/* */} - { if (val) { onLoadData(); } }} - /> + /> */} @@ -190,7 +179,7 @@ function TableView({ listData }: { listData: any }) { radius={"xl"} placeholder="Cari postingan" onChange={(val) => { - // console.log(val.currentTarget.value) + onSearch(val.currentTarget.value); }} /> @@ -218,12 +207,12 @@ function TableView({ listData }: { listData: any }) {
Jenis Laporan
- + {/*
Author
Postingan - + */}
Status Posting
diff --git a/src/app_modules/admin/list_page.tsx b/src/app_modules/admin/list_page.tsx index ae9806ee..d7e09358 100644 --- a/src/app_modules/admin/list_page.tsx +++ b/src/app_modules/admin/list_page.tsx @@ -236,11 +236,11 @@ export const listAdminPage = [ name: "Report Posting", path: RouterAdminForum.table_report_posting, }, - // { - // id: 74, - // name: "Laporan Komentar", - // path: RouterAdminForum.report_komentar, - // }, + { + id: 74, + name: "Report Komentar", + path: RouterAdminForum.table_report_komentar, + }, ], }, diff --git a/src/app_modules/admin/notifikasi/route_setting/forum.ts b/src/app_modules/admin/notifikasi/route_setting/forum.ts index 279c5dc4..99dd044a 100644 --- a/src/app_modules/admin/notifikasi/route_setting/forum.ts +++ b/src/app_modules/admin/notifikasi/route_setting/forum.ts @@ -13,10 +13,21 @@ export default async function adminNotifikasi_findRouterForum({ onChangeNavbar: (val: any) => void; onToggleNavbar: (val: any) => void; }) { - const routeName = RouterAdminForum.table_report_posting; - router.push(routeName); - onChangeNavbar({ - id: 7, - childId: 73, - }); + if (data.status === "Report Posting") { + const routeName = RouterAdminForum.table_report_posting; + router.push(routeName); + onChangeNavbar({ + id: 7, + childId: 73, + }); + } + + if (data.status === "Report Komentar") { + const routeName = RouterAdminForum.table_report_komentar; + router.push(routeName); + onChangeNavbar({ + id: 7, + childId: 74, + }); + } } diff --git a/src/app_modules/auth/login/view.tsx b/src/app_modules/auth/login/view.tsx index 8b8e87c0..d345a9b6 100644 --- a/src/app_modules/auth/login/view.tsx +++ b/src/app_modules/auth/login/view.tsx @@ -1,6 +1,7 @@ "use client"; import { + BackgroundImage, Box, Button, Center, @@ -81,56 +82,56 @@ export default function Login() { return ( <> - - - - WELCOME TO - - HIPMI APPS + + + + WELCOME TO + + HIPMI APPS + + + +
+ Nomor telepon +
+ { + setPhone(val); + }} + /> + + {isError ? ( + + ) : ( + "" + )} + + +
- - -
- Nomor telepon -
- { - setPhone(val); - }} - /> - - {isError ? ( - - ) : ( - "" - )} - - -
-
+ ); } diff --git a/src/app_modules/auth/register/view.tsx b/src/app_modules/auth/register/view.tsx index 710d8b0f..59dd2e1f 100644 --- a/src/app_modules/auth/register/view.tsx +++ b/src/app_modules/auth/register/view.tsx @@ -10,8 +10,13 @@ import { Center, PinInput, Stack, + BackgroundImage, } from "@mantine/core"; -import { IconCircleLetterH, IconCloudLockOpen, IconUserCircle } from "@tabler/icons-react"; +import { + IconCircleLetterH, + IconCloudLockOpen, + IconUserCircle, +} from "@tabler/icons-react"; import { gs_nomor } from "../state/state"; import { useAtom } from "jotai"; import { useState } from "react"; @@ -28,7 +33,10 @@ import { IconPencilCheck } from "@tabler/icons-react"; import { RouterHome } from "@/app/lib/router_hipmi/router_home"; import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input"; -import { AccentColor, MainColor } from "@/app_modules/component_global/color/color_pallet"; +import { + AccentColor, + MainColor, +} from "@/app_modules/component_global/color/color_pallet"; export default function Register({ dataOtp }: { dataOtp: any }) { const router = useRouter(); @@ -72,85 +80,26 @@ export default function Register({ dataOtp }: { dataOtp: any }) { return ( <> {/*
{JSON.stringify(dataOtp,null,2)}
*/} + +
+ + + REGISTRASI + -
- - - REGISTRASI - + - - - - - Anda akan terdaftar dengan nomor berikut{" "} - - +{nomor} + + + Anda akan terdaftar dengan nomor berikut{" "} + + +{nomor} + - - 0 && value.length < 5 ? ( - - ) : _.values(value).includes(" ") ? ( - - - - - ) : isValue ? ( - - ) : ( - "" - ) - } - onChange={(val) => { - val.currentTarget.value.length > 0 ? setIsValue(false) : ""; - setValue(val.currentTarget.value); - }} - /> - - - - - - - {/* -
- -
- - - - REGISTRASI - Masukan username anda ! - - - - Anda akan terdaftar dengan nomor berikut{" "} - - +{nomor} - - - - - - + + + -
*/} -
+
+
); } diff --git a/src/app_modules/auth/splash/view.tsx b/src/app_modules/auth/splash/view.tsx index b7ae6b7a..5ca2f9d8 100644 --- a/src/app_modules/auth/splash/view.tsx +++ b/src/app_modules/auth/splash/view.tsx @@ -1,12 +1,7 @@ "use client"; import { MainColor } from "@/app_modules/component_global/color/color_pallet"; -import { - Center, - Image, - Paper, - Stack -} from "@mantine/core"; +import { BackgroundImage, Center, Image, Paper, Stack } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; @@ -24,21 +19,28 @@ export default function SplashScreen({ data }: { data: any }) { }, 2000); } }, []); + return ( <> -
- - {/* Welcome to */} - - - - -
+ +
+ + {/* Welcome to */} + + + + +
+
); } diff --git a/src/app_modules/auth/validasi/view.tsx b/src/app_modules/auth/validasi/view.tsx index bb9c4f00..2b729418 100644 --- a/src/app_modules/auth/validasi/view.tsx +++ b/src/app_modules/auth/validasi/view.tsx @@ -11,18 +11,17 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; import { ActionIcon, + BackgroundImage, Box, Button, Center, PinInput, Stack, Text, - Title + Title, } from "@mantine/core"; import { useFocusTrap } from "@mantine/hooks"; -import { - IconChevronLeft -} from "@tabler/icons-react"; +import { IconChevronLeft } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; @@ -66,64 +65,74 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) { return ( <> - - - router.back()}> - - - - - - - Verifikasi Kode OTP - - - - - Masukan 4 digit kode otp - - - Yang dikirim ke +{nomor} - -
- { - setInputOtp(val); - }} - /> -
-
- + router.back()}> + + + + + + + Verifikasi Kode OTP + + + + + Masukan 4 digit kode otp + + + Yang dikirim ke{" "} + + {" "} + +{nomor} + + +
+ { + setInputOtp(val); + }} + /> +
+
+ +
-
+ ); } diff --git a/src/app_modules/colab/detail/chat/index.tsx b/src/app_modules/colab/detail/chat/index.tsx index 40e3c30d..4debaea7 100644 --- a/src/app_modules/colab/detail/chat/index.tsx +++ b/src/app_modules/colab/detail/chat/index.tsx @@ -1,52 +1,41 @@ "use client"; import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; +import { evnPesan } from "@/util/evn"; +import mqtt_client from "@/util/mqtt_client"; import { ActionIcon, Box, - Button, - Card, Center, - Code, Grid, Group, - Header, Loader, Paper, - ScrollArea, Stack, Text, Textarea, - Title, + Title } from "@mantine/core"; +import { useShallowEffect } from "@mantine/hooks"; import { IconChevronLeft, IconCircle, IconInfoSquareRounded, IconSend, } from "@tabler/icons-react"; -import { useRouter } from "next/navigation"; -import router from "next/router"; -import React, { useRef, useState } from "react"; -import { - MODEL_COLLABORATION_MESSAGE, - MODEL_COLLABORATION_ROOM_CHAT, -} from "../../model/interface"; import _ from "lodash"; -import ComponentColab_IsEmptyData from "../../component/is_empty_data"; -import colab_getMessageByRoomId from "../../fun/get/room_chat/get_message_by_room_id"; -import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; -import colab_funCreateMessageByUserId from "../../fun/create/room/fun_create_message_by_user_id"; -import { useShallowEffect } from "@mantine/hooks"; -import mqtt_client from "@/util/mqtt_client"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; import useInfiniteScroll, { ScrollDirection, ScrollDirectionBooleanState, } from "react-easy-infinite-scroll-hook"; -import toast from "react-simple-toasts"; -import colab_getOneMessageById from "../../fun/get/room_chat/get_one_message_by_id"; -import { List } from "react-virtualized"; -import { evnPesan } from "@/util/evn"; +import ComponentColab_IsEmptyData from "../../component/is_empty_data"; +import colab_getMessageByRoomId from "../../fun/get/room_chat/get_message_by_room_id"; +import { + MODEL_COLLABORATION_MESSAGE, + MODEL_COLLABORATION_ROOM_CHAT, +} from "../../model/interface"; const list = Array(100).fill(0); export default function ColabViewChat({ diff --git a/src/app_modules/component_global/author_name_on_header.tsx b/src/app_modules/component_global/author_name_on_header.tsx index e40f5151..940941c4 100644 --- a/src/app_modules/component_global/author_name_on_header.tsx +++ b/src/app_modules/component_global/author_name_on_header.tsx @@ -52,7 +52,11 @@ export default function ComponentGlobal_AuthorNameOnHeader({ {visible ? ( @@ -65,7 +69,11 @@ export default function ComponentGlobal_AuthorNameOnHeader({ ) : ( - + - + {authorName ? authorName : "Nama author"} {tglPublish ? ( - + {skrng.toLocaleDateString(["id-ID"], { dateStyle: "medium", })} diff --git a/src/app_modules/component_global/box_information.tsx b/src/app_modules/component_global/box_information.tsx new file mode 100644 index 00000000..e9504e1d --- /dev/null +++ b/src/app_modules/component_global/box_information.tsx @@ -0,0 +1,52 @@ +import { Center, Grid, Group, Paper, Stack, Text, Title } from "@mantine/core"; +import { AccentColor, MainColor } from "./color/color_pallet"; + +export default function ComponentGlobal_BoxInformation({ + informasi, + isReport, +}: { + informasi: string; + isReport?: boolean; +}) { + return ( + <> + {isReport ? ( + + + + * Report + + + {informasi} + + + + ) : ( + + + + *{" "} + + {informasi} + + + + + )} + + ); +} diff --git a/src/app_modules/component_global/color/color_pallet.ts b/src/app_modules/component_global/color/color_pallet.ts index 9ce5fab0..15f676ba 100644 --- a/src/app_modules/component_global/color/color_pallet.ts +++ b/src/app_modules/component_global/color/color_pallet.ts @@ -8,5 +8,6 @@ export const AccentColor = { blackgray: "#333533", darkblue: "#002E59", blue: "#00447D", + skyblue: "#00BFFF", yellow: "#FFD60A", }; diff --git a/src/app_modules/component_global/component_layout_tamplate.tsx b/src/app_modules/component_global/component_layout_tamplate.tsx index 627b36c3..135d2079 100644 --- a/src/app_modules/component_global/component_layout_tamplate.tsx +++ b/src/app_modules/component_global/component_layout_tamplate.tsx @@ -1,21 +1,9 @@ "use client"; -import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; -import { RouterUserSearch } from "@/app/lib/router_hipmi/router_user_search"; import { Box, - Center, - Title, - SimpleGrid, - Loader, - Stack, - ActionIcon, - Avatar, - Text, + Stack } from "@mantine/core"; -import { IconUserSearch, IconUserCircle } from "@tabler/icons-react"; -import router from "next/router"; -import { ComponentGlobal_NotifikasiPeringatan } from "./notif_global/notifikasi_peringatan"; export default function AppComponentGlobal_LayoutTamplate({ children, @@ -44,7 +32,7 @@ export default function AppComponentGlobal_LayoutTamplate({ {/* Children */} - + {children} {footer ? ( diff --git a/src/app_modules/component_global/is_empty_data.tsx b/src/app_modules/component_global/is_empty_data.tsx index f7418471..0cc2fe35 100644 --- a/src/app_modules/component_global/is_empty_data.tsx +++ b/src/app_modules/component_global/is_empty_data.tsx @@ -1,22 +1,22 @@ "use client"; -import { Center } from "@mantine/core"; +import { Center, Text } from "@mantine/core"; export default function ComponentGlobal_IsEmptyData({ text, height, }: { - text: string; - height?: number}) { + text?: string; + height?: number; +}) { return ( <>
- {text} + {text ? text : "Tidak Ada Data"}
); diff --git a/src/app_modules/component_global/loading_card.tsx b/src/app_modules/component_global/loading_card.tsx index ff43d946..2cd225c3 100644 --- a/src/app_modules/component_global/loading_card.tsx +++ b/src/app_modules/component_global/loading_card.tsx @@ -1,5 +1,3 @@ -"use client"; - import { Overlay, Center, Loader } from "@mantine/core"; export default function ComponentGlobal_CardLoadingOverlay({ @@ -16,7 +14,7 @@ export default function ComponentGlobal_CardLoadingOverlay({
diff --git a/src/app_modules/component_global/loading_page_v2.tsx b/src/app_modules/component_global/loading_page_v2.tsx index a36ab160..a2d24ec2 100644 --- a/src/app_modules/component_global/loading_page_v2.tsx +++ b/src/app_modules/component_global/loading_page_v2.tsx @@ -47,8 +47,8 @@ export default function ComponentGlobal_V2_LoadingPage() { <> diff --git a/src/app_modules/component_global/splash/splash_global.tsx b/src/app_modules/component_global/splash/splash_global.tsx new file mode 100644 index 00000000..97463ec2 --- /dev/null +++ b/src/app_modules/component_global/splash/splash_global.tsx @@ -0,0 +1,20 @@ +"use client"; + +import { Stack, Loader, ActionIcon, ThemeIcon } from "@mantine/core"; +import ComponentGlobal_UI_LayoutTamplate from "../ui/ui_layout_tamplate"; +import { IconMessages, IconX } from "@tabler/icons-react"; + +export default function ComponentGlobal_SplashScreen({ icon }: { icon: any }) { + return ( + <> + + + + {icon} + + + + + + ); +} diff --git a/src/app_modules/component_global/ui/ui_drawer.tsx b/src/app_modules/component_global/ui/ui_drawer.tsx new file mode 100644 index 00000000..ccbd53fe --- /dev/null +++ b/src/app_modules/component_global/ui/ui_drawer.tsx @@ -0,0 +1,72 @@ +import { + Drawer, + Stack, + Group, + ActionIcon, + SimpleGrid, + Text, + Box, +} from "@mantine/core"; +import { IconX, IconEdit } from "@tabler/icons-react"; +import { MainColor, AccentColor } from "../color/color_pallet"; +import React from "react"; +import { useRouter } from "next/navigation"; + +export default function ComponentGlobal_UI_Drawer({ + opened, + close, + component, +}: { + opened: boolean; + close: () => void; + component: any[]; +}) { + const router = useRouter(); + return ( + <> + close()} + position={"bottom"} + size={"auto"} + withCloseButton={false} + styles={{ + content: { + backgroundColor: "transparent", + }, + body: { + backgroundColor: MainColor.darkblue, + borderTop: `2px solid ${AccentColor.blue}`, + borderRight: `1px solid ${AccentColor.blue}`, + borderLeft: `1px solid ${AccentColor.blue}`, + borderRadius: "20px 20px 0px 0px", + color: "white", + paddingBottom: "5%", + }, + }} + > + + + + + + + + {component.map((e, i) => ( + + router.push(e.path)} + > + {e.icon} + + {e.name} + + ))} + + + + + ); +} diff --git a/src/app_modules/component_global/ui/ui_header_tamplate.tsx b/src/app_modules/component_global/ui/ui_header_tamplate.tsx new file mode 100644 index 00000000..fdeab7d9 --- /dev/null +++ b/src/app_modules/component_global/ui/ui_header_tamplate.tsx @@ -0,0 +1,106 @@ +"use client"; + +import { + Header, + Group, + ActionIcon, + Text, + Title, + Box, + Loader, +} from "@mantine/core"; +import { IconArrowLeft, IconChevronLeft } from "@tabler/icons-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { AccentColor, MainColor } from "../color/color_pallet"; + +export default function ComponentGlobal_UI_HeaderTamplate({ + title, + posotion, + // left button + hideButtonLeft, + iconLeft, + routerLeft, + // right button + iconRight, + routerRight, +}: { + title: string; + posotion?: any; + // left button + hideButtonLeft?: boolean; + iconLeft?: any; + routerLeft?: any; + // right button + iconRight?: any; + routerRight?: any; +}) { + const router = useRouter(); + const [isLoading, setIsLoading] = useState(false); + const [isRightLoading, setRightLoading] = useState(false); + + return ( + <> +
+ + {hideButtonLeft ? ( + + ) : ( + { + setIsLoading(true); + routerLeft === undefined + ? router.back() + : router.push(routerLeft); + }} + > + {isLoading ? ( + + ) : iconLeft ? ( + iconLeft + ) : ( + + )} + + )} + + + {title} + + + {iconRight === undefined ? ( + + ) : routerRight === undefined ? ( + {iconRight} + ) : ( + { + setRightLoading(true); + router.push(routerRight); + }} + > + {isRightLoading ? ( + + ) : ( + iconRight + )} + + )} + +
+ + ); +} diff --git a/src/app_modules/component_global/ui/ui_layout_tamplate.tsx b/src/app_modules/component_global/ui/ui_layout_tamplate.tsx new file mode 100644 index 00000000..652254b1 --- /dev/null +++ b/src/app_modules/component_global/ui/ui_layout_tamplate.tsx @@ -0,0 +1,73 @@ +import { + BackgroundImage, + Box, + Container, + Footer, + ScrollArea, +} from "@mantine/core"; +import { AccentColor, MainColor } from "../color/color_pallet"; + +export default function ComponentGlobal_UI_LayoutTamplate({ + children, + header, + footer, +}: { + children: React.ReactNode; + header?: React.ReactNode; + footer?: React.ReactNode; +}) { + return ( + <> + + {/* Header */} + {header ? ( + + {header} + + ) : ( + "" + )} + + {/* Children */} + + + {children} + + + + {/* Footer */} + {footer ? ( + + + {footer} + + + ) : ( + "" + )} + + + ); +} diff --git a/src/app_modules/component_global/ui/ui_modal.tsx b/src/app_modules/component_global/ui/ui_modal.tsx new file mode 100644 index 00000000..357f905e --- /dev/null +++ b/src/app_modules/component_global/ui/ui_modal.tsx @@ -0,0 +1,45 @@ +import { Modal, Stack, Title, Group, Button, Box } from "@mantine/core"; +import { MainColor, AccentColor } from "../color/color_pallet"; + +export default function ComponentGlobal_UI_Modal({ + opened, + close, + title, + buttonKiri, + buttonKanan, +}: { + opened: any; + close: any; + title: any; + buttonKiri: any; + buttonKanan: any; +}) { + return ( + <> + { + close(); + }} + centered + withCloseButton={false} + styles={{ + content: { + backgroundColor: MainColor.darkblue, + border: `2px solid ${AccentColor.blue}`, + }, + }} + > + + + {title} + + + {buttonKiri} + {buttonKanan} + + + + + ); +} diff --git a/src/app_modules/forum/component/beranda/beranda_card.tsx b/src/app_modules/forum/component/beranda/beranda_card.tsx deleted file mode 100644 index d0c4d57d..00000000 --- a/src/app_modules/forum/component/beranda/beranda_card.tsx +++ /dev/null @@ -1,99 +0,0 @@ -"use client"; - -import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; -import { Stack, Card, Group, ActionIcon, Divider, Text } from "@mantine/core"; -import { IconMessageCircle, IconMessageCircleOff } from "@tabler/icons-react"; - - - -import { useState } from "react"; -import { useShallowEffect } from "@mantine/hooks"; -import { useRouter } from "next/navigation"; -import { useAtom } from "jotai"; - - -import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; -import { IconMessageCircleX } from "@tabler/icons-react"; -import { MODEL_FORUM_POSTING } from "../../model/interface"; -import ComponentForum_BerandaAuthorNameOnHeader from "./beranda_author_header"; - -export default function ComponentForum_BerandaCardView({ - data, - setData, - setLoadingKomen, - setLoadingDetail, - userLoginId, -}: { - data: MODEL_FORUM_POSTING[]; - setData: any; - setLoadingKomen: any; - setLoadingDetail: any; - userLoginId: any; -}) { - const router = useRouter(); - return ( - <> - - {data.map((e, i) => ( - - - - - - { - setLoadingDetail(true); - router.push(RouterForum.main_detail + e.id); - }} - > - -
- - - - - - - { - (e?.ForumMaster_StatusPosting.id as any) === 1 - ? (router.push(RouterForum.komentar + e?.id), - setLoadingKomen(true)) - : router.push(RouterForum.main_detail + e?.id); - }} - > - {(e?.ForumMaster_StatusPosting?.id as any) === 1 ? ( - - ) : ( - - )} - - - {/* */} - - {e?._count} - - - - - - ))} - - - ); -} diff --git a/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx b/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx new file mode 100644 index 00000000..4840bc18 --- /dev/null +++ b/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx @@ -0,0 +1,126 @@ +"use client"; + +import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown"; +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 notifikasiToUser_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_user"; +import { Stack, Paper, Group, Button, Divider } from "@mantine/core"; +import { useState } from "react"; +import dynamic from "next/dynamic"; +const ReactQuill = dynamic( + () => { + return import("react-quill"); + }, + { ssr: false } +); +import { forum_funCreateKomentar } from "../../fun/create/fun_create_komentar"; +import { forum_funGetAllKomentarById } from "../../fun/get/get_all_komentar_by_id"; +import { MODEL_FORUM_POSTING } from "../../model/interface"; +import { useRouter } from "next/navigation"; +import { MainColor } from "@/app_modules/component_global/color/color_pallet"; +import mqtt_client from "@/util/mqtt_client"; +export default function ComponentForum_DetailCreateKomentar({ + postingId, + onSetKomentar, + data, + userLoginId, +}: { + postingId: string; + onSetKomentar: (val: any) => void; + data: MODEL_FORUM_POSTING; + userLoginId: string; +}) { + const router = useRouter(); + const [value, setValue] = useState(""); + const [loading, setLoading] = useState(false); + const [isEmpty, setIsEmpty] = useState(false); + + async function onComment() { + if (value.length > 500) { + return null; + } + + const createComment = await forum_funCreateKomentar(postingId, value); + if (createComment.status === 201) { + // const loadKomentar = await forum_funGetAllKomentarById(data.id); + + const loadData = await forum_funGetAllKomentarById({ + postingId: data.id, + page: 1, + }); + onSetKomentar(loadData); + + setValue(""); + setIsEmpty(true); + ComponentGlobal_NotifikasiBerhasil(createComment.message, 2000); + + if (userLoginId !== data.Author.id) { + const dataNotif = { + appId: data.id, + userId: data.authorId, + pesan: value, + kategoriApp: "FORUM", + title: "Komentar baru", + }; + + const createNotifikasi = await notifikasiToUser_funCreate({ + data: dataNotif as any, + }); + + if (createNotifikasi.status === 201) { + mqtt_client.publish( + "USER", + JSON.stringify({ + userId: dataNotif.userId, + count: 1, + }) + ); + } + } + } else { + ComponentGlobal_NotifikasiGagal(createComment.message); + } + } + + return ( + <> + + + { + setValue(val); + }} + /> + + + + + + + + + ); +} diff --git a/src/app_modules/forum/component/detail_component/detail_header.tsx b/src/app_modules/forum/component/detail_component/detail_header.tsx index 63ec8d26..f241bd35 100644 --- a/src/app_modules/forum/component/detail_component/detail_header.tsx +++ b/src/app_modules/forum/component/detail_component/detail_header.tsx @@ -44,6 +44,7 @@ import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_ import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id"; import { forum_getOnePostingById } from "../../fun/get/get_one_posting_by_id"; import mqtt_client from "@/util/mqtt_client"; +import { AccentColor, MainColor } from "@/app_modules/component_global/color/color_pallet"; export default function ComponentForum_DetailHeader({ data, @@ -85,13 +86,13 @@ export default function ComponentForum_DetailHeader({ - - + + {data?.Author.username ? data?.Author.username : "Nama author "} {userLoginId != authorId ? ( - "" + { + setLoadingReport(true); + router.push(RouterForum.report_posting + postingId); + }} + > + + + + + + + Laporkan posting + {" "} + {loadingReport ? : ""} + + + ) : ( + { + setLoadingEdit(true); + router.push(RouterForum.edit_posting + postingId); + }} + > + + + + + + Edit posting{" "} + {loadingEdit ? : ""} + + + + { close(); @@ -173,16 +214,16 @@ function ComponentForum_DetailButtonMore_V2({ > {statusId === 1 ? ( - + ) : ( - + )} {statusId === 1 ? ( - Tutup forum + Tutup forum ) : ( - Buka forum + Buka forum )} @@ -200,56 +241,30 @@ function ComponentForum_DetailButtonMore_V2({ Hapus - - { - setLoadingEdit(true); - router.push(RouterForum.edit_posting + postingId); - }} - > - - - - - - Edit posting{" "} - {loadingEdit ? : ""} - - - )} - {userLoginId == authorId ? ( - "" - ) : ( - { - setLoadingReport(true); - router.push(RouterForum.report_posting + postingId); - }} - > - - - - - - - Laporkan posting - {" "} - {loadingReport ? : ""} - - - - )} - - { setOpenDel(false); @@ -261,6 +276,12 @@ function ComponentForum_DetailButtonMore_V2({ setOpenStatusClose(false)} centered @@ -276,7 +297,7 @@ function ComponentForum_DetailButtonMore_V2({ /> - open()}> + open()}> @@ -317,7 +338,7 @@ function ButtonDelete({ return ( <> - Yakin menghapus posting ini ? + Yakin menghapus posting ini ? { setOpenDel(false); @@ -177,11 +187,20 @@ export default function ComponentForum_BerandaButtonMore({ { + onLoadData(val); + }} + allData={allData} /> setOpenStatusClose(false)} centered @@ -191,13 +210,16 @@ export default function ComponentForum_BerandaButtonMore({ postingId={postingId} setOpenStatus={setOpenStatusClose} statusId={statusId} - setData={setData} + onLoadData={(val) => { + onLoadData(val); + }} userLoginId={userLoginId} authorId={authorId} + allData={allData} /> - open()}> + open()}> @@ -207,11 +229,13 @@ export default function ComponentForum_BerandaButtonMore({ function ButtonDelete({ postingId, setOpenDel, - setData, + onLoadData, + allData, }: { postingId?: string; setOpenDel: any; - setData: any; + onLoadData: (val: any) => void; + allData: MODEL_FORUM_POSTING[]; }) { const [loading, setLoading] = useState(false); @@ -219,21 +243,31 @@ function ButtonDelete({ setOpenDel(false); await forum_funDeletePostingById(postingId as any).then(async (res) => { if (res.status === 200) { - // ComponentGlobal_NotifikasiBerhasil(`Postingan Terhapus`, 2000); + ComponentGlobal_NotifikasiBerhasil(`Postingan Terhapus`, 2000); setLoading(true); - const listForum = await forum_getListAllPosting(); - setData(listForum); - return null; + + const cloneData = _.clone(allData); + const hapusData = cloneData.filter((e) => e.id !== postingId); + + onLoadData(hapusData); + + mqtt_client.publish( + "Forum_hapus_data", + JSON.stringify({ + data: hapusData, + }) + ); } else { - // ComponentGlobal_NotifikasiGagal(res.message); - return null; + ComponentGlobal_NotifikasiGagal(res.message); } }); } return ( <> - Yakin menghapus posting ini ? + + Yakin menghapus posting ini ? + { setOpenDel(false); @@ -153,7 +151,7 @@ export default function ComponentForum_KomentarButtonMore({ /> - open()}> + open()}> @@ -178,7 +176,7 @@ function ButtonDelete({ async function onDelete() { await forum_funDeleteKomentarById(komentarId as any).then(async (res) => { if (res.status === 200) { - await forum_getKomentarById(postingId as any).then((val) => { + await forum_funGetAllKomentarById(postingId as any).then((val) => { setKomentar(val); setOpenDel(false); setLoading(true); @@ -188,19 +186,11 @@ function ButtonDelete({ ComponentGlobal_NotifikasiGagal(res.message); } }); - - // await forum_funDeletePostingById(komentarId as any).then((res) => { - // if (res.status === 200) { - // ComponentGlobal_NotifikasiBerhasil(`Postingan Terhapus`, 2000); - // } else { - // ComponentGlobal_NotifikasiGagal(res.message); - // } - // }); } return ( <> - Yakin menghapus komentar ini ? + Yakin menghapus komentar ini ? { setOpenDel(false); @@ -181,6 +196,12 @@ export default function ComponentForum_V2_CardMoreButton({ setOpenStatusClose(false)} centered @@ -199,7 +220,7 @@ export default function ComponentForum_V2_CardMoreButton({ /> - open()}> + open()}> @@ -237,7 +258,6 @@ function ButtonDelete({ data: hapusData, }) ); - } else { ComponentGlobal_NotifikasiGagal(res.message); } @@ -246,7 +266,9 @@ function ButtonDelete({ return ( <> - Yakin menghapus posting ini ? + + Yakin menghapus posting ini ? + - - - - - ); -} - -function KomentarView({ - listKomentar, - setKomentar, - postingId, - userLoginId, -}: { - listKomentar: MODEL_FORUM_KOMENTAR[]; - setKomentar: any; - postingId: string; - userLoginId: string; -}) { - return ( - <> - - {_.isEmpty(listKomentar) ? ( -
- - Belum ada komentar - -
- ) : ( - -
- - {" "} - Komentar - -
- {listKomentar.map((e, i) => ( - - - - - - - - {e.komentar ? ( - -
- - ) : ( - "" - )} - - - - - - - - - - ))} - - )} - - - ); -} diff --git a/src/app_modules/forum/detail/layout.tsx b/src/app_modules/forum/detail/layout.tsx index 77cc8d40..51745523 100644 --- a/src/app_modules/forum/detail/layout.tsx +++ b/src/app_modules/forum/detail/layout.tsx @@ -8,6 +8,8 @@ import { IconChevronLeft } from "@tabler/icons-react"; import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; import { revalidatePath } from "next/cache"; import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate"; +import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; +import ComponentGlobal_UI_HeaderTamplate from "@/app_modules/component_global/ui/ui_header_tamplate"; export const dynamic = "force-dynamic"; export default function LayoutForum_Detail({ @@ -22,7 +24,13 @@ export default function LayoutForum_Detail({ return ( <> - } + > + {children} + + + {/* @@ -31,7 +39,6 @@ export default function LayoutForum_Detail({ variant="transparent" onClick={() => { setLoading(true); - // revalidatePath("/dev/forum/main"); router.back(); }} > @@ -43,7 +50,7 @@ export default function LayoutForum_Detail({ } > {children} - + */} ); } diff --git a/src/app_modules/forum/detail/main_detail.tsx b/src/app_modules/forum/detail/main_detail.tsx new file mode 100644 index 00000000..48315363 --- /dev/null +++ b/src/app_modules/forum/detail/main_detail.tsx @@ -0,0 +1,127 @@ +"use client"; + +import { Box, Center, Loader, Stack } from "@mantine/core"; +import _ from "lodash"; +import { MODEL_FORUM_KOMENTAR, MODEL_FORUM_POSTING } from "../model/interface"; + +import mqtt_client from "@/util/mqtt_client"; +import { useShallowEffect } from "@mantine/hooks"; +import { useState } from "react"; +import "react-quill/dist/quill.bubble.css"; +import ComponentForum_DetailCreateKomentar from "../component/detail_component/detail_create_komentar"; +import ComponentForum_KomentarView from "../component/detail_component/detail_list_komentar"; +import ComponentForum_DetailForumView from "../component/detail_component/detail_view"; +import { ScrollOnly } from "next-scroll-loader"; +import { forum_funGetAllKomentarById } from "../fun/get/get_all_komentar_by_id"; + +export default function Forum_MainDetail({ + dataPosting, + listKomentar, + userLoginId, + countKomentar, +}: { + dataPosting: MODEL_FORUM_POSTING; + listKomentar: MODEL_FORUM_KOMENTAR[]; + userLoginId: string; + countKomentar: number; +}) { + const [data, setData] = useState(dataPosting); + const [lsKomentar, setLsKomentar] = useState(listKomentar); + + const [activePage, setActivePage] = useState(1); + + // useShallowEffect(() => { + // onLoadKomentar({ + // onLoad(val) { + // setKomentar(val); + // }, + // }); + // }, [setKomentar]); + + // async function onLoadKomentar({ onLoad }: { onLoad: (val: any) => void }) { + // const loadKomentar = await forum_getKomentarById(data.id); + // onLoad(loadKomentar); + // } + + useShallowEffect(() => { + mqtt_client.subscribe("Forum_detail_ganti_status"); + + mqtt_client.on("message", (topic: any, message: any) => { + const newData = JSON.parse(message.toString()); + if (newData.id === data.id) { + const cloneData = _.clone(data); + + // console.log(newData.data); + const updateData = { + ...cloneData, + ForumMaster_StatusPosting: { + id: newData.data.id, + status: newData.data.status, + }, + }; + + setData(updateData as any); + } + }); + }, [data]); + + return ( + <> + + { + setData(val); + }} + /> + + {(data?.ForumMaster_StatusPosting?.id as any) === 1 ? ( + { + setLsKomentar(val); + }} + data={data} + userLoginId={userLoginId} + /> + ) : ( + "" + )} + + + ( +
+ +
+ )} + data={lsKomentar} + setData={setLsKomentar} + moreData={async () => { + const loadData = await forum_funGetAllKomentarById({ + postingId: data.id, + page: activePage + 1, + }); + setActivePage((val) => val + 1); + + return loadData; + }} + > + {(item) => ( + + )} +
+
+
+ + ); +} diff --git a/src/app_modules/forum/edit/posting/index.tsx b/src/app_modules/forum/edit/posting/index.tsx index 65b67a2d..cf52fdfc 100644 --- a/src/app_modules/forum/edit/posting/index.tsx +++ b/src/app_modules/forum/edit/posting/index.tsx @@ -26,6 +26,10 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown"; +import { + AccentColor, + MainColor, +} from "@/app_modules/component_global/color/color_pallet"; const ReactQuill = dynamic( () => { return import("react-quill"); @@ -114,6 +118,17 @@ function ButtonAction({ return ( <> + + + + + ); +} diff --git a/src/app_modules/forum/forumku/index.tsx b/src/app_modules/forum/forumku/index.tsx index e246717e..3df6496a 100644 --- a/src/app_modules/forum/forumku/index.tsx +++ b/src/app_modules/forum/forumku/index.tsx @@ -1,28 +1,30 @@ "use client"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; -import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; +import { + AccentColor, + MainColor, +} from "@/app_modules/component_global/color/color_pallet"; import { MODEL_USER } from "@/app_modules/home/model/interface"; import { ActionIcon, Affix, - Avatar, - Button, Center, - Divider, - Grid, + Loader, Stack, Text, rem, } from "@mantine/core"; import { useWindowScroll } from "@mantine/hooks"; -import { IconCircleFilled, IconPencilPlus } from "@tabler/icons-react"; +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_MainCardView from "../component/main_card_view"; +import ComponentForum_ForumkuMainCardView from "../component/forumku_component/forumku_view"; +import { forum_getAllPostingByAuhtorId } from "../fun/get/get_list_posting_by_author_id"; import { MODEL_FORUM_POSTING } from "../model/interface"; +import ComponentForum_ViewForumProfile from "./forum_profile"; export default function Forum_Forumku({ auhtorSelectedData, @@ -36,6 +38,9 @@ export default function Forum_Forumku({ userLoginId: string; }) { const router = useRouter(); + const [data, setData] = useState(dataPosting); + const [activePage, setActivePage] = useState(1); + const [scroll, scrollTo] = useWindowScroll(); const [loadingCreate, setLoadingCreate] = useState(false); @@ -44,193 +49,80 @@ export default function Forum_Forumku({ {userLoginId === auhtorSelectedData.id ? ( 0 ? 0.5 : ""} style={{ transition: "0.5s", + border: `1px solid ${AccentColor.skyblue}`, }} size={"xl"} radius={"xl"} variant="transparent" - bg={"blue"} + bg={AccentColor.blue} onClick={() => { setLoadingCreate(true); router.push(RouterForum.create); }} > - + {loadingCreate ? ( + + ) : ( + + )} ) : ( "" )} - - + - {_.isEmpty(dataPosting) ? ( -
- - Belum ada posting - -
+ + {_.isEmpty(data) ? ( + + + + + Tidak ada data + + + ) : ( - + // --- Main component --- // + ( +
+ +
+ )} + data={data} + setData={setData} + moreData={async () => { + const loadData = await forum_getAllPostingByAuhtorId({ + page: activePage + 1, + authorId: auhtorSelectedData.id, + }); + setActivePage((val) => val + 1); + + return loadData; + }} + > + {(item) => ( + { + setData(val); + }} + allData={data} + /> + )} +
)}
); } - -function ForumProfile({ - auhtorSelectedData, - totalPosting, -}: { - auhtorSelectedData: MODEL_USER; - totalPosting: number; -}) { - const router = useRouter(); - const [loading, setLoading] = useState(false); - - // if (loading) return ; - - return ( - <> -
- -
- - - - - {auhtorSelectedData?.Profile?.name} - - - - - {totalPosting} Posting - - - - - @{auhtorSelectedData?.username} - {""} - - - - - - - - - - - - - - - ); -} - -function ForumPosting({ - dataPosting, - userLoginId, -}: { - dataPosting: MODEL_FORUM_POSTING[]; - userLoginId: any; -}) { - const router = useRouter(); - const [data, setData] = useState(dataPosting); - const [loadingDetail, setLoadingDetail] = useState(false); - const [loadingKomen, setLoadingKomen] = useState(false); - - if (loadingDetail) return ; - if (loadingKomen) return ; - return ( - <> - - - {/* - {dataPosting.map((e, i) => ( - - - - - { - // console.log("halaman forum"); - setLoadingDetail(true); - router.push(RouterForum.main_detail + i); - }} - > - - - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad, - vitae. Quisquam aspernatur, eius consequatur dicta repellendus - facere vero recusandae deleniti voluptas quod architecto, - tenetur totam excepturi rem nam iusto earum. - - - - - - - { - setLoadingKomen(true); - router.push(RouterForum.komentar + i); - }} - > - - - 1 - - - - - - ))} - */} - - ); -} diff --git a/src/app_modules/forum/forumku/layout.tsx b/src/app_modules/forum/forumku/layout.tsx index a89824b6..2ea05fa3 100644 --- a/src/app_modules/forum/forumku/layout.tsx +++ b/src/app_modules/forum/forumku/layout.tsx @@ -6,6 +6,8 @@ import ComponentForum_HeaderTamplate from "../component/header/header_tamplate"; import { MODEL_USER } from "@/app_modules/home/model/interface"; import { IconX } from "@tabler/icons-react"; import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate"; +import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; +import ComponentGlobal_UI_HeaderTamplate from "@/app_modules/component_global/ui/ui_header_tamplate"; export default function LayoutForum_Forumku({ children, @@ -16,7 +18,18 @@ export default function LayoutForum_Forumku({ }) { return ( <> - } + /> + } + > + {children} + + + {/* {children} - + */} ); } diff --git a/src/app_modules/forum/forumku/postingan_pribadi.tsx b/src/app_modules/forum/forumku/postingan_pribadi.tsx new file mode 100644 index 00000000..8d654861 --- /dev/null +++ b/src/app_modules/forum/forumku/postingan_pribadi.tsx @@ -0,0 +1,85 @@ +"use client" + +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import ComponentForum_MainCardView from "../component/main_card_view"; +import { MODEL_FORUM_POSTING } from "../model/interface"; +import ComponentForum_ForumkuMainCardView from "../component/forumku_component/forumku_view"; + +export default function ComponentForum_PostinganPribadi({ + dataPosting, + userLoginId, +}: { + dataPosting: MODEL_FORUM_POSTING[]; + userLoginId: any; +}) { + const router = useRouter(); + const [data, setData] = useState(dataPosting); + const [loadingDetail, setLoadingDetail] = useState(false); + const [loadingKomen, setLoadingKomen] = useState(false); + +// if (loadingDetail) return ; +// if (loadingKomen) return ; + + return ( + <> + + + {/* */} + + {/* + {dataPosting.map((e, i) => ( + + + + + { + // console.log("halaman forum"); + setLoadingDetail(true); + router.push(RouterForum.main_detail + i); + }} + > + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad, + vitae. Quisquam aspernatur, eius consequatur dicta repellendus + facere vero recusandae deleniti voluptas quod architecto, + tenetur totam excepturi rem nam iusto earum. + + + + + + + { + setLoadingKomen(true); + router.push(RouterForum.komentar + i); + }} + > + + + 1 + + + + + + ))} + */} + + ); +} \ No newline at end of file diff --git a/src/app_modules/forum/fun/count/count_total_komentar_by_id.ts b/src/app_modules/forum/fun/count/count_total_komentar_by_id.ts index 3dbf6ce9..d6a5f9d6 100644 --- a/src/app_modules/forum/fun/count/count_total_komentar_by_id.ts +++ b/src/app_modules/forum/fun/count/count_total_komentar_by_id.ts @@ -2,31 +2,19 @@ import prisma from "@/app/lib/prisma"; - -// PERCOBAAN -export async function forum_countTotalKomenById(postingId: any[]) { +// PERCOBAAN +export async function forum_countTotalKomenById(postingId: string) { // console.log(postingId) - const data = postingId.map(async (e) => { - const get = await prisma.forum_Komentar.count({ - where: { - forum_PostingId: e, - isActive: true, - }, - select: { - forum_PostingId: true, + const get = await prisma.forum_Komentar.count({ + where: { + forum_PostingId: postingId, + isActive: true, + }, - }, - }); - console.log(get); }); - // const data = await prisma.forum_Komentar.count({ - // where: { - // forum_PostingId: postingId, - // isActive: true, - // }, - // }); + // console.log(get); - // return data; + return get; } diff --git a/src/app_modules/forum/fun/create/fun_create_report_komentar.ts b/src/app_modules/forum/fun/create/fun_create_report_komentar.ts index 9b33e379..932a921b 100644 --- a/src/app_modules/forum/fun/create/fun_create_report_komentar.ts +++ b/src/app_modules/forum/fun/create/fun_create_report_komentar.ts @@ -3,27 +3,36 @@ import prisma from "@/app/lib/prisma"; import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; -export async function forum_funCreateReportKomentar( - komentarId: string, - value: string -) { +export async function forum_funCreateReportKomentar({ + komentarId, + kategoriId, +}: { + komentarId: string; + kategoriId: any; +}) { const authorId = await user_getOneUserId(); + // console.log(kategoriId); - const cekId = await prisma.forumMaster_KategoriReport.findFirst({ - where: { - title: value, - }, - }); + // const cekId = await prisma.forumMaster_KategoriReport.findFirst({ + // where: { + // title: kategoriId, + // }, + // }); - const createReport = await prisma.forum_ReportKomentar.create({ - data: { - userId: authorId, - forumMaster_KategoriReportId: cekId?.id, - forum_KomentarId: komentarId, - }, - }); + try { + const createReport = await prisma.forum_ReportKomentar.create({ + data: { + userId: authorId, + forumMaster_KategoriReportId: kategoriId, + forum_KomentarId: komentarId, + }, + }); + + if (!createReport) + return { status: 400, message: "Gagal menambahkan report komentar !" }; + } catch (error) { + console.log(error); + } - if (!createReport) - return { status: 400, message: "Gagal menambahkan report komentar !" }; return { status: 201, message: "Berhasil me-report komentar !" }; } diff --git a/src/app_modules/forum/fun/get/get_komentar_by_id.ts b/src/app_modules/forum/fun/get/get_all_komentar_by_id.ts similarity index 69% rename from src/app_modules/forum/fun/get/get_komentar_by_id.ts rename to src/app_modules/forum/fun/get/get_all_komentar_by_id.ts index c60c6440..ad1d5cc8 100644 --- a/src/app_modules/forum/fun/get/get_komentar_by_id.ts +++ b/src/app_modules/forum/fun/get/get_all_komentar_by_id.ts @@ -2,8 +2,19 @@ import prisma from "@/app/lib/prisma"; -export async function forum_getKomentarById(postingId: string) { +export async function forum_funGetAllKomentarById({ + postingId, + page, +}: { + postingId: string; + page: number; +}) { + const takeData = 5; + const skipData = page * takeData - takeData; + const data = await prisma.forum_Komentar.findMany({ + take: takeData, + skip: skipData, orderBy: { createdAt: "desc", }, @@ -19,6 +30,7 @@ export async function forum_getKomentarById(postingId: string) { Author: { select: { id: true, + username: true, Profile: { select: { name: true, diff --git a/src/app_modules/forum/fun/get/get_list_all_posting.ts b/src/app_modules/forum/fun/get/get_list_all_posting.ts index 59eed9e9..07c16404 100644 --- a/src/app_modules/forum/fun/get/get_list_all_posting.ts +++ b/src/app_modules/forum/fun/get/get_list_all_posting.ts @@ -1,9 +1,7 @@ "use server"; -import _ from "lodash"; import prisma from "@/app/lib/prisma"; -import { forum_countOneTotalKomentarById } from "../count/count_one_total_komentar_by_id"; -import { forum_countTotalKomenById } from "../count/count_total_komentar_by_id"; +import _ from "lodash"; export async function forum_getListAllPosting() { const get = await prisma.forum_Posting.findMany({ diff --git a/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts b/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts index 7b4bd9de..bfbbb073 100644 --- a/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts +++ b/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts @@ -4,8 +4,19 @@ import prisma from "@/app/lib/prisma"; import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; import _ from "lodash"; -export async function forum_getListPostingByAuhtorId(authorId: string) { +export async function forum_getAllPostingByAuhtorId({ + authorId, + page, +}: { + authorId: string; + page: any; +}) { + const takeData = 5; + const skipData = page * takeData - takeData; + const get = await prisma.forum_Posting.findMany({ + take: takeData, + skip: skipData, orderBy: { createdAt: "desc", }, @@ -22,7 +33,13 @@ export async function forum_getListPostingByAuhtorId(authorId: string) { Author: { select: { id: true, - Profile: true, + username: true, + Profile: { + select: { + id: true, + imagesId: true, + }, + }, }, }, Forum_Komentar: { @@ -30,14 +47,20 @@ export async function forum_getListPostingByAuhtorId(authorId: string) { isActive: true, }, }, - ForumMaster_StatusPosting: true + ForumMaster_StatusPosting: { + select: { + id: true, + status: true, + }, + }, + forumMaster_StatusPostingId: true, }, }); - const data = get.map((val) => ({ - ..._.omit(val, ["Forum_Komentar"]), - _count: val.Forum_Komentar.length, - })); + // const data = get.map((val) => ({ + // ..._.omit(val, ["Forum_Komentar"]), + // _count: val.Forum_Komentar.length, + // })); - return data; + return get; } diff --git a/src/app_modules/forum/fun/get/get_one_kategori_by_id.ts b/src/app_modules/forum/fun/get/get_one_kategori_by_id.ts index 2acabf36..e32ce4c4 100644 --- a/src/app_modules/forum/fun/get/get_one_kategori_by_id.ts +++ b/src/app_modules/forum/fun/get/get_one_kategori_by_id.ts @@ -13,5 +13,5 @@ export default async function forum_getOneKategoriById({ }, }); - return cekData + return cekData; } diff --git a/src/app_modules/forum/fun/get/get_one_posting_reported_by_id.ts b/src/app_modules/forum/fun/get/get_one_posting_reported_by_id.ts new file mode 100644 index 00000000..7ea057dc --- /dev/null +++ b/src/app_modules/forum/fun/get/get_one_posting_reported_by_id.ts @@ -0,0 +1,46 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import _ from "lodash"; + +export default async function forum_funGetOneReportedPostingById({ + postingId, +}: { + postingId: string; +}) { + const data = await prisma.forum_Posting.findFirst({ + where: { + id: postingId, + }, + select: { + id: true, + diskusi: true, + Forum_ReportPosting: { + select: { + id: true, + deskripsi: true, + forumMaster_KategoriReportId: true, + ForumMaster_KategoriReport: true, + }, + }, + }, + }); + + // console.log(data) + + const group = _.groupBy( + data?.Forum_ReportPosting, + (val) => val.ForumMaster_KategoriReport?.title + ); + const getKey = _.keys(group); + const filterGroup = getKey.map((e) => e.replace("undefined", "Lainnya")); + + const allData = { + data: data, + list: filterGroup, + }; + + // console.log(allData); + + return allData; +} diff --git a/src/app_modules/forum/fun/get/get_one_report_komentar_by_id.tsx b/src/app_modules/forum/fun/get/get_one_report_komentar_by_id.tsx new file mode 100644 index 00000000..36993d76 --- /dev/null +++ b/src/app_modules/forum/fun/get/get_one_report_komentar_by_id.tsx @@ -0,0 +1,60 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import _ from "lodash"; +import { MODEL_FORUM_KOMENTAR } from "../../model/interface"; +import { group } from "console"; + +export default async function forum_funGetOneReportKomentarById({ + komentarId, +}: { + komentarId: string; +}) { + const data = await prisma.forum_Komentar.findFirst({ + where: { + id: komentarId, + }, + select: { + id: true, + komentar: true, + Forum_Posting: { + select: { + id: true, + diskusi: true, + Author: { + select: { + username: true, + }, + }, + }, + }, + + Forum_ReportKomentar: { + select: { + deskripsi: true, + ForumMaster_KategoriReport: { + select: { + id: true, + title: true, + }, + }, + }, + }, + }, + }); + + const group = _.groupBy( + data?.Forum_ReportKomentar, + (v) => v.ForumMaster_KategoriReport?.title + ); + + const getKey = _.keys(group); + const filterGroup = getKey.map((e) => e.replace("undefined", "Lainnya")); + + const allData = { + data: data, + list: filterGroup, + }; + + return allData; +} diff --git a/src/app_modules/forum/index.ts b/src/app_modules/forum/index.ts index 45d85403..99bd696a 100644 --- a/src/app_modules/forum/index.ts +++ b/src/app_modules/forum/index.ts @@ -5,7 +5,7 @@ import Forum_Forumku from "./forumku"; import Forum_Create from "./create"; import LayoutForum_Create from "./create/layout"; import LayoutForum_Forumku from "./forumku/layout"; -import Forum_Detail from "./detail"; +import Forum_MainDetail from "./detail/main_detail"; import LayoutForum_Detail from "./detail/layout"; import Forum_Komentar from "./komentar"; import LayoutForum_Komentar from "./komentar/layout"; @@ -19,6 +19,8 @@ import Forum_ReportKomentar from "./report/komentar"; import LayoutForum_ReportKomentar from "./report/komentar/layout"; import Forum_ReportPostingLainnya from "./report/posting/lainnya"; import Forum_ReportKomentarLainnya from "./report/komentar/lainnya"; +import Forum_DetailReportKomentar from "./detail/detail_report_komentar"; +import Forum_DetailReportPosting from "./detail/detail_report_posting"; export { Forum_Splash, @@ -28,7 +30,7 @@ export { Forum_Create, LayoutForum_Create, LayoutForum_Forumku, - Forum_Detail, + Forum_MainDetail as Forum_Detail, LayoutForum_Detail, Forum_Komentar, LayoutForum_Komentar, @@ -42,4 +44,6 @@ export { LayoutForum_ReportKomentar, Forum_ReportPostingLainnya, Forum_ReportKomentarLainnya, + Forum_DetailReportKomentar, + Forum_DetailReportPosting, }; diff --git a/src/app_modules/forum/main/beranda.tsx b/src/app_modules/forum/main/beranda.tsx index b83e5f04..e3842721 100644 --- a/src/app_modules/forum/main/beranda.tsx +++ b/src/app_modules/forum/main/beranda.tsx @@ -1,6 +1,7 @@ "use client"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; +import { AccentColor } from "@/app_modules/component_global/color/color_pallet"; import mqtt_client from "@/util/mqtt_client"; import { ActionIcon, @@ -11,18 +12,15 @@ import { Stack, Text, TextInput, - rem + rem, } from "@mantine/core"; import { useShallowEffect, useWindowScroll } from "@mantine/hooks"; -import { - IconPencilPlus, - IconSearchOff -} from "@tabler/icons-react"; +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_BerandaCardView from "../component/main_component/card_view"; import { forum_new_getAllPosting } from "../fun/get/new_get_all_posting"; import { MODEL_FORUM_POSTING } from "../model/interface"; @@ -121,7 +119,7 @@ export default function Forum_Beranda({ return ( <> {isNewPost && ( - + setData(val)} @@ -138,25 +136,29 @@ export default function Forum_Beranda({ {/*
{JSON.stringify(listForum, null, 2)}
*/} 0 ? 0.5 : ""} style={{ transition: "0.5s", + border: `1px solid ${AccentColor.skyblue}`, }} size={"xl"} radius={"xl"} variant="transparent" - bg={"blue"} + bg={AccentColor.blue} onClick={() => { setLoadingCreate(true); router.push(RouterForum.create); }} > - + {loadingCreate ? ( + + ) : ( + + )} - + + {_.isEmpty(data) ? ( - + - + Tidak ada data @@ -176,10 +179,10 @@ export default function Forum_Beranda({ ) : ( // --- Main component --- // (
- +
)} data={data} @@ -195,7 +198,7 @@ export default function Forum_Beranda({ }} > {(item) => ( - { @@ -241,6 +244,11 @@ function ButtonUpdateBeranda({ <>
- diff --git a/src/app_modules/forum/report/komentar/layout.tsx b/src/app_modules/forum/report/komentar/layout.tsx index fd72b2ef..f131b935 100644 --- a/src/app_modules/forum/report/komentar/layout.tsx +++ b/src/app_modules/forum/report/komentar/layout.tsx @@ -1,12 +1,10 @@ "use client"; -import { ActionIcon, AppShell, Group, Header, Title } from "@mantine/core"; -import React from "react"; -import ComponentForum_HeaderTamplate from "../../component/header/header_tamplate"; -import { IconChevronLeft, IconX } from "@tabler/icons-react"; -import router from "next/router"; -import ComponentForum_HeaderRataKiri from "../../component/header/header_rata_kiri"; import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate"; +import React from "react"; +import ComponentForum_HeaderRataKiri from "../../component/header/header_rata_kiri"; +import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; +import ComponentGlobal_UI_HeaderTamplate from "@/app_modules/component_global/ui/ui_header_tamplate"; export default function LayoutForum_ReportKomentar({ children, @@ -15,13 +13,20 @@ export default function LayoutForum_ReportKomentar({ }) { return ( <> - + } + > + {children} + + {/* } > {children} - + */} ); } diff --git a/src/app_modules/forum/report/posting/index.tsx b/src/app_modules/forum/report/posting/index.tsx index 650f86b6..47e4cbc6 100644 --- a/src/app_modules/forum/report/posting/index.tsx +++ b/src/app_modules/forum/report/posting/index.tsx @@ -1,18 +1,21 @@ "use client"; -import { Box, Button, Paper, Radio, Stack, Text, Title } from "@mantine/core"; -import { MODEL_FORUM_MASTER_REPORT } from "../../model/interface"; +import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; +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_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; +import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; +import mqtt_client from "@/util/mqtt_client"; +import { Button, Radio, Stack, Text, Title } from "@mantine/core"; +import { toNumber } from "lodash"; +import { useRouter } from "next/navigation"; import { useState } from "react"; import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report_posting"; -import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; -import { useRouter } from "next/navigation"; -import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; -import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; -import mqtt_client from "@/util/mqtt_client"; -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 forum_getOneKategoriById from "../../fun/get/get_one_kategori_by_id"; -import { toNumber } from "lodash"; +import { MODEL_FORUM_MASTER_REPORT } from "../../model/interface"; export default function Forum_ReportPosting({ postingId, @@ -27,8 +30,17 @@ export default function Forum_ReportPosting({ return ( <> - + { setReportValue(val); @@ -39,7 +51,11 @@ export default function Forum_ReportPosting({ {e.title}} + label={ + + {e.title} + + } /> {e.deskripsi} @@ -66,7 +82,8 @@ function ButtonAction({ userLoginId: string; }) { const router = useRouter(); - const [loading, setLoading] = useState(false); + const [isLoading, setIsLoading] = useState(false); + const [isLoadingLain, setIsLoadingLain] = useState(false); async function onReport() { const report = await forum_funCreateReportPosting({ @@ -77,10 +94,9 @@ function ButtonAction({ const getKategori = await forum_getOneKategoriById({ kategoriId: toNumber(kategoriId), }); - console.log(getKategori); + // console.log(getKategori); ComponentGlobal_NotifikasiBerhasil(report.message, 2000); - setLoading(true); router.back(); const dataNotif = { @@ -99,6 +115,7 @@ function ButtonAction({ if (createNotifikasi.status === 201) { mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 })); } + setIsLoading(true); } else { ComponentGlobal_NotifikasiGagal(report.message); } @@ -107,10 +124,13 @@ function ButtonAction({ <> @@ -118,7 +138,7 @@ function ButtonAction({ radius={"xl"} color="orange" loaderPosition="center" - loading={loading ? true : false} + loading={isLoading ? true : false} onClick={() => onReport()} > Report diff --git a/src/app_modules/forum/report/posting/lainnya.tsx b/src/app_modules/forum/report/posting/lainnya.tsx index de89b6c8..4b1fe678 100644 --- a/src/app_modules/forum/report/posting/lainnya.tsx +++ b/src/app_modules/forum/report/posting/lainnya.tsx @@ -8,11 +8,15 @@ import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { forum_funCreateReportPostingLainnya } from "../../fun/create/fun_create_report_posting_lainnya"; +import mqtt_client from "@/util/mqtt_client"; +import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; export default function Forum_ReportPostingLainnya({ - postingIg, + postingId, + userLoginId, }: { - postingIg: string; + postingId: string; + userLoginId: string; }) { const [deskripsi, setDeskripsi] = useState(""); return ( @@ -26,46 +30,69 @@ export default function Forum_ReportPostingLainnya({ setDeskripsi(val.currentTarget.value); }} /> - + ); } function ButtonAction({ - postingIg, + postingId, deskripsi, + userLoginId, }: { - postingIg: string; + postingId: string; deskripsi: string; + userLoginId: string; }) { const router = useRouter(); async function onReport() { - await forum_funCreateReportPostingLainnya(postingIg, deskripsi).then( - (res) => { - if (res.status === 201) { - ComponentGlobal_NotifikasiBerhasil(res.message); - router.back(); - } else { - ComponentGlobal_NotifikasiGagal(res.message); - } - } + const report = await forum_funCreateReportPostingLainnya( + postingId, + deskripsi ); + if (report.status === 201) { + ComponentGlobal_NotifikasiBerhasil(report.message); + router.back(); + + const dataNotif = { + appId: postingId, + pesan: deskripsi, + kategoriApp: "FORUM", + title: "Lainnya", + userId: userLoginId, + status: "Report Posting", + }; + + const createNotifikasi = await notifikasiToAdmin_funCreate({ + data: dataNotif as any, + }); + + if (createNotifikasi.status === 201) { + mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 })); + } + } else { + ComponentGlobal_NotifikasiGagal(report.message); + } } return ( <> @@ -122,10 +117,23 @@ export default function Job_Create() { - + - + - + Syarat & Ketentuan {" "} @@ -150,6 +158,9 @@ export default function Job_Create() { - + Deskripsi {" "} @@ -184,6 +195,9 @@ export default function Job_Create() { - + + } + buttonKanan={ + + } + /> + - - - - - + {/* HAPUS */} + {/* + + + Yakin ingin menghapus ini ? + + + + + + + */} - + {/* AJUKAN KEMBALI */} + {/* { + setAjukan(false); + }} + centered + withCloseButton={false} + styles={{ + content: { + backgroundColor: MainColor.darkblue, + border: `2px solid ${AccentColor.blue}`, + }, + }} + > + + + Anda yakin akan melakukan pengajuan review kembali ? + + + + + + + */} + + {/* Ajukan */} + setAjukan(false)} + title={" Anda sudah yakin akan melakukan pengajuan review kembali ?"} + buttonKiri={ + + } + buttonKanan={ + + } + /> + + {/* Hapus */} + close()} + title={"Anda yakin ingin menghapus ?"} + buttonKiri={ + + } + buttonKanan={ + + } + /> + + + + + + */} + + close()} + title={ + " Mengarsipkan akan menghilangkan info lowongan kerja dari beranda, anda yakin ?" + } + buttonKiri={ + + } + buttonKanan={ + + } + /> + - - - - - + close()} + title={" Anda yakin ingin menghapus ?"} + buttonKiri={ + + } + buttonKanan={ + + } + /> - + {/* + + + Yakin ingin menghapus ini ? + + + + + + + */} + + + } + buttonKanan={ + + } + /> + @@ -133,8 +130,21 @@ export default function Job_Edit({ dataJob }: { dataJob: MODEL_JOB }) { - + - + Syarat & Ketentuan {" "} @@ -158,6 +168,9 @@ export default function Job_Edit({ dataJob }: { dataJob: MODEL_JOB }) { - + Deskripsi {" "} @@ -192,6 +205,9 @@ export default function Job_Edit({ dataJob }: { dataJob: MODEL_JOB }) { - + - Anda yakin menyimpan data ini ? + + Anda yakin menyimpan data ini ? +