Fix: admin investasi
Deskripsi: - Fix image dari server wibu ## No Issue
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { RouterAdminGlobal } from "@/app/lib";
|
||||
import { Button } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AdminInvestasi_ComponentCekBuktiTransfer({
|
||||
imagesId,
|
||||
imageId,
|
||||
}: {
|
||||
imagesId: string;
|
||||
imageId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false)
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
@@ -18,10 +18,10 @@ export function AdminInvestasi_ComponentCekBuktiTransfer({
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterAdminInvestasi.bukti_transfer + `${imagesId}`);
|
||||
router.push(RouterAdminGlobal.preview_image({ id: imageId }));
|
||||
}}
|
||||
>
|
||||
Cek
|
||||
Cek Transaksi
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Paper, Stack, Title, AspectRatio, Center, Image } from "@mantine/core";
|
||||
import { Paper, Stack, Title } from "@mantine/core";
|
||||
import { Admin_ComponentLoadImageLandscape } from "../../_admin_global";
|
||||
|
||||
export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}) {
|
||||
return (
|
||||
@@ -10,7 +10,9 @@ export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}
|
||||
Gambar Proyek
|
||||
</Title>
|
||||
|
||||
<AspectRatio ratio={1 / 1} mah={300}>
|
||||
<Admin_ComponentLoadImageLandscape fileId={imagesId} />
|
||||
|
||||
{/* <AspectRatio ratio={1 / 1} mah={300}>
|
||||
<Center>
|
||||
<Image
|
||||
style={{ borderRadius: "10px" }}
|
||||
@@ -20,7 +22,7 @@ export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}
|
||||
src={RouterInvestasi_OLD.api_gambar + `${imagesId}`}
|
||||
/>
|
||||
</Center>
|
||||
</AspectRatio>
|
||||
</AspectRatio> */}
|
||||
</Stack>
|
||||
</Paper>
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { APIs } from "@/app/lib";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { MODEL_INVESTASI_DOKUMEN } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
SimpleGrid,
|
||||
Paper,
|
||||
@@ -17,10 +19,12 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
||||
title,
|
||||
dataProspektus,
|
||||
listDokumen,
|
||||
prospektusFileId,
|
||||
}: {
|
||||
title: string;
|
||||
dataProspektus: any;
|
||||
listDokumen: any[];
|
||||
prospektusFileId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
@@ -49,10 +53,7 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
||||
<Text>Prospek {title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi_OLD.api_file_prospektus +
|
||||
`${dataProspektus === null ? "" : dataProspektus.id}`
|
||||
}
|
||||
href={APIs.GET({ fileId: prospektusFileId })}
|
||||
>
|
||||
<Button radius={50}>Lihat</Button>
|
||||
</Link>
|
||||
@@ -70,16 +71,14 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
||||
{_.isEmpty(listDokumen) ? (
|
||||
<Text>-</Text>
|
||||
) : (
|
||||
listDokumen.map((e: any) => (
|
||||
listDokumen.map((e: MODEL_INVESTASI_DOKUMEN) => (
|
||||
<Paper key={e.id}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>{e.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi_OLD.api_file_dokumen + `${e.id}`
|
||||
}
|
||||
href={APIs.GET({ fileId: e.fileId })}
|
||||
>
|
||||
<Button radius={50}>Lihat</Button>
|
||||
</Link>
|
||||
|
||||
@@ -125,7 +125,7 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
<td>
|
||||
<Center>
|
||||
{e?.statusInvoiceId !== "3" ? (
|
||||
<AdminInvestasi_ComponentCekBuktiTransfer imagesId={e?.imagesId} />
|
||||
<AdminInvestasi_ComponentCekBuktiTransfer imageId={e?.imageId} />
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
|
||||
@@ -25,7 +25,7 @@ export function AdminInvestasi_ViewDetailData({
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||
|
||||
{/* Data Detail */}
|
||||
<ComponentAdminInvestasi_DetailData data={data} />
|
||||
@@ -34,6 +34,7 @@ export function AdminInvestasi_ViewDetailData({
|
||||
title={data.title}
|
||||
dataProspektus={data.ProspektusInvestasi}
|
||||
listDokumen={data.DokumenInvestasi}
|
||||
prospektusFileId={data.prospektusFileId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import { AdminInvestasi_ViewBuktiTransfer } from "../_view";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||
|
||||
export function AdminInvestasi_DetailBuktiTransfer({ imageId }: { imageId: string }) {
|
||||
return (
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<ComponentAdminGlobal_TitlePage name="Bukti Transfer" />
|
||||
<AdminInvestasi_ViewBuktiTransfer imageId={imageId} />
|
||||
</Stack>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import { IconCircleCheck } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import {
|
||||
AdminInvestasi_ViewDaftarInvestor,
|
||||
AdminInvestasi_ViewDaftarTransaksi,
|
||||
@@ -46,7 +46,7 @@ export function AdminInvestasi_DetailPublish({
|
||||
return (
|
||||
<>
|
||||
<Stack >
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
|
||||
<Group>
|
||||
{listPage.map((e) => (
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Text,
|
||||
Title
|
||||
} from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import { ComponentAdminInvestasi_DetailDataAuthor } from "../_component/detail_data_author";
|
||||
import { ComponentAdminInvestasi_DetailData } from "../_component/detail_data_investasi";
|
||||
import { ComponentAdminInvestasi_DetailGambar } from "../_component/detail_gambar_investasi";
|
||||
@@ -18,7 +18,7 @@ export function AdminInvestasi_DetailReject({ data }: { data: MODEL_INVESTASI })
|
||||
return (
|
||||
<>
|
||||
<Stack px={"lg"}>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
spacing="lg"
|
||||
@@ -54,7 +54,7 @@ export function AdminInvestasi_DetailReject({ data }: { data: MODEL_INVESTASI })
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||
|
||||
{/* Data Detail */}
|
||||
<ComponentAdminInvestasi_DetailData data={data} />
|
||||
@@ -64,6 +64,7 @@ export function AdminInvestasi_DetailReject({ data }: { data: MODEL_INVESTASI })
|
||||
title={data.title}
|
||||
dataProspektus={data.ProspektusInvestasi}
|
||||
listDokumen={data.DokumenInvestasi}
|
||||
prospektusFileId={data.prospektusFileId}
|
||||
/>
|
||||
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
||||
</Stack>
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||
import {
|
||||
Button,
|
||||
Group,
|
||||
Modal,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Textarea,
|
||||
} from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -11,7 +18,7 @@ import { useState } from "react";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||
import { ComponentAdminInvestasi_DetailDataAuthor } from "../_component/detail_data_author";
|
||||
import { ComponentAdminInvestasi_DetailData } from "../_component/detail_data_investasi";
|
||||
@@ -19,6 +26,7 @@ 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 { Admin_ComponentModalReport } from "../../_admin_global/_component";
|
||||
|
||||
export default function AdminInvestasi_DetailReview({
|
||||
dataInvestasi,
|
||||
@@ -31,6 +39,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [isLoadingPublish, setIsLoadingPublish] = useState(false);
|
||||
const [isLoadingReject, setIsLoadingReject] = useState(false);
|
||||
const [report, setReport] = useState("");
|
||||
|
||||
useShallowEffect(() => {
|
||||
cekStatusPublish();
|
||||
@@ -43,13 +52,16 @@ export default function AdminInvestasi_DetailReview({
|
||||
async function onReject() {
|
||||
const body = {
|
||||
id: data.id,
|
||||
catatan: data.catatan,
|
||||
catatan: report,
|
||||
status: "4",
|
||||
};
|
||||
if (_.isEmpty(body.catatan))
|
||||
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi alasan");
|
||||
|
||||
const res = await Admin_funRejectInvestasi(body);
|
||||
if (res.status === 200) {
|
||||
setIsLoadingReject(true);
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
@@ -75,8 +87,11 @@ export default function AdminInvestasi_DetailReview({
|
||||
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
router.back();
|
||||
setOpenModal(false);
|
||||
setIsLoadingReject(false);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
setOpenModal(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +142,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
<>
|
||||
<Stack px={"lg"}>
|
||||
<Group position="apart">
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
|
||||
{data.masterStatusInvestasiId === "2" ? (
|
||||
<Group>
|
||||
@@ -141,11 +156,9 @@ export default function AdminInvestasi_DetailReview({
|
||||
Publish
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingReject}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => onReject()}
|
||||
onClick={() => setOpenModal(true)}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
@@ -168,7 +181,7 @@ export default function AdminInvestasi_DetailReview({
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||
|
||||
{/* Data Detail */}
|
||||
<ComponentAdminInvestasi_DetailData data={data} />
|
||||
@@ -178,8 +191,53 @@ export default function AdminInvestasi_DetailReview({
|
||||
title={data.title}
|
||||
dataProspektus={data.ProspektusInvestasi}
|
||||
listDokumen={data.DokumenInvestasi}
|
||||
prospektusFileId={data.prospektusFileId}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Admin_ComponentModalReport
|
||||
opened={openModal}
|
||||
onClose={() => setOpenModal(false)}
|
||||
title="Alasan Penolakan"
|
||||
onHandlerChange={(val) => setReport(val.target.value)}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingReject}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onReject();
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* <Modal
|
||||
opened={openModal}
|
||||
onClose={() => setOpenModal(false)}
|
||||
title="Alasan Penolakan"
|
||||
size={"sm"}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={3}
|
||||
maxRows={5}
|
||||
placeholder="Masukan alasan penolakan"
|
||||
onChange={(val) => setReport(val.target.value)}
|
||||
/>
|
||||
<Group position="right"></Group>
|
||||
</Stack>
|
||||
</Modal> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ export async function adminInvestasi_funRejectInvoiceById({
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {
|
||||
|
||||
|
||||
|
||||
const updt = await prisma.investasi_Invoice.update({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
|
||||
@@ -13,6 +13,22 @@ export async function adminInvestasi_funEditStatusPublishById({
|
||||
statusId: string;
|
||||
progesInvestasiId: string;
|
||||
}) {
|
||||
const cekStatus = await prisma.investasi.findFirst({
|
||||
where: {
|
||||
id: investasiId,
|
||||
},
|
||||
select: {
|
||||
masterStatusInvestasiId: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (cekStatus?.masterStatusInvestasiId !== "2") {
|
||||
return {
|
||||
status: 400,
|
||||
message: "User membatalkan review",
|
||||
};
|
||||
}
|
||||
|
||||
const publishTime = new Date();
|
||||
const res = await prisma.investasi.update({
|
||||
where: {
|
||||
@@ -31,8 +47,8 @@ export async function adminInvestasi_funEditStatusPublishById({
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal Update" };
|
||||
|
||||
@@ -6,6 +6,21 @@ import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function Admin_funRejectInvestasi(data: any) {
|
||||
// console.log(data)
|
||||
const cekStatus = await prisma.investasi.findFirst({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
select: {
|
||||
masterStatusInvestasiId: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (cekStatus?.masterStatusInvestasiId !== "2") {
|
||||
return {
|
||||
status: 400,
|
||||
message: "User membatalkan review",
|
||||
};
|
||||
}
|
||||
|
||||
const res = await prisma.investasi.update({
|
||||
where: { id: data.id },
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
"use server";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export default async function adminInvestasi_getOneById({
|
||||
investasiId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
}) {
|
||||
const data = await prisma.investasi.findUnique({
|
||||
where: {
|
||||
id: investasiId,
|
||||
},
|
||||
select: {
|
||||
imageId: true,
|
||||
prospektusFileId: true,
|
||||
id: true,
|
||||
author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
lembarTerbeli: true,
|
||||
progress: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
catatan: true,
|
||||
imagesId: true,
|
||||
MasterStatusInvestasi: true,
|
||||
BeritaInvestasi: true,
|
||||
DokumenInvestasi: true,
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
masterStatusInvestasiId: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "1",
|
||||
},
|
||||
},
|
||||
countDown: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { adminInvestasi_funAcceptTransaksiById } from "./edit/fun_accept_invoice_by_id";
|
||||
import { adminInvestasi_funRejectInvoiceById } from "./edit/fun_reject_invoice_by_id";
|
||||
import { adminInvestasi_funGetAllTransaksiById } from "./get/fun_get_all_transaksi_by_id";
|
||||
import adminInvestasi_getOneById from "./get/fun_get_investasi_by_id";
|
||||
import { adminInvestasi_getStatusInvestasi } from "./get/fun_get_status_transaksi";
|
||||
|
||||
export { adminInvestasi_getStatusInvestasi };
|
||||
export { adminInvestasi_funGetAllTransaksiById };
|
||||
export { adminInvestasi_funRejectInvoiceById };
|
||||
export { adminInvestasi_funAcceptTransaksiById };
|
||||
export { adminInvestasi_getOneById };
|
||||
|
||||
Reference in New Issue
Block a user