Fix: admin investasi
Deskripsi: - Fix image dari server wibu ## No Issue
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
"use client";
|
||||
|
||||
import { APIs, RouterAdminGlobal } from "@/app/lib";
|
||||
import { pathAssetImage } from "@/app/lib/path_asset_image";
|
||||
import { Center, Image, Skeleton } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function Admin_ComponentLoadImageLandscape({
|
||||
fileId,
|
||||
}: {
|
||||
fileId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isImage, setIsImage] = useState<boolean | null>(null);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const url = APIs.GET({ fileId: fileId });
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadImage();
|
||||
}, []);
|
||||
|
||||
async function onLoadImage() {
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
if (res.ok) {
|
||||
return setIsImage(true);
|
||||
}
|
||||
setIsImage(false);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (isImage === null) return <Skeleton h={200} w={"100%"} />;
|
||||
|
||||
if (!isImage)
|
||||
return (
|
||||
<>
|
||||
<Center h={200} bg={"white"} style={{ borderRadius: "5px" }}>
|
||||
<Image
|
||||
alt="No Image"
|
||||
maw={150}
|
||||
m={"auto"}
|
||||
p={"xs"}
|
||||
src={pathAssetImage.no_image}
|
||||
/>
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Center>
|
||||
<Image
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
|
||||
router.push(RouterAdminGlobal.preview_image({ id: fileId }), {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
style={{
|
||||
borderColor: "white",
|
||||
borderStyle: "solid",
|
||||
borderWidth: "1px",
|
||||
borderRadius: "5px",
|
||||
}}
|
||||
radius={"4px"}
|
||||
height={200}
|
||||
alt="Image"
|
||||
opacity={isLoading ? 0.5 : 1}
|
||||
src={url}
|
||||
/>
|
||||
{isLoading ? (
|
||||
<Image
|
||||
alt="Loader"
|
||||
src={pathAssetImage.new_loader}
|
||||
height={50}
|
||||
width={50}
|
||||
style={{
|
||||
position: "absolute",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
"use client";
|
||||
|
||||
import { Modal, Stack, Textarea, Group, Button } from "@mantine/core";
|
||||
import React from "react";
|
||||
|
||||
export function Admin_ComponentModalReport({
|
||||
opened,
|
||||
onClose,
|
||||
title,
|
||||
onHandlerChange,
|
||||
buttonKanan,
|
||||
buttonKiri,
|
||||
}: {
|
||||
opened: any;
|
||||
onClose: () => void;
|
||||
title: string;
|
||||
onHandlerChange: (val: any) => void;
|
||||
buttonKanan: React.ReactNode;
|
||||
buttonKiri: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={onClose}
|
||||
title={title}
|
||||
size={"sm"}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={3}
|
||||
maxRows={5}
|
||||
placeholder="Masukan alasan penolakan"
|
||||
onChange={onHandlerChange}
|
||||
/>
|
||||
<Group position="right">
|
||||
{buttonKiri}
|
||||
{buttonKanan}
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { ComponentAdminGlobal_TitlePage } from "./title_page";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "./comp_admin_tampilan_rupiah";
|
||||
import { Admin_ComponentModalReport } from "./comp_admin_modal_report";
|
||||
|
||||
export { ComponentAdminGlobal_TampilanRupiah };
|
||||
export { ComponentAdminGlobal_TitlePage };
|
||||
export { Admin_ComponentModalReport };
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import { APIs, pathAssetImage } from "@/app/lib";
|
||||
import { Box, Center, Image, ScrollArea, Skeleton, Stack } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import AdminGlobal_ComponentBackButton from "../back_button";
|
||||
|
||||
export function Admin_UiImagePreview({ fileId }: { fileId: string }) {
|
||||
const router = useRouter();
|
||||
const [isImage, setIsImage] = useState<boolean | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const url = APIs.GET({ fileId: fileId });
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadImage();
|
||||
}, []);
|
||||
|
||||
async function onLoadImage() {
|
||||
const res = await fetch(url);
|
||||
try {
|
||||
if (res.ok) {
|
||||
return setIsImage(true);
|
||||
}
|
||||
setIsImage(false);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
|
||||
<Box style={{ zIndex: 0 }} h={"90vh"} pos={"static"} px={"lg"}>
|
||||
{isImage === null ? (
|
||||
<Skeleton height={200} radius={"sm"} />
|
||||
) : isImage ? (
|
||||
<ScrollArea h={"100%"}>
|
||||
<Center>
|
||||
<Image alt="Image" src={url} maw={500} miw={200} />
|
||||
</Center>
|
||||
</ScrollArea>
|
||||
) : (
|
||||
<Box
|
||||
bg={"gray"}
|
||||
style={{
|
||||
borderColor: "white",
|
||||
borderStyle: "solid",
|
||||
borderWidth: "0.5px",
|
||||
borderRadius: "5px",
|
||||
height: 300,
|
||||
}}
|
||||
>
|
||||
<Center h={"100%"}>
|
||||
<Image
|
||||
alt="Image"
|
||||
height={100}
|
||||
width={100}
|
||||
src={pathAssetImage.no_image}
|
||||
/>
|
||||
</Center>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { IconChevronLeft } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function ComponentAdminGlobal_BackButton({
|
||||
export default function AdminGlobal_ComponentBackButton({
|
||||
path,
|
||||
}: {
|
||||
path?: string;
|
||||
|
||||
5
src/app_modules/admin/_admin_global/index.ts
Normal file
5
src/app_modules/admin/_admin_global/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Admin_ComponentLoadImageLandscape } from "./_component/comp_admin_load_image";
|
||||
import { Admin_UiImagePreview } from "./_ui/ui_admin_image_preview";
|
||||
|
||||
export { Admin_ComponentLoadImageLandscape };
|
||||
export { Admin_UiImagePreview };
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { useState } from "react";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
||||
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||
@@ -92,7 +92,7 @@ function ButtonOnHeader({
|
||||
<>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<Button radius={"xl"} bg={"orange"} color="orange" onClick={open}>
|
||||
Tambah catatan
|
||||
</Button>
|
||||
|
||||
@@ -32,7 +32,7 @@ import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||
import { AdminDonasi_funUpdateStatusPublish } from "../fun/update/fun_status_publish";
|
||||
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
||||
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
@@ -159,7 +159,7 @@ function ButtonOnHeader({
|
||||
return (
|
||||
<>
|
||||
<Group position="apart">
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
{donasi.donasiMaster_StatusDonasiId === "2" ? (
|
||||
<Group>
|
||||
<Button
|
||||
|
||||
@@ -48,7 +48,7 @@ import { useRouter } from "next/navigation";
|
||||
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
||||
import ComponentAdminGlobal_BackButton from "@/app_modules/admin/_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "@/app_modules/admin/_admin_global/back_button";
|
||||
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||
import { adminDonasi_getListDonatur } from "../../fun/get/get_list_donatur_by_id";
|
||||
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||
@@ -88,7 +88,7 @@ export default function AdminDonasi_DetailPublish({
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton path={RouterAdminDonasi.table_publish} />
|
||||
<AdminGlobal_ComponentBackButton path={RouterAdminDonasi.table_publish} />
|
||||
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
||||
<TampilanListDonatur
|
||||
donatur={listDonatur}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
|
||||
export default function AdminDonasi_BuktiTransfer({
|
||||
@@ -12,7 +12,7 @@ export default function AdminDonasi_BuktiTransfer({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<BuktiTransfer imageId={imageId} />
|
||||
</Stack>
|
||||
</>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function AdminDonasi_BuktiTransferPencairan({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<BuktiTransfer imageId={imageId} />
|
||||
</Stack>
|
||||
</>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import { AdminEvent_ViewDetailPeserta } from "../_view";
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||
@@ -16,7 +16,7 @@ export function AdminEvent_UiDetailPeserta({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<ComponentAdminGlobal_TitlePage name="Detail Peserta" />
|
||||
<AdminEvent_ViewDetailPeserta
|
||||
dataPeserta={dataPeserta as any}
|
||||
|
||||
@@ -36,7 +36,7 @@ import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_glo
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||
import { adminForum_getListKomentarById } from "../fun/get/get_list_komentar_by_id";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||
|
||||
export default function AdminForum_DetailPosting({
|
||||
@@ -53,7 +53,7 @@ export default function AdminForum_DetailPosting({
|
||||
{/* <pre>{JSON.stringify(listKomentar, null, 2)}</pre> */}
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Detail Posting" />
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
||||
<TableKomentar
|
||||
listKomentar={listKomentar}
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||
import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_komentar";
|
||||
@@ -54,7 +54,7 @@ export default function AdminForum_HasilReportKomentar({
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Komentar" />
|
||||
<Group position="apart">
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<ButtonDeleteKomentar
|
||||
komentarId={komentarId}
|
||||
data={data}
|
||||
|
||||
@@ -26,7 +26,7 @@ import { IconTrash } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||
import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id";
|
||||
import { adminForum_getListReportPostingById } from "../fun/get/get_list_report_posting_by_id";
|
||||
@@ -46,7 +46,7 @@ export default function AdminForum_HasilReportPosting({
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Posting" />
|
||||
<Group position="apart">
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<ButtonDeletePosting dataPosting={dataPosting} />
|
||||
</Group>
|
||||
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
||||
import { Center, Image, Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import { APIs } from "@/app/lib";
|
||||
import { useState } from "react";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
@@ -17,7 +17,7 @@ export default function AdminJob_DetailPoster({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<AdminGlobal_ComponentBackButton />
|
||||
<Center>
|
||||
<Image
|
||||
onLoad={() => setLoading(false)}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
ActionIcon,
|
||||
AppShell,
|
||||
Box,
|
||||
Center,
|
||||
Divider,
|
||||
Drawer,
|
||||
Grid,
|
||||
Group,
|
||||
Menu,
|
||||
Navbar,
|
||||
NavLink,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Text,
|
||||
Title
|
||||
ActionIcon,
|
||||
AppShell,
|
||||
Box,
|
||||
Center,
|
||||
Divider,
|
||||
Drawer,
|
||||
Grid,
|
||||
Group,
|
||||
Menu,
|
||||
Navbar,
|
||||
NavLink,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useMediaQuery } from "@mantine/hooks";
|
||||
import {
|
||||
IconBell,
|
||||
IconCircleDot,
|
||||
IconCircleDotFilled,
|
||||
IconPhone,
|
||||
IconUser,
|
||||
IconUserCircle
|
||||
IconBell,
|
||||
IconCircleDot,
|
||||
IconCircleDotFilled,
|
||||
IconPhone,
|
||||
IconUser,
|
||||
IconUserCircle,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import _ from "lodash";
|
||||
@@ -34,9 +34,9 @@ import { AccentColor, MainColor } from "../_global/color";
|
||||
import { MODEL_USER } from "../home/model/interface";
|
||||
import Admin_Logout from "./_admin_global/logout";
|
||||
import {
|
||||
gs_admin_navbar_isActive_dropdown,
|
||||
gs_admin_navbar_menu,
|
||||
gs_admin_navbar_subMenu,
|
||||
gs_admin_navbar_isActive_dropdown,
|
||||
gs_admin_navbar_menu,
|
||||
gs_admin_navbar_subMenu,
|
||||
} from "./_admin_global/new_global_state";
|
||||
import { newListAdminPage } from "./new_list_page";
|
||||
import { ComponentAdmin_UIDrawerNotifikasi } from "./notifikasi/ui_drawer_notifikasi";
|
||||
@@ -60,9 +60,9 @@ export function Admin_NewLayout({
|
||||
return (
|
||||
<>
|
||||
<AppShell
|
||||
h={"100vh"}
|
||||
padding="md"
|
||||
navbarOffsetBreakpoint={1024}
|
||||
asideOffsetBreakpoint="sm"
|
||||
navbar={
|
||||
<Navbar
|
||||
width={{ lg: 250, md: 200, base: 250 }}
|
||||
|
||||
Reference in New Issue
Block a user