Update Versi 1.5.27 #32
@@ -25,6 +25,7 @@ export async function GET(request: Request,
|
||||
User: {
|
||||
username: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +48,7 @@ export async function GET(request: Request,
|
||||
User: {
|
||||
username: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -63,6 +65,12 @@ export async function GET(request: Request,
|
||||
const nCount = await prisma.event_Peserta.count({
|
||||
where: {
|
||||
eventId: eventId,
|
||||
User: {
|
||||
username: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive",
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -5,13 +5,14 @@ import { NextResponse } from "next/server";
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: string } }) {
|
||||
|
||||
console.log("Ini ID", params.id);
|
||||
|
||||
|
||||
try {
|
||||
const { id } = params;
|
||||
const investasiId = id;
|
||||
const data = await prisma.investasi.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
id: investasiId,
|
||||
},
|
||||
select: {
|
||||
imageId: true,
|
||||
@@ -31,7 +31,7 @@ export async function GET(request: Request, { params }: {
|
||||
const fixStatus = _.startCase(status);
|
||||
|
||||
if (!page) {
|
||||
const data = await prisma.job.findMany({
|
||||
fixData = await prisma.job.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc"
|
||||
},
|
||||
@@ -79,6 +79,9 @@ export async function GET(request: Request, { params }: {
|
||||
where: {
|
||||
isActive: true,
|
||||
isArsip: false,
|
||||
MasterStatus: {
|
||||
name: fixStatus
|
||||
},
|
||||
title: {
|
||||
contains: search ? search : "",
|
||||
mode: "insensitive"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AdminInvestasi_DetailPublish } from "@/app_modules/admin/investasi";
|
||||
import { apiGetAdminInvestasiById } from "@/app_modules/admin/investasi/_lib/api_fetch_admin_investasi";
|
||||
import {
|
||||
adminInvestasi_funGetAllTransaksiById,
|
||||
adminInvestasi_getStatusInvestasi,
|
||||
@@ -7,20 +8,24 @@ import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_b
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id;
|
||||
const dataInvestasi = await getOneInvestasiById(investasiId);
|
||||
const statusTransaksi = await adminInvestasi_getStatusInvestasi();
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
// export default async function Page({ params }: { params: { id: string } }) {
|
||||
// const investasiId = params.id;
|
||||
// const dataInvestasi = await getOneInvestasiById(investasiId);
|
||||
// const statusTransaksi = await adminInvestasi_getStatusInvestasi();
|
||||
// const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
// investasiId,
|
||||
// page: 1,
|
||||
// });
|
||||
|
||||
return (
|
||||
<>
|
||||
<AdminInvestasi_DetailPublish
|
||||
data={dataInvestasi as any}
|
||||
dataTransaksi={dataTransaksi as any}
|
||||
statusTransaksi={statusTransaksi}
|
||||
investasiId={investasiId as any}
|
||||
<AdminInvestasi_DetailPublish dataTransaksi={dataTransaksi as any}
|
||||
statusTransaksi={statusTransaksi as any}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
||||
import { adminInvestasi_getOneById } from "@/app_modules/admin/investasi/fun";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id;
|
||||
const dataInvestasi = await adminInvestasi_getOneById({investasiId});
|
||||
export default async function Page() {
|
||||
// const investasiId = params.id;
|
||||
// const dataInvestasi = await adminInvestasi_getOneById({investasiId});
|
||||
// console.log(dataUser)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Admin_KonfirmasiInvestasi dataInvestasi={dataInvestasi as any} />
|
||||
<Admin_KonfirmasiInvestasi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,55 +1,56 @@
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||
import { Paper, Stack, Title, Grid, Text } from "@mantine/core";
|
||||
|
||||
export function ComponentAdminInvestasi_DetailDataAuthor({
|
||||
data,
|
||||
}: {
|
||||
data: any;
|
||||
data: MODEL_USER;
|
||||
}) {
|
||||
return (
|
||||
|
||||
|
||||
|
||||
|
||||
<Paper bg={AdminColor.softBlue} p={"lg"}>
|
||||
<Stack c={AdminColor.white}>
|
||||
<Title order={3}>Data User</Title>
|
||||
<Stack spacing={"xs"}>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Nama:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>{data?.Profile?.name}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Username:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>@{data?.username}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Nomor:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>+ {data?.nomor}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Alamat:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>{data?.Profile?.alamat}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<>
|
||||
{!data ? (<CustomSkeleton height={"50vh"} width={"100%"} />)
|
||||
: (<Paper bg={AdminColor.softBlue} p={"lg"}>
|
||||
<Stack c={AdminColor.white}>
|
||||
<Title order={3}>Data User</Title>
|
||||
<Stack spacing={"xs"}>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Nama:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>{data?.Profile?.name}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Username:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>@{data?.username}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Nomor:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>+ {data?.nomor}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Text fw={"bold"}>Alamat:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text>{data?.Profile?.alamat}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Paper>)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
{/* <CustomSkeleton height={"80vh"} width={"100%"} /> */ }
|
||||
|
||||
@@ -1,83 +1,85 @@
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { Paper, Stack, Title, Grid, Box, Text } from "@mantine/core";
|
||||
|
||||
export function ComponentAdminInvestasi_DetailData({ data }: { data: any }) {
|
||||
return (
|
||||
<>
|
||||
<Paper bg={AdminColor.softBlue} p={"lg"}>
|
||||
<Stack c={AdminColor.white}>
|
||||
<Title order={3}>Rincian Data Investasi</Title>
|
||||
<Grid justify="center">
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Judul</Text>
|
||||
<Text fw={"bold"}>{data?.title}</Text>
|
||||
</Box>
|
||||
{!data ? (<CustomSkeleton height={"50vh"} width={"100%"} />) :
|
||||
(<Paper bg={AdminColor.softBlue} p={"lg"}>
|
||||
<Stack c={AdminColor.white}>
|
||||
<Title order={3}>Rincian Data Investasi</Title>
|
||||
<Grid justify="center">
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Judul</Text>
|
||||
<Text fw={"bold"}>{data?.title}</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data?.targetDana)}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.hargaLembar)}{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data?.hargaLembar)}{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text fw={"bold"}>
|
||||
{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumFractionDigits: 10,
|
||||
}).format(+data?.totalLembar)}{" "}
|
||||
lembar
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text fw={"bold"}>{data.roi} %</Text>
|
||||
</Box>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text fw={"bold"}>{data?.roi} %</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text fw={"bold"}>{data.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text fw={"bold"}>{data?.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data.MasterPembagianDeviden.name} bulan{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data?.MasterPembagianDeviden.name} bulan{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data.MasterPencarianInvestor.name} hari{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text fw={"bold"}>
|
||||
{data?.MasterPencarianInvestor.name} hari{" "}
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
||||
import { Box, SimpleGrid, Stack } from '@mantine/core';
|
||||
import React from 'react';
|
||||
|
||||
function SkeletonAdminInvestasi() {
|
||||
return (
|
||||
<>
|
||||
<Stack px={"lg"}>
|
||||
<Box pb={"xl"}>
|
||||
</Box>
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 3, spacing: "md" },
|
||||
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
<Box>
|
||||
<CustomSkeleton width={"100%"} height={"40vh"} />
|
||||
</Box>
|
||||
<Box>
|
||||
<CustomSkeleton width={"100%"} height={"40vh"} />
|
||||
</Box>
|
||||
<Box>
|
||||
<CustomSkeleton width={"100%"} height={"40vh"} />
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
<Box>
|
||||
<CustomSkeleton width={"100%"} height={"30vh"} />
|
||||
</Box>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SkeletonAdminInvestasi;
|
||||
@@ -38,7 +38,7 @@ const apiGetAdminInvestasiByStatus = async ({ status, page, search }: {
|
||||
|
||||
const isPage = page ? `?page=${page}` : "";
|
||||
const isSearch = search ? `&search=${search}` : "";
|
||||
const response = await fetch(`/api/admin/investasi/${status}${isPage}${isSearch}`, {
|
||||
const response = await fetch(`/api/admin/investasi/status/${status}${isPage}${isSearch}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -56,7 +56,7 @@ const apiGetAdminInvestasiById = async ({id} : {id: string}) => {
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
|
||||
const response = await fetch(`/api/admin/investasi/detail/${id}`, {
|
||||
const response = await fetch(`/api/admin/investasi/${id}/detail`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -66,6 +66,5 @@ const apiGetAdminInvestasiById = async ({id} : {id: string}) => {
|
||||
}
|
||||
})
|
||||
|
||||
console.log("Ini data Response", await response.json())
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { ComponentAdminInvestasi_DetailDataAuthor } from "../../_component/detai
|
||||
import { ComponentAdminInvestasi_DetailData } from "../../_component/detail_data_investasi";
|
||||
import { ComponentAdminInvestasi_DetailGambar } from "../../_component/detail_gambar_investasi";
|
||||
import { ComponentAdminInvestasi_UIDetailFile } from "../../_component/ui_detail_file";
|
||||
import SkeletonAdminInvestasi from "../../_component/skeleton_admin_investasi";
|
||||
|
||||
export function AdminInvestasi_ViewDetailData({
|
||||
data,
|
||||
@@ -12,6 +13,7 @@ export function AdminInvestasi_ViewDetailData({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{!data ? (<SkeletonAdminInvestasi/>) : ( <>
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
spacing="lg"
|
||||
@@ -22,20 +24,21 @@ export function AdminInvestasi_ViewDetailData({
|
||||
]}
|
||||
>
|
||||
{/* Data Author */}
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data?.author as any} />
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data?.imageId } />
|
||||
|
||||
{/* Data Detail */}
|
||||
<ComponentAdminInvestasi_DetailData data={data} />
|
||||
<ComponentAdminInvestasi_DetailData data={data as any} />
|
||||
</SimpleGrid>
|
||||
<ComponentAdminInvestasi_UIDetailFile
|
||||
title={data.title}
|
||||
dataProspektus={data.ProspektusInvestasi}
|
||||
listDokumen={data.DokumenInvestasi}
|
||||
prospektusFileId={data.prospektusFileId}
|
||||
title={data?.title}
|
||||
dataProspektus={data?.ProspektusInvestasi}
|
||||
listDokumen={data?.DokumenInvestasi}
|
||||
prospektusFileId={data?.prospektusFileId}
|
||||
/>
|
||||
</>)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,18 +12,20 @@ import {
|
||||
} from "../_view";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_admin_invetasi_menu_publish } from "../_lib/global_state";
|
||||
import { useParams } from "next/navigation";
|
||||
import { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export function AdminInvestasi_DetailPublish({
|
||||
data,
|
||||
dataTransaksi,
|
||||
statusTransaksi,
|
||||
investasiId,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
dataTransaksi: any[];
|
||||
statusTransaksi: any[];
|
||||
investasiId: string;
|
||||
}) {
|
||||
}) {
|
||||
const params = useParams<{ id: string }>();
|
||||
const [data, setData] = useState<MODEL_INVESTASI | null>(null);
|
||||
const [selectPage, setSelectPage] = useAtom(gs_admin_invetasi_menu_publish);
|
||||
const listPage = [
|
||||
{
|
||||
@@ -43,6 +45,23 @@ export function AdminInvestasi_DetailPublish({
|
||||
// },
|
||||
];
|
||||
|
||||
useShallowEffect(() => {
|
||||
loadInitialData()
|
||||
}, []);
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetAdminInvestasiById({
|
||||
id: params.id
|
||||
})
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
setData(response.data)
|
||||
}
|
||||
} catch (error) {
|
||||
clientLogger.error("Invalid data format recieved:", error)
|
||||
setData(null);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Stack >
|
||||
@@ -65,13 +84,13 @@ export function AdminInvestasi_DetailPublish({
|
||||
</Group>
|
||||
|
||||
{selectPage == "1" ? (
|
||||
<AdminInvestasi_ViewDetailData data={data} />
|
||||
<AdminInvestasi_ViewDetailData data={data as any} />
|
||||
) : null}
|
||||
{selectPage == "2" ? (
|
||||
<AdminInvestasi_ViewDaftarTransaksi
|
||||
dataTransaksi={dataTransaksi}
|
||||
statusTransaksi={statusTransaksi}
|
||||
investasiId={investasiId}
|
||||
investasiId={params.id}
|
||||
/>
|
||||
) : null}
|
||||
</Stack>
|
||||
|
||||
@@ -4,10 +4,10 @@ import { IRealtimeData } from "@/lib/global_state";
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||
import { Button, Group, SimpleGrid, Stack, Loader } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { WibuRealtime } from "wibu-pkg";
|
||||
import { Admin_ComponentModalReport } from "../../_admin_global/_component";
|
||||
@@ -23,33 +23,49 @@ import { ComponentAdminInvestasi_DetailGambar } from "../_component/detail_gamba
|
||||
import { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
||||
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
||||
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
||||
import SkeletonAdminInvestasi from "../_component/skeleton_admin_investasi";
|
||||
|
||||
export default function AdminInvestasi_DetailReview({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
}) {
|
||||
export default function AdminInvestasi_DetailReview() {
|
||||
const params = useParams<{ id: string }>();
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(dataInvestasi);
|
||||
const [data, setData] = useState<MODEL_INVESTASI | null>(null);
|
||||
const [publish, setPublish] = useState(true);
|
||||
const [openModalPublish, setOpenModalPublish] = useState(false);
|
||||
const [openModalReject, setOpenModalReject] = useState(false);
|
||||
const [isLoadingPublish, setIsLoadingPublish] = useState(false);
|
||||
const [isLoadingReject, setIsLoadingReject] = useState(false);
|
||||
const [report, setReport] = useState("");
|
||||
const investasiId = params;
|
||||
|
||||
useShallowEffect(() => {
|
||||
cekStatusPublish();
|
||||
// omload()
|
||||
loadInitialData();
|
||||
}, []);
|
||||
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetAdminInvestasiById({
|
||||
id: params.id,
|
||||
})
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
setData(response.data);
|
||||
}
|
||||
} catch (error) {
|
||||
clientLogger.error("Invalid data format recieved:", error);
|
||||
setData(null);
|
||||
}
|
||||
}
|
||||
|
||||
async function cekStatusPublish() {
|
||||
if (data.MasterStatusInvestasi.id === "3") setPublish(false);
|
||||
if (data?.MasterStatusInvestasi.id === "3") setPublish(false);
|
||||
}
|
||||
|
||||
async function onReject() {
|
||||
const body = {
|
||||
id: data.id,
|
||||
id: data?.id,
|
||||
catatan: report,
|
||||
status: "4",
|
||||
};
|
||||
@@ -81,8 +97,8 @@ export default function AdminInvestasi_DetailReview({
|
||||
});
|
||||
}
|
||||
|
||||
const loadData = await getOneInvestasiById(data.id);
|
||||
setData(loadData as any);
|
||||
// const loadData = await getOneInvestasiById(data?.id);
|
||||
// setData(loadData as any);
|
||||
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
router.back();
|
||||
@@ -96,7 +112,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
|
||||
async function onPublish() {
|
||||
const res = await adminInvestasi_funEditStatusPublishById({
|
||||
investasiId: data.id,
|
||||
investasiId: data?.id as any,
|
||||
statusId: "1",
|
||||
progesInvestasiId: "1",
|
||||
});
|
||||
@@ -128,7 +144,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
const loadData = await getOneInvestasiById(data.id);
|
||||
const loadData = await getOneInvestasiById(data?.id as any);
|
||||
setData(loadData as any);
|
||||
|
||||
ComponentAdminGlobal_NotifikasiBerhasil("Proyek Investasi Di Publish");
|
||||
@@ -143,6 +159,9 @@ export default function AdminInvestasi_DetailReview({
|
||||
}
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return <SkeletonAdminInvestasi/>
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
@@ -151,7 +170,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
<Group position="apart">
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
|
||||
{data.masterStatusInvestasiId === "2" ? (
|
||||
{data?.masterStatusInvestasiId === "2" ? (
|
||||
<Group>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
@@ -185,23 +204,20 @@ export default function AdminInvestasi_DetailReview({
|
||||
]}
|
||||
>
|
||||
{/* Data Author */}
|
||||
if(!data.author){
|
||||
|
||||
}
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data?.author as any} />
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data?.imageId} />
|
||||
|
||||
{/* Data Detail */}
|
||||
<ComponentAdminInvestasi_DetailData data={data} />
|
||||
</SimpleGrid>
|
||||
|
||||
<ComponentAdminInvestasi_UIDetailFile
|
||||
title={data.title}
|
||||
dataProspektus={data.ProspektusInvestasi}
|
||||
listDokumen={data.DokumenInvestasi}
|
||||
prospektusFileId={data.prospektusFileId}
|
||||
title={data?.title}
|
||||
dataProspektus={data?.ProspektusInvestasi}
|
||||
listDokumen={data?.DokumenInvestasi}
|
||||
prospektusFileId={data?.prospektusFileId}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ const middlewareConfig: MiddlewareConfig = {
|
||||
// ADMIN API
|
||||
// >> buat dibawah sini <<
|
||||
|
||||
|
||||
|
||||
// Akses awal
|
||||
"/api/get-cookie",
|
||||
|
||||
Reference in New Issue
Block a user