Admin Collaboration Done

# feat
- Detail Project
- Report Project
## No Issuue
This commit is contained in:
2024-05-10 15:16:09 +08:00
parent c34f9a9b75
commit dc41a5f9af
47 changed files with 2110 additions and 83 deletions

View File

@@ -0,0 +1,68 @@
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
export default function ComponentAdminColab_DetailData({
data,
}: {
data: MODEL_COLLABORATION;
}) {
return (
<>
<Stack>
<Box>
<Center px={"md"} mb={"lg"}>
<Title order={4}>{data?.title ? data.title : "Judul Proyek"}</Title>
</Center>
<Stack spacing={"sm"}>
<Grid>
<Grid.Col span={2}>
<Text fw={"bold"} fz={"sm"}>
Industri
</Text>
</Grid.Col>
<Grid.Col span={1}>
<Text fz={"sm"}>:</Text>
</Grid.Col>
<Grid.Col span={"auto"}>
<Text fz={"sm"}>
{data?.ProjectCollaborationMaster_Industri.name
? data.ProjectCollaborationMaster_Industri.name
: "Industri"}
</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={2}>
<Text fw={"bold"} fz={"sm"}>
Lokasi
</Text>
</Grid.Col>
<Grid.Col span={1}>
<Text fz={"sm"}>:</Text>
</Grid.Col>
<Grid.Col span={"auto"}>
<Text fz={"sm"} lineClamp={1}>
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
</Text>
</Grid.Col>
</Grid>
<Stack spacing={5}>
<Text fw={"bold"} fz={"sm"}>
Tujuan proyek
</Text>
<Text fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
</Stack>
<Stack spacing={5}>
<Text fw={"bold"} fz={"sm"}>
Keuntungan
</Text>
<Text fz={"sm"}>{data?.benefit ? data?.benefit : "-"}</Text>
</Stack>
</Stack>
</Box>
</Stack>
</>
);
}

View File

@@ -0,0 +1,72 @@
"use client";
import { Stack, SimpleGrid, Paper, Group, Title, Text } from "@mantine/core";
import { useRouter } from "next/navigation";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
export default function AdminColab_Dashboard({
countPublish,
countRoom,
countReject,
}: {
countPublish: number;
countRoom: number;
countReject: number;
}) {
const router = useRouter();
const listStatus = [
{
id: 1,
name: "Publish",
jumlah: countPublish,
color: "green",
},
{
id: 2,
name: "Group Chat",
jumlah: countRoom,
color: "orange",
},
{
id: 3,
name: "Reject",
jumlah: countReject,
color: "red",
},
];
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
>
{listStatus.map((e, i) => (
<Paper
key={i}
bg={"gray.2"}
shadow="md"
radius="md"
p="md"
// sx={{ borderColor: e.color, borderStyle: "solid" }}
>
<Group position="center">
<Stack align="center" spacing={0}>
<Text>{e.name}</Text>
<Title>{e.jumlah ? e.jumlah : 0}</Title>
</Stack>
</Group>
</Paper>
))}
</SimpleGrid>
</Stack>
</>
);
}

View File

@@ -0,0 +1,13 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function adminColab_countGroupChat() {
const count = await prisma.projectCollaboration_RoomChat.count({
where: {
isActive: true,
},
});
return count;
}

View File

@@ -0,0 +1,13 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function adminColab_countIsPublish() {
const count = await prisma.projectCollaboration.count({
where: {
isActive: true,
},
});
return count;
}

View File

@@ -0,0 +1,13 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function adminColab_countIsReject() {
const count = await prisma.projectCollaboration.count({
where: {
isReject: true,
},
});
return count;
}

View File

@@ -0,0 +1,46 @@
"use server";
import prisma from "@/app/lib/prisma";
import { RouterAdminColab } from "@/app/lib/router_admin/router_admin_colab";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
import { revalidatePath } from "next/cache";
export default async function adminColab_funReportProjectById({
colabId,
report,
}: {
colabId: string;
report: string;
}) {
const authorId = await user_getOneUserId();
const projectUpdate = await prisma.projectCollaboration.update({
where: {
id: colabId,
},
data: {
isActive: false,
isReject: true,
report: report,
},
select: {
userId: true,
},
});
if (!projectUpdate) return { status: 400, message: "Gagal update project" };
const updateReport = await prisma.projectCollaboration_Notifikasi.create({
data: {
projectCollaborationId: colabId,
adminId: authorId,
userId: projectUpdate.userId as any,
note: "Project Anda Telah Direport Admin",
},
});
if (!updateReport) return { status: 400, message: "Gagal update notifikasi" };
revalidatePath(RouterAdminColab.table_publish);
return { status: 200, message: "Berhasil Update" };
}

View File

@@ -0,0 +1,74 @@
"use server";
import prisma from "@/app/lib/prisma";
import { ceil } from "lodash";
export default async function adminColab_getListAllGroupChat({
page,
}: {
page: number;
}) {
const lewat = page * 5 - 5;
const ambil = 5;
const dataAwal = await prisma.projectCollaboration_RoomChat.count({
where: {
isActive: true,
},
});
const getData = await prisma.projectCollaboration_RoomChat.findMany({
orderBy: {
createdAt: "desc",
},
where: {
isActive: true,
},
select: {
id: true,
createdAt: true,
isActive: true,
name: true,
ProjectCollaboration_AnggotaRoomChat: {
select: {
User: {
select: {
id: true,
Profile: true,
},
},
},
},
ProjectCollaboration: {
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
createdAt: true,
report: true,
Author: {
select: {
id: true,
Profile: {
select: {
name: true,
},
},
},
},
ProjectCollaborationMaster_Industri: true,
},
},
},
});
const allData = {
data: getData,
nPage: ceil(dataAwal / ambil)
}
return allData;
}

View File

@@ -0,0 +1,76 @@
"use server";
import prisma from "@/app/lib/prisma";
import _, { ceil } from "lodash";
export default async function adminColab_getListAllPublish({
page,
}: {
page: number;
}) {
const lewat = page * 5 - 5;
const ambil = 5;
const awal = await prisma.projectCollaboration.count({
where: {
isActive: true,
isReject: false,
Author: {
active: true,
},
},
});
const getData = await prisma.projectCollaboration.findMany({
skip: lewat,
take: ambil,
orderBy: {
createdAt: "desc",
},
where: {
isActive: true,
isReject: false,
Author: {
active: true,
},
},
select: {
id: true,
createdAt: true,
isActive: true,
title: true,
Author: {
select: {
id: true,
username: true,
Profile: true,
},
},
projectCollaborationMaster_IndustriId: true,
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
User: {
active: true,
},
},
// select: {
// User: {
// select: {
// id: true,
// username: true,
// Profile: true,
// },
// },
// },
},
},
});
const allData = {
data: getData,
nPage: ceil(awal / ambil),
};
return allData;
}

View File

@@ -0,0 +1,80 @@
"use server";
import prisma from "@/app/lib/prisma";
import _ from "lodash";
export default async function adminColab_getListAllRejected({
page,
}: {
page: number;
}) {
const lewat = page * 5 - 5;
const ambil = 5;
const dataAwal = await prisma.projectCollaboration.count({
where: {
isActive: false,
isReject: true,
Author: {
active: true,
},
},
});
const getData = await prisma.projectCollaboration.findMany({
skip: lewat,
take: ambil,
orderBy: {
updatedAt: "desc",
},
where: {
isActive: false,
isReject: true,
Author: {
active: true,
},
},
select: {
id: true,
createdAt: true,
isActive: true,
title: true,
report: true,
Author: {
select: {
id: true,
username: true,
Profile: true,
},
},
projectCollaborationMaster_IndustriId: true,
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
User: {
active: true,
},
},
select: {
id: true,
User: {
select: {
Profile: {
select: {
name: true,
},
},
},
},
},
},
},
});
const allData = {
data: getData,
nPage: _.ceil(dataAwal / ambil),
};
return allData
}

View File

@@ -0,0 +1,54 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function adminColab_getOneByColabId({
id,
}: {
id: string;
}) {
const getData = await prisma.projectCollaboration.findFirst({
where: {
id: id,
},
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
createdAt: true,
Author: {
select: {
id: true,
Profile: true,
},
},
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
User: {
active: true,
},
},
select: {
id: true,
User: {
select: {
id: true,
Profile: {
select: {
name: true,
},
},
},
},
},
},
},
});
if (!getData) return { status: 400, message: "Gagal " };
return { data: getData, status: 200, message: " Berhasil" };
}

View File

@@ -0,0 +1,49 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function adminColab_getOneRoomChatById({
roomId,
}: {
roomId: string;
}) {
const get = await prisma.projectCollaboration_RoomChat.findFirst({
where: {
id: roomId,
},
select: {
id: true,
name: true,
ProjectCollaboration: {
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
createdAt: true,
ProjectCollaborationMaster_Industri: true,
},
},
ProjectCollaboration_AnggotaRoomChat: {
select: {
User: {
select: {
id: true,
Profile: {
select: {
id: true,
name: true,
},
},
},
},
},
},
},
});
if (!get) return { status: 400, message: "Gagal ambil data" };
return {data: get, status: 200, message: "Berhasil ambil data" };
}

View File

@@ -0,0 +1,11 @@
import AdminColab_Dashboard from "./dashboard";
import AdminColab_TablePublish from "./sub_menu/publish";
import AdminColab_TableGroup from "./sub_menu/group";
import AdminColab_TableRejected from "./sub_menu/reject";
export {
AdminColab_Dashboard,
AdminColab_TablePublish,
AdminColab_TableGroup,
AdminColab_TableRejected,
};

View File

@@ -0,0 +1,249 @@
"use client";
import {
Stack,
Group,
Title,
Paper,
ScrollArea,
Table,
Center,
Text,
Badge,
Spoiler,
Pagination,
Button,
Modal,
SimpleGrid,
Box,
} from "@mantine/core";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import {
MODEL_COLLABORATION,
MODEL_COLLABORATION_ROOM_CHAT,
} from "@/app_modules/colab/model/interface";
import { IconBan, IconCircleDot, IconEye } from "@tabler/icons-react";
import { useState } from "react";
import adminColab_getOneByColabId from "../fun/get/get_one_by_colab_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import ComponentAdminColab_DetailData from "../component/detail_data";
import adminColab_getOneRoomChatById from "../fun/get/get_one_room_chat_by_id";
import adminColab_getListAllGroupChat from "../fun/get/get_list_all_group_chat";
export default function AdminColab_TableGroup({
listGroup,
}: {
listGroup: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
<TableMenu listGroup={listGroup} />
</Stack>
</>
);
}
function TableMenu({ listGroup }: { listGroup: any }) {
const [data, setData] = useState<MODEL_COLLABORATION_ROOM_CHAT[]>(
listGroup.data
);
const [isNPage, setNPage] = useState(listGroup.nPage);
const [activePage, setActivePage] = useState(1);
const [idProject, setIdProject] = useState("");
const [openDetail, setOpenDetail] = useState(false);
const [loadingDetail, setLoadingDetail] = useState(false);
const [detailData, setDetailData] = useState<MODEL_COLLABORATION_ROOM_CHAT>();
// PAGINATION dan No awal data di tampilkan
let noAwal = activePage * 5 - 4;
async function onLoad(pindahPage: any) {
const load = await adminColab_getListAllGroupChat({ page: pindahPage });
setActivePage(pindahPage);
setData(load.data as any);
setNPage(load.nPage);
}
async function onDetailData(roomId: string) {
setLoadingDetail(true);
await adminColab_getOneRoomChatById({ roomId: roomId }).then((res) => {
if (res.status === 200) {
setIdProject(roomId);
setLoadingDetail(false);
setDetailData(res.data as any);
setOpenDetail(true);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
const tableRow = data.map((e, i) => (
<tr key={i}>
<td>
<Center>{noAwal++}</Center>
</td>
<td>
<Center>
<Text lineClamp={1}>
{e?.ProjectCollaboration?.Author?.Profile?.name}
</Text>
</Center>
</td>
<td>
<Center>
<Text lineClamp={1}>{e?.name}</Text>
</Center>
</td>
<td>
<Center>
<Text>
{e?.ProjectCollaboration?.ProjectCollaborationMaster_Industri?.name}
</Text>
</Center>
</td>
<td>
<Center>
<Text>{e?.ProjectCollaboration_AnggotaRoomChat.length}</Text>
</Center>
</td>
<td>
<Center>
<Stack>
<Button
loading={
idProject === e?.id ? (loadingDetail ? true : false) : false
}
leftIcon={<IconEye />}
loaderPosition="center"
radius={"xl"}
color="green"
onClick={() => {
onDetailData(e?.id);
}}
>
Detail
</Button>
{/* <Button
// loading={
// idProject === e?.id ? (loadingReject ? true : false) : false
// }
leftIcon={<IconBan />}
loaderPosition="center"
radius={"xl"}
color="red"
// onClick={() => {
// onRejected(e.id);
// }}
>
Reject
</Button> */}
</Stack>
</Center>
</td>
</tr>
));
return (
<>
<Stack spacing={"xs"}>
<Group
position="apart"
bg={"blue.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Group Chat</Title>
</Group>
<Paper p={"md"} withBorder shadow="lg">
<Stack>
<ScrollArea h={"65vh"}>
<Table
verticalSpacing={"xs"}
horizontalSpacing={"md"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>No</Center>
</th>
<th>
<Center>Admin Room</Center>
</th>
<th>
<Center>Nama Group</Center>
</th>
<th>
<Center>Industri</Center>
</th>
<th>
<Center>Jumlah Partisipan</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{tableRow}</tbody>
</Table>
</ScrollArea>
<Pagination
position="center"
total={isNPage}
value={activePage}
onChange={(val) => {
onLoad(val);
}}
/>
</Stack>
</Paper>
</Stack>
<Modal
opened={openDetail}
onClose={() => setOpenDetail(false)}
centered
size={"xl"}
withCloseButton={false}
>
<SimpleGrid cols={2}>
<Paper bg={"gray.1"} p={"md"} h={500}>
<ScrollArea h={"100%"} w={"100%"}>
<ComponentAdminColab_DetailData
data={detailData?.ProjectCollaboration as any}
/>
</ScrollArea>
</Paper>
<Paper bg={"gray.1"} p={"md"} h={500}>
<ScrollArea h={"100%"}>
<Stack>
<Center>
<Title order={4}>Partisipan</Title>
</Center>
<Stack>
{detailData?.ProjectCollaboration_AnggotaRoomChat?.map(
(e, i) => (
<Box key={i}>
<Text lineClamp={1}>
<IconCircleDot size={10} />{" "}
<Text span inherit>
{e?.User?.Profile?.name}
</Text>
</Text>
</Box>
)
)}
</Stack>
</Stack>
</ScrollArea>
</Paper>
</SimpleGrid>
</Modal>
{/* <pre>{JSON.stringify(detailData, null, 2)}</pre> */}
</>
);
}

View File

@@ -0,0 +1,314 @@
"use client";
import {
Stack,
Group,
Title,
Paper,
ScrollArea,
Table,
Center,
Text,
Badge,
Spoiler,
Pagination,
Button,
Modal,
TextInput,
Textarea,
Box,
} from "@mantine/core";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
import { useState } from "react";
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
import adminColab_getListAllPublish from "../fun/get/get_list_all_publish";
import ComponentAdminColab_DetailData from "../component/detail_data";
import adminColab_getOneByColabId from "../fun/get/get_one_by_colab_id";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import _ from "lodash";
import { IconBan, IconCheck, IconEye } from "@tabler/icons-react";
import adminColab_funReportProjectById from "../fun/edit/fun_report_project_by_id";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
export default function AdminColab_TablePublish({
listData,
}: {
listData: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
<TableMenu listData={listData} />
{/* <pre>{JSON.stringify(listData.nPage, null, 2)}</pre> */}
</Stack>
</>
);
}
function TableMenu({ listData }: { listData: any }) {
const [data, setData] = useState<MODEL_COLLABORATION[]>(listData.data);
const [isNPage, setNPage] = useState(listData.nPage);
const [activePage, setActivePage] = useState(1);
const [idProject, setIdProject] = useState("");
const [openDetail, setOpenDetail] = useState(false);
const [loadingDetail, setLoadingDetail] = useState(false);
const [detailData, setDetailData] = useState<MODEL_COLLABORATION>();
const [openReject, setOpenReject] = useState(false);
const [report, setReport] = useState("");
const [loadingReject, setLoadingReject] = useState(false);
const [loadingReport, setLoadingReport] = useState(false);
// PAGINATION dan No awal data di tampilkan
let noAwal = activePage * 5 - 4;
async function onLoad(pindahPage: any) {
const load = await adminColab_getListAllPublish({ page: pindahPage });
setActivePage(pindahPage);
setData(load.data as any);
setNPage(load.nPage);
}
// Table Body
const tableRow = data.map((e, i) => (
<tr key={i}>
<td>
<Center>{noAwal++}</Center>
</td>
<td>
<Center>
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
</Center>
</td>
<td>
<Center>
<Box>
<Center>
<Text lineClamp={1}>{e?.title}</Text>
</Center>
</Box>
</Center>
</td>
<td>
<Center>
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
</Center>
</td>
<td>
<Center>
<Text>{e?.ProjectCollaboration_Partisipasi.length}</Text>
</Center>
</td>
<td>
<Center>
<Stack>
<Button
loading={
idProject === e?.id ? (loadingDetail ? true : false) : false
}
leftIcon={<IconEye />}
loaderPosition="center"
radius={"xl"}
color="green"
onClick={() => {
getDetailData(e.id);
}}
>
Detail
</Button>
<Button
loading={
idProject === e?.id ? (loadingReject ? true : false) : false
}
leftIcon={<IconBan />}
loaderPosition="center"
radius={"xl"}
color="red"
onClick={() => {
onRejected(e.id);
}}
>
Reject
</Button>
</Stack>
</Center>
</td>
</tr>
));
// Menampilkan Detail Data
async function getDetailData(colabId: any) {
setLoadingDetail(true);
setIdProject(colabId);
await adminColab_getOneByColabId({ id: colabId }).then((res) => {
if (res.status === 200) {
setDetailData(res.data as any);
setOpenDetail(true);
setLoadingDetail(false);
} else {
ComponentGlobal_NotifikasiPeringatan("Gagal Load");
}
});
}
// Menampilkan Data Title yang akan di REJECT
async function onRejected(colabId: string) {
setLoadingReject(true);
setIdProject(colabId);
await adminColab_getOneByColabId({ id: colabId }).then((res) => {
if (res.status === 200) {
const selectedData = _.omit(res.data, [
"Author",
"ProjectCollaborationMaster_Industri",
"ProjectCollaboration_Partisipasi",
"benefit",
"createdAt",
"purpose",
"lokasi",
]);
setDetailData(selectedData as any);
setOpenReject(true);
setLoadingReject(false);
} else {
ComponentGlobal_NotifikasiPeringatan("Gagal Load");
}
});
}
// Update status report pada project
async function onReport() {
if (report === "")
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Alasan Report");
await adminColab_funReportProjectById({
colabId: idProject,
report: report,
}).then(async (res) => {
if (res.status === 200) {
const newData = await adminColab_getListAllPublish({
page: activePage,
});
setActivePage(activePage);
setData(newData.data as any);
setNPage(newData.nPage);
setOpenReject(false);
ComponentGlobal_NotifikasiBerhasil(res.message);
} else {
ComponentGlobal_NotifikasiPeringatan(res.message);
}
});
}
return (
<>
<Stack spacing={"xs"}>
<Group
position="apart"
bg={"green.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Publish</Title>
</Group>
<Paper p={"md"} withBorder shadow="lg" >
<Stack>
<ScrollArea h={"65vh"}>
<Table
verticalSpacing={"xs"}
horizontalSpacing={"md"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>No</Center>
</th>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Title</Center>
</th>
<th>
<Center>Industri</Center>
</th>
<th>
<Center>Jumlah Partisipan</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{tableRow}</tbody>
</Table>
</ScrollArea>
<Pagination
position="center"
total={isNPage}
value={activePage}
onChange={(val) => {
onLoad(val);
}}
/>
</Stack>
</Paper>
</Stack>
{/* Detail Data */}
<Modal
opened={openDetail}
onClose={() => setOpenDetail(false)}
centered
withCloseButton={false}
size={"lg"}
>
<Paper p={"md"} bg={"gray.1"}>
<ComponentAdminColab_DetailData data={detailData as any} />
</Paper>
</Modal>
{/* Reject Project */}
<Modal
opened={openReject}
onClose={() => setOpenReject(false)}
centered
withCloseButton={false}
size={"lg"}
>
<Paper p={"md"}>
<Stack>
<Text>
Apakah anda yakin ingin mereport project{" "}
<Text span inherit fw={"bold"}>
{detailData?.title}
</Text>
?
</Text>{" "}
<Textarea
minRows={2}
placeholder="Ketik alasan report.."
onChange={(val) => setReport(val.currentTarget.value)}
/>
<Group position="right">
<Button
leftIcon={<IconCheck />}
radius={"xl"}
onClick={() => onReport()}
>
Simpan
</Button>
</Group>
</Stack>
</Paper>
</Modal>
</>
);
}

View File

@@ -0,0 +1,186 @@
"use client";
import {
Stack,
Group,
Title,
Paper,
ScrollArea,
Table,
Center,
Text,
Badge,
Spoiler,
Box,
Pagination,
} from "@mantine/core";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import { useState } from "react";
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
import adminColab_getListAllRejected from "../fun/get/get_list_all_reject";
export default function AdminColab_TableRejected({
listReject,
}: {
listReject: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
<TableMenu listReject={listReject} />
</Stack>
</>
);
}
function TableMenu({ listReject }: { listReject: any }) {
const [data, setData] = useState<MODEL_COLLABORATION[]>(listReject.data);
const [isNPage, setNPage] = useState(listReject.nPage);
const [activePage, setActivePage] = useState(1);
let noAwal = activePage * 5 - 4;
async function onLoad(pindahPage: any) {
const load = await adminColab_getListAllRejected({ page: pindahPage });
setActivePage(pindahPage);
setData(load.data as any);
setNPage(load.nPage);
}
const tableRow = data?.map((e, i) => (
<tr key={i}>
<td>
<Center>{noAwal++}</Center>
</td>
<td>
<Center>
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
</Center>
</td>
<td>
<Center>
<Box>
<Center>
<Text lineClamp={1}>{e?.title}</Text>
</Center>
</Box>
</Center>
</td>
<td>
<Center>
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
</Center>
</td>
<td>
<Center>
<Text>{e?.ProjectCollaboration_Partisipasi.length}</Text>
</Center>
</td>
<td>
<Center>
<Box w={400}>
<Center>
<Spoiler
hideLabel={"sembunyikan"}
maxHeight={50}
showLabel="tampilkan"
>
{e?.report}
</Spoiler>
</Center>
</Box>
</Center>
{/* <Stack>
<Button
loading={
idProject === e?.id ? (loadingDetail ? true : false) : false
}
leftIcon={<IconEye />}
loaderPosition="center"
radius={"xl"}
color="green"
onClick={() => {
getDetailData(e.id);
}}
>
Detail
</Button>
<Button
loading={
idProject === e?.id ? (loadingReject ? true : false) : false
}
leftIcon={<IconBan />}
loaderPosition="center"
radius={"xl"}
color="red"
onClick={() => {
onRejected(e.id);
}}
>
Reject
</Button>
</Stack> */}
</td>
</tr>
));
return (
<>
<Stack spacing={"xs"}>
<Group
position="apart"
bg={"red.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Reject</Title>
</Group>
<Paper p={"md"} withBorder shadow="lg">
<Stack>
<ScrollArea h={"65vh"}>
<Table
verticalSpacing={"lg"}
horizontalSpacing={"md"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>No</Center>
</th>
<th>
<Center>Username</Center>
</th>
<th>
<Center>Title</Center>
</th>
<th>
<Center>Industri</Center>
</th>
<th>
<Center>Jumlah Partisipan</Center>
</th>
<th>
<Center>Report</Center>
</th>
</tr>
</thead>
<tbody>{tableRow}</tbody>
</Table>
</ScrollArea>
<Pagination
position="center"
total={isNPage}
value={activePage}
onChange={(val) => {
onLoad(val);
}}
/>
</Stack>
</Paper>
</Stack>
</>
);
}

View File

@@ -5,7 +5,7 @@ import { Box, Title, Divider, Stack } from "@mantine/core";
export default function ComponentAdminGlobal_HeaderTamplate({name}: {name: string}) {
return (
<>
<Stack spacing={"xs"}>
<Stack spacing={"xs"} >
<Title>{name ? name : null}</Title>
<Divider/>
</Stack>

View File

@@ -221,18 +221,16 @@ export default function AdminLayout({
navbarOffsetBreakpoint="md"
asideOffsetBreakpoint="sm"
navbar={
<MediaQuery
smallerThan={"md"}
styles={{ display: "none", }}
>
<MediaQuery smallerThan={"md"} styles={{ display: "none" }}>
<Navbar
h={"100vh"}
width={{ lg: 200, md: 200, sm: 200, base: 200 }}
hiddenBreakpoint="md"
hidden={!opened}
p="xs"
bg={"gray.2"}
>
<ScrollArea h={"100vh"} scrollbarSize={2}>
<ScrollArea h={"100vh"} scrollbarSize={2}>
<Navbar.Section>
<Stack>
{userRole === "3" ? navbarItems : notAdminDev}

View File

@@ -1,3 +1,4 @@
import { RouterAdminColab } from "@/app/lib/router_admin/router_admin_colab";
import { RouterAdminDeveloper } from "@/app/lib/router_admin/router_admin_developer";
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum";
@@ -9,7 +10,13 @@ import {
RouterAdminDonasi,
RouterAdminInvestasi,
} from "@/app/lib/router_hipmi/router_admin";
import { IconBriefcase, IconDashboard, IconMessages, IconUserCog } from "@tabler/icons-react";
import {
IconAffiliate,
IconBriefcase,
IconDashboard,
IconMessages,
IconUserCog,
} from "@tabler/icons-react";
import {
IconHeartHandshake,
IconHome,
@@ -173,6 +180,34 @@ export const listAdminPage = [
// },
],
},
{
id: 8,
name: "Project Collaboration",
path: "",
icon: <IconAffiliate />,
child: [
{
id: 81,
name: "Dashboard",
path: RouterAdminColab.dashboard,
},
{
id: 82,
name: "Table Publish",
path: RouterAdminColab.table_publish,
},
{
id: 83,
name: "Table Group",
path: RouterAdminColab.table_group,
},
{
id: 84,
name: "Table Reject",
path: RouterAdminColab.table_reject,
},
],
},
{
id: 98,
name: "User Access",

View File

@@ -103,8 +103,8 @@ export default function AdminUserAccess_View({
placeholder="Masukan username"
/> */}
</Group>
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea h={"70vh"}>
<Paper p={"md"} withBorder shadow="lg" h={"85vh"}>
<ScrollArea h={"80vh"}>
<Table
verticalSpacing={"xs"}
horizontalSpacing={"md"}