Update Versi 1.5.27 #32
@@ -5,11 +5,6 @@
|
||||
},
|
||||
"auditLog": "logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json",
|
||||
"files": [
|
||||
{
|
||||
"date": 1739327386336,
|
||||
"name": "logs/backend/combined-2025-02-12.log",
|
||||
"hash": "e37b3d0427223c278c22797248e12d501c266188b48b4edee0591037415ce990"
|
||||
},
|
||||
{
|
||||
"date": 1739413125862,
|
||||
"name": "logs/backend/combined-2025-02-13.log",
|
||||
@@ -64,6 +59,11 @@
|
||||
"date": 1740536165848,
|
||||
"name": "logs/backend/combined-2025-02-26.log",
|
||||
"hash": "428aedb3a3a248ad2c7069fcb8c6e0d669c23eae0dc3db08914886cce8d2cad9"
|
||||
},
|
||||
{
|
||||
"date": 1740595120097,
|
||||
"name": "logs/backend/combined-2025-02-27.log",
|
||||
"hash": "f6884fe9b12faf0557662daa93ae1d32d64bb6b12714c8be494ce9396a55ae18"
|
||||
}
|
||||
],
|
||||
"hashType": "sha256"
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
},
|
||||
"auditLog": "logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json",
|
||||
"files": [
|
||||
{
|
||||
"date": 1739327386330,
|
||||
"name": "logs/backend/error-2025-02-12.log",
|
||||
"hash": "0d834a4ac0d78d547969ae0e55bc53a760b5a11942ed2efb7a08b50b2a16e7ee"
|
||||
},
|
||||
{
|
||||
"date": 1739413125859,
|
||||
"name": "logs/backend/error-2025-02-13.log",
|
||||
@@ -64,6 +59,11 @@
|
||||
"date": 1740536165843,
|
||||
"name": "logs/backend/error-2025-02-26.log",
|
||||
"hash": "fc1b904017c0517b4aa4138d2edb5dd58474ef723a17cab177d0605026a23c11"
|
||||
},
|
||||
{
|
||||
"date": 1740595120075,
|
||||
"name": "logs/backend/error-2025-02-27.log",
|
||||
"hash": "50f75c53936bf2ca5beb3f48fb5de09dde49fea0792fc3532055fab75aae408f"
|
||||
}
|
||||
],
|
||||
"hashType": "sha256"
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
||||
import { adminInvestasi_getOneById } from "@/app_modules/admin/investasi/fun";
|
||||
|
||||
export default async function Page() {
|
||||
// const investasiId = params.id;
|
||||
// const dataInvestasi = await adminInvestasi_getOneById({investasiId});
|
||||
// console.log(dataUser)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Admin_KonfirmasiInvestasi />
|
||||
<Admin_KonfirmasiInvestasi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { Investasi_ViewBerandaNew } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page() {
|
||||
// const allData = await investasi_funGetAllPublish({ page: 1 });
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <Investasi_UiBeranda dataInvestasi={allData as any} /> */}
|
||||
<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 {
|
||||
apiGetPdfToImage,
|
||||
}
|
||||
export { apiGetPdfToImage };
|
||||
|
||||
export interface PageData {
|
||||
imageUrl: string;
|
||||
@@ -11,7 +9,7 @@ interface PdfResponse {
|
||||
pages: PageData[];
|
||||
totalPages: number;
|
||||
}
|
||||
const apiGetPdfToImage = async ({id}: {id: string}) => {
|
||||
const apiGetPdfToImage = async ({ id }: { id: string }) => {
|
||||
try {
|
||||
// Fetch token from cookie
|
||||
// const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
@@ -22,7 +20,6 @@ const apiGetPdfToImage = async ({id}: {id: string}) => {
|
||||
|
||||
const token =
|
||||
"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7ImlkIjoiY20wdXIxeXh3MDAwMDU2bnNqbHI2MTg3cCIsIm5hbWUiOiJiYWdhcyIsImVtYWlsIjoiYmFnYXNAZ21haWwuY29tIn0sImlhdCI6MTcyNTg3MTAzNiwiZXhwIjo0ODgxNjMxMDM2fQ.wFQLcrJj66wFeqIMYk2esMx3ULaHK6RFxkiToaLCuko";
|
||||
|
||||
|
||||
// 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}`;
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
Group,
|
||||
Button,
|
||||
Text,
|
||||
Box,
|
||||
} from "@mantine/core";
|
||||
import { IconFileTypePdf } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
@@ -73,7 +74,7 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
||||
<Text>-</Text>
|
||||
) : (
|
||||
listDokumen.map((e: MODEL_INVESTASI_DOKUMEN) => (
|
||||
<Paper key={e.id}>
|
||||
<Box key={e.id}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>{e.title}</Text>
|
||||
@@ -84,7 +85,7 @@ export function ComponentAdminInvestasi_UIDetailFile({
|
||||
<Button radius={50}>Lihat</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
</Box>
|
||||
))
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { IRealtimeData } from "@/lib/global_state";
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import { Button, Group, SimpleGrid, Stack, Loader } from "@mantine/core";
|
||||
import { IRealtimeData } from "@/lib/global_state";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
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_DetailData } from "../_component/detail_data_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 { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
||||
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
||||
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { apiGetAdminInvestasiById } from "../_lib/api_fetch_admin_investasi";
|
||||
import SkeletonAdminInvestasi from "../_component/skeleton_admin_investasi";
|
||||
|
||||
export default function AdminInvestasi_DetailReview() {
|
||||
const params = useParams<{ id: string }>();
|
||||
@@ -45,19 +44,19 @@ export default function AdminInvestasi_DetailReview() {
|
||||
}, []);
|
||||
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const response = await apiGetAdminInvestasiById({
|
||||
id: params.id,
|
||||
})
|
||||
try {
|
||||
const response = await apiGetAdminInvestasiById({
|
||||
id: params.id,
|
||||
});
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
setData(response.data);
|
||||
if (response?.success && 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() {
|
||||
if (data?.MasterStatusInvestasi.id === "3") setPublish(false);
|
||||
@@ -72,98 +71,106 @@ export default function AdminInvestasi_DetailReview() {
|
||||
if (_.isEmpty(body.catatan))
|
||||
return ComponentAdminGlobal_NotifikasiPeringatan("Lengkapi alasan");
|
||||
|
||||
const res = await Admin_funRejectInvestasi(body);
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
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 = {
|
||||
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 notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// const loadData = await getOneInvestasiById(data?.id);
|
||||
// setData(loadData as any);
|
||||
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
router.back();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
setOpenModalReject(false);
|
||||
setIsLoadingReject(false);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
setOpenModalReject(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function onPublish() {
|
||||
const res = await adminInvestasi_funEditStatusPublishById({
|
||||
investasiId: data?.id as any,
|
||||
statusId: "1",
|
||||
progesInvestasiId: "1",
|
||||
});
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
setIsLoadingPublish(true);
|
||||
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",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
const res = await adminInvestasi_funEditStatusPublishById({
|
||||
investasiId: data?.id as any,
|
||||
statusId: "1",
|
||||
progesInvestasiId: "1",
|
||||
});
|
||||
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) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "trigger",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
const loadData = await getOneInvestasiById(data?.id as any);
|
||||
setData(loadData as any);
|
||||
WibuRealtime.setData({
|
||||
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);
|
||||
setIsLoadingPublish(false);
|
||||
router.back();
|
||||
// router.push(RouterAdminInvestasi_OLD.table_status_review);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
setOpenModalPublish(false);
|
||||
setIsLoadingPublish(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return <SkeletonAdminInvestasi/>
|
||||
return <SkeletonAdminInvestasi />;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack px={"lg"}>
|
||||
@@ -173,8 +180,6 @@ export default function AdminInvestasi_DetailReview() {
|
||||
{data?.masterStatusInvestasiId === "2" ? (
|
||||
<Group>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingPublish}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => setOpenModalPublish(true)}
|
||||
@@ -204,7 +209,9 @@ export default function AdminInvestasi_DetailReview() {
|
||||
]}
|
||||
>
|
||||
{/* Data Author */}
|
||||
<ComponentAdminInvestasi_DetailDataAuthor data={data?.author as any} />
|
||||
<ComponentAdminInvestasi_DetailDataAuthor
|
||||
data={data?.author as any}
|
||||
/>
|
||||
|
||||
{/* Data Foto */}
|
||||
<ComponentAdminInvestasi_DetailGambar imagesId={data?.imageId} />
|
||||
@@ -257,8 +264,8 @@ export default function AdminInvestasi_DetailReview() {
|
||||
buttonKanan={
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
style={{ backgroundColor: MainColor.green }}
|
||||
loading={isLoadingPublish}
|
||||
style={{ backgroundColor: MainColor.green }}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onPublish();
|
||||
|
||||
@@ -55,12 +55,8 @@ export default function MainCrowd() {
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoadingInv(true);
|
||||
router.push(RouterCrowd.investasi);
|
||||
router.push(RouterCrowd.investasi, { scroll: false });
|
||||
setChangeColor(0);
|
||||
// ComponentGlobal_NotifikasiPeringatan(
|
||||
// "Sedang Perbaikan",
|
||||
// 3000
|
||||
// );
|
||||
}}
|
||||
>
|
||||
<Grid>
|
||||
@@ -99,7 +95,7 @@ export default function MainCrowd() {
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoadingDon(true);
|
||||
router.push(RouterCrowd.donasi);
|
||||
router.push(RouterCrowd.donasi, { scroll: false });
|
||||
setDonasiHotMenu(0);
|
||||
// ComponentGlobal_NotifikasiPeringatan(
|
||||
// "Sementara ini sedang maintenance",
|
||||
|
||||
@@ -1,109 +1,141 @@
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/lib/warna";
|
||||
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 { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
|
||||
|
||||
export function Investasi_ComponentCardBerandaNew({ data }: { data: IDataInvestasiBursa; }) {
|
||||
const router = useRouter()
|
||||
export function Investasi_ComponentCardBerandaNew({
|
||||
data,
|
||||
}: {
|
||||
data: IDataInvestasiBursa;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles
|
||||
onClickHandler={() => {
|
||||
router.push(NEW_RouterInvestasi.detail_main({ id: data.id }), {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<ComponentGlobal_LoadImageCustom
|
||||
height={100}
|
||||
fileId={data.imageId}
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Text c={MainColor.white} fw={"bold"} align="center" lineClamp={2}>
|
||||
{data?.title}
|
||||
</Text>
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles
|
||||
onClickHandler={() => {
|
||||
router.push(NEW_RouterInvestasi.detail_main({ id: data.id }), {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<ComponentGlobal_LoadImageCustom
|
||||
height={100}
|
||||
fileId={data.imageId}
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Text
|
||||
c={MainColor.white}
|
||||
fw={"bold"}
|
||||
align="center"
|
||||
lineClamp={2}
|
||||
>
|
||||
{data?.title}
|
||||
</Text>
|
||||
|
||||
<Progress
|
||||
label={(+data?.progress).toFixed(2) + " %"}
|
||||
value={+data?.progress}
|
||||
color={MainColor.yellow}
|
||||
size="xl"
|
||||
radius="xl"
|
||||
style={{ backgroundColor: MainColor.white }}
|
||||
styles={{
|
||||
label: { color: MainColor.black },
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
{data?.progress === "100" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
{+data?.pencarianInvestor -
|
||||
moment(new Date()).diff(
|
||||
new Date(data?.countDown),
|
||||
"days"
|
||||
) <=
|
||||
0 ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text c={MainColor.white} truncate>Sisa waktu:</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>
|
||||
)}
|
||||
<Progress
|
||||
label={
|
||||
data?.progress === "0"
|
||||
? +data?.progress + " %"
|
||||
: (+data?.progress).toFixed(2) + " %"
|
||||
}
|
||||
value={+data?.progress}
|
||||
color={MainColor.yellow}
|
||||
size="xl"
|
||||
radius="xl"
|
||||
style={{ backgroundColor: MainColor.white }}
|
||||
styles={{
|
||||
root: {
|
||||
position: "relative",
|
||||
},
|
||||
label: {
|
||||
color: MainColor.black,
|
||||
position: "absolute",
|
||||
left: "50%",
|
||||
top: "50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
textAlign: "center",
|
||||
paddingLeft: "30px",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
<Group position="right">
|
||||
{data?.progress === "100" ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconCircleCheck color="green" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.hijau_tua}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Selesai
|
||||
</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
{+data?.pencarianInvestor -
|
||||
moment(new Date()).diff(
|
||||
new Date(data?.countDown),
|
||||
"days"
|
||||
) <=
|
||||
0 ? (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<IconXboxX color="red" />
|
||||
<Text
|
||||
truncate
|
||||
variant="text"
|
||||
c={Warna.merah}
|
||||
sx={{ fontFamily: "Greycliff CF, sans-serif" }}
|
||||
ta="center"
|
||||
fz="md"
|
||||
fw={700}
|
||||
>
|
||||
Waktu Habis
|
||||
</Text>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</>
|
||||
);
|
||||
) : (
|
||||
<Group position="right" spacing={"xs"}>
|
||||
<Text c={MainColor.white} truncate>
|
||||
Sisa waktu:
|
||||
</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";
|
||||
|
||||
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_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 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() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const dokumenId = param.id;
|
||||
|
||||
const [pdfPages, setPdfPages] = useState<PageData[] | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const pdfsRef = useRef<HTMLDivElement>(null);
|
||||
const param = useParams<{ id: string }>();
|
||||
const dokumenId = param.id;
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPdfData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetPdfToImage({ id: dokumenId });
|
||||
const [pdfPages, setPdfPages] = useState<PageData[] | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const pdfsRef = useRef<HTMLDivElement>(null);
|
||||
const [isOpen, setOpen] = useState(false);
|
||||
|
||||
if (response) {
|
||||
setPdfPages(response.pages as any);
|
||||
setLoading(false);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error fetching PDF:", err);
|
||||
setError(
|
||||
err instanceof Error ? err.message : "Unknown error occurred"
|
||||
);
|
||||
useEffect(() => {
|
||||
const fetchPdfData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetPdfToImage({ id: dokumenId });
|
||||
|
||||
if (response) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
fetchPdfData();
|
||||
}, [dokumenId]);
|
||||
fetchPdfData();
|
||||
}, [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 (
|
||||
<>
|
||||
<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">
|
||||
{loading ? (
|
||||
@@ -84,6 +117,25 @@ export function Investasi_UiFileViewDokumen() {
|
||||
)}
|
||||
</Box>
|
||||
</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";
|
||||
|
||||
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_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { Box, Stack } from "@mantine/core";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
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";
|
||||
@@ -22,6 +24,7 @@ export function Investasi_UiFileViewProspektus() {
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const pdfsRef = useRef<HTMLDivElement>(null);
|
||||
const [isOpen, setOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPdfData = async () => {
|
||||
@@ -29,8 +32,6 @@ export function Investasi_UiFileViewProspektus() {
|
||||
setLoading(true);
|
||||
const response = await apiGetPdfToImage({ id: prospektusId });
|
||||
|
||||
console.log("res:", response)
|
||||
|
||||
if (response) {
|
||||
setPdfPages(response.pages as any);
|
||||
setLoading(false);
|
||||
@@ -45,6 +46,25 @@ export function Investasi_UiFileViewProspektus() {
|
||||
fetchPdfData();
|
||||
}, [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 (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
@@ -52,6 +72,16 @@ export function Investasi_UiFileViewProspektus() {
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Pratinjau Prospektus"
|
||||
iconLeft={<IconX />}
|
||||
customButtonRight={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setOpen(true);
|
||||
}}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -87,6 +117,25 @@ export function Investasi_UiFileViewProspektus() {
|
||||
)}
|
||||
</Box>
|
||||
</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";
|
||||
import { RouterInvestasi_OLD } from "@/lib/router_hipmi/router_investasi";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
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 { useShallowEffect } from "@mantine/hooks";
|
||||
import { useAtom } from "jotai";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
@@ -14,8 +15,6 @@ import { Investasi_ComponentCardBerandaNew } from "../../_component/main/com_car
|
||||
import { apiGetAllInvestasi } from "../../_lib/api_interface";
|
||||
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
|
||||
import SkeletonInvestasiBursa from "./skeleton_beranda";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_investasiTriggerBeranda } from "@/lib/global_state";
|
||||
|
||||
export function Investasi_ViewBerandaNew() {
|
||||
const [data, setData] = useState<IDataInvestasiBursa[]>([]);
|
||||
@@ -86,7 +85,7 @@ export function Investasi_ViewBerandaNew() {
|
||||
const loadData = await apiGetAllInvestasi(
|
||||
`?cat=bursa&page=${pageNew}`
|
||||
);
|
||||
setActivePage((val) => val + 1);
|
||||
setActivePage(pageNew);
|
||||
|
||||
return loadData.data as any;
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user