fix investasi:
- beranda progress - admin publish and reject button
This commit is contained in:
@@ -5,11 +5,6 @@
|
|||||||
},
|
},
|
||||||
"auditLog": "logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json",
|
"auditLog": "logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json",
|
||||||
"files": [
|
"files": [
|
||||||
{
|
|
||||||
"date": 1739327386336,
|
|
||||||
"name": "logs/backend/combined-2025-02-12.log",
|
|
||||||
"hash": "e37b3d0427223c278c22797248e12d501c266188b48b4edee0591037415ce990"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"date": 1739413125862,
|
"date": 1739413125862,
|
||||||
"name": "logs/backend/combined-2025-02-13.log",
|
"name": "logs/backend/combined-2025-02-13.log",
|
||||||
@@ -64,6 +59,11 @@
|
|||||||
"date": 1740536165848,
|
"date": 1740536165848,
|
||||||
"name": "logs/backend/combined-2025-02-26.log",
|
"name": "logs/backend/combined-2025-02-26.log",
|
||||||
"hash": "428aedb3a3a248ad2c7069fcb8c6e0d669c23eae0dc3db08914886cce8d2cad9"
|
"hash": "428aedb3a3a248ad2c7069fcb8c6e0d669c23eae0dc3db08914886cce8d2cad9"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"date": 1740595120097,
|
||||||
|
"name": "logs/backend/combined-2025-02-27.log",
|
||||||
|
"hash": "f6884fe9b12faf0557662daa93ae1d32d64bb6b12714c8be494ce9396a55ae18"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hashType": "sha256"
|
"hashType": "sha256"
|
||||||
|
|||||||
@@ -5,11 +5,6 @@
|
|||||||
},
|
},
|
||||||
"auditLog": "logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json",
|
"auditLog": "logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json",
|
||||||
"files": [
|
"files": [
|
||||||
{
|
|
||||||
"date": 1739327386330,
|
|
||||||
"name": "logs/backend/error-2025-02-12.log",
|
|
||||||
"hash": "0d834a4ac0d78d547969ae0e55bc53a760b5a11942ed2efb7a08b50b2a16e7ee"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"date": 1739413125859,
|
"date": 1739413125859,
|
||||||
"name": "logs/backend/error-2025-02-13.log",
|
"name": "logs/backend/error-2025-02-13.log",
|
||||||
@@ -64,6 +59,11 @@
|
|||||||
"date": 1740536165843,
|
"date": 1740536165843,
|
||||||
"name": "logs/backend/error-2025-02-26.log",
|
"name": "logs/backend/error-2025-02-26.log",
|
||||||
"hash": "fc1b904017c0517b4aa4138d2edb5dd58474ef723a17cab177d0605026a23c11"
|
"hash": "fc1b904017c0517b4aa4138d2edb5dd58474ef723a17cab177d0605026a23c11"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"date": 1740595120075,
|
||||||
|
"name": "logs/backend/error-2025-02-27.log",
|
||||||
|
"hash": "50f75c53936bf2ca5beb3f48fb5de09dde49fea0792fc3532055fab75aae408f"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hashType": "sha256"
|
"hashType": "sha256"
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
||||||
import { adminInvestasi_getOneById } from "@/app_modules/admin/investasi/fun";
|
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
// const investasiId = params.id;
|
|
||||||
// const dataInvestasi = await adminInvestasi_getOneById({investasiId});
|
|
||||||
// console.log(dataUser)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Admin_KonfirmasiInvestasi />
|
<Admin_KonfirmasiInvestasi />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { Investasi_ViewBerandaNew } from "@/app_modules/investasi/_ui";
|
import { Investasi_ViewBerandaNew } from "@/app_modules/investasi/_ui";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
// const allData = await investasi_funGetAllPublish({ page: 1 });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <Investasi_UiBeranda dataInvestasi={allData as any} /> */}
|
|
||||||
<Investasi_ViewBerandaNew />
|
<Investasi_ViewBerandaNew />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
46
src/app/zCoba/pdf/_view.tsx
Normal file
46
src/app/zCoba/pdf/_view.tsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button } from "@mantine/core";
|
||||||
|
|
||||||
|
interface DownloadButtonProps {
|
||||||
|
fileUrl: string;
|
||||||
|
fileName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Coba() {
|
||||||
|
const fileUrl =
|
||||||
|
"https://wibu-storage.wibudev.com/api/pdf-to-image?url=https://wibu-storage.wibudev.com/api/files/cm7liew81000t3y8ax1v6yo02";
|
||||||
|
const fileName = "example.pdf"; // Nama file yang akan diunduh
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1>Download File Example</h1>
|
||||||
|
<DownloadButton fileUrl={fileUrl} fileName={fileName} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DownloadButton({ fileUrl, fileName }: DownloadButtonProps) {
|
||||||
|
const handleDownloadFromAPI = async () => {
|
||||||
|
try {
|
||||||
|
const response = await fetch("https://wibu-storage.wibudev.com/api/files/cm7liew81000t3y8ax1v6yo02")
|
||||||
|
const blob = await response.blob(); // Konversi respons ke Blob
|
||||||
|
const url = window.URL.createObjectURL(blob); // Buat URL untuk Blob
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.download = "generated-file.pdf"; // Nama file yang akan diunduh
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
window.URL.revokeObjectURL(url); // Bersihkan URL
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error downloading file:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button onClick={handleDownloadFromAPI} variant="outline" color="blue">
|
||||||
|
Download File
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
13
src/app/zCoba/pdf/page.tsx
Normal file
13
src/app/zCoba/pdf/page.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import Coba from "./_view";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function Page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Coba />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Page;
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
export {
|
export { apiGetPdfToImage };
|
||||||
apiGetPdfToImage,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PageData {
|
export interface PageData {
|
||||||
imageUrl: string;
|
imageUrl: string;
|
||||||
@@ -11,7 +9,7 @@ interface PdfResponse {
|
|||||||
pages: PageData[];
|
pages: PageData[];
|
||||||
totalPages: number;
|
totalPages: number;
|
||||||
}
|
}
|
||||||
const apiGetPdfToImage = async ({id}: {id: string}) => {
|
const apiGetPdfToImage = async ({ id }: { id: string }) => {
|
||||||
try {
|
try {
|
||||||
// Fetch token from cookie
|
// Fetch token from cookie
|
||||||
// const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
// const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
@@ -23,7 +21,6 @@ const apiGetPdfToImage = async ({id}: {id: string}) => {
|
|||||||
const token =
|
const token =
|
||||||
"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7ImlkIjoiY20wdXIxeXh3MDAwMDU2bnNqbHI2MTg3cCIsIm5hbWUiOiJiYWdhcyIsImVtYWlsIjoiYmFnYXNAZ21haWwuY29tIn0sImlhdCI6MTcyNTg3MTAzNiwiZXhwIjo0ODgxNjMxMDM2fQ.wFQLcrJj66wFeqIMYk2esMx3ULaHK6RFxkiToaLCuko";
|
"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7ImlkIjoiY20wdXIxeXh3MDAwMDU2bnNqbHI2MTg3cCIsIm5hbWUiOiJiYWdhcyIsImVtYWlsIjoiYmFnYXNAZ21haWwuY29tIn0sImlhdCI6MTcyNTg3MTAzNiwiZXhwIjo0ODgxNjMxMDM2fQ.wFQLcrJj66wFeqIMYk2esMx3ULaHK6RFxkiToaLCuko";
|
||||||
|
|
||||||
|
|
||||||
// Anda bisa menggunakan prospektusId di URL jika diperlukan
|
// Anda bisa menggunakan prospektusId di URL jika diperlukan
|
||||||
const pdfUrl = `https://wibu-storage.wibudev.com/api/pdf-to-image?url=https://wibu-storage.wibudev.com/api/files/${id}`;
|
const pdfUrl = `https://wibu-storage.wibudev.com/api/pdf-to-image?url=https://wibu-storage.wibudev.com/api/files/${id}`;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
Group,
|
Group,
|
||||||
Button,
|
Button,
|
||||||
Text,
|
Text,
|
||||||
|
Box,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconFileTypePdf } from "@tabler/icons-react";
|
import { IconFileTypePdf } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -73,7 +74,7 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
|||||||
<Text>-</Text>
|
<Text>-</Text>
|
||||||
) : (
|
) : (
|
||||||
listDokumen.map((e: MODEL_INVESTASI_DOKUMEN) => (
|
listDokumen.map((e: MODEL_INVESTASI_DOKUMEN) => (
|
||||||
<Paper key={e.id}>
|
<Box key={e.id}>
|
||||||
<Group>
|
<Group>
|
||||||
<IconFileTypePdf />
|
<IconFileTypePdf />
|
||||||
<Text>{e.title}</Text>
|
<Text>{e.title}</Text>
|
||||||
@@ -84,7 +85,7 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
|||||||
<Button radius={50}>Lihat</Button>
|
<Button radius={50}>Lihat</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</Group>
|
</Group>
|
||||||
</Paper>
|
</Box>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { IRealtimeData } from "@/lib/global_state";
|
|
||||||
import { MainColor } from "@/app_modules/_global/color";
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
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 { IRealtimeData } from "@/lib/global_state";
|
||||||
import { Button, Group, SimpleGrid, Stack, Loader } from "@mantine/core";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useParams, useRouter } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
@@ -20,12 +20,11 @@ import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_cre
|
|||||||
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";
|
||||||
|
import SkeletonAdminInvestasi from "../_component/skeleton_admin_investasi";
|
||||||
import { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
import { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
||||||
|
import { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
||||||
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 { clientLogger } from "@/util/clientLogger";
|
|
||||||
import { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
|
||||||
import SkeletonAdminInvestasi from "../_component/skeleton_admin_investasi";
|
|
||||||
|
|
||||||
export default function AdminInvestasi_DetailReview() {
|
export default function AdminInvestasi_DetailReview() {
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
@@ -45,19 +44,19 @@ export default function AdminInvestasi_DetailReview() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const loadInitialData = async () => {
|
const loadInitialData = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiGetAdminInvestasiById({
|
const response = await apiGetAdminInvestasiById({
|
||||||
id: params.id,
|
id: params.id,
|
||||||
})
|
});
|
||||||
|
|
||||||
if (response?.success && response?.data) {
|
if (response?.success && response?.data) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Invalid data format recieved:", error);
|
||||||
|
setData(null);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
};
|
||||||
clientLogger.error("Invalid data format recieved:", error);
|
|
||||||
setData(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function cekStatusPublish() {
|
async function cekStatusPublish() {
|
||||||
if (data?.MasterStatusInvestasi.id === "3") setPublish(false);
|
if (data?.MasterStatusInvestasi.id === "3") setPublish(false);
|
||||||
@@ -72,98 +71,106 @@ export default function AdminInvestasi_DetailReview() {
|
|||||||
if (_.isEmpty(body.catatan))
|
if (_.isEmpty(body.catatan))
|
||||||
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi alasan");
|
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi alasan");
|
||||||
|
|
||||||
const res = await Admin_funRejectInvestasi(body);
|
try {
|
||||||
if (res.status === 200) {
|
|
||||||
setIsLoadingReject(true);
|
setIsLoadingReject(true);
|
||||||
|
const res = await Admin_funRejectInvestasi(body);
|
||||||
|
if (res.status === 200) {
|
||||||
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
appId: res.data?.id as string,
|
||||||
|
userId: res.data?.authorId as string,
|
||||||
|
pesan: res.data?.title as string,
|
||||||
|
status: res.data?.MasterStatusInvestasi?.name as any,
|
||||||
|
kategoriApp: "INVESTASI",
|
||||||
|
title: "Investasi anda di tolak !",
|
||||||
|
};
|
||||||
|
|
||||||
const dataNotifikasi: IRealtimeData = {
|
const notif = await adminNotifikasi_funCreateToUser({
|
||||||
appId: res.data?.id as string,
|
data: dataNotifikasi as any,
|
||||||
userId: res.data?.authorId as string,
|
|
||||||
pesan: res.data?.title as string,
|
|
||||||
status: res.data?.MasterStatusInvestasi?.name as any,
|
|
||||||
kategoriApp: "INVESTASI",
|
|
||||||
title: "Investasi anda di tolak !",
|
|
||||||
};
|
|
||||||
|
|
||||||
const notif = await adminNotifikasi_funCreateToUser({
|
|
||||||
data: dataNotifikasi as any,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (notif.status === 201) {
|
|
||||||
WibuRealtime.setData({
|
|
||||||
type: "notification",
|
|
||||||
pushNotificationTo: "USER",
|
|
||||||
dataMessage: dataNotifikasi,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (notif.status === 201) {
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "notification",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
router.back();
|
||||||
|
setOpenModalReject(false);
|
||||||
|
setIsLoadingReject(false);
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
|
setOpenModalReject(false);
|
||||||
|
setIsLoadingReject(false);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
// const loadData = await getOneInvestasiById(data?.id);
|
console.log(error);
|
||||||
// setData(loadData as any);
|
|
||||||
|
|
||||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
|
||||||
router.back();
|
|
||||||
setOpenModalReject(false);
|
setOpenModalReject(false);
|
||||||
setIsLoadingReject(false);
|
setIsLoadingReject(false);
|
||||||
} else {
|
|
||||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
|
||||||
setOpenModalReject(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onPublish() {
|
async function onPublish() {
|
||||||
const res = await adminInvestasi_funEditStatusPublishById({
|
try {
|
||||||
investasiId: data?.id as any,
|
|
||||||
statusId: "1",
|
|
||||||
progesInvestasiId: "1",
|
|
||||||
});
|
|
||||||
if (res.status === 200) {
|
|
||||||
setIsLoadingPublish(true);
|
setIsLoadingPublish(true);
|
||||||
const dataNotifikasi: IRealtimeData = {
|
const res = await adminInvestasi_funEditStatusPublishById({
|
||||||
appId: res.data?.id as string,
|
investasiId: data?.id as any,
|
||||||
userId: res.data?.authorId as any,
|
statusId: "1",
|
||||||
pesan: res.data?.title as any,
|
progesInvestasiId: "1",
|
||||||
status: res.data?.MasterStatusInvestasi?.name as any,
|
|
||||||
kategoriApp: "INVESTASI",
|
|
||||||
title: "Investasi publish",
|
|
||||||
};
|
|
||||||
|
|
||||||
const notif = await adminNotifikasi_funCreateToUser({
|
|
||||||
data: dataNotifikasi as any,
|
|
||||||
});
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
appId: res.data?.id as string,
|
||||||
|
userId: res.data?.authorId as any,
|
||||||
|
pesan: res.data?.title as any,
|
||||||
|
status: res.data?.MasterStatusInvestasi?.name as any,
|
||||||
|
kategoriApp: "INVESTASI",
|
||||||
|
title: "Investasi publish",
|
||||||
|
};
|
||||||
|
|
||||||
if (notif.status === 201) {
|
const notif = await adminNotifikasi_funCreateToUser({
|
||||||
WibuRealtime.setData({
|
data: dataNotifikasi as any,
|
||||||
type: "notification",
|
|
||||||
pushNotificationTo: "USER",
|
|
||||||
dataMessage: dataNotifikasi,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
WibuRealtime.setData({
|
if (notif.status === 201) {
|
||||||
type: "trigger",
|
WibuRealtime.setData({
|
||||||
pushNotificationTo: "USER",
|
type: "notification",
|
||||||
dataMessage: dataNotifikasi,
|
pushNotificationTo: "USER",
|
||||||
});
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
|
||||||
const loadData = await getOneInvestasiById(data?.id as any);
|
WibuRealtime.setData({
|
||||||
setData(loadData as any);
|
type: "trigger",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
|
||||||
ComponentAdminGlobal_NotifikasiBerhasil("Proyek Investasi Di Publish");
|
ComponentAdminGlobal_NotifikasiBerhasil(
|
||||||
|
"Proyek Investasi Di Publish"
|
||||||
|
);
|
||||||
|
setOpenModalPublish(false);
|
||||||
|
setIsLoadingPublish(false);
|
||||||
|
router.back();
|
||||||
|
// router.push(RouterAdminInvestasi_OLD.table_status_review);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
setOpenModalPublish(false);
|
setOpenModalPublish(false);
|
||||||
setIsLoadingPublish(false);
|
setIsLoadingPublish(false);
|
||||||
router.back();
|
|
||||||
// router.push(RouterAdminInvestasi_OLD.table_status_review);
|
|
||||||
}
|
}
|
||||||
} else {
|
} catch (error) {
|
||||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
console.log(error);
|
||||||
setOpenModalPublish(false);
|
setOpenModalPublish(false);
|
||||||
|
setIsLoadingPublish(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <SkeletonAdminInvestasi/>
|
return <SkeletonAdminInvestasi />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={"lg"}>
|
<Stack px={"lg"}>
|
||||||
@@ -173,8 +180,6 @@ export default function AdminInvestasi_DetailReview() {
|
|||||||
{data?.masterStatusInvestasiId === "2" ? (
|
{data?.masterStatusInvestasiId === "2" ? (
|
||||||
<Group>
|
<Group>
|
||||||
<Button
|
<Button
|
||||||
loaderPosition="center"
|
|
||||||
loading={isLoadingPublish}
|
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="green"
|
color="green"
|
||||||
onClick={() => setOpenModalPublish(true)}
|
onClick={() => setOpenModalPublish(true)}
|
||||||
@@ -204,7 +209,9 @@ export default function AdminInvestasi_DetailReview() {
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{/* Data Author */}
|
{/* Data Author */}
|
||||||
<ComponentAdminInvestasi_DetailDataAuthor data={data?.author as any} />
|
<ComponentAdminInvestasi_DetailDataAuthor
|
||||||
|
data={data?.author as any}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Data Foto */}
|
{/* Data Foto */}
|
||||||
<ComponentAdminInvestasi_DetailGambar imagesId={data?.imageId} />
|
<ComponentAdminInvestasi_DetailGambar imagesId={data?.imageId} />
|
||||||
@@ -257,8 +264,8 @@ export default function AdminInvestasi_DetailReview() {
|
|||||||
buttonKanan={
|
buttonKanan={
|
||||||
<Button
|
<Button
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
style={{ backgroundColor: MainColor.green }}
|
|
||||||
loading={isLoadingPublish}
|
loading={isLoadingPublish}
|
||||||
|
style={{ backgroundColor: MainColor.green }}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onPublish();
|
onPublish();
|
||||||
|
|||||||
@@ -55,12 +55,8 @@ export default function MainCrowd() {
|
|||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLoadingInv(true);
|
setLoadingInv(true);
|
||||||
router.push(RouterCrowd.investasi);
|
router.push(RouterCrowd.investasi, { scroll: false });
|
||||||
setChangeColor(0);
|
setChangeColor(0);
|
||||||
// ComponentGlobal_NotifikasiPeringatan(
|
|
||||||
// "Sedang Perbaikan",
|
|
||||||
// 3000
|
|
||||||
// );
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -99,7 +95,7 @@ export default function MainCrowd() {
|
|||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLoadingDon(true);
|
setLoadingDon(true);
|
||||||
router.push(RouterCrowd.donasi);
|
router.push(RouterCrowd.donasi, { scroll: false });
|
||||||
setDonasiHotMenu(0);
|
setDonasiHotMenu(0);
|
||||||
// ComponentGlobal_NotifikasiPeringatan(
|
// ComponentGlobal_NotifikasiPeringatan(
|
||||||
// "Sementara ini sedang maintenance",
|
// "Sementara ini sedang maintenance",
|
||||||
|
|||||||
@@ -1,109 +1,141 @@
|
|||||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||||
import { Warna } from "@/lib/warna";
|
import { Warna } from "@/lib/warna";
|
||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import { ComponentGlobal_CardStyles, ComponentGlobal_LoadImageCustom } from "@/app_modules/_global/component";
|
import {
|
||||||
|
ComponentGlobal_CardStyles,
|
||||||
|
ComponentGlobal_LoadImageCustom,
|
||||||
|
} from "@/app_modules/_global/component";
|
||||||
import { Box, Grid, Group, Progress, Stack, Text } from "@mantine/core";
|
import { Box, Grid, Group, Progress, Stack, Text } from "@mantine/core";
|
||||||
import { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
import { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
|
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
|
||||||
|
|
||||||
export function Investasi_ComponentCardBerandaNew({ data }: { data: IDataInvestasiBursa; }) {
|
export function Investasi_ComponentCardBerandaNew({
|
||||||
const router = useRouter()
|
data,
|
||||||
|
}: {
|
||||||
|
data: IDataInvestasiBursa;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ComponentGlobal_CardStyles
|
<ComponentGlobal_CardStyles
|
||||||
onClickHandler={() => {
|
onClickHandler={() => {
|
||||||
router.push(NEW_RouterInvestasi.detail_main({ id: data.id }), {
|
router.push(NEW_RouterInvestasi.detail_main({ id: data.id }), {
|
||||||
scroll: false,
|
scroll: false,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<ComponentGlobal_LoadImageCustom
|
<ComponentGlobal_LoadImageCustom
|
||||||
height={100}
|
height={100}
|
||||||
fileId={data.imageId}
|
fileId={data.imageId}
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text c={MainColor.white} fw={"bold"} align="center" lineClamp={2}>
|
<Text
|
||||||
{data?.title}
|
c={MainColor.white}
|
||||||
</Text>
|
fw={"bold"}
|
||||||
|
align="center"
|
||||||
|
lineClamp={2}
|
||||||
|
>
|
||||||
|
{data?.title}
|
||||||
|
</Text>
|
||||||
|
|
||||||
<Progress
|
<Progress
|
||||||
label={(+data?.progress).toFixed(2) + " %"}
|
label={
|
||||||
value={+data?.progress}
|
data?.progress === "0"
|
||||||
color={MainColor.yellow}
|
? +data?.progress + " %"
|
||||||
size="xl"
|
: (+data?.progress).toFixed(2) + " %"
|
||||||
radius="xl"
|
}
|
||||||
style={{ backgroundColor: MainColor.white }}
|
value={+data?.progress}
|
||||||
styles={{
|
color={MainColor.yellow}
|
||||||
label: { color: MainColor.black },
|
size="xl"
|
||||||
}}
|
radius="xl"
|
||||||
/>
|
style={{ backgroundColor: MainColor.white }}
|
||||||
<Group position="right">
|
styles={{
|
||||||
{data?.progress === "100" ? (
|
root: {
|
||||||
<Group position="right" spacing={"xs"}>
|
position: "relative",
|
||||||
<IconCircleCheck color="green" />
|
},
|
||||||
<Text
|
label: {
|
||||||
truncate
|
color: MainColor.black,
|
||||||
variant="text"
|
position: "absolute",
|
||||||
c={Warna.hijau_tua}
|
left: "50%",
|
||||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
top: "50%",
|
||||||
ta="center"
|
transform: "translate(-50%, -50%)",
|
||||||
fz="md"
|
textAlign: "center",
|
||||||
fw={700}
|
paddingLeft: "30px",
|
||||||
>
|
},
|
||||||
Selesai
|
}}
|
||||||
</Text>
|
/>
|
||||||
</Group>
|
|
||||||
) : (
|
<Group position="right">
|
||||||
<Box>
|
{data?.progress === "100" ? (
|
||||||
{+data?.pencarianInvestor -
|
<Group position="right" spacing={"xs"}>
|
||||||
moment(new Date()).diff(
|
<IconCircleCheck color="green" />
|
||||||
new Date(data?.countDown),
|
<Text
|
||||||
"days"
|
truncate
|
||||||
) <=
|
variant="text"
|
||||||
0 ? (
|
c={Warna.hijau_tua}
|
||||||
<Group position="right" spacing={"xs"}>
|
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||||
<IconXboxX color="red" />
|
ta="center"
|
||||||
<Text
|
fz="md"
|
||||||
truncate
|
fw={700}
|
||||||
variant="text"
|
>
|
||||||
c={Warna.merah}
|
Selesai
|
||||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
</Text>
|
||||||
ta="center"
|
</Group>
|
||||||
fz="md"
|
) : (
|
||||||
fw={700}
|
<Box>
|
||||||
>
|
{+data?.pencarianInvestor -
|
||||||
Waktu Habis
|
moment(new Date()).diff(
|
||||||
</Text>
|
new Date(data?.countDown),
|
||||||
</Group>
|
"days"
|
||||||
) : (
|
) <=
|
||||||
<Group position="right" spacing={"xs"}>
|
0 ? (
|
||||||
<Text c={MainColor.white} truncate>Sisa waktu:</Text>
|
<Group position="right" spacing={"xs"}>
|
||||||
<Text c={MainColor.white} truncate>
|
<IconXboxX color="red" />
|
||||||
{Number(data?.pencarianInvestor) -
|
<Text
|
||||||
moment(new Date()).diff(
|
truncate
|
||||||
new Date(data?.countDown),
|
variant="text"
|
||||||
"days"
|
c={Warna.merah}
|
||||||
)}
|
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||||
</Text>
|
ta="center"
|
||||||
<Text c={MainColor.white} truncate>Hari</Text>
|
fz="md"
|
||||||
</Group>
|
fw={700}
|
||||||
)}
|
>
|
||||||
</Box>
|
Waktu Habis
|
||||||
)}
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
</Stack>
|
) : (
|
||||||
</Grid.Col>
|
<Group position="right" spacing={"xs"}>
|
||||||
</Grid>
|
<Text c={MainColor.white} truncate>
|
||||||
</Stack>
|
Sisa waktu:
|
||||||
</ComponentGlobal_CardStyles>
|
</Text>
|
||||||
</>
|
<Text c={MainColor.white} truncate>
|
||||||
);
|
{Number(data?.pencarianInvestor) -
|
||||||
|
moment(new Date()).diff(
|
||||||
|
new Date(data?.countDown),
|
||||||
|
"days"
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
<Text c={MainColor.white} truncate>
|
||||||
|
Hari
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
</ComponentGlobal_CardStyles>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,89 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { APIs } from "@/lib";
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
|
import {
|
||||||
|
apiGetPdfToImage,
|
||||||
|
PageData,
|
||||||
|
} from "@/app_modules/_global/lib/api_fetch_global";
|
||||||
|
import { UIGlobal_DrawerCustom } from "@/app_modules/_global/ui";
|
||||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||||
import { Box, Stack } from "@mantine/core";
|
|
||||||
import { IconX } from "@tabler/icons-react";
|
|
||||||
import dynamic from "next/dynamic";
|
|
||||||
import { apiGetPdfToImage, PageData } from "@/app_modules/_global/lib/api_fetch_global";
|
|
||||||
import { useParams } from "next/navigation";
|
|
||||||
import { useState, useRef, useEffect } from "react";
|
|
||||||
import PdfToImage from "../../_view/file_view/view_file_viewer";
|
|
||||||
import Image from "next/image";
|
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
import { ActionIcon, Box, Stack, Text } from "@mantine/core";
|
||||||
|
import { IconDotsVertical, IconDownload, IconX } from "@tabler/icons-react";
|
||||||
|
import Image from "next/image";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
export function Investasi_UiFileViewDokumen() {
|
export function Investasi_UiFileViewDokumen() {
|
||||||
const param = useParams<{ id: string }>();
|
const param = useParams<{ id: string }>();
|
||||||
const dokumenId = param.id;
|
const dokumenId = param.id;
|
||||||
|
|
||||||
const [pdfPages, setPdfPages] = useState<PageData[] | null>(null);
|
const [pdfPages, setPdfPages] = useState<PageData[] | null>(null);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const pdfsRef = useRef<HTMLDivElement>(null);
|
const pdfsRef = useRef<HTMLDivElement>(null);
|
||||||
|
const [isOpen, setOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchPdfData = async () => {
|
const fetchPdfData = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await apiGetPdfToImage({ id: dokumenId });
|
const response = await apiGetPdfToImage({ id: dokumenId });
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
setPdfPages(response.pages as any);
|
setPdfPages(response.pages as any);
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Error fetching PDF:", err);
|
|
||||||
setError(
|
|
||||||
err instanceof Error ? err.message : "Unknown error occurred"
|
|
||||||
);
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
} catch (err) {
|
||||||
|
console.error("Error fetching PDF:", err);
|
||||||
|
setError(err instanceof Error ? err.message : "Unknown error occurred");
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
fetchPdfData();
|
fetchPdfData();
|
||||||
}, [dokumenId]);
|
}, [dokumenId]);
|
||||||
|
|
||||||
|
const handleDownloadFromAPI = async () => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${dokumenId}`
|
||||||
|
);
|
||||||
|
const blob = await response.blob(); // Konversi respons ke Blob
|
||||||
|
const url = window.URL.createObjectURL(blob); // Buat URL untuk Blob
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.download = `file-dokumen-${new Date()}.pdf`; // Nama file yang akan diunduh
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
window.URL.revokeObjectURL(url); // Bersihkan URL
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error downloading file:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
header={<UIGlobal_LayoutHeaderTamplate title="Pratinjau Dokumen" iconLeft={<IconX />} />}
|
header={
|
||||||
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
|
title="Pratinjau Dokumen"
|
||||||
|
iconLeft={<IconX />}
|
||||||
|
customButtonRight={
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => {
|
||||||
|
setOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconDotsVertical color="white" />
|
||||||
|
</ActionIcon>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Box mb="lg">
|
<Box mb="lg">
|
||||||
{loading ? (
|
{loading ? (
|
||||||
@@ -84,6 +117,25 @@ export function Investasi_UiFileViewDokumen() {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
|
|
||||||
|
<UIGlobal_DrawerCustom
|
||||||
|
close={() => setOpen(false)}
|
||||||
|
opened={isOpen}
|
||||||
|
component={
|
||||||
|
<Stack align="center" spacing={"xs"}>
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
c={MainColor.white}
|
||||||
|
onClick={handleDownloadFromAPI}
|
||||||
|
>
|
||||||
|
<IconDownload />
|
||||||
|
</ActionIcon>
|
||||||
|
<Text fz={"sm"} align="center" color={MainColor.white}>
|
||||||
|
Download
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
import {
|
import {
|
||||||
apiGetPdfToImage,
|
apiGetPdfToImage,
|
||||||
PageData,
|
PageData,
|
||||||
} from "@/app_modules/_global/lib/api_fetch_global";
|
} from "@/app_modules/_global/lib/api_fetch_global";
|
||||||
|
import { UIGlobal_DrawerCustom } from "@/app_modules/_global/ui";
|
||||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import { Box, Stack } from "@mantine/core";
|
import { ActionIcon, Box, Stack, Text } from "@mantine/core";
|
||||||
import { IconX } from "@tabler/icons-react";
|
import { IconDotsVertical, IconDownload, IconX } from "@tabler/icons-react";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
@@ -22,6 +24,7 @@ export function Investasi_UiFileViewProspektus() {
|
|||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const pdfsRef = useRef<HTMLDivElement>(null);
|
const pdfsRef = useRef<HTMLDivElement>(null);
|
||||||
|
const [isOpen, setOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchPdfData = async () => {
|
const fetchPdfData = async () => {
|
||||||
@@ -29,8 +32,6 @@ export function Investasi_UiFileViewProspektus() {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await apiGetPdfToImage({ id: prospektusId });
|
const response = await apiGetPdfToImage({ id: prospektusId });
|
||||||
|
|
||||||
console.log("res:", response)
|
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
setPdfPages(response.pages as any);
|
setPdfPages(response.pages as any);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -45,6 +46,25 @@ export function Investasi_UiFileViewProspektus() {
|
|||||||
fetchPdfData();
|
fetchPdfData();
|
||||||
}, [prospektusId]);
|
}, [prospektusId]);
|
||||||
|
|
||||||
|
const handleDownloadFromAPI = async () => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${prospektusId}`
|
||||||
|
);
|
||||||
|
const blob = await response.blob(); // Konversi respons ke Blob
|
||||||
|
const url = window.URL.createObjectURL(blob); // Buat URL untuk Blob
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.download = `file-portofolio-${new Date()}.pdf`; // Nama file yang akan diunduh
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
window.URL.revokeObjectURL(url); // Bersihkan URL
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error downloading file:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
@@ -52,6 +72,16 @@ export function Investasi_UiFileViewProspektus() {
|
|||||||
<UIGlobal_LayoutHeaderTamplate
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
title="Pratinjau Prospektus"
|
title="Pratinjau Prospektus"
|
||||||
iconLeft={<IconX />}
|
iconLeft={<IconX />}
|
||||||
|
customButtonRight={
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => {
|
||||||
|
setOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconDotsVertical color="white" />
|
||||||
|
</ActionIcon>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -87,6 +117,25 @@ export function Investasi_UiFileViewProspektus() {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
|
|
||||||
|
<UIGlobal_DrawerCustom
|
||||||
|
close={() => setOpen(false)}
|
||||||
|
opened={isOpen}
|
||||||
|
component={
|
||||||
|
<Stack align="center" spacing={"xs"}>
|
||||||
|
<ActionIcon
|
||||||
|
onClick={handleDownloadFromAPI}
|
||||||
|
variant="transparent"
|
||||||
|
c={MainColor.white}
|
||||||
|
>
|
||||||
|
<IconDownload />
|
||||||
|
</ActionIcon>
|
||||||
|
<Text fz={"sm"} align="center" color={MainColor.white}>
|
||||||
|
Download
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { RouterInvestasi_OLD } from "@/lib/router_hipmi/router_investasi";
|
|
||||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import { gs_investasiTriggerBeranda } from "@/lib/global_state";
|
||||||
|
import { RouterInvestasi_OLD } from "@/lib/router_hipmi/router_investasi";
|
||||||
import { Box, Center } from "@mantine/core";
|
import { Box, Center } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { ScrollOnly } from "next-scroll-loader";
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -14,8 +15,6 @@ import { Investasi_ComponentCardBerandaNew } from "../../_component/main/com_car
|
|||||||
import { apiGetAllInvestasi } from "../../_lib/api_interface";
|
import { apiGetAllInvestasi } from "../../_lib/api_interface";
|
||||||
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
|
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
|
||||||
import SkeletonInvestasiBursa from "./skeleton_beranda";
|
import SkeletonInvestasiBursa from "./skeleton_beranda";
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import { gs_investasiTriggerBeranda } from "@/lib/global_state";
|
|
||||||
|
|
||||||
export function Investasi_ViewBerandaNew() {
|
export function Investasi_ViewBerandaNew() {
|
||||||
const [data, setData] = useState<IDataInvestasiBursa[]>([]);
|
const [data, setData] = useState<IDataInvestasiBursa[]>([]);
|
||||||
@@ -86,7 +85,7 @@ export function Investasi_ViewBerandaNew() {
|
|||||||
const loadData = await apiGetAllInvestasi(
|
const loadData = await apiGetAllInvestasi(
|
||||||
`?cat=bursa&page=${pageNew}`
|
`?cat=bursa&page=${pageNew}`
|
||||||
);
|
);
|
||||||
setActivePage((val) => val + 1);
|
setActivePage(pageNew);
|
||||||
|
|
||||||
return loadData.data as any;
|
return loadData.data as any;
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user