API Dashboard Investasi & Event

This commit is contained in:
2025-01-30 17:44:18 +08:00
36 changed files with 1070 additions and 288 deletions

View File

@@ -0,0 +1,60 @@
export {
apiGetEventStatusCountDashboard,
apiGetEventTipeAcara,
apiGetEventRiwayatCount,
};
const apiGetEventStatusCountDashboard = 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/event/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 apiGetEventRiwayatCount = 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/event/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);
}
const apiGetEventTipeAcara = 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/event/dashboard/tipe-acara`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
});
return await response.json().catch(() => null);
};

View File

@@ -1,26 +1,9 @@
import { AdminEvent_Main } from "@/app_modules/admin/event";
import AdminEvent_funCountByStatusId from "@/app_modules/admin/event/fun/count/fun_count_event_by_status_id";
import { AdminEvent_funCountRiwayat } from "@/app_modules/admin/event/fun/count/fun_count_riwayat";
import { AdminEvent_funCountTipeAcara } from "@/app_modules/admin/event/fun/count/fun_count_tipe_acara";
export default async function Page() {
const countPublish = await AdminEvent_funCountByStatusId("1");
const countReview = await AdminEvent_funCountByStatusId("2");
const countDraft = await AdminEvent_funCountByStatusId("3");
const countReject = await AdminEvent_funCountByStatusId("4");
const countTipeAcara = await AdminEvent_funCountTipeAcara();
const countRiwayat = await AdminEvent_funCountRiwayat();
return (
<>
<AdminEvent_Main
countPublish={countPublish as number}
countReview={countReview as number}
countDraft={countDraft as number}
countReject={countReject as number}
countTipeAcara={countTipeAcara as number}
countRiwayat={countRiwayat}
/>
<AdminEvent_Main />
</>
);
}

View File

@@ -6,10 +6,10 @@ import Admin_getTotalInvestasiByUser from "@/app_modules/admin/investasi/fun/get
export default async function Page() {
const listInvestasi = await Admin_funGetAllInvestasi();
const countDraft = await Admin_CountStatusInvestasi(1);
const countReview = await Admin_CountStatusInvestasi(2);
const countPublish = await Admin_CountStatusInvestasi(3);
const countReject = await Admin_CountStatusInvestasi(4);
// const countDraft = await Admin_CountStatusInvestasi(1);
// const countReview = await Admin_CountStatusInvestasi(2);
// const countPublish = await Admin_CountStatusInvestasi(3);
// const countReject = await Admin_CountStatusInvestasi(4);
const totalInvestasiByUser = await Admin_getTotalInvestasiByUser()
const publishProgres = await Admin_getPublishProgresInvestasi()
// console.log(targetTerbesar)
@@ -18,10 +18,10 @@ export default async function Page() {
<>
<Admin_Investasi
listInvestasi={listInvestasi as any}
countDraft={countDraft}
countReview={countReview}
countPublish={countPublish}
countReject={countReject}
// countDraft={countDraft}
// countReview={countReview}
// countPublish={countPublish}
// countReject={countReject}
totalInvestasiByUser={totalInvestasiByUser}
publishProgres={publishProgres}

View File

@@ -1,7 +1,5 @@
import Event_MetodePembayaran from '@/app_modules/event/detail/sponsor/metode_pembayaran';
import { MODEL_MASTER_BANK } from '@/app_modules/investasi/_lib/interface';
import React from 'react';
function Page() {
return (

View File

@@ -0,0 +1,14 @@
import { funGetUserIdByToken } from '@/app_modules/_global/fun/get';
import Event_Invoice from '@/app_modules/event/detail/invoice';
import React from 'react';
async function Page() {
const userLoginId = await funGetUserIdByToken();
return (
<>
<Event_Invoice userLoginId={userLoginId} />
</>
);
}
export default Page;

View File

@@ -1,12 +0,0 @@
import Event_Invoice from '@/app_modules/event/detail/invoice';
import React from 'react';
function Page() {
return (
<>
<Event_Invoice/>
</>
);
}
export default Page;