Merge branch 'join' of https://github.com/bipproduction/hipmi into bagas/7-mar-25
This commit is contained in:
66
src/app/api/admin/collaboration/[id]/route.ts
Normal file
66
src/app/api/admin/collaboration/[id]/route.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import prisma from "@/lib/prisma";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(req: Request, { params }: { params: { id: string } }) {
|
||||||
|
try {
|
||||||
|
const { id } = params;
|
||||||
|
const data = await prisma.projectCollaboration.findUnique({
|
||||||
|
where: {
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
isActive: true,
|
||||||
|
title: true,
|
||||||
|
lokasi: true,
|
||||||
|
purpose: true,
|
||||||
|
benefit: true,
|
||||||
|
createdAt: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ProjectCollaborationMaster_Industri: true,
|
||||||
|
ProjectCollaboration_Partisipasi: {
|
||||||
|
where: {
|
||||||
|
User: {
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success get collaboration",
|
||||||
|
data: data
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get collaboration >>", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Error get collaboration",
|
||||||
|
reason: (error as Error).message
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,20 +3,15 @@ import backendLogger from "@/util/backendLogger";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export async function GET(request: Request, { params }:
|
export async function GET(request: Request) {
|
||||||
{ params: { name: string } }
|
|
||||||
) {
|
|
||||||
|
|
||||||
|
|
||||||
const { name } = params;
|
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const page = searchParams.get("page");
|
const page = searchParams.get("page");
|
||||||
const takeData = 10;
|
const takeData = 10;
|
||||||
const skipData = Number(page) * takeData - takeData;
|
const skipData = Number(page) * takeData - takeData;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let fixData;
|
let fixData;
|
||||||
const fixStatus = _.startCase(name);
|
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
fixData = await prisma.projectCollaboration.findMany({
|
fixData = await prisma.projectCollaboration.findMany({
|
||||||
@@ -30,6 +25,7 @@ export async function GET(request: Request, { params }:
|
|||||||
active: true,
|
active: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
143
src/app/api/admin/collaboration/status/reject/route.ts
Normal file
143
src/app/api/admin/collaboration/status/reject/route.ts
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
import { prisma } from "@/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
|
||||||
|
const { searchParams } = new URL(request.url);
|
||||||
|
const page = searchParams.get("page");
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = Number(page) * takeData - takeData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
|
||||||
|
|
||||||
|
if (!page) {
|
||||||
|
fixData = await prisma.projectCollaboration.findMany({
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
isActive: false,
|
||||||
|
isReject: true,
|
||||||
|
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,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const data = await prisma.projectCollaboration.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
isActive: false,
|
||||||
|
isReject: true,
|
||||||
|
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 nCount = await prisma.projectCollaboration.count({
|
||||||
|
where: {
|
||||||
|
isActive: false,
|
||||||
|
isReject: true,
|
||||||
|
Author: {
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fixData = {
|
||||||
|
data: data,
|
||||||
|
nPage: _.ceil(nCount / takeData),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success get data collaboration dashboard",
|
||||||
|
data: fixData,
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get data collaboration dashboard >>", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Error get data collaboration dashboard",
|
||||||
|
reason: (error as Error).message
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/app/dev/admin/colab/detail/publish/[id]/page.tsx
Normal file
12
src/app/dev/admin/colab/detail/publish/[id]/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import DetailPublish from '@/app_modules/admin/colab/detail/detail_publish';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
function Page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DetailPublish/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Page;
|
||||||
@@ -2,11 +2,9 @@ import { AdminColab_TablePublish } from "@/app_modules/admin/colab";
|
|||||||
import adminColab_getListAllPublish from "@/app_modules/admin/colab/fun/get/get_list_all_publish";
|
import adminColab_getListAllPublish from "@/app_modules/admin/colab/fun/get/get_list_all_publish";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listData = await adminColab_getListAllPublish({ page: 1 });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminColab_TablePublish listData={listData} />
|
<AdminColab_TablePublish />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { AdminColab_TableRejected } from "@/app_modules/admin/colab";
|
|||||||
import adminColab_getListAllRejected from "@/app_modules/admin/colab/fun/get/get_list_all_reject";
|
import adminColab_getListAllRejected from "@/app_modules/admin/colab/fun/get/get_list_all_reject";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listReject = await adminColab_getListAllRejected({page: 1})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminColab_TableRejected listReject={listReject as any} />
|
<AdminColab_TableRejected />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,8 @@ import {
|
|||||||
} from "@/app_modules/admin/investasi/fun";
|
} from "@/app_modules/admin/investasi/fun";
|
||||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page() {
|
||||||
const investasiId = params.id;
|
|
||||||
const statusTransaksi = await adminInvestasi_getStatusInvestasi();
|
|
||||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
|
||||||
investasiId,
|
|
||||||
page: 1,
|
|
||||||
});
|
|
||||||
// export default async function Page({ params }: { params: { id: string } }) {
|
// export default async function Page({ params }: { params: { id: string } }) {
|
||||||
// const investasiId = params.id;
|
// const investasiId = params.id;
|
||||||
// const dataInvestasi = await getOneInvestasiById(investasiId);
|
// const dataInvestasi = await getOneInvestasiById(investasiId);
|
||||||
@@ -24,8 +19,7 @@ export default async function Page({ params }: { params: { id: string } }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminInvestasi_DetailPublish dataTransaksi={dataTransaksi as any}
|
<AdminInvestasi_DetailPublish
|
||||||
statusTransaksi={statusTransaksi as any}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
11
src/app_modules/admin/colab/detail/detail_group.tsx
Normal file
11
src/app_modules/admin/colab/detail/detail_group.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
function DetailGroup() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
DetailGroup
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DetailGroup;
|
||||||
173
src/app_modules/admin/colab/detail/detail_publish.tsx
Normal file
173
src/app_modules/admin/colab/detail/detail_publish.tsx
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
'use client';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import AdminGlobal_ComponentBackButton from '../../_admin_global/back_button';
|
||||||
|
import { Button, Flex, Grid, Group, Modal, Paper, Stack, Text, Textarea, Title } from '@mantine/core';
|
||||||
|
import { useParams } from 'next/navigation';
|
||||||
|
import { MODEL_COLLABORATION } from '@/app_modules/colab/model/interface';
|
||||||
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
|
import { clientLogger } from '@/util/clientLogger';
|
||||||
|
import { apiGetAdminCollaborationById } from '../lib/api_fetch_admin_collaboration';
|
||||||
|
import { AdminColor } from '@/app_modules/_global/color/color_pallet';
|
||||||
|
import CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from '@/app_modules/_global/notif_global';
|
||||||
|
import { IconCheck } from '@tabler/icons-react';
|
||||||
|
|
||||||
|
function DetailPublish() {
|
||||||
|
const params = useParams<{ id: string }>();
|
||||||
|
const [data, setData] = useState<MODEL_COLLABORATION | null>(null);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [openReject, setOpenReject] = useState(false);
|
||||||
|
|
||||||
|
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 {
|
||||||
|
const response = await apiGetAdminCollaborationById({
|
||||||
|
id: params.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response?.success && response?.data) {
|
||||||
|
setOpenReject(true)
|
||||||
|
setData(response.data);
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ComponentGlobal_NotifikasiPeringatan("Gagal Load");
|
||||||
|
clientLogger.error("Invalid data format recieved:", error);
|
||||||
|
setData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<Flex justify={"space-between"}>
|
||||||
|
<AdminGlobal_ComponentBackButton />
|
||||||
|
<Button radius={"xl"} bg={"red"} color='white' onClick={onReject}>
|
||||||
|
Reject
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
{!data ? (<CustomSkeleton height={"50vh"} width={"100%"} />) : (
|
||||||
|
<Paper bg={AdminColor.softBlue} p={"md"}>
|
||||||
|
<Title pb={10} c={AdminColor.white} order={3}>Detail Publish</Title>
|
||||||
|
<Stack spacing={"xs"}>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Username:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>{data?.Author?.username}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Title:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>@{data?.title}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Industri:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>+ {data?.ProjectCollaborationMaster_Industri.name}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Jumlah Partisipan:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>{data?.ProjectCollaboration_Partisipasi.length}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Lokasi:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>{data?.lokasi}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Tujuan Proyek:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>{data?.purpose}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>Keuntungan:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Text c={AdminColor.white}>{data?.benefit}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* Reject Project */}
|
||||||
|
<Modal
|
||||||
|
styles={{ body: { backgroundColor: AdminColor.softBlue } }}
|
||||||
|
opened={openReject}
|
||||||
|
onClose={() => setOpenReject(false)}
|
||||||
|
centered
|
||||||
|
withCloseButton={false}
|
||||||
|
size={"lg"}
|
||||||
|
>
|
||||||
|
<Paper bg={AdminColor.softBlue} p={"md"}>
|
||||||
|
<Stack>
|
||||||
|
<Text c={AdminColor.white}>
|
||||||
|
Apakah anda yakin ingin mereport project{" "}
|
||||||
|
<Text c={AdminColor.white} span inherit fw={"bold"}>
|
||||||
|
{data?.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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DetailPublish;
|
||||||
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
export {
|
export {
|
||||||
apiGetAdminCollaborationStatusCountDashboard,
|
apiGetAdminCollaborationStatusCountDashboard,
|
||||||
apiGetAdminCollaborationStatusById,
|
apiGetAdminCollaborationPublish,
|
||||||
apiGetAdminCollaborationRoomById
|
apiGetAdminCollaborationReject,
|
||||||
|
apiGetAdminCollaborationRoomById,
|
||||||
|
apiGetAdminCollaborationById
|
||||||
|
|
||||||
}
|
}
|
||||||
const apiGetAdminCollaborationStatusCountDashboard = async ({
|
const apiGetAdminCollaborationStatusCountDashboard = async ({
|
||||||
@@ -25,8 +27,7 @@ const apiGetAdminCollaborationStatusCountDashboard = async ({
|
|||||||
// console.log("Ini Response", await response.json());
|
// console.log("Ini Response", await response.json());
|
||||||
return await response.json().catch(() => null);
|
return await response.json().catch(() => null);
|
||||||
}
|
}
|
||||||
const apiGetAdminCollaborationStatusById = async ({ name, page}: {
|
const apiGetAdminCollaborationPublish = async ({ page }: {
|
||||||
name: "Publish" | "Reject",
|
|
||||||
page: string,
|
page: string,
|
||||||
|
|
||||||
}) => {
|
}) => {
|
||||||
@@ -35,7 +36,28 @@ const apiGetAdminCollaborationStatusById = async ({ name, page}: {
|
|||||||
if (!token) return await token.json().catch(() => null);
|
if (!token) return await token.json().catch(() => null);
|
||||||
|
|
||||||
const isPage = page ? `?page=${page}` : "";
|
const isPage = page ? `?page=${page}` : "";
|
||||||
const response = await fetch(`/api/admin/collaboration/${name}${isPage}`, {
|
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: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
@@ -68,3 +90,19 @@ const apiGetAdminCollaborationRoomById = async ({ page, search }: {
|
|||||||
return await response.json().catch(() => null);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,179 +31,144 @@ import { IconBan, IconCheck, IconEye } from "@tabler/icons-react";
|
|||||||
import adminColab_funReportProjectById from "../fun/edit/fun_report_project_by_id";
|
import adminColab_funReportProjectById from "../fun/edit/fun_report_project_by_id";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function AdminColab_TablePublish({
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
listData,
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
}: {
|
import { apiGetAdminCollaborationPublish } from "../lib/api_fetch_admin_collaboration";
|
||||||
listData: any;
|
import { RouterAdminColab } from "@/lib/router_admin/router_admin_colab";
|
||||||
}) {
|
|
||||||
|
export default function AdminColab_TablePublish() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
|
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
|
||||||
<TableMenu listData={listData} />
|
<TableMenu />
|
||||||
{/* <pre>{JSON.stringify(listData.nPage, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(listData.nPage, null, 2)}</pre> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function TableMenu({ listData }: { listData: any }) {
|
function TableMenu() {
|
||||||
const [data, setData] = useState<MODEL_COLLABORATION[]>(listData.data);
|
const router = useRouter();
|
||||||
const [isNPage, setNPage] = useState(listData.nPage);
|
const [data, setData] = useState<MODEL_COLLABORATION[] | null>(null);
|
||||||
|
const [isNPage, setNPage] = useState<number>(1);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
const [idProject, setIdProject] = useState("");
|
useShallowEffect(() => {
|
||||||
const [openDetail, setOpenDetail] = useState(false);
|
loadInitialData();
|
||||||
const [loadingDetail, setLoadingDetail] = useState(false);
|
}, [activePage]);
|
||||||
const [detailData, setDetailData] = useState<MODEL_COLLABORATION>();
|
|
||||||
|
|
||||||
const [openReject, setOpenReject] = useState(false);
|
const loadInitialData = async () => {
|
||||||
const [report, setReport] = useState("");
|
try {
|
||||||
const [loadingReject, setLoadingReject] = useState(false);
|
const response = await apiGetAdminCollaborationPublish({
|
||||||
const [loadingReport, setLoadingReport] = useState(false);
|
page: `${activePage}`,
|
||||||
|
})
|
||||||
|
console.log("Ini Response", response)
|
||||||
|
|
||||||
// PAGINATION dan No awal data di tampilkan
|
if (response?.success && response?.data?.data) {
|
||||||
let noAwal = activePage * 5 - 4;
|
setData(response.data.data);
|
||||||
async function onLoad(pindahPage: any) {
|
setNPage(response.data.nPage || 1);
|
||||||
const load = await adminColab_getListAllPublish({ page: pindahPage });
|
} else {
|
||||||
setActivePage(pindahPage);
|
console.error("Invalid data format recieved", response);
|
||||||
setData(load.data as any);
|
setData([])
|
||||||
setNPage(load.nPage);
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Invalid data table publish", error);
|
||||||
|
setData([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table Body
|
const onPageCLick = (page: number) => {
|
||||||
const tableRow = data.map((e, i) => (
|
setActivePage(page);
|
||||||
<tr key={i}>
|
}
|
||||||
<td>
|
|
||||||
<Center c={AdminColor.white}>{noAwal++}</Center>
|
const renderTableBody = () => {
|
||||||
</td>
|
if (!Array.isArray(data) || data.length === 0) {
|
||||||
<td>
|
return (
|
||||||
<Center c={AdminColor.white}>
|
<tr>
|
||||||
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
<td colSpan={12}>
|
||||||
</Center>
|
<Center>
|
||||||
</td>
|
<Text color="gray">Tidak ada data</Text>
|
||||||
<td>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Box>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Text lineClamp={1}>{e?.title}</Text>
|
|
||||||
</Center>
|
</Center>
|
||||||
</Box>
|
</td>
|
||||||
</Center>
|
</tr>
|
||||||
</td>
|
)
|
||||||
<td>
|
}
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
|
return data.map((e, i) => (
|
||||||
</Center>
|
<tr key={i}>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
<Center c={AdminColor.white}>
|
||||||
<Center c={AdminColor.white}>
|
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
||||||
<Text>{e?.ProjectCollaboration_Partisipasi.length}</Text>
|
</Center>
|
||||||
</Center>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
<Center c={AdminColor.white}>
|
||||||
<Center>
|
<Box>
|
||||||
<Stack>
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.title}</Text>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text>{e?.ProjectCollaboration_Partisipasi.length}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
<Button
|
<Button
|
||||||
loading={
|
loading={isLoading && e?.id == idData ? true : false}
|
||||||
idProject === e?.id ? (loadingDetail ? true : false) : false
|
|
||||||
}
|
|
||||||
leftIcon={<IconEye />}
|
leftIcon={<IconEye />}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="green"
|
color="green"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
getDetailData(e.id);
|
setLoading(true);
|
||||||
|
setIdData(e?.id);
|
||||||
|
router.push(RouterAdminColab.detail_publish + `${e?.id}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
</Center>
|
||||||
loading={
|
</td>
|
||||||
idProject === e?.id ? (loadingReject ? true : false) : false
|
</tr>
|
||||||
}
|
));
|
||||||
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 onReport() {
|
||||||
async function onRejected(colabId: string) {
|
// if (report === "")
|
||||||
setLoadingReject(true);
|
// return ComponentGlobal_NotifikasiPeringatan("Lengkapi Alasan Report");
|
||||||
setIdProject(colabId);
|
|
||||||
|
|
||||||
await adminColab_getOneByColabId({ id: colabId }).then((res) => {
|
// await adminColab_funReportProjectById({
|
||||||
if (res.status === 200) {
|
// colabId: idData,
|
||||||
const selectedData = _.omit(res.data, [
|
// report: report,
|
||||||
"Author",
|
// }).then(async (res) => {
|
||||||
"ProjectCollaborationMaster_Industri",
|
// if (res.status === 200) {
|
||||||
"ProjectCollaboration_Partisipasi",
|
// const newData = await adminColab_getListAllPublish({
|
||||||
"benefit",
|
// page: activePage,
|
||||||
"createdAt",
|
// });
|
||||||
"purpose",
|
|
||||||
"lokasi",
|
|
||||||
]);
|
|
||||||
|
|
||||||
setDetailData(selectedData as any);
|
// setActivePage(activePage);
|
||||||
setOpenReject(true);
|
// setData(newData.data as any);
|
||||||
setLoadingReject(false);
|
// setNPage(newData.nPage);
|
||||||
} else {
|
// setOpenReject(false);
|
||||||
ComponentGlobal_NotifikasiPeringatan("Gagal Load");
|
// ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
}
|
// } else {
|
||||||
});
|
// ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||||
}
|
// }
|
||||||
|
// });
|
||||||
// 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 (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -217,101 +182,52 @@ function TableMenu({ listData }: { listData: any }) {
|
|||||||
>
|
>
|
||||||
<Title order={4}>Publish</Title>
|
<Title order={4}>Publish</Title>
|
||||||
</Group>
|
</Group>
|
||||||
<Paper p={"md"} bg={AdminColor.softBlue} >
|
{!data ? (
|
||||||
<Stack>
|
<CustomSkeleton height={"80vh"} width={"100%"} />
|
||||||
<ScrollArea h={"65vh"}>
|
) : (
|
||||||
<Table
|
<Paper p={"md"} bg={AdminColor.softBlue} >
|
||||||
verticalSpacing={"xs"}
|
<Stack>
|
||||||
horizontalSpacing={"md"}
|
<ScrollArea h={"65vh"}>
|
||||||
p={"md"}
|
<Table
|
||||||
|
verticalSpacing={"xs"}
|
||||||
>
|
horizontalSpacing={"md"}
|
||||||
<thead>
|
p={"md"}
|
||||||
<tr>
|
|
||||||
<th>
|
>
|
||||||
<Center c={AdminColor.white}>No</Center>
|
<thead>
|
||||||
</th>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Username</Center>
|
<Center c={AdminColor.white}>Username</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Title</Center>
|
<Center c={AdminColor.white}>Title</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Industri</Center>
|
<Center c={AdminColor.white}>Industri</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Jumlah Partisipan</Center>
|
<Center c={AdminColor.white}>Jumlah Partisipan</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Aksi</Center>
|
<Center c={AdminColor.white}>Aksi</Center>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>{tableRow}</tbody>
|
<tbody>{renderTableBody()}</tbody>
|
||||||
</Table>
|
</Table>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
<Pagination
|
<Pagination
|
||||||
position="center"
|
position="center"
|
||||||
total={isNPage}
|
total={isNPage}
|
||||||
value={activePage}
|
value={activePage}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
onLoad(val);
|
onPageCLick(val);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{/* Detail Data */}
|
|
||||||
<Modal
|
|
||||||
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
|
||||||
opened={openDetail}
|
|
||||||
onClose={() => setOpenDetail(false)}
|
|
||||||
centered
|
|
||||||
withCloseButton={false}
|
|
||||||
size={"lg"}
|
|
||||||
>
|
|
||||||
<Paper p={"md"} bg={AdminColor.softBlue}>
|
|
||||||
<ComponentAdminColab_DetailData data={detailData as any} />
|
|
||||||
</Paper>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
{/* Reject Project */}
|
|
||||||
<Modal
|
|
||||||
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
|
||||||
opened={openReject}
|
|
||||||
onClose={() => setOpenReject(false)}
|
|
||||||
centered
|
|
||||||
withCloseButton={false}
|
|
||||||
size={"lg"}
|
|
||||||
>
|
|
||||||
<Paper bg={AdminColor.softBlue} p={"md"}>
|
|
||||||
<Stack>
|
|
||||||
<Text c={AdminColor.white}>
|
|
||||||
Apakah anda yakin ingin mereport project{" "}
|
|
||||||
<Text c={AdminColor.white} 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>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
317
src/app_modules/admin/colab/sub_menu/publish.txt
Normal file
317
src/app_modules/admin/colab/sub_menu/publish.txt
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
"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 "../../_admin_global/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/_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/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
|
||||||
|
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 c={AdminColor.white}>{noAwal++}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Box>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.title}</Text>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<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={AdminColor.softBlue}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
c={AdminColor.white}
|
||||||
|
>
|
||||||
|
<Title order={4}>Publish</Title>
|
||||||
|
</Group>
|
||||||
|
<Paper p={"md"} bg={AdminColor.softBlue} >
|
||||||
|
<Stack>
|
||||||
|
<ScrollArea h={"65vh"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"xs"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>No</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Title</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Industri</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Jumlah Partisipan</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>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
|
||||||
|
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
||||||
|
opened={openDetail}
|
||||||
|
onClose={() => setOpenDetail(false)}
|
||||||
|
centered
|
||||||
|
withCloseButton={false}
|
||||||
|
size={"lg"}
|
||||||
|
>
|
||||||
|
<Paper p={"md"} bg={AdminColor.softBlue}>
|
||||||
|
<ComponentAdminColab_DetailData data={detailData as any} />
|
||||||
|
</Paper>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
{/* Reject Project */}
|
||||||
|
<Modal
|
||||||
|
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
||||||
|
opened={openReject}
|
||||||
|
onClose={() => setOpenReject(false)}
|
||||||
|
centered
|
||||||
|
withCloseButton={false}
|
||||||
|
size={"lg"}
|
||||||
|
>
|
||||||
|
<Paper bg={AdminColor.softBlue} p={"md"}>
|
||||||
|
<Stack>
|
||||||
|
<Text c={AdminColor.white}>
|
||||||
|
Apakah anda yakin ingin mereport project{" "}
|
||||||
|
<Text c={AdminColor.white} 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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -13,118 +13,138 @@ import {
|
|||||||
Spoiler,
|
Spoiler,
|
||||||
Box,
|
Box,
|
||||||
Pagination,
|
Pagination,
|
||||||
|
Button,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
|
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
|
||||||
import adminColab_getListAllRejected from "../fun/get/get_list_all_reject";
|
import adminColab_getListAllRejected from "../fun/get/get_list_all_reject";
|
||||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
|
||||||
export default function AdminColab_TableRejected({
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
listReject,
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
}: {
|
import { IconEye } from "@tabler/icons-react";
|
||||||
listReject: any;
|
import { apiGetAdminCollaborationReject } from "../lib/api_fetch_admin_collaboration";
|
||||||
}) {
|
|
||||||
|
export default function AdminColab_TableRejected() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
|
<ComponentAdminGlobal_HeaderTamplate name="Project Collaboration" />
|
||||||
<TableMenu listReject={listReject} />
|
<TableMenu />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function TableMenu({ listReject }: { listReject: any }) {
|
function TableMenu() {
|
||||||
const [data, setData] = useState<MODEL_COLLABORATION[]>(listReject.data);
|
const [data, setData] = useState<MODEL_COLLABORATION[] | null>(null);
|
||||||
const [isNPage, setNPage] = useState(listReject.nPage);
|
const [isNPage, setNPage] = useState<number>(1);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
|
||||||
let noAwal = activePage * 5 - 4;
|
useShallowEffect(() => {
|
||||||
async function onLoad(pindahPage: any) {
|
loadInitialData()
|
||||||
const load = await adminColab_getListAllRejected({ page: pindahPage });
|
}, [activePage])
|
||||||
setActivePage(pindahPage);
|
const loadInitialData = async () => {
|
||||||
setData(load.data as any);
|
try {
|
||||||
setNPage(load.nPage);
|
const response = await apiGetAdminCollaborationReject({
|
||||||
|
page: `${activePage}`,
|
||||||
|
})
|
||||||
|
console.log("Ini Response", response)
|
||||||
|
if (response?.success && response?.data?.data) {
|
||||||
|
setData(response.data.data);
|
||||||
|
setNPage(response.data.nPage || 1);
|
||||||
|
} else {
|
||||||
|
console.error("Invalid data format recieved", response);
|
||||||
|
setData([])
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get data table reject", error);
|
||||||
|
setData([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableRow = data?.map((e, i) => (
|
const onPageClick = (page: number) => {
|
||||||
<tr key={i}>
|
setActivePage(page);
|
||||||
<td>
|
}
|
||||||
<Center c={AdminColor.white}>{noAwal++}</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Box>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Text lineClamp={1}>{e?.title}</Text>
|
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Center c={AdminColor.white}>
|
|
||||||
<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>
|
const renderTableBody = () => {
|
||||||
|
if (!Array.isArray(data) || data.length === 0) {
|
||||||
|
return (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={12}>
|
||||||
|
<Center>
|
||||||
|
<Text color="gray">Tidak ada data</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Box>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.title}</Text>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text>{e?.ProjectCollaboration_Partisipasi.length}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Box w={300}>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Spoiler
|
||||||
|
hideLabel={"sembunyikan"}
|
||||||
|
maxHeight={50}
|
||||||
|
showLabel="tampilkan"
|
||||||
|
>
|
||||||
|
{e?.report}
|
||||||
|
</Spoiler>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
<Button
|
<Button
|
||||||
loading={
|
loading={loading && e?.id == idData ? true : false}
|
||||||
idProject === e?.id ? (loadingDetail ? true : false) : false
|
|
||||||
}
|
|
||||||
leftIcon={<IconEye />}
|
leftIcon={<IconEye />}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="green"
|
color="green"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
getDetailData(e.id);
|
setLoading(true);
|
||||||
|
setIdData(e.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
</Center>
|
||||||
loading={
|
</td>
|
||||||
idProject === e?.id ? (loadingReject ? true : false) : false
|
</tr >
|
||||||
}
|
));
|
||||||
leftIcon={<IconBan />}
|
}
|
||||||
loaderPosition="center"
|
|
||||||
radius={"xl"}
|
|
||||||
color="red"
|
|
||||||
onClick={() => {
|
|
||||||
onRejected(e.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Reject
|
|
||||||
</Button>
|
|
||||||
</Stack> */}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack spacing={"xs"}>
|
<Stack spacing={"xs"}>
|
||||||
@@ -136,51 +156,55 @@ function TableMenu({ listReject }: { listReject: any }) {
|
|||||||
>
|
>
|
||||||
<Title c={AdminColor.white} order={4}>Reject</Title>
|
<Title c={AdminColor.white} order={4}>Reject</Title>
|
||||||
</Group>
|
</Group>
|
||||||
<Paper p={"md"} bg={AdminColor.softBlue}>
|
{!data ? (
|
||||||
<Stack>
|
<CustomSkeleton height={"80vh"} width={"100%"} />
|
||||||
<ScrollArea h={"65vh"}>
|
) : (
|
||||||
<Table
|
<Paper p={"md"} bg={AdminColor.softBlue}>
|
||||||
verticalSpacing={"lg"}
|
<Stack>
|
||||||
horizontalSpacing={"md"}
|
<ScrollArea h={"65vh"}>
|
||||||
p={"md"}
|
<Table
|
||||||
|
verticalSpacing={"lg"}
|
||||||
>
|
horizontalSpacing={"md"}
|
||||||
<thead>
|
p={"md"}
|
||||||
<tr>
|
|
||||||
<th>
|
>
|
||||||
<Center c={AdminColor.white}>No</Center>
|
<thead>
|
||||||
</th>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Username</Center>
|
<Center c={AdminColor.white}>Username</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Title</Center>
|
<Center c={AdminColor.white}>Title</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Industri</Center>
|
<Center c={AdminColor.white}>Industri</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Jumlah Partisipan</Center>
|
<Center c={AdminColor.white}>Jumlah Partisipan</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Report</Center>
|
<Center c={AdminColor.white}>Report</Center>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
<th>
|
||||||
</thead>
|
<Center c={AdminColor.white}>Aksi</Center>
|
||||||
<tbody>{tableRow}</tbody>
|
</th>
|
||||||
</Table>
|
</tr>
|
||||||
</ScrollArea>
|
</thead>
|
||||||
<Pagination
|
<tbody>{renderTableBody()}</tbody>
|
||||||
position="center"
|
</Table>
|
||||||
total={isNPage}
|
</ScrollArea>
|
||||||
value={activePage}
|
<Pagination
|
||||||
onChange={(val) => {
|
position="center"
|
||||||
onLoad(val);
|
total={isNPage}
|
||||||
}}
|
value={activePage}
|
||||||
/>
|
onChange={(val) => {
|
||||||
</Stack>
|
onPageClick(val);
|
||||||
</Paper>
|
}}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
186
src/app_modules/admin/colab/sub_menu/reject.txt
Normal file
186
src/app_modules/admin/colab/sub_menu/reject.txt
Normal 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 "../../_admin_global/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";
|
||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
|
||||||
|
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 c={AdminColor.white}>{noAwal++}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.Author?.Profile?.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Box>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text lineClamp={1}>{e?.title}</Text>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<Text>{e?.ProjectCollaborationMaster_Industri.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center c={AdminColor.white}>
|
||||||
|
<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={AdminColor.softBlue}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title c={AdminColor.white} order={4}>Reject</Title>
|
||||||
|
</Group>
|
||||||
|
<Paper p={"md"} bg={AdminColor.softBlue}>
|
||||||
|
<Stack>
|
||||||
|
<ScrollArea h={"65vh"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"lg"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>No</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Title</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Industri</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Jumlah Partisipan</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center c={AdminColor.white}>Report</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{tableRow}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
<Pagination
|
||||||
|
position="center"
|
||||||
|
total={isNPage}
|
||||||
|
value={activePage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onLoad(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -17,13 +17,7 @@ import { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
|||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
|
||||||
export function AdminInvestasi_DetailPublish({
|
export function AdminInvestasi_DetailPublish() {
|
||||||
dataTransaksi,
|
|
||||||
statusTransaksi,
|
|
||||||
}: {
|
|
||||||
dataTransaksi: any[];
|
|
||||||
statusTransaksi: any[];
|
|
||||||
}) {
|
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
const [data, setData] = useState<MODEL_INVESTASI | null>(null);
|
const [data, setData] = useState<MODEL_INVESTASI | null>(null);
|
||||||
const [selectPage, setSelectPage] = useAtom(gs_admin_invetasi_menu_publish);
|
const [selectPage, setSelectPage] = useAtom(gs_admin_invetasi_menu_publish);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
<td>
|
<td>
|
||||||
<Spoiler
|
<Spoiler
|
||||||
c={AdminColor.white}
|
c={AdminColor.white}
|
||||||
w={200}
|
w={150}
|
||||||
maxHeight={50}
|
maxHeight={50}
|
||||||
hideLabel="sembunyikan"
|
hideLabel="sembunyikan"
|
||||||
showLabel="tampilkan"
|
showLabel="tampilkan"
|
||||||
@@ -141,7 +141,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
</Spoiler>
|
</Spoiler>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={150}>
|
||||||
{e.imageId ? (
|
{e.imageId ? (
|
||||||
<Button
|
<Button
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
@@ -170,7 +170,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
<Spoiler
|
<Spoiler
|
||||||
style={{ color: AdminColor.white }}
|
style={{ color: AdminColor.white }}
|
||||||
hideLabel="sembunyikan"
|
hideLabel="sembunyikan"
|
||||||
w={400}
|
w={250}
|
||||||
maxHeight={50}
|
maxHeight={50}
|
||||||
showLabel="tampilkan"
|
showLabel="tampilkan"
|
||||||
>
|
>
|
||||||
@@ -226,6 +226,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
|
styles={{ header: { backgroundColor: AdminColor.softBlue }, body: { backgroundColor: AdminColor.softBlue}, title: { color: AdminColor.white } }}
|
||||||
title={"Apakah anda yakin ingin mempublish job ini?"}
|
title={"Apakah anda yakin ingin mempublish job ini?"}
|
||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
opened={publish}
|
opened={publish}
|
||||||
@@ -261,6 +262,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
styles={{ header: { backgroundColor: AdminColor.softBlue }, body: { backgroundColor: AdminColor.softBlue}, title: { color: AdminColor.white } }}
|
||||||
opened={reject}
|
opened={reject}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setReject(false);
|
setReject(false);
|
||||||
@@ -276,7 +278,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
maxRows={5}
|
maxRows={5}
|
||||||
maxLength={300}
|
maxLength={300}
|
||||||
autosize
|
autosize
|
||||||
label={<Text fw={"bold"}>Alasan Penolakan</Text>}
|
label={<Text c={AdminColor.white} fw={"bold"}>Alasan Penolakan</Text>}
|
||||||
placeholder="Masukkan alasan penolakan lowongan ini"
|
placeholder="Masukkan alasan penolakan lowongan ini"
|
||||||
onChange={(val) => setCatatan(val.currentTarget.value)}
|
onChange={(val) => setCatatan(val.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ export const RouterAdminColab = {
|
|||||||
table_publish: "/dev/admin/colab/sub-menu/publish",
|
table_publish: "/dev/admin/colab/sub-menu/publish",
|
||||||
table_group: "/dev/admin/colab/sub-menu/group",
|
table_group: "/dev/admin/colab/sub-menu/group",
|
||||||
table_reject: "/dev/admin/colab/sub-menu/reject",
|
table_reject: "/dev/admin/colab/sub-menu/reject",
|
||||||
|
detail_publish: "/dev/admin/colab/detail/publish/",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ export const RouterAdminDonasi_OLD = {
|
|||||||
pencairan_dana: "/dev/admin/donasi/pencairan_dana/",
|
pencairan_dana: "/dev/admin/donasi/pencairan_dana/",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const RouterColab = {
|
||||||
|
// detail
|
||||||
|
detail_publish: "/dev/admin/colab/detail/publish/",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const RouterAdminAward = {
|
export const RouterAdminAward = {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const middlewareConfig: MiddlewareConfig = {
|
|||||||
// >> buat dibawah sini <<
|
// >> buat dibawah sini <<
|
||||||
"/api/admin/donasi/*",
|
"/api/admin/donasi/*",
|
||||||
"/api/admin/investasi/*",
|
"/api/admin/investasi/*",
|
||||||
|
"/api/admin/collaboration/*",
|
||||||
|
|
||||||
|
|
||||||
// Akses awal
|
// Akses awal
|
||||||
|
|||||||
Reference in New Issue
Block a user