(null);
+ const [loading, setLoading] = useState(false);
+ const [openReject, setOpenReject] = useState(false);
+ const [report, setReport] = useState("");
+
+ useShallowEffect(() => {
+ loadInitialData();
+ }, []);
+
+ const loadInitialData = async () => {
+ try {
+ const response = await apiGetAdminCollaborationById({
+ id: params.id,
+ });
+
+ if (response?.success && response?.data) {
+ setData(response.data);
+ }
+ } catch (error) {
+ clientLogger.error("Invalid data format recieved:", error);
+ setData(null);
+ }
+ };
+
+// async function onReject() {
+// try {
+// setLoading(true);
+// const response = await adminColab_funReportProjectById({
+// colabId: params.id,
+// report: report,
+// });
+
+// if (response.status == 200) {
+// setLoading(false);
+// router.back();
+// }
+// } catch (error) {
+// setLoading(false);
+// ComponentGlobal_NotifikasiPeringatan("Gagal Load");
+// clientLogger.error("Invalid report collaboration", error);
+// }
+// }
+
+ const listData = [
+ {
+ label: "Username",
+ value: data?.Author.username,
+ },
+ {
+ label: "Judul",
+ value: data?.title,
+ },
+ {
+ label: "Industri",
+ value: data?.ProjectCollaborationMaster_Industri.name,
+ },
+ {
+ label: "Jumlah Partisipan",
+ value: data?.ProjectCollaboration_Partisipasi.length,
+ },
+ {
+ label: "Lokasi",
+ value: data?.lokasi,
+ },
+ {
+ label: "Tujuan",
+ value: data?.purpose,
+ },
+ {
+ label: "Keuntungan",
+ value: data?.benefit,
+ },
+ {
+ label: "Catatan Report",
+ value: data?.report,
+ },
+ ];
+
+ return (
+ <>
+
+
+
+
+
+ {!data ? (
+
+ ) : (
+
+
+ {listData.map((e, i) => (
+
+
+
+ {e.label}
+
+
+ :
+
+ {e.value}
+
+
+ ))}
+
+
+
+ )}
+
+
+ >
+ );
+}
+
+export default DetailReject;
diff --git a/src/app_modules/admin/colab/fun/edit/fun_report_project_by_id.ts b/src/app_modules/admin/colab/fun/edit/fun_report_project_by_id.ts
index 592e5484..41b87e6e 100644
--- a/src/app_modules/admin/colab/fun/edit/fun_report_project_by_id.ts
+++ b/src/app_modules/admin/colab/fun/edit/fun_report_project_by_id.ts
@@ -30,16 +30,16 @@ export default async function adminColab_funReportProjectById({
if (!projectUpdate) return { status: 400, message: "Gagal update project" };
- const updateReport = await prisma.projectCollaboration_Notifikasi.create({
- data: {
- projectCollaborationId: colabId,
- adminId: userLoginId as string,
- userId: projectUpdate.userId as any,
- note: "Project Anda Telah Direport Admin",
- },
- });
+ // const updateReport = await prisma.projectCollaboration_Notifikasi.create({
+ // data: {
+ // projectCollaborationId: colabId,
+ // adminId: userLoginId as string,
+ // userId: projectUpdate.userId as any,
+ // note: "Project Anda Telah Direport Admin",
+ // },
+ // });
- if (!updateReport) return { status: 400, message: "Gagal update notifikasi" };
+ // if (!updateReport) return { status: 400, message: "Gagal update notifikasi" };
revalidatePath(RouterAdminColab.table_publish);
return { status: 200, message: "Berhasil Update" };
diff --git a/src/app_modules/admin/colab/lib/api_fetch_admin_collaboration.ts b/src/app_modules/admin/colab/lib/api_fetch_admin_collaboration.ts
index 33306ebe..57765d71 100644
--- a/src/app_modules/admin/colab/lib/api_fetch_admin_collaboration.ts
+++ b/src/app_modules/admin/colab/lib/api_fetch_admin_collaboration.ts
@@ -1,108 +1,151 @@
export {
- apiGetAdminCollaborationStatusCountDashboard,
- apiGetAdminCollaborationPublish,
- apiGetAdminCollaborationReject,
- apiGetAdminCollaborationRoomById,
- apiGetAdminCollaborationById
-
-}
+ apiGetAdminCollaborationStatusCountDashboard,
+ apiGetAdminCollaborationPublish,
+ apiGetAdminCollaborationReject,
+ apiGetAdminCollaborationRoomById,
+ apiGetAdminCollaborationById,
+ apiGetAdminCollaborationGroupById,
+};
const apiGetAdminCollaborationStatusCountDashboard = async ({
- name
+ name,
}: {
- name: "Publish" | "Reject" | "Room";
+ name: "Publish" | "Reject" | "Room";
}) => {
- const { token } = await fetch("/api/get-cookie").then((res) => res.json());
- if (!token) return await token.json().catch(() => null);
+ const { token } = await fetch("/api/get-cookie").then((res) => res.json());
+ if (!token) return await token.json().catch(() => null);
- // console.log("Ini Token", token);
- const response = await fetch(`/api/admin/collaboration/dashboard/${name}`, {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- Accept: "application/json",
- "Access-Control-Allow-Origin": "*",
- Authorization: `Bearer ${token}`,
- }
- })
- // console.log("Ini Response", await response.json());
- return await response.json().catch(() => null);
-}
-const apiGetAdminCollaborationPublish = async ({ page }: {
- page: string,
-
+ // console.log("Ini Token", token);
+ const response = await fetch(`/api/admin/collaboration/dashboard/${name}`, {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "Access-Control-Allow-Origin": "*",
+ Authorization: `Bearer ${token}`,
+ },
+ });
+ // console.log("Ini Response", await response.json());
+ return await response.json().catch(() => null);
+};
+const apiGetAdminCollaborationPublish = async ({ page }: { page: string }) => {
+ const { token } = await fetch("/api/get-cookie").then((res) => res.json());
+ if (!token) return await token.json().catch(() => null);
+
+ const isPage = page ? `?page=${page}` : "";
+ const response = await fetch(
+ `/api/admin/collaboration/status/publish/${isPage}`,
+ {
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "Access-Control-Allow-Origin": "*",
+ Authorization: `Bearer ${token}`,
+ },
+ }
+ );
+
+ return await response.json().catch(() => null);
+};
+
+const apiGetAdminCollaborationReject = async ({ page }: { page: string }) => {
+ const { token } = await fetch("/api/get-cookie").then((res) => res.json());
+ if (!token) return await token.json().catch(() => null);
+
+ const isPage = page ? `?page=${page}` : "";
+ const response = await fetch(
+ `/api/admin/collaboration/status/reject/${isPage}`,
+ {
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "Access-Control-Allow-Origin": "*",
+ Authorization: `Bearer ${token}`,
+ },
+ }
+ );
+
+ return await response.json().catch(() => null);
+};
+const apiGetAdminCollaborationRoomById = async ({
+ page,
+ search,
+}: {
+ page: string;
+ search: string;
}) => {
-
+ const { token } = await fetch("/api/get-cookie").then((res) => res.json());
+ if (!token) return await token.json().catch(() => null);
+
+ const isPage = page ? `?page=${page}` : "";
+ const isSearch = search ? `&search=${search}` : "";
+ const response = await fetch(
+ `/api/admin/collaboration/group${isPage}${isSearch}`,
+ {
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "Access-Control-Allow-Origin": "*",
+ Authorization: `Bearer ${token}`,
+ },
+ }
+ );
+
+ return await response.json().catch(() => null);
+};
+
+const apiGetAdminCollaborationById = async ({ id }: { id: string }) => {
+ const { token } = await fetch("/api/get-cookie").then((res) => res.json());
+ if (!token) return await token.json().catch(() => null);
+
+ const response = await fetch(`/api/admin/collaboration/${id}`, {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "Access-Control-Allow-Origin": "*",
+ Authorization: `Bearer ${token}`,
+ },
+ });
+ return await response.json().catch(() => null);
+};
+
+const apiGetAdminCollaborationGroupById = async ({ id }: { id: string }) => {
+ try {
+ // Fetch token from cookie
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
- if (!token) return await token.json().catch(() => null);
-
- const isPage = page ? `?page=${page}` : "";
- const response = await fetch(`/api/admin/collaboration/status/publish/${isPage}`, {
- headers: {
- "Content-Type": "application/json",
- Accept: "application/json",
- "Access-Control-Allow-Origin": "*",
- Authorization: `Bearer ${token}`,
- }
- })
+ if (!token) {
+ console.error("No token found");
+ return null;
+ }
- return await response.json().catch(() => null);
-}
+ const response = await fetch(`/api/admin/collaboration/group/${id}`, {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ Authorization: `Bearer ${token}`,
+ },
+ });
-const apiGetAdminCollaborationReject = async ({ page }: {
- page: string,
-
-}) => {
-
- const { token } = await fetch("/api/get-cookie").then((res) => res.json());
- if (!token) return await token.json().catch(() => null);
-
- const isPage = page ? `?page=${page}` : "";
- const response = await fetch(`/api/admin/collaboration/status/reject/${isPage}`, {
- headers: {
- "Content-Type": "application/json",
- Accept: "application/json",
- "Access-Control-Allow-Origin": "*",
- Authorization: `Bearer ${token}`,
- }
- })
+ // Check if the response is OK
+ if (!response.ok) {
+ const errorData = await response.json().catch(() => null);
+ console.error(
+ "Failed to get data collaboration group",
+ response.statusText,
+ errorData
+ );
+ throw new Error(
+ errorData?.message || "Failed to get data collaboration group"
+ );
+ }
- return await response.json().catch(() => null);
-}
-const apiGetAdminCollaborationRoomById = async ({ page, search }: {
- page: string,
- search: string
-}) => {
-
- const { token } = await fetch("/api/get-cookie").then((res) => res.json());
- if (!token) return await token.json().catch(() => null);
-
- const isPage = page ? `?page=${page}` : "";
- const isSearch = search ? `&search=${search}` : "";
- const response = await fetch(`/api/admin/collaboration/group${isPage}${isSearch}`, {
- headers: {
- "Content-Type": "application/json",
- Accept: "application/json",
- "Access-Control-Allow-Origin": "*",
- Authorization: `Bearer ${token}`,
- }
- })
-
- return await response.json().catch(() => null);
-}
-
-const apiGetAdminCollaborationById = async ({id} : {id: string}) => {
- const { token } = await fetch("/api/get-cookie").then((res) => res.json());
- if (!token) return await token.json().catch(() => null);
-
- const response = await fetch(`/api/admin/collaboration/${id}`, {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- Accept: "application/json",
- "Access-Control-Allow-Origin": "*",
- Authorization: `Bearer ${token}`,
- }
- })
- return await response.json().catch(() => null);
-}
+ // Return the JSON response
+ const result = await response.json();
+ return result;
+ } catch (error) {
+ console.error("Error get data collaboration group", error);
+ throw error; // Re-throw the error to handle it in the calling function
+ }
+};
diff --git a/src/app_modules/admin/colab/sub_menu/group.tsx b/src/app_modules/admin/colab/sub_menu/group.tsx
index 5dbb4d6d..0b06457a 100644
--- a/src/app_modules/admin/colab/sub_menu/group.tsx
+++ b/src/app_modules/admin/colab/sub_menu/group.tsx
@@ -32,6 +32,7 @@ import adminColab_getListAllGroupChat from "../fun/get/get_list_all_group_chat";
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import { AccentColor } from "@/app_modules/_global/color";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
+import Admin_DetailButton from "../../_admin_global/_component/button/detail_button";
export default function AdminColab_TableGroup({
listGroup,
@@ -114,7 +115,11 @@ function TableMenu({ listGroup }: { listGroup: any }) {
|
-
+
+ {/*
+ Detail 1
+ */}
+
{/* |