Fix: admin investasi
Deskripsi: - Fix image dari server wibu ## No Issue
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hipmi",
|
"name": "hipmi",
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "npx tsx prisma/seed.ts"
|
"seed": "npx tsx prisma/seed.ts"
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
||||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
import { adminInvestasi_getOneById } from "@/app_modules/admin/investasi/fun";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
const dataInvestasi = await getOneInvestasiById(params.id);
|
const investasiId = params.id;
|
||||||
|
const dataInvestasi = await adminInvestasi_getOneById({investasiId});
|
||||||
// console.log(dataUser)
|
// console.log(dataUser)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||||
|
import { funGlobal_getUserById } from "@/app_modules/_global/fun/get/fun_get_user_by_id";
|
||||||
import { Admin_NewLayout } from "@/app_modules/admin";
|
import { Admin_NewLayout } from "@/app_modules/admin";
|
||||||
import { AdminLayout } from "@/app_modules/admin/main_dashboard";
|
|
||||||
import adminNotifikasi_countNotifikasi from "@/app_modules/admin/notifikasi/fun/count/count_is_read";
|
import adminNotifikasi_countNotifikasi from "@/app_modules/admin/notifikasi/fun/count/count_is_read";
|
||||||
import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
|
import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
|
||||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default async function Layout({
|
export default async function Layout({
|
||||||
@@ -13,7 +12,7 @@ export default async function Layout({
|
|||||||
}) {
|
}) {
|
||||||
const userLoginId = await funGetUserIdByToken();
|
const userLoginId = await funGetUserIdByToken();
|
||||||
|
|
||||||
const dataUser = await user_getOneByUserId(userLoginId);
|
const dataUser = await funGlobal_getUserById({ userId: userLoginId });
|
||||||
const listNotif = await adminNotifikasi_getByUserId();
|
const listNotif = await adminNotifikasi_getByUserId();
|
||||||
const countNotifikasi = await adminNotifikasi_countNotifikasi();
|
const countNotifikasi = await adminNotifikasi_countNotifikasi();
|
||||||
|
|
||||||
|
|||||||
14
src/app/dev/admin/preview-image/[id]/page.tsx
Normal file
14
src/app/dev/admin/preview-image/[id]/page.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Admin_UiImagePreview } from "@/app_modules/admin/_admin_global";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
async function Page({ params }: { params: { id: string } }) {
|
||||||
|
const fileId = params.id;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Admin_UiImagePreview fileId={fileId} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Page;
|
||||||
@@ -13,7 +13,7 @@ export default async function Page({ params }: { params: { id: string } }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Investasi_UiDetailPortofolio
|
<Investasi_UiDetailPortofolio
|
||||||
data={dataPortofolio as any}
|
dataInvestasi={dataPortofolio as any}
|
||||||
userLoginId={userLoginId}
|
userLoginId={userLoginId}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import DIRECTORY_ID from "./id-derectory";
|
|||||||
import prisma from "./prisma";
|
import prisma from "./prisma";
|
||||||
import { pathAssetImage } from "./path_asset_image";
|
import { pathAssetImage } from "./path_asset_image";
|
||||||
import { RouterImagePreview } from "./router_hipmi/router_image_preview";
|
import { RouterImagePreview } from "./router_hipmi/router_image_preview";
|
||||||
|
import { RouterAdminGlobal } from "./router_admin/router_admin_global";
|
||||||
|
|
||||||
export { DIRECTORY_ID };
|
export { DIRECTORY_ID };
|
||||||
export { prisma };
|
export { prisma };
|
||||||
@@ -11,3 +12,4 @@ export { pathAssetImage };
|
|||||||
|
|
||||||
// Router
|
// Router
|
||||||
export { RouterImagePreview };
|
export { RouterImagePreview };
|
||||||
|
export { RouterAdminGlobal };
|
||||||
|
|||||||
7
src/app/lib/router_admin/router_admin_global.ts
Normal file
7
src/app/lib/router_admin/router_admin_global.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const RouterAdminGlobal = {
|
||||||
|
/**
|
||||||
|
* @param fileId | file id from wibu storage , atau bisa diambil di DB
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
preview_image: ({ id }: { id: string }) => `/dev/admin/preview-image/${id}`,
|
||||||
|
};
|
||||||
16
src/app_modules/_global/fun/get/fun_get_user_by_id.ts
Normal file
16
src/app_modules/_global/fun/get/fun_get_user_by_id.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
|
||||||
|
export async function funGlobal_getUserById({ userId }: { userId: string }) {
|
||||||
|
const data = await prisma.user.findFirst({
|
||||||
|
where: {
|
||||||
|
id: userId,
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -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_TitlePage } from "./title_page";
|
||||||
import { ComponentAdminGlobal_TampilanRupiah } from "./comp_admin_tampilan_rupiah";
|
import { ComponentAdminGlobal_TampilanRupiah } from "./comp_admin_tampilan_rupiah";
|
||||||
|
import { Admin_ComponentModalReport } from "./comp_admin_modal_report";
|
||||||
|
|
||||||
export { ComponentAdminGlobal_TampilanRupiah };
|
export { ComponentAdminGlobal_TampilanRupiah };
|
||||||
export { ComponentAdminGlobal_TitlePage };
|
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 { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export default function ComponentAdminGlobal_BackButton({
|
export default function AdminGlobal_ComponentBackButton({
|
||||||
path,
|
path,
|
||||||
}: {
|
}: {
|
||||||
path?: string;
|
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 { useDisclosure } from "@mantine/hooks";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
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_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
||||||
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
||||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||||
@@ -92,7 +92,7 @@ function ButtonOnHeader({
|
|||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<Button radius={"xl"} bg={"orange"} color="orange" onClick={open}>
|
<Button radius={"xl"} bg={"orange"} color="orange" onClick={open}>
|
||||||
Tambah catatan
|
Tambah catatan
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
|||||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||||
import { AdminDonasi_funUpdateStatusPublish } from "../fun/update/fun_status_publish";
|
import { AdminDonasi_funUpdateStatusPublish } from "../fun/update/fun_status_publish";
|
||||||
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
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_TampilanDetailDonasi from "../component/tampilan_detail_donasi";
|
||||||
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
import ComponentAdminDonasi_CeritaPenggalangDana from "../component/tampilan_detail_cerita";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
@@ -159,7 +159,7 @@ function ButtonOnHeader({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
{donasi.donasiMaster_StatusDonasiId === "2" ? (
|
{donasi.donasiMaster_StatusDonasiId === "2" ? (
|
||||||
<Group>
|
<Group>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
||||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
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 { 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 { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||||
import { adminDonasi_getListDonatur } from "../../fun/get/get_list_donatur_by_id";
|
import { adminDonasi_getListDonatur } from "../../fun/get/get_list_donatur_by_id";
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
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> */}
|
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_BackButton path={RouterAdminDonasi.table_publish} />
|
<AdminGlobal_ComponentBackButton path={RouterAdminDonasi.table_publish} />
|
||||||
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
||||||
<TampilanListDonatur
|
<TampilanListDonatur
|
||||||
donatur={listDonatur}
|
donatur={listDonatur}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
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 { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
|
||||||
export default function AdminDonasi_BuktiTransfer({
|
export default function AdminDonasi_BuktiTransfer({
|
||||||
@@ -12,7 +12,7 @@ export default function AdminDonasi_BuktiTransfer({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<BuktiTransfer imageId={imageId} />
|
<BuktiTransfer imageId={imageId} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
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 { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ export default function AdminDonasi_BuktiTransferPencairan({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<BuktiTransfer imageId={imageId} />
|
<BuktiTransfer imageId={imageId} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Stack } from "@mantine/core";
|
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 { AdminEvent_ViewDetailPeserta } from "../_view";
|
||||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||||
@@ -16,7 +16,7 @@ export function AdminEvent_UiDetailPeserta({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<ComponentAdminGlobal_TitlePage name="Detail Peserta" />
|
<ComponentAdminGlobal_TitlePage name="Detail Peserta" />
|
||||||
<AdminEvent_ViewDetailPeserta
|
<AdminEvent_ViewDetailPeserta
|
||||||
dataPeserta={dataPeserta as any}
|
dataPeserta={dataPeserta as any}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_glo
|
|||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||||
import { adminForum_getListKomentarById } from "../fun/get/get_list_komentar_by_id";
|
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";
|
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||||
|
|
||||||
export default function AdminForum_DetailPosting({
|
export default function AdminForum_DetailPosting({
|
||||||
@@ -53,7 +53,7 @@ export default function AdminForum_DetailPosting({
|
|||||||
{/* <pre>{JSON.stringify(listKomentar, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(listKomentar, null, 2)}</pre> */}
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Detail Posting" />
|
<ComponentAdminGlobal_HeaderTamplate name="Forum: Detail Posting" />
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
||||||
<TableKomentar
|
<TableKomentar
|
||||||
listKomentar={listKomentar}
|
listKomentar={listKomentar}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
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 ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||||
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||||
import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_komentar";
|
import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_komentar";
|
||||||
@@ -54,7 +54,7 @@ export default function AdminForum_HasilReportKomentar({
|
|||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Komentar" />
|
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Komentar" />
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<ButtonDeleteKomentar
|
<ButtonDeleteKomentar
|
||||||
komentarId={komentarId}
|
komentarId={komentarId}
|
||||||
data={data}
|
data={data}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { IconTrash } from "@tabler/icons-react";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
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 ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||||
import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id";
|
import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id";
|
||||||
import { adminForum_getListReportPostingById } from "../fun/get/get_list_report_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>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Posting" />
|
<ComponentAdminGlobal_HeaderTamplate name="Forum: Hasil Report Posting" />
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<ButtonDeletePosting dataPosting={dataPosting} />
|
<ButtonDeletePosting dataPosting={dataPosting} />
|
||||||
</Group>
|
</Group>
|
||||||
<ComponentAdminForum_ViewOneDetailPosting dataPosting={dataPosting} />
|
<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 { Button } from "@mantine/core";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export function AdminInvestasi_ComponentCekBuktiTransfer({
|
export function AdminInvestasi_ComponentCekBuktiTransfer({
|
||||||
imagesId,
|
imageId,
|
||||||
}: {
|
}: {
|
||||||
imagesId: string;
|
imageId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoading, setLoading] = useState(false)
|
const [isLoading, setLoading] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
@@ -18,10 +18,10 @@ export function AdminInvestasi_ComponentCekBuktiTransfer({
|
|||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
router.push(RouterAdminInvestasi.bukti_transfer + `${imagesId}`);
|
router.push(RouterAdminGlobal.preview_image({ id: imageId }));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Cek
|
Cek Transaksi
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { Paper, Stack, Title } from "@mantine/core";
|
||||||
import { Paper, Stack, Title, AspectRatio, Center, Image } from "@mantine/core";
|
import { Admin_ComponentLoadImageLandscape } from "../../_admin_global";
|
||||||
|
|
||||||
export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}) {
|
export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}) {
|
||||||
return (
|
return (
|
||||||
@@ -10,7 +10,9 @@ export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}
|
|||||||
Gambar Proyek
|
Gambar Proyek
|
||||||
</Title>
|
</Title>
|
||||||
|
|
||||||
<AspectRatio ratio={1 / 1} mah={300}>
|
<Admin_ComponentLoadImageLandscape fileId={imagesId} />
|
||||||
|
|
||||||
|
{/* <AspectRatio ratio={1 / 1} mah={300}>
|
||||||
<Center>
|
<Center>
|
||||||
<Image
|
<Image
|
||||||
style={{ borderRadius: "10px" }}
|
style={{ borderRadius: "10px" }}
|
||||||
@@ -20,7 +22,7 @@ export function ComponentAdminInvestasi_DetailGambar({imagesId}: {imagesId: any}
|
|||||||
src={RouterInvestasi_OLD.api_gambar + `${imagesId}`}
|
src={RouterInvestasi_OLD.api_gambar + `${imagesId}`}
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</AspectRatio>
|
</AspectRatio> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import { APIs } from "@/app/lib";
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { MODEL_INVESTASI_DOKUMEN } from "@/app_modules/investasi/_lib/interface";
|
||||||
import {
|
import {
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Paper,
|
Paper,
|
||||||
@@ -17,10 +19,12 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
|||||||
title,
|
title,
|
||||||
dataProspektus,
|
dataProspektus,
|
||||||
listDokumen,
|
listDokumen,
|
||||||
|
prospektusFileId,
|
||||||
}: {
|
}: {
|
||||||
title: string;
|
title: string;
|
||||||
dataProspektus: any;
|
dataProspektus: any;
|
||||||
listDokumen: any[];
|
listDokumen: any[];
|
||||||
|
prospektusFileId: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -49,10 +53,7 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
|||||||
<Text>Prospek {title}</Text>
|
<Text>Prospek {title}</Text>
|
||||||
<Link
|
<Link
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={
|
href={APIs.GET({ fileId: prospektusFileId })}
|
||||||
RouterInvestasi_OLD.api_file_prospektus +
|
|
||||||
`${dataProspektus === null ? "" : dataProspektus.id}`
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Button radius={50}>Lihat</Button>
|
<Button radius={50}>Lihat</Button>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -70,16 +71,14 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
|||||||
{_.isEmpty(listDokumen) ? (
|
{_.isEmpty(listDokumen) ? (
|
||||||
<Text>-</Text>
|
<Text>-</Text>
|
||||||
) : (
|
) : (
|
||||||
listDokumen.map((e: any) => (
|
listDokumen.map((e: MODEL_INVESTASI_DOKUMEN) => (
|
||||||
<Paper key={e.id}>
|
<Paper key={e.id}>
|
||||||
<Group>
|
<Group>
|
||||||
<IconFileTypePdf />
|
<IconFileTypePdf />
|
||||||
<Text>{e.title}</Text>
|
<Text>{e.title}</Text>
|
||||||
<Link
|
<Link
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={
|
href={APIs.GET({ fileId: e.fileId })}
|
||||||
RouterInvestasi_OLD.api_file_dokumen + `${e.id}`
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Button radius={50}>Lihat</Button>
|
<Button radius={50}>Lihat</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
|||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
{e?.statusInvoiceId !== "3" ? (
|
{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} />
|
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||||
|
|
||||||
{/* Data Foto */}
|
{/* Data Foto */}
|
||||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||||
|
|
||||||
{/* Data Detail */}
|
{/* Data Detail */}
|
||||||
<ComponentAdminInvestasi_DetailData data={data} />
|
<ComponentAdminInvestasi_DetailData data={data} />
|
||||||
@@ -34,6 +34,7 @@ export function AdminInvestasi_ViewDetailData({
|
|||||||
title={data.title}
|
title={data.title}
|
||||||
dataProspektus={data.ProspektusInvestasi}
|
dataProspektus={data.ProspektusInvestasi}
|
||||||
listDokumen={data.DokumenInvestasi}
|
listDokumen={data.DokumenInvestasi}
|
||||||
|
prospektusFileId={data.prospektusFileId}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Stack } from "@mantine/core";
|
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 { AdminInvestasi_ViewBuktiTransfer } from "../_view";
|
||||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||||
|
|
||||||
export function AdminInvestasi_DetailBuktiTransfer({ imageId }: { imageId: string }) {
|
export function AdminInvestasi_DetailBuktiTransfer({ imageId }: { imageId: string }) {
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<ComponentAdminGlobal_TitlePage name="Bukti Transfer" />
|
<ComponentAdminGlobal_TitlePage name="Bukti Transfer" />
|
||||||
<AdminInvestasi_ViewBuktiTransfer imageId={imageId} />
|
<AdminInvestasi_ViewBuktiTransfer imageId={imageId} />
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
|||||||
import { Button, Group, Stack } from "@mantine/core";
|
import { Button, Group, Stack } from "@mantine/core";
|
||||||
import { IconCircleCheck } from "@tabler/icons-react";
|
import { IconCircleCheck } from "@tabler/icons-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||||
import {
|
import {
|
||||||
AdminInvestasi_ViewDaftarInvestor,
|
AdminInvestasi_ViewDaftarInvestor,
|
||||||
AdminInvestasi_ViewDaftarTransaksi,
|
AdminInvestasi_ViewDaftarTransaksi,
|
||||||
@@ -46,7 +46,7 @@ export function AdminInvestasi_DetailPublish({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack >
|
<Stack >
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
{listPage.map((e) => (
|
{listPage.map((e) => (
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from "@mantine/core";
|
} 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_DetailDataAuthor } from "../_component/detail_data_author";
|
||||||
import { ComponentAdminInvestasi_DetailData } from "../_component/detail_data_investasi";
|
import { ComponentAdminInvestasi_DetailData } from "../_component/detail_data_investasi";
|
||||||
import { ComponentAdminInvestasi_DetailGambar } from "../_component/detail_gambar_investasi";
|
import { ComponentAdminInvestasi_DetailGambar } from "../_component/detail_gambar_investasi";
|
||||||
@@ -18,7 +18,7 @@ export function AdminInvestasi_DetailReject({ data }: { data: MODEL_INVESTASI })
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={"lg"}>
|
<Stack px={"lg"}>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
cols={3}
|
cols={3}
|
||||||
spacing="lg"
|
spacing="lg"
|
||||||
@@ -54,7 +54,7 @@ export function AdminInvestasi_DetailReject({ data }: { data: MODEL_INVESTASI })
|
|||||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||||
|
|
||||||
{/* Data Foto */}
|
{/* Data Foto */}
|
||||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||||
|
|
||||||
{/* Data Detail */}
|
{/* Data Detail */}
|
||||||
<ComponentAdminInvestasi_DetailData data={data} />
|
<ComponentAdminInvestasi_DetailData data={data} />
|
||||||
@@ -64,6 +64,7 @@ export function AdminInvestasi_DetailReject({ data }: { data: MODEL_INVESTASI })
|
|||||||
title={data.title}
|
title={data.title}
|
||||||
dataProspektus={data.ProspektusInvestasi}
|
dataProspektus={data.ProspektusInvestasi}
|
||||||
listDokumen={data.DokumenInvestasi}
|
listDokumen={data.DokumenInvestasi}
|
||||||
|
prospektusFileId={data.prospektusFileId}
|
||||||
/>
|
/>
|
||||||
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -3,7 +3,14 @@
|
|||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
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 { useShallowEffect } from "@mantine/hooks";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
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_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
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 adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||||
import { ComponentAdminInvestasi_DetailDataAuthor } from "../_component/detail_data_author";
|
import { ComponentAdminInvestasi_DetailDataAuthor } from "../_component/detail_data_author";
|
||||||
import { ComponentAdminInvestasi_DetailData } from "../_component/detail_data_investasi";
|
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 { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
||||||
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
||||||
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
||||||
|
import { Admin_ComponentModalReport } from "../../_admin_global/_component";
|
||||||
|
|
||||||
export default function AdminInvestasi_DetailReview({
|
export default function AdminInvestasi_DetailReview({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
@@ -31,6 +39,7 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
const [isLoadingPublish, setIsLoadingPublish] = useState(false);
|
const [isLoadingPublish, setIsLoadingPublish] = useState(false);
|
||||||
const [isLoadingReject, setIsLoadingReject] = useState(false);
|
const [isLoadingReject, setIsLoadingReject] = useState(false);
|
||||||
|
const [report, setReport] = useState("");
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
cekStatusPublish();
|
cekStatusPublish();
|
||||||
@@ -43,13 +52,16 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
async function onReject() {
|
async function onReject() {
|
||||||
const body = {
|
const body = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
catatan: data.catatan,
|
catatan: report,
|
||||||
status: "4",
|
status: "4",
|
||||||
};
|
};
|
||||||
if (_.isEmpty(body.catatan))
|
if (_.isEmpty(body.catatan))
|
||||||
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi alasan");
|
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi alasan");
|
||||||
|
|
||||||
const res = await Admin_funRejectInvestasi(body);
|
const res = await Admin_funRejectInvestasi(body);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
setIsLoadingReject(true);
|
||||||
|
|
||||||
const dataNotif = {
|
const dataNotif = {
|
||||||
appId: res.data?.id,
|
appId: res.data?.id,
|
||||||
userId: res.data?.authorId,
|
userId: res.data?.authorId,
|
||||||
@@ -75,8 +87,11 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
|
|
||||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
router.back();
|
router.back();
|
||||||
|
setOpenModal(false);
|
||||||
|
setIsLoadingReject(false);
|
||||||
} else {
|
} else {
|
||||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
|
setOpenModal(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +142,7 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
<>
|
<>
|
||||||
<Stack px={"lg"}>
|
<Stack px={"lg"}>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
|
|
||||||
{data.masterStatusInvestasiId === "2" ? (
|
{data.masterStatusInvestasiId === "2" ? (
|
||||||
<Group>
|
<Group>
|
||||||
@@ -141,11 +156,9 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
Publish
|
Publish
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
loaderPosition="center"
|
|
||||||
loading={isLoadingReject}
|
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="red"
|
color="red"
|
||||||
onClick={() => onReject()}
|
onClick={() => setOpenModal(true)}
|
||||||
>
|
>
|
||||||
Reject
|
Reject
|
||||||
</Button>
|
</Button>
|
||||||
@@ -168,7 +181,7 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||||
|
|
||||||
{/* Data Foto */}
|
{/* Data Foto */}
|
||||||
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
<ComponentAdminInvestasi_DetailGambar imagesId={data.imageId} />
|
||||||
|
|
||||||
{/* Data Detail */}
|
{/* Data Detail */}
|
||||||
<ComponentAdminInvestasi_DetailData data={data} />
|
<ComponentAdminInvestasi_DetailData data={data} />
|
||||||
@@ -178,8 +191,53 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
title={data.title}
|
title={data.title}
|
||||||
dataProspektus={data.ProspektusInvestasi}
|
dataProspektus={data.ProspektusInvestasi}
|
||||||
listDokumen={data.DokumenInvestasi}
|
listDokumen={data.DokumenInvestasi}
|
||||||
|
prospektusFileId={data.prospektusFileId}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</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;
|
invoiceId: string;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const updt = await prisma.investasi_Invoice.update({
|
const updt = await prisma.investasi_Invoice.update({
|
||||||
where: {
|
where: {
|
||||||
id: invoiceId,
|
id: invoiceId,
|
||||||
|
|||||||
@@ -13,6 +13,22 @@ export async function adminInvestasi_funEditStatusPublishById({
|
|||||||
statusId: string;
|
statusId: string;
|
||||||
progesInvestasiId: 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 publishTime = new Date();
|
||||||
const res = await prisma.investasi.update({
|
const res = await prisma.investasi.update({
|
||||||
where: {
|
where: {
|
||||||
@@ -31,8 +47,8 @@ export async function adminInvestasi_funEditStatusPublishById({
|
|||||||
select: {
|
select: {
|
||||||
name: true,
|
name: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!res) return { status: 400, message: "Gagal Update" };
|
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) {
|
export default async function Admin_funRejectInvestasi(data: any) {
|
||||||
// console.log(data)
|
// 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({
|
const res = await prisma.investasi.update({
|
||||||
where: { id: data.id },
|
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_funAcceptTransaksiById } from "./edit/fun_accept_invoice_by_id";
|
||||||
import { adminInvestasi_funRejectInvoiceById } from "./edit/fun_reject_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_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";
|
import { adminInvestasi_getStatusInvestasi } from "./get/fun_get_status_transaksi";
|
||||||
|
|
||||||
export { adminInvestasi_getStatusInvestasi };
|
export { adminInvestasi_getStatusInvestasi };
|
||||||
export { adminInvestasi_funGetAllTransaksiById };
|
export { adminInvestasi_funGetAllTransaksiById };
|
||||||
export { adminInvestasi_funRejectInvoiceById };
|
export { adminInvestasi_funRejectInvoiceById };
|
||||||
export { adminInvestasi_funAcceptTransaksiById };
|
export { adminInvestasi_funAcceptTransaksiById };
|
||||||
|
export { adminInvestasi_getOneById };
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
||||||
import { Center, Image, Stack } from "@mantine/core";
|
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 { APIs } from "@/app/lib";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
@@ -17,7 +17,7 @@ export default function AdminJob_DetailPoster({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
<Center>
|
<Center>
|
||||||
<Image
|
<Image
|
||||||
onLoad={() => setLoading(false)}
|
onLoad={() => setLoading(false)}
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
AppShell,
|
AppShell,
|
||||||
Box,
|
Box,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
Divider,
|
||||||
Drawer,
|
Drawer,
|
||||||
Grid,
|
Grid,
|
||||||
Group,
|
Group,
|
||||||
Menu,
|
Menu,
|
||||||
Navbar,
|
Navbar,
|
||||||
NavLink,
|
NavLink,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
Title
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useMediaQuery } from "@mantine/hooks";
|
import { useMediaQuery } from "@mantine/hooks";
|
||||||
import {
|
import {
|
||||||
IconBell,
|
IconBell,
|
||||||
IconCircleDot,
|
IconCircleDot,
|
||||||
IconCircleDotFilled,
|
IconCircleDotFilled,
|
||||||
IconPhone,
|
IconPhone,
|
||||||
IconUser,
|
IconUser,
|
||||||
IconUserCircle
|
IconUserCircle,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -34,9 +34,9 @@ import { AccentColor, MainColor } from "../_global/color";
|
|||||||
import { MODEL_USER } from "../home/model/interface";
|
import { MODEL_USER } from "../home/model/interface";
|
||||||
import Admin_Logout from "./_admin_global/logout";
|
import Admin_Logout from "./_admin_global/logout";
|
||||||
import {
|
import {
|
||||||
gs_admin_navbar_isActive_dropdown,
|
gs_admin_navbar_isActive_dropdown,
|
||||||
gs_admin_navbar_menu,
|
gs_admin_navbar_menu,
|
||||||
gs_admin_navbar_subMenu,
|
gs_admin_navbar_subMenu,
|
||||||
} from "./_admin_global/new_global_state";
|
} from "./_admin_global/new_global_state";
|
||||||
import { newListAdminPage } from "./new_list_page";
|
import { newListAdminPage } from "./new_list_page";
|
||||||
import { ComponentAdmin_UIDrawerNotifikasi } from "./notifikasi/ui_drawer_notifikasi";
|
import { ComponentAdmin_UIDrawerNotifikasi } from "./notifikasi/ui_drawer_notifikasi";
|
||||||
@@ -60,9 +60,9 @@ export function Admin_NewLayout({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppShell
|
<AppShell
|
||||||
|
h={"100vh"}
|
||||||
padding="md"
|
padding="md"
|
||||||
navbarOffsetBreakpoint={1024}
|
navbarOffsetBreakpoint={1024}
|
||||||
asideOffsetBreakpoint="sm"
|
|
||||||
navbar={
|
navbar={
|
||||||
<Navbar
|
<Navbar
|
||||||
width={{ lg: 250, md: 200, base: 250 }}
|
width={{ lg: 250, md: 200, base: 250 }}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { prisma } from "@/app/lib";
|
import { prisma } from "@/app/lib";
|
||||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||||
|
|
||||||
export async function investasi_funUpdateInvestasi({
|
export async function investasi_funUpdateInvestasi({
|
||||||
data,
|
data,
|
||||||
@@ -39,7 +39,8 @@ export async function investasi_funUpdateInvestasi({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!updtWithImage) return { status: 400, message: "Gagal update data" };
|
if (!updtWithImage) return { status: 400, message: "Gagal update data" };
|
||||||
revalidatePath(NEW_RouterInvestasi.detail_draft);
|
revalidatePath("/dev/investasi/detail/portofolio/");
|
||||||
|
|
||||||
return { status: 200, message: "Berhasil update" };
|
return { status: 200, message: "Berhasil update" };
|
||||||
} else {
|
} else {
|
||||||
const updtNoImage = await prisma.investasi.update({
|
const updtNoImage = await prisma.investasi.update({
|
||||||
@@ -61,7 +62,8 @@ export async function investasi_funUpdateInvestasi({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!updtNoImage) return { status: 400, message: "Gagal update data" };
|
if (!updtNoImage) return { status: 400, message: "Gagal update data" };
|
||||||
revalidatePath(NEW_RouterInvestasi.detail_draft);
|
revalidatePath("/dev/investasi/detail/portofolio/");
|
||||||
|
|
||||||
return { status: 200, message: "Berhasil update" };
|
return { status: 200, message: "Berhasil update" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import {
|
import {
|
||||||
UIGlobal_Drawer,
|
UIGlobal_Drawer,
|
||||||
|
UIGlobal_DrawerCustom,
|
||||||
UIGlobal_LayoutHeaderTamplate,
|
UIGlobal_LayoutHeaderTamplate,
|
||||||
UIGlobal_LayoutTamplate,
|
UIGlobal_LayoutTamplate,
|
||||||
} from "@/app_modules/_global/ui";
|
} from "@/app_modules/_global/ui";
|
||||||
import { ActionIcon } from "@mantine/core";
|
import { ActionIcon, Box, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||||
import {
|
import {
|
||||||
IconCategoryPlus,
|
IconCategoryPlus,
|
||||||
IconDotsVertical,
|
IconDotsVertical,
|
||||||
@@ -21,16 +22,20 @@ import {
|
|||||||
Investasi_ViewDetailReject,
|
Investasi_ViewDetailReject,
|
||||||
Investasi_ViewDetailReview,
|
Investasi_ViewDetailReview,
|
||||||
} from "../../_view";
|
} from "../../_view";
|
||||||
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
|
|
||||||
export function Investasi_UiDetailPortofolio({
|
export function Investasi_UiDetailPortofolio({
|
||||||
data,
|
dataInvestasi,
|
||||||
userLoginId,
|
userLoginId,
|
||||||
}: {
|
}: {
|
||||||
data: MODEL_INVESTASI;
|
dataInvestasi: MODEL_INVESTASI;
|
||||||
userLoginId: string;
|
userLoginId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [pageId, setPageId] = useState("");
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
|
const [data, setData] = useState<any>(dataInvestasi);
|
||||||
const listPage = [
|
const listPage = [
|
||||||
{
|
{
|
||||||
id: "1",
|
id: "1",
|
||||||
@@ -70,13 +75,47 @@ export function Investasi_UiDetailPortofolio({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Investasi_ViewDetailDraft dataInvestasi={data} />
|
<Investasi_ViewDetailDraft dataInvestasi={dataInvestasi} />
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
|
|
||||||
<UIGlobal_Drawer
|
{/* <UIGlobal_Drawer
|
||||||
opened={openDrawer}
|
opened={openDrawer}
|
||||||
close={() => setOpenDrawer(false)}
|
close={() => setOpenDrawer(false)}
|
||||||
component={listPage}
|
component={listPage}
|
||||||
|
/> */}
|
||||||
|
|
||||||
|
<UIGlobal_DrawerCustom
|
||||||
|
opened={openDrawer}
|
||||||
|
close={() => setOpenDrawer(false)}
|
||||||
|
component={
|
||||||
|
<SimpleGrid cols={listPage.length}>
|
||||||
|
{listPage.map((e, i) => (
|
||||||
|
<Stack key={i} align="center" spacing={"xs"}>
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
c="white"
|
||||||
|
onClick={() => {
|
||||||
|
setPageId(e?.id);
|
||||||
|
setLoading(true);
|
||||||
|
if (e.id === "1") {
|
||||||
|
setData({});
|
||||||
|
}
|
||||||
|
router.push(e?.path, { scroll: false });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isLoading && e?.id === pageId ? (
|
||||||
|
<ComponentGlobal_Loader />
|
||||||
|
) : (
|
||||||
|
e?.icon
|
||||||
|
)}
|
||||||
|
</ActionIcon>
|
||||||
|
<Text fz={"sm"} align="center" color="white">
|
||||||
|
{e?.name}
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -85,23 +124,16 @@ export function Investasi_UiDetailPortofolio({
|
|||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
header={
|
header={
|
||||||
<UIGlobal_LayoutHeaderTamplate
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
title={`Detail ${data.MasterStatusInvestasi.name}`}
|
title={`Detail ${dataInvestasi.MasterStatusInvestasi.name}`}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{/* {data.masterStatusInvestasiId === "1" && (
|
{dataInvestasi.masterStatusInvestasiId === "2" && (
|
||||||
<Investasi_ViewDetailPublish
|
<Investasi_ViewDetailReview dataInvestasi={dataInvestasi} />
|
||||||
dataInvestasi={data}
|
|
||||||
userLoginId={userLoginId}
|
|
||||||
/>
|
|
||||||
)} */}
|
|
||||||
|
|
||||||
{data.masterStatusInvestasiId === "2" && (
|
|
||||||
<Investasi_ViewDetailReview dataInvestasi={data} />
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{data.masterStatusInvestasiId === "4" && (
|
{dataInvestasi.masterStatusInvestasiId === "4" && (
|
||||||
<Investasi_ViewDetailReject dataInvestasi={data} />
|
<Investasi_ViewDetailReject dataInvestasi={dataInvestasi} />
|
||||||
)}
|
)}
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export function Investasi_UiPortofolio({
|
|||||||
}) {
|
}) {
|
||||||
const [activeTab, setActiveTab] = useState<string | null>(statusId);
|
const [activeTab, setActiveTab] = useState<string | null>(statusId);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [data, setData] = useState(dataPortofolio);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -61,7 +60,7 @@ export function Investasi_UiPortofolio({
|
|||||||
|
|
||||||
<Investasi_ViewPortofolio
|
<Investasi_ViewPortofolio
|
||||||
statusId={statusId}
|
statusId={statusId}
|
||||||
dataPortofolio={data as any}
|
dataPortofolio={dataPortofolio as any}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export function Investasi_ViewCreateDocument({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack spacing={"xl"}>
|
<Stack spacing={"xl"}>
|
||||||
<ComponentGlobal_BoxInformation informasi="File dokumen bersifat opsional, jika memang ada file yang bisa membantu meyakinkan investor. Anda bisa mengupload nya disini !" />
|
<ComponentGlobal_BoxInformation informasi="File dokumen bersifat opsional, jika memang ada file yang bisa membantu meyakinkan investor. Anda bisa mengupload nya !" />
|
||||||
|
|
||||||
<Stack>
|
<Stack>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
@@ -3,34 +3,47 @@
|
|||||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||||
|
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
import { UIGlobal_Modal } from "@/app_modules/_global/ui";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi/_component";
|
import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi/_component";
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
||||||
import { gs_investasi_status } from "@/app_modules/investasi/g_state";
|
import funDeleteInvestasi from "@/app_modules/investasi/fun/fun_delete_investasi";
|
||||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import { Button, Stack } from "@mantine/core";
|
import { Button, Group, Stack } from "@mantine/core";
|
||||||
import { useAtom } from "jotai";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export default function Investasi_ViewDetailDraft({
|
export default function Investasi_ViewDetailDraft({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
}: {
|
}: {
|
||||||
dataInvestasi: MODEL_INVESTASI;
|
dataInvestasi: any;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [data, setData] = useState<MODEL_INVESTASI>(dataInvestasi);
|
||||||
|
const [openModal, setOpenModal] = useState(false);
|
||||||
|
|
||||||
async function onAjukanReview() {
|
// Delete
|
||||||
|
const [isLoadingDelete, setIsLoadingDelete] = useState(false);
|
||||||
|
const [openModalDelete, setOpenModalDelete] = useState(false);
|
||||||
|
|
||||||
|
async function onChangeStatus() {
|
||||||
const res = await investasi_funEditStatusById({
|
const res = await investasi_funEditStatusById({
|
||||||
investasiId: dataInvestasi.id,
|
investasiId: data.id,
|
||||||
statusId: "2",
|
statusId: "2",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
setIsLoading(true);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil("Review Berhasil Diajukan");
|
||||||
|
router.replace(NEW_RouterInvestasi.portofolio({ id: "2" }));
|
||||||
|
|
||||||
const dataNotif = {
|
const dataNotif = {
|
||||||
appId: res.data?.id,
|
appId: res.data?.id,
|
||||||
userId: res.data?.authorId,
|
userId: res.data?.authorId,
|
||||||
@@ -46,41 +59,138 @@ export default function Investasi_ViewDetailDraft({
|
|||||||
|
|
||||||
if (notif.status === 201) {
|
if (notif.status === 201) {
|
||||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||||
|
|
||||||
setIsLoading(true);
|
|
||||||
ComponentGlobal_NotifikasiBerhasil("Review Berhasil Diajukan");
|
|
||||||
router.push(NEW_RouterInvestasi.portofolio({ id: "2" }));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onDelete() {
|
||||||
|
const res = await funDeleteInvestasi(data.id);
|
||||||
|
if (res.status === 200) {
|
||||||
|
setIsLoadingDelete(true);
|
||||||
|
|
||||||
|
const delImage = await funGlobal_DeleteFileById({
|
||||||
|
fileId: data.imageId,
|
||||||
|
});
|
||||||
|
if (!delImage.success) {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus image ");
|
||||||
|
}
|
||||||
|
|
||||||
|
const delFileProspektus = await funGlobal_DeleteFileById({
|
||||||
|
fileId: data.prospektusFileId,
|
||||||
|
});
|
||||||
|
if (!delFileProspektus.success) {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus prospektus ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isEmpty(data.DokumenInvestasi)) {
|
||||||
|
for (let i of data.DokumenInvestasi) {
|
||||||
|
const delFileDokumen = await funGlobal_DeleteFileById({
|
||||||
|
fileId: i.fileId,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!delFileDokumen.success) {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
|
"Gagal hapus prospektus "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
setOpenModal(false);
|
||||||
|
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||||
|
setIsLoadingDelete(false);
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
setIsLoadingDelete(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack mb={"lg"}>
|
<Stack mb={"lg"}>
|
||||||
{dataInvestasi.catatan && (
|
{data.catatan && (
|
||||||
<ComponentGlobal_BoxInformation
|
<ComponentGlobal_BoxInformation informasi={data.catatan} isReport />
|
||||||
informasi={dataInvestasi.catatan}
|
|
||||||
isReport
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
<Investasi_ComponentDetailDataNonPublish data={dataInvestasi} />
|
<Investasi_ComponentDetailDataNonPublish data={data} />
|
||||||
|
|
||||||
<Stack>
|
<Group position="apart" grow>
|
||||||
<Button
|
<Button
|
||||||
loaderPosition="center"
|
|
||||||
loading={isLoading}
|
|
||||||
radius={50}
|
radius={50}
|
||||||
bg={MainColor.yellow}
|
bg={MainColor.yellow}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
c={"black"}
|
c={"black"}
|
||||||
onClick={() => onAjukanReview()}
|
onClick={() => setOpenModal(true)}
|
||||||
>
|
>
|
||||||
Ajukan Review
|
Ajukan Review
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
|
||||||
|
<Button
|
||||||
|
radius={50}
|
||||||
|
color="red"
|
||||||
|
c={"black"}
|
||||||
|
onClick={() => setOpenModalDelete(true)}
|
||||||
|
>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
|
{/* Ajukan Kembali */}
|
||||||
|
<UIGlobal_Modal
|
||||||
|
opened={openModal}
|
||||||
|
close={() => setOpenModal(false)}
|
||||||
|
title={"Anda yakin ingin mengajukan review ?"}
|
||||||
|
buttonKiri={
|
||||||
|
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
buttonKanan={
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
}}
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoading}
|
||||||
|
radius={"xl"}
|
||||||
|
color={"orange"}
|
||||||
|
onClick={() => onChangeStatus()}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Hapus */}
|
||||||
|
<UIGlobal_Modal
|
||||||
|
opened={openModalDelete}
|
||||||
|
close={() => setOpenModalDelete(false)}
|
||||||
|
title={"Anda yakin ingin menghapus ?"}
|
||||||
|
buttonKiri={
|
||||||
|
<Button radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
buttonKanan={
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
}}
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoadingDelete}
|
||||||
|
radius={"xl"}
|
||||||
|
color={"red"}
|
||||||
|
onClick={() => {
|
||||||
|
onDelete();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {
|
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
NEW_RouterInvestasi,
|
|
||||||
RouterInvestasi_OLD,
|
|
||||||
} from "@/app/lib/router_hipmi/router_investasi";
|
|
||||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||||
|
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi/_component";
|
import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi/_component";
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
||||||
import funDeleteInvestasi from "@/app_modules/investasi/fun/fun_delete_investasi";
|
import funDeleteInvestasi from "@/app_modules/investasi/fun/fun_delete_investasi";
|
||||||
import { gs_investasi_status } from "@/app_modules/investasi/g_state";
|
|
||||||
import { Button, Group, Stack } from "@mantine/core";
|
import { Button, Group, Stack } from "@mantine/core";
|
||||||
import { useAtom } from "jotai";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
@@ -24,36 +22,65 @@ export default function Investasi_ViewDetailReject({
|
|||||||
dataInvestasi: MODEL_INVESTASI;
|
dataInvestasi: MODEL_INVESTASI;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
const [data, setData] = useState(dataInvestasi);
|
||||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
async function onAjukan() {
|
async function onAjukan() {
|
||||||
const res = await investasi_funEditStatusById({
|
const res = await investasi_funEditStatusById({
|
||||||
investasiId: dataInvestasi.id,
|
investasiId: data.id,
|
||||||
statusId: "3",
|
statusId: "3",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
||||||
setActiveTab("Draft");
|
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||||
router.push(RouterInvestasi_OLD.portofolio);
|
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
await funDeleteInvestasi(investasi.id).then((res) => {
|
const res = await funDeleteInvestasi(data.id);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
setLoading(true);
|
||||||
setOpenModal(false);
|
|
||||||
router.push(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
const delImage = await funGlobal_DeleteFileById({
|
||||||
} else {
|
fileId: data.imageId,
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
});
|
||||||
|
if (!delImage.success) {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus image ");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
// setActiveTab("Reject");
|
const delFileProspektus = await funGlobal_DeleteFileById({
|
||||||
|
fileId: data.prospektusFileId,
|
||||||
|
});
|
||||||
|
if (!delFileProspektus.success) {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus prospektus ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isEmpty(data.DokumenInvestasi)) {
|
||||||
|
for (let i of data.DokumenInvestasi) {
|
||||||
|
const delFileDokumen = await funGlobal_DeleteFileById({
|
||||||
|
fileId: i.fileId,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!delFileDokumen.success) {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
|
"Gagal hapus prospektus "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
setOpenModal(false);
|
||||||
|
router.replace(NEW_RouterInvestasi.portofolio({ id: "4" }));
|
||||||
|
setLoading(false);
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -69,7 +96,14 @@ export default function Investasi_ViewDetailReject({
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
buttonKanan={
|
buttonKanan={
|
||||||
<Button bg={"red"} radius={"xl"} onClick={() => onDelete()}>
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoading}
|
||||||
|
color="red"
|
||||||
|
bg={"red"}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => onDelete()}
|
||||||
|
>
|
||||||
Hapus
|
Hapus
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
@@ -77,18 +111,14 @@ export default function Investasi_ViewDetailReject({
|
|||||||
|
|
||||||
<Stack>
|
<Stack>
|
||||||
{/* Alasan */}
|
{/* Alasan */}
|
||||||
<ComponentGlobal_BoxInformation
|
<ComponentGlobal_BoxInformation informasi={data.catatan} isReport />
|
||||||
informasi={investasi.catatan}
|
|
||||||
isReport
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Investasi_ComponentDetailDataNonPublish data={dataInvestasi} />
|
<Investasi_ComponentDetailDataNonPublish data={dataInvestasi} />
|
||||||
|
|
||||||
<Group position="apart" grow>
|
<Group position="apart" grow mb={"xl"}>
|
||||||
{/* Tombol Ajukan */}
|
{/* Tombol Ajukan */}
|
||||||
<Button
|
<Button
|
||||||
mb={"xl"}
|
radius={"xl"}
|
||||||
radius={50}
|
|
||||||
bg={"orange.7"}
|
bg={"orange.7"}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
onClick={() => onAjukan()}
|
onClick={() => onAjukan()}
|
||||||
@@ -98,10 +128,9 @@ export default function Investasi_ViewDetailReject({
|
|||||||
|
|
||||||
{/* Tombol Hapus */}
|
{/* Tombol Hapus */}
|
||||||
<Button
|
<Button
|
||||||
mb={"xl"}
|
radius={"xl"}
|
||||||
radius={50}
|
|
||||||
bg={"red.7"}
|
bg={"red.7"}
|
||||||
color="yellow"
|
color="red"
|
||||||
onClick={() => setOpenModal(true)}
|
onClick={() => setOpenModal(true)}
|
||||||
>
|
>
|
||||||
Hapus
|
Hapus
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {
|
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
NEW_RouterInvestasi,
|
|
||||||
RouterInvestasi_OLD,
|
|
||||||
} from "@/app/lib/router_hipmi/router_investasi";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
|
import { UIGlobal_Modal } from "@/app_modules/_global/ui";
|
||||||
import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi/_component";
|
import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi/_component";
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
||||||
import { gs_investasi_status } from "@/app_modules/investasi/g_state";
|
|
||||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import { Button, Stack } from "@mantine/core";
|
import { Button, Stack } from "@mantine/core";
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
@@ -25,13 +21,18 @@ export default function Investasi_ViewDetailReview({
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoading, setLoading] = useState(false);
|
const [isLoading, setLoading] = useState(false);
|
||||||
const [data, setData] = useState<MODEL_INVESTASI>(dataInvestasi);
|
const [data, setData] = useState<MODEL_INVESTASI>(dataInvestasi);
|
||||||
|
const [openModal, setOpenModal] = useState(false);
|
||||||
|
|
||||||
async function onCancleReview() {
|
async function onChangeStatus() {
|
||||||
const res = await investasi_funEditStatusById({
|
const res = await investasi_funEditStatusById({
|
||||||
investasiId: data.id,
|
investasiId: data.id,
|
||||||
statusId: "3",
|
statusId: "3",
|
||||||
});
|
});
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
setLoading(true);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||||
|
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||||
|
|
||||||
const dataNotif = {
|
const dataNotif = {
|
||||||
appId: res.data?.id,
|
appId: res.data?.id,
|
||||||
userId: res.data?.authorId,
|
userId: res.data?.authorId,
|
||||||
@@ -47,13 +48,11 @@ export default function Investasi_ViewDetailReview({
|
|||||||
|
|
||||||
if (notif.status === 201) {
|
if (notif.status === 201) {
|
||||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||||
|
|
||||||
setLoading(true);
|
|
||||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
|
||||||
router.push(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
|
||||||
}
|
}
|
||||||
|
setLoading(false);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,20 +64,41 @@ export default function Investasi_ViewDetailReview({
|
|||||||
<Stack>
|
<Stack>
|
||||||
<Button
|
<Button
|
||||||
mb={"xl"}
|
mb={"xl"}
|
||||||
style={{
|
|
||||||
transition: "0.5s",
|
|
||||||
}}
|
|
||||||
loaderPosition="center"
|
|
||||||
loading={isLoading ? true : false}
|
|
||||||
radius={50}
|
radius={50}
|
||||||
bg={"orange"}
|
bg={"orange"}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
onClick={() => onCancleReview()}
|
c={"black"}
|
||||||
|
onClick={() => setOpenModal(true)}
|
||||||
>
|
>
|
||||||
Batalkan Review
|
Batalkan Review
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
|
<UIGlobal_Modal
|
||||||
|
opened={openModal}
|
||||||
|
close={() => setOpenModal(false)}
|
||||||
|
title={"Anda yakin ingin batalkan review?"}
|
||||||
|
buttonKiri={
|
||||||
|
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
buttonKanan={
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
}}
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoading}
|
||||||
|
radius={"xl"}
|
||||||
|
color={"orange"}
|
||||||
|
onClick={() => onChangeStatus()}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { APIs, DIRECTORY_ID } from "@/app/lib";
|
|
||||||
import { MainColor } from "@/app_modules/_global/color";
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
import {
|
import {
|
||||||
ComponentGlobal_BoxInformation,
|
ComponentGlobal_BoxInformation,
|
||||||
ComponentGlobal_BoxUploadImage,
|
ComponentGlobal_BoxUploadImage,
|
||||||
ComponentGlobal_LoadImage,
|
ComponentGlobal_LoadImage,
|
||||||
} from "@/app_modules/_global/component";
|
} from "@/app_modules/_global/component";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
|
||||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||||
import {
|
import {
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
@@ -22,11 +20,8 @@ import {
|
|||||||
import { IconCamera } from "@tabler/icons-react";
|
import { IconCamera } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
|
||||||
import { investasi_funUpdateInvestasi } from "../../_fun";
|
|
||||||
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
|
|
||||||
import { Investasi_ComponentButtonUpdateDataInvestasi } from "../../_component";
|
import { Investasi_ComponentButtonUpdateDataInvestasi } from "../../_component";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||||
|
|
||||||
export function Investasi_ViewEditInvestasi({
|
export function Investasi_ViewEditInvestasi({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
import {
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
NEW_RouterInvestasi
|
||||||
|
} from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export default async function funDeleteInvestasi(id: string) {
|
export default async function funDeleteInvestasi(id: string) {
|
||||||
@@ -14,7 +15,8 @@ export default async function funDeleteInvestasi(id: string) {
|
|||||||
|
|
||||||
if (!res) return { status: 400, message: "Gagal Hapus Data" };
|
if (!res) return { status: 400, message: "Gagal Hapus Data" };
|
||||||
|
|
||||||
revalidatePath(RouterInvestasi_OLD.portofolio);
|
revalidatePath(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||||
|
revalidatePath(NEW_RouterInvestasi.portofolio({ id: "4" }));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export default async function getOneInvestasiById(id: string) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
countDown: true,
|
countDown: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user