Add API Dashboard ADMIN Doasi, Job, dan Voting
This commit is contained in:
@@ -26,9 +26,6 @@ export async function GET(request: Request, { params }: {
|
|||||||
DonasiMaster_Status: {
|
DonasiMaster_Status: {
|
||||||
name: fixStatus
|
name: fixStatus
|
||||||
},
|
},
|
||||||
DonasiMaster_Ketegori: {
|
|
||||||
name: fixStatus
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
|
|||||||
39
src/app/api/admin/donasi/dashboard/kategori/route.ts
Normal file
39
src/app/api/admin/donasi/dashboard/kategori/route.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== 'GET') {
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: 'Method not allowed',
|
||||||
|
},
|
||||||
|
{ status: 405 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
fixData = await prisma.donasiMaster_Kategori.count({});
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: 'Success get data donasi dashboard',
|
||||||
|
data: fixData
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error('Error get data donasi dashboard >>', error);
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: 'Error get data donasi dashboard',
|
||||||
|
reason: (error as Error).message
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/app/api/admin/job/dashboard/[status]/route.ts
Normal file
50
src/app/api/admin/job/dashboard/[status]/route.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: Request, { params }: {
|
||||||
|
params: { status: string }
|
||||||
|
}) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Method not allowed",
|
||||||
|
},
|
||||||
|
{ status: 405 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const { status } = params;
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
const fixStatus = _.startCase(status);
|
||||||
|
fixData = await prisma.job.count({
|
||||||
|
where: {
|
||||||
|
MasterStatus: {
|
||||||
|
name: fixStatus,
|
||||||
|
},
|
||||||
|
isArsip: false,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success get data job-vacancy dashboard",
|
||||||
|
data: fixData
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get data job-vacancy dashboard", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Error get data job-vacancy dashboard",
|
||||||
|
reason: (error as Error).message,
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
44
src/app/api/admin/job/dashboard/arsip/route.ts
Normal file
44
src/app/api/admin/job/dashboard/arsip/route.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Method not allowed",
|
||||||
|
},
|
||||||
|
{ status: 405 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
fixData = await prisma.job.count({
|
||||||
|
where: {
|
||||||
|
MasterStatus: {
|
||||||
|
name: "Publish"
|
||||||
|
},
|
||||||
|
isArsip: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success get data job-vacancy dashboard",
|
||||||
|
data: fixData
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get data job-vacancy dashboard", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Error get data job-vacancy dashboard",
|
||||||
|
reason: (error as Error).message
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
51
src/app/api/admin/voting/dashboard/[name]/route.ts
Normal file
51
src/app/api/admin/voting/dashboard/[name]/route.ts
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: Request, { params }: {
|
||||||
|
params: { name: string }
|
||||||
|
}) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Method not allowed",
|
||||||
|
},
|
||||||
|
{ status: 405 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { name } = params;
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
const fixStatus = _.startCase(name);
|
||||||
|
fixData = await prisma.voting.count({
|
||||||
|
where: {
|
||||||
|
Voting_Status: {
|
||||||
|
name: fixStatus
|
||||||
|
},
|
||||||
|
isArsip: false
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success get data voting dashboard",
|
||||||
|
data: fixData
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get data voting dashboard >>", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Error get data voting dashboard",
|
||||||
|
reason: (error as Error).message
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
44
src/app/api/admin/voting/dashboard/riwayat/route.ts
Normal file
44
src/app/api/admin/voting/dashboard/riwayat/route.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: "Method not allowed",
|
||||||
|
},
|
||||||
|
{ status: 405 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
fixData = await prisma.voting.count({
|
||||||
|
where: {
|
||||||
|
Voting_Status: {
|
||||||
|
name: "Publish",
|
||||||
|
},
|
||||||
|
isArsip: true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: 'Success get data voting dashboard',
|
||||||
|
data: fixData
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error('Error get data voting dashboard >>', error);
|
||||||
|
NextResponse.json({
|
||||||
|
success: false,
|
||||||
|
message: 'Error get data voting dashboard',
|
||||||
|
reason: (error as Error).message
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@ import { AdminJob_Main } from "@/app_modules/admin/job";
|
|||||||
import { AdminJob_funCountStatusByStatusId } from "@/app_modules/admin/job/fun/count/fun_count_job_by_status_id";
|
import { AdminJob_funCountStatusByStatusId } from "@/app_modules/admin/job/fun/count/fun_count_job_by_status_id";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const countPublish = await AdminJob_funCountStatusByStatusId("1")
|
// const countPublish = await AdminJob_funCountStatusByStatusId("1")
|
||||||
const countReview = await AdminJob_funCountStatusByStatusId("2");
|
// const countReview = await AdminJob_funCountStatusByStatusId("2");
|
||||||
const countReject = await AdminJob_funCountStatusByStatusId("4");
|
// const countReject = await AdminJob_funCountStatusByStatusId("4");
|
||||||
const countArsip = await AdminJob_funCountStatusByStatusId("0")
|
// const countArsip = await AdminJob_funCountStatusByStatusId("0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -13,10 +13,10 @@ export default async function Page() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminJob_Main
|
<AdminJob_Main
|
||||||
countPublish={countPublish as number}
|
// countPublish={countPublish as number}
|
||||||
countReview={countReview as number}
|
// countReview={countReview as number}
|
||||||
countReject={countReject as number}
|
// countReject={countReject as number}
|
||||||
countArsip={countArsip as number}
|
// countArsip={countArsip as number}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,18 +2,18 @@ import { AdminVote_Main } from "@/app_modules/admin/vote";
|
|||||||
import AdminVote_funCountByStatusId from "@/app_modules/admin/vote/fun/count/fun_count_vote_by_status_id";
|
import AdminVote_funCountByStatusId from "@/app_modules/admin/vote/fun/count/fun_count_vote_by_status_id";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const countPublish = await AdminVote_funCountByStatusId("1");
|
// const countPublish = await AdminVote_funCountByStatusId("1");
|
||||||
const countReview = await AdminVote_funCountByStatusId("2");
|
// const countReview = await AdminVote_funCountByStatusId("2");
|
||||||
const countDraft = await AdminVote_funCountByStatusId("0");
|
// const countDraft = await AdminVote_funCountByStatusId("0");
|
||||||
const countReject = await AdminVote_funCountByStatusId("4");
|
// const countReject = await AdminVote_funCountByStatusId("4");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminVote_Main
|
<AdminVote_Main
|
||||||
countPublish={countPublish as number}
|
// countPublish={countPublish as number}
|
||||||
countReview={countReview as number}
|
// countReview={countReview as number}
|
||||||
countDraft={countDraft as number}
|
// countDraft={countDraft as number}
|
||||||
countReject={countReject as number}
|
// countReject={countReject as number}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ const apiGetDonasiStatusCountDashboard = async ({ name }:
|
|||||||
return await response.json().catch(() => null);
|
return await response.json().catch(() => null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiGetDonasiKategoriCountDashboard = async ({ name }: { name: "Kategori" }) => {
|
const apiGetDonasiKategoriCountDashboard = async () => {
|
||||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
if (!token) return await token.json().catch(() => null);
|
if (!token) return await token.json().catch(() => null);
|
||||||
|
|
||||||
const response = await fetch(`/api/admin/donasi/dashboard/${name}`, {
|
const response = await fetch(`/api/admin/donasi/dashboard/kategori`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
@@ -99,9 +99,7 @@ export default function AdminDonasi_Main({
|
|||||||
}
|
}
|
||||||
async function onLoadCountKategori() {
|
async function onLoadCountKategori() {
|
||||||
try {
|
try {
|
||||||
const response = await apiGetDonasiKategoriCountDashboard({
|
const response = await apiGetDonasiKategoriCountDashboard()
|
||||||
name: "Kategori"
|
|
||||||
})
|
|
||||||
if (response) {
|
if (response) {
|
||||||
setCountKategori(response.data);
|
setCountKategori(response.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,20 +3,34 @@
|
|||||||
import { Group, Paper, SimpleGrid, Stack, Text, Title } from "@mantine/core";
|
import { Group, Paper, SimpleGrid, Stack, Text, Title } from "@mantine/core";
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
|
||||||
export default function AdminJob_Main({
|
export default function AdminJob_Main({
|
||||||
countPublish,
|
// countPublish,
|
||||||
countReview,
|
// countReview,
|
||||||
countReject,
|
// countReject,
|
||||||
countArsip,
|
// countArsip,
|
||||||
}: {
|
}: {
|
||||||
countPublish: number;
|
// countPublish: number;
|
||||||
countReview: number;
|
// countReview: number;
|
||||||
countReject: number;
|
// countReject: number;
|
||||||
countArsip: number
|
// countArsip: number
|
||||||
}) {
|
}) {
|
||||||
|
const [countPublish, setCountPublish] = useState<number | null>(null);
|
||||||
|
const [countReview, setCountReview] = useState<number | null>(null);
|
||||||
|
const [countReject, setCountReject] = useState<number | null>(null);
|
||||||
|
const [countArsip, setCountArsip] = useState<number | null>(null);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
async function onLoadCountPublish() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get count publish", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const listStatus = [
|
const listStatus = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|||||||
36
src/app_modules/admin/vote/lib/api_fetch_admin_voting.ts
Normal file
36
src/app_modules/admin/vote/lib/api_fetch_admin_voting.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
export {
|
||||||
|
apiGetVoteStatusCountDashboard,
|
||||||
|
apiGetVoteRiwayatCount
|
||||||
|
}
|
||||||
|
const apiGetVoteStatusCountDashboard = async ({ name }: {
|
||||||
|
name: "Publish" | "Review" | "Reject";
|
||||||
|
}) => {
|
||||||
|
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/voting/dashboard/${name}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return await response.json().catch(() => null);
|
||||||
|
}
|
||||||
|
const apiGetVoteRiwayatCount = async () => {
|
||||||
|
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/voting/dashboard/riwayat`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return await response.json().catch(() => null);
|
||||||
|
}
|
||||||
@@ -5,49 +5,134 @@ import { useRouter } from "next/navigation";
|
|||||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||||
import { IconAlertTriangle, IconBookmark, IconHistory, IconUpload } from "@tabler/icons-react";
|
import { IconAlertTriangle, IconBookmark, IconHistory, IconUpload } from "@tabler/icons-react";
|
||||||
import { AccentColor, AdminColor } from "@/app_modules/_global/color/color_pallet";
|
import { AccentColor, AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import { apiGetVoteRiwayatCount, apiGetVoteStatusCountDashboard } from "../lib/api_fetch_admin_voting";
|
||||||
|
import global_limit from "@/app/lib/limit";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
|
||||||
|
export default function AdminVote_Main() {
|
||||||
|
const [countPublish, setCountPublish] = useState<number | null>(null);
|
||||||
|
const [countReview, setCountReview] = useState<number | null>(null);
|
||||||
|
const [countReject, setCountReject] = useState<number | null>(null);
|
||||||
|
const [countRiwayat, setCountRiwayat] = useState<number | null>(null);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
handlerLoadData();
|
||||||
|
}, []);
|
||||||
|
async function handlerLoadData() {
|
||||||
|
try {
|
||||||
|
const listLoadData = [
|
||||||
|
global_limit(() => onLoadCountPublish()),
|
||||||
|
global_limit(() => onLoadCountReview()),
|
||||||
|
global_limit(() => onLoadCountReject()),
|
||||||
|
global_limit(() => onLoadCountRiwayat()),
|
||||||
|
];
|
||||||
|
const result = await Promise.all(listLoadData);
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error handler load data", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function onLoadCountPublish() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetVoteStatusCountDashboard({
|
||||||
|
name: "Publish",
|
||||||
|
})
|
||||||
|
if (response) {
|
||||||
|
setCountPublish(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get count publish", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function onLoadCountReview() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetVoteStatusCountDashboard({
|
||||||
|
name: "Review",
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setCountReview(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get count review", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function onLoadCountReject() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetVoteStatusCountDashboard({
|
||||||
|
name: "Reject",
|
||||||
|
})
|
||||||
|
if (response) {
|
||||||
|
setCountReject(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get count reject", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function onLoadCountRiwayat() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetVoteRiwayatCount()
|
||||||
|
if (response) {
|
||||||
|
setCountRiwayat(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get count riwayat", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function AdminVote_Main({
|
|
||||||
countPublish,
|
|
||||||
countReview,
|
|
||||||
countDraft,
|
|
||||||
countReject,
|
|
||||||
countRiwayat,
|
|
||||||
}: {
|
|
||||||
countPublish?: number;
|
|
||||||
countReview?: number;
|
|
||||||
countDraft?: number;
|
|
||||||
countReject?: number;
|
|
||||||
countRiwayat?: number;
|
|
||||||
}) {
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const listStatus = [
|
const listStatus = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Publish",
|
name: "Publish",
|
||||||
jumlah: countPublish,
|
jumlah: countPublish == null ? (
|
||||||
|
<CustomSkeleton height={40} width={40} />
|
||||||
|
) : countPublish ? (
|
||||||
|
countPublish
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
color: "green",
|
color: "green",
|
||||||
icon: <IconUpload size={18} color="#4CAF4F"/>
|
icon: <IconUpload size={18} color="#4CAF4F" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Review",
|
name: "Review",
|
||||||
jumlah: countReview,
|
jumlah: countReview == null ? (
|
||||||
|
<CustomSkeleton height={40} width={40} />
|
||||||
|
) : countReview ? (
|
||||||
|
countReview
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
color: "orange",
|
color: "orange",
|
||||||
icon: <IconBookmark size={18} color="#FF7043" />
|
icon: <IconBookmark size={18} color="#FF7043" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "Reject",
|
name: "Reject",
|
||||||
jumlah: countReject,
|
jumlah: countReject == null ? (
|
||||||
|
<CustomSkeleton height={40} width={40} />
|
||||||
|
) : countReject ? (
|
||||||
|
countReject
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
color: "red",
|
color: "red",
|
||||||
icon: <IconAlertTriangle size={18} color="#FF4B4C" />
|
icon: <IconAlertTriangle size={18} color="#FF4B4C" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
name: "Riwayat",
|
name: "Riwayat",
|
||||||
jumlah: countDraft,
|
jumlah: countRiwayat == null ? (
|
||||||
path: "",
|
<CustomSkeleton height={40} width={40} />
|
||||||
|
) : countRiwayat ? (
|
||||||
|
countRiwayat
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
color: "gray",
|
color: "gray",
|
||||||
icon: <IconHistory size={18} color="#007CBA" />
|
icon: <IconHistory size={18} color="#007CBA" />
|
||||||
},
|
},
|
||||||
|
|||||||
30
src/app_modules/job/lib/api_fetch_admin_job.ts
Normal file
30
src/app_modules/job/lib/api_fetch_admin_job.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
const apiGetJobStatuCountDashboard = async ({ name }: { name: "Publish" | "Review" | "Reject" }) => {
|
||||||
|
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/job/dashboard/${name}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return await response.json().catch(() => null)
|
||||||
|
}
|
||||||
|
const apiGetJobStatusCountArsip = async () => {
|
||||||
|
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/job/dashboard/arsip`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return await response.json().catch(() => null);
|
||||||
|
}
|
||||||
@@ -40,6 +40,8 @@ const middlewareConfig: MiddlewareConfig = {
|
|||||||
// "/api/admin/event/*",
|
// "/api/admin/event/*",
|
||||||
// "/api/admin/investasi/*",
|
// "/api/admin/investasi/*",
|
||||||
// "/api/admin/donasi/dashboard/*",
|
// "/api/admin/donasi/dashboard/*",
|
||||||
|
// "/api/admin/voting/dashboard/*",
|
||||||
|
// "/api/admin/job/dashboard/*",
|
||||||
|
|
||||||
|
|
||||||
// Akses awal
|
// Akses awal
|
||||||
|
|||||||
Reference in New Issue
Block a user