fix: investasi:
deskripsi: fix penggunaan use server menjadi API - berita - detail [id] - src/app/dev/(user)/investasi/detail_ - src/app/dev/(user)/investasi/edit_ - src/app/dev/(user)/investasi/list_... - src/app/dev/(user)/investasi/main - src/app_modules/investasi/_ui - src/app_modules/investasi/_view/ - src/app_modules/investasi/berita/ - src/lib/router_hipmi/router_investasi No Issue
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Investasi_UiDetailBerita } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiDetailBerita userLoginId={userLoginId} />
|
||||
<Investasi_UiDetailBerita />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Investasi_UiDetailMain } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiDetailMain userLoginId={userLoginId as string} />
|
||||
<Investasi_UiDetailMain />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { investasi_funGetOneInvestasiById } from "@/app_modules/investasi/_fun";
|
||||
import { Investasi_UiDetailProspektus } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id;
|
||||
const dataInvestasi = await investasi_funGetOneInvestasiById({ investasiId });
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiDetailProspektus dataInvestasi={dataInvestasi} />
|
||||
<Investasi_UiDetailProspektus />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { investasi_funGetOneInvoiceById } from "@/app_modules/investasi/_fun/get/fun_get_one_invoice_by_id";
|
||||
import { Investasi_UiDetailSahamSaya } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const invoiceId = params.id;
|
||||
// const dataSaham = await investasi_funGetOneInvoiceById({ invoiceId });
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiDetailSahamSaya />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { LayoutDetailBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { DetailBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import getOneBeritaInvestasiById from "@/app_modules/investasi/fun/get_one_berita_by_id";
|
||||
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id;
|
||||
const dataBerita = await getOneBeritaInvestasiById(investasiId);
|
||||
// console.log(dataBerita)
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -15,3 +16,4 @@ export default async function Page({ params }: { params: { id: string } }) {
|
||||
</>
|
||||
);
|
||||
}
|
||||
// -- DELETE SOON -- //
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// -- DELETE SOON -- //
|
||||
import { DetailDokumenInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// -- DELETE SOON -- //
|
||||
import { LayoutDetailPropektus } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DetailPropektus } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const dataInvestasi = await getOneInvestasiById(params.id);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { LayoutEditBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
|
||||
export default async function Layout({children}: { children: React.ReactNode }) {
|
||||
return<>
|
||||
<LayoutEditBeritaInvestasi>{children}</LayoutEditBeritaInvestasi>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EditBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import getOneBeritaInvestasiById from "@/app_modules/investasi/fun/get_one_berita_by_id";
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
const dataBerita = await getOneBeritaInvestasiById(params.id)
|
||||
// console.log(dataBerita)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// -- DELETE SOON -- //
|
||||
import { LayoutEditIntroInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// -- DELETE SOON -- //
|
||||
|
||||
import { EditIntroInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
import getPembagianDeviden from "@/app_modules/investasi/fun/master/get_pembagian_deviden";
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
// -- DELETE Or UPDATE SOON -- //
|
||||
|
||||
import { LayoutListEditBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
params
|
||||
params,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
params: { id: string };
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<LayoutListEditBeritaInvestasi idInves={params.id}>{children}</LayoutListEditBeritaInvestasi>
|
||||
<LayoutListEditBeritaInvestasi idInves={params.id}>
|
||||
{children}
|
||||
</LayoutListEditBeritaInvestasi>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// -- DELETE Or UPDATE SOON -- //
|
||||
|
||||
import { ListEditBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
import { Investasi_UiPortofolioNew } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
// const statusId = params.id;
|
||||
// const listStatus = await getStatusInvestasi();
|
||||
// const dataPortofolio = await investasi_funGetPortofolioByStatusId({
|
||||
// page: 1,
|
||||
// statusId: statusId,
|
||||
// });
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
{/* <Investasi_UiPortofolio
|
||||
statusId={statusId}
|
||||
listStatus={listStatus as any}
|
||||
dataPortofolio={dataPortofolio as any}
|
||||
/> */}
|
||||
<Investasi_UiPortofolioNew />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { Investasi_ViewSahamSayaNew } from "@/app_modules/investasi/_view/main/view_saham_saya_new";
|
||||
|
||||
export default async function Page() {
|
||||
// const dataSaham = await investasi_funGetSuccessTransactionById({ page: 1 });
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <InvestasiSahamTerbeli listTransaksi={listTransaksi as any} /> */}
|
||||
{/* <Investasi_UiSahamSaya dataSaham={dataSaham as any} /> */}
|
||||
<Investasi_ViewSahamSayaNew />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
import getListAllTransaksiById_Investasi from "@/app_modules/investasi/fun/get_list_all_transaksi_by_id";
|
||||
import getMaster_StatusTransaksiInvestasi from "@/app_modules/investasi/fun/master/get_status_transaksi";
|
||||
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { investasi_funGetTransaksiByUserId } from "@/app_modules/investasi/_fun";
|
||||
import { Investasi_UiDaftarTransaksi } from "@/app_modules/investasi/_ui";
|
||||
import { Investasi_ViewDaftarTransaksiNew } from "@/app_modules/investasi/_view/main/view_transaksi_new";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
// const statusTransaksi = await getMaster_StatusTransaksiInvestasi();
|
||||
// const listTransaksi = await getListAllTransaksiById_Investasi(
|
||||
// userLoginId as string
|
||||
// );
|
||||
|
||||
// NEW
|
||||
// const dataTransaksi = await investasi_funGetTransaksiByUserId({ page: 1 });
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <TransaksiInvestasi
|
||||
statusTransaksi={statusTransaksi as any}
|
||||
listTransaksi={listTransaksi as any}
|
||||
/> */}
|
||||
{/* <Investasi_UiDaftarTransaksi dataTransaksi={dataTransaksi} /> */}
|
||||
<Investasi_ViewDaftarTransaksiNew/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import { investasi_funGetOneInvestasiById } from "@/app_modules/investasi/_fun";
|
||||
import { Investasi_UiProsesPembelian } from "@/app_modules/investasi/_ui";
|
||||
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id;
|
||||
const dataInvestasi = await investasi_funGetOneInvestasiById({ investasiId });
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiProsesPembelian dataInvestasi={dataInvestasi} />
|
||||
<Investasi_UiProsesPembelian />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,12 +28,9 @@ import UI_NewLayoutTamplate, {
|
||||
UI_NewHeader,
|
||||
UI_NewChildren,
|
||||
} from "@/app_modules/_global/ui/V2_layout_tamplate";
|
||||
import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global";
|
||||
|
||||
export function Investasi_UiDetailBerita({
|
||||
userLoginId,
|
||||
}: {
|
||||
userLoginId: string;
|
||||
}) {
|
||||
export function Investasi_UiDetailBerita() {
|
||||
const params = useParams<{ id: string }>();
|
||||
const id = params.id;
|
||||
|
||||
@@ -43,6 +40,25 @@ export function Investasi_UiDetailBerita({
|
||||
const [data, setData] = useState<any | null>(null);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [userLoginId, setUserLoginId] = useState<string | null>(null);
|
||||
|
||||
useShallowEffect(() => {
|
||||
handleGetUserId();
|
||||
onLoadData();
|
||||
}, []);
|
||||
|
||||
async function handleGetUserId() {
|
||||
try {
|
||||
const respone = await apiNewGetUserIdByToken();
|
||||
|
||||
if (respone) {
|
||||
setUserLoginId(respone.userId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error get data detail", error);
|
||||
}
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadData();
|
||||
}, []);
|
||||
@@ -96,27 +112,6 @@ export function Investasi_UiDetailBerita({
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Detail Berita"
|
||||
customButtonRight={
|
||||
data && userLoginId === data.investasi.authorId ? (
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Investasi_ViewDetailBerita />
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
|
||||
<UI_NewLayoutTamplate>
|
||||
<UI_NewHeader>
|
||||
|
||||
@@ -2,31 +2,47 @@
|
||||
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import { Component_Header } from "@/app_modules/_global/component/new/component_header";
|
||||
import {
|
||||
UIGlobal_Drawer
|
||||
} from "@/app_modules/_global/ui";
|
||||
import UI_NewLayoutTamplate, { UI_NewChildren, UI_NewHeader } from "@/app_modules/_global/ui/V2_layout_tamplate";
|
||||
import {
|
||||
NEW_RouterInvestasi
|
||||
} from "@/lib/router_hipmi/router_investasi";
|
||||
import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global";
|
||||
import { UIGlobal_Drawer } from "@/app_modules/_global/ui";
|
||||
import UI_NewLayoutTamplate, {
|
||||
UI_NewChildren,
|
||||
UI_NewHeader,
|
||||
} from "@/app_modules/_global/ui/V2_layout_tamplate";
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { IconCategoryPlus, IconDeviceIpadPlus, IconDotsVertical } from "@tabler/icons-react";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import {
|
||||
IconCategoryPlus,
|
||||
IconDeviceIpadPlus,
|
||||
IconDotsVertical,
|
||||
} from "@tabler/icons-react";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { apiNewGetOneInvestasiById } from "../../_lib/api_fetch_new_investasi";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { Investasi_ViewDetailPublish } from "../../_view";
|
||||
|
||||
export function Investasi_UiDetailMain({
|
||||
userLoginId,
|
||||
}: {
|
||||
userLoginId: string;
|
||||
}) {
|
||||
export function Investasi_UiDetailMain() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const router = useRouter();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
const [data, setData] = useState<MODEL_INVESTASI | null>(null);
|
||||
const [userLoginId, setUserLoginId] = useState<string | null>(null);
|
||||
|
||||
useShallowEffect(() => {
|
||||
handleGetUserId();
|
||||
}, []);
|
||||
|
||||
async function handleGetUserId() {
|
||||
try {
|
||||
const respone = await apiNewGetUserIdByToken();
|
||||
|
||||
if (respone) {
|
||||
setUserLoginId(respone.userId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error get data detail", error);
|
||||
}
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
handleLoadData();
|
||||
@@ -85,36 +101,11 @@ export function Investasi_UiDetailMain({
|
||||
<UI_NewChildren>
|
||||
<Investasi_ViewDetailPublish
|
||||
data={data as any}
|
||||
userLoginId={userLoginId}
|
||||
userLoginId={userLoginId as string}
|
||||
/>
|
||||
</UI_NewChildren>
|
||||
</UI_NewLayoutTamplate>
|
||||
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Detail "
|
||||
customButtonRight={
|
||||
userLoginId === data?.authorId ? (
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color={MainColor.white} />
|
||||
</ActionIcon>
|
||||
) : (
|
||||
<ActionIcon disabled variant="transparent" />
|
||||
)
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Investasi_ViewDetailPublish
|
||||
data={data as any}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
|
||||
<UIGlobal_Drawer
|
||||
opened={openDrawer}
|
||||
close={() => setOpenDrawer(false)}
|
||||
|
||||
@@ -7,25 +7,15 @@ import UI_NewLayoutTamplate, {
|
||||
} from "@/app_modules/_global/ui/V2_layout_tamplate";
|
||||
import { Investasi_ViewDetailProspektus } from "../../_view";
|
||||
|
||||
export function Investasi_UiDetailProspektus({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: any;
|
||||
}) {
|
||||
export function Investasi_UiDetailProspektus() {
|
||||
return (
|
||||
<>
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Detail Prospektus" />}
|
||||
>
|
||||
<Investasi_ViewDetailProspektus dataInvestasi={dataInvestasi} />
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
|
||||
<UI_NewLayoutTamplate>
|
||||
<UI_NewHeader>
|
||||
<Component_Header title="Detail Prospektus" />
|
||||
</UI_NewHeader>
|
||||
<UI_NewChildren>
|
||||
<Investasi_ViewDetailProspektus dataInvestasi={dataInvestasi} />
|
||||
<Investasi_ViewDetailProspektus />
|
||||
</UI_NewChildren>
|
||||
</UI_NewLayoutTamplate>
|
||||
</>
|
||||
|
||||
@@ -7,25 +7,16 @@ import UI_NewLayoutTamplate, {
|
||||
} from "@/app_modules/_global/ui/V2_layout_tamplate";
|
||||
import { Investasi_ViewProsesPembelian } from "../../_view";
|
||||
|
||||
export function Investasi_UiProsesPembelian({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: any;
|
||||
}) {
|
||||
export function Investasi_UiProsesPembelian() {
|
||||
return (
|
||||
<>
|
||||
{/* <UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Pembelian Saham" />}
|
||||
>
|
||||
<Investasi_ViewProsesPembelian dataInvestasi={dataInvestasi} />
|
||||
</UIGlobal_LayoutTamplate> */}
|
||||
|
||||
<UI_NewLayoutTamplate>
|
||||
<UI_NewHeader>
|
||||
<Component_Header title="Pembelian Saham" />
|
||||
</UI_NewHeader>
|
||||
<UI_NewChildren>
|
||||
<Investasi_ViewProsesPembelian dataInvestasi={dataInvestasi} />
|
||||
<Investasi_ViewProsesPembelian />
|
||||
</UI_NewChildren>
|
||||
</UI_NewLayoutTamplate>
|
||||
</>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
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";
|
||||
@@ -13,6 +15,7 @@ import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
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 notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
@@ -35,17 +38,16 @@ export default function Investasi_ViewDetailDraft({
|
||||
const [openModalDelete, setOpenModalDelete] = useState(false);
|
||||
|
||||
async function onChangeStatus() {
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "2",
|
||||
});
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "2",
|
||||
});
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Berhasil Diajukan");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "2" }));
|
||||
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
@@ -54,11 +56,11 @@ export default function Investasi_ViewDetailDraft({
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Mengajukan review",
|
||||
};
|
||||
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
}
|
||||
@@ -73,31 +75,30 @@ export default function Investasi_ViewDetailDraft({
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
const res = await funDeleteInvestasi(data.id);
|
||||
try {
|
||||
setIsLoadingDelete(true);
|
||||
const res = await funDeleteInvestasi(data.id);
|
||||
if (res.status === 200) {
|
||||
|
||||
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 "
|
||||
@@ -105,7 +106,7 @@ export default function Investasi_ViewDetailDraft({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setOpenModal(false);
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
@@ -131,7 +132,7 @@ export default function Investasi_ViewDetailDraft({
|
||||
<Group position="apart" grow>
|
||||
<Button
|
||||
radius={50}
|
||||
style={{ backgroundColor: AccentColor.yellow}}
|
||||
style={{ backgroundColor: AccentColor.yellow }}
|
||||
c={MainColor.darkblue}
|
||||
onClick={() => setOpenModal(true)}
|
||||
>
|
||||
@@ -140,7 +141,7 @@ export default function Investasi_ViewDetailDraft({
|
||||
|
||||
<Button
|
||||
radius={50}
|
||||
style={{ backgroundColor: MainColor.red}}
|
||||
style={{ backgroundColor: MainColor.red }}
|
||||
c={AccentColor.white}
|
||||
onClick={() => setOpenModalDelete(true)}
|
||||
>
|
||||
@@ -155,15 +156,20 @@ export default function Investasi_ViewDetailDraft({
|
||||
close={() => setOpenModal(false)}
|
||||
title={"Anda yakin ingin mengajukan review ?"}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModal(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s", color: "black",
|
||||
transition: "0.5s",
|
||||
color: "black",
|
||||
backgroundColor: AccentColor.yellow,
|
||||
}}
|
||||
loaderPosition="center"
|
||||
@@ -183,8 +189,12 @@ export default function Investasi_ViewDetailDraft({
|
||||
close={() => setOpenModalDelete(false)}
|
||||
title={"Anda yakin ingin menghapus ?"}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModalDelete(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -192,7 +202,7 @@ export default function Investasi_ViewDetailDraft({
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
backgroundColor: MainColor.red
|
||||
backgroundColor: MainColor.red,
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoadingDelete}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||
@@ -12,6 +11,7 @@ import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
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 { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
@@ -31,65 +31,67 @@ export default function Investasi_ViewDetailReject({
|
||||
const [isLoadingEdit, setLoadingEdit] = useState(false);
|
||||
|
||||
async function onAjukan() {
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "3",
|
||||
});
|
||||
|
||||
try {
|
||||
setLoadingEdit(true);
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "3",
|
||||
});
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
} else {
|
||||
setLoadingEdit(false);
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
||||
}
|
||||
} catch (error) {
|
||||
setLoadingEdit(false);
|
||||
clientLogger.error("Error ajukan kembali", error);
|
||||
} finally {
|
||||
setLoadingEdit(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
const res = await funDeleteInvestasi(data.id);
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
setLoadingDel(true);
|
||||
const res = await funDeleteInvestasi(data.id);
|
||||
if (res.status === 200) {
|
||||
const delImage = await funGlobal_DeleteFileById({
|
||||
fileId: data.imageId,
|
||||
});
|
||||
if (!delImage.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus image ");
|
||||
}
|
||||
|
||||
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 ");
|
||||
}
|
||||
|
||||
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 (!_.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 "
|
||||
);
|
||||
if (!delFileDokumen.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||
"Gagal hapus prospektus "
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setOpenModalDel(false);
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "4" }));
|
||||
setLoadingDel(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setOpenModalDel(false);
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "4" }));
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error delete investasi", error);
|
||||
} finally {
|
||||
setLoadingDel(false);
|
||||
}
|
||||
}
|
||||
@@ -102,8 +104,12 @@ export default function Investasi_ViewDetailReject({
|
||||
opened={openModalDel}
|
||||
close={() => setOpenModalDel(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalDel(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModalDel(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -112,7 +118,7 @@ export default function Investasi_ViewDetailReject({
|
||||
loaderPosition="center"
|
||||
loading={isLoadingDel}
|
||||
c={AccentColor.white}
|
||||
style={{ backgroundColor: MainColor.red}}
|
||||
style={{ backgroundColor: MainColor.red }}
|
||||
radius={"xl"}
|
||||
onClick={() => onDelete()}
|
||||
>
|
||||
@@ -126,8 +132,12 @@ export default function Investasi_ViewDetailReject({
|
||||
opened={openModalEdit}
|
||||
close={() => setOpenModalEdit(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalEdit(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModalEdit(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -26,16 +26,16 @@ export default function Investasi_ViewDetailReview({
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
|
||||
async function onChangeStatus() {
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "3",
|
||||
});
|
||||
try {
|
||||
setLoading(true);
|
||||
const res = await investasi_funEditStatusById({
|
||||
investasiId: data.id,
|
||||
statusId: "3",
|
||||
});
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
@@ -44,11 +44,11 @@ export default function Investasi_ViewDetailReview({
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
}
|
||||
@@ -88,16 +88,21 @@ export default function Investasi_ViewDetailReview({
|
||||
close={() => setOpenModal(false)}
|
||||
title={"Anda yakin ingin batalkan review?"}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModal(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s", color: "black",
|
||||
backgroundColor: AccentColor.yellow
|
||||
transition: "0.5s",
|
||||
color: "black",
|
||||
backgroundColor: AccentColor.yellow,
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
|
||||
@@ -1,30 +1,52 @@
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { MainColor } from "@/app_modules/_global/color";
|
||||
import {
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_CardStyles,
|
||||
ComponentGlobal_CardLoadingOverlay,
|
||||
ComponentGlobal_CardStyles,
|
||||
} from "@/app_modules/_global/component";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { NEW_RouterInvestasi } from "@/lib/router_hipmi/router_investasi";
|
||||
import { Center, Group, Text } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { IconFileTypePdf } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { apiNewGetOneInvestasiById } from "../../_lib/api_fetch_new_investasi";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
|
||||
export function Investasi_ViewDetailProspektus({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
}) {
|
||||
export function Investasi_ViewDetailProspektus() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
const [dataInvestasi, setDataInvestasi] = useState<MODEL_INVESTASI | null>(
|
||||
null
|
||||
);
|
||||
useShallowEffect(() => {
|
||||
onLoadData();
|
||||
}, []);
|
||||
|
||||
async function onLoadData() {
|
||||
try {
|
||||
const response = await apiNewGetOneInvestasiById({ id: param.id });
|
||||
if (response.success) {
|
||||
setDataInvestasi(response.data);
|
||||
} else {
|
||||
setDataInvestasi(null);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dataInvestasi) return <CustomSkeleton height={"80vh"} width={"100%"} />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles
|
||||
onClickHandler={() => {
|
||||
router.push(
|
||||
NEW_RouterInvestasi.file_prospektus({
|
||||
id: dataInvestasi.prospektusFileId,
|
||||
id: dataInvestasi?.prospektusFileId,
|
||||
}),
|
||||
{ scroll: false }
|
||||
);
|
||||
|
||||
@@ -110,6 +110,8 @@ export function Investasi_ViewEditDokumen() {
|
||||
ComponentGlobal_NotifikasiPeringatan(updateNoFile.message);
|
||||
}
|
||||
ComponentGlobal_NotifikasiBerhasil(updateNoFile.message);
|
||||
router.back();
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
|
||||
@@ -11,23 +11,24 @@ import {
|
||||
NumberInput,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap, useLocalStorage } from "@mantine/hooks";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import {
|
||||
useFocusTrap,
|
||||
useLocalStorage,
|
||||
useShallowEffect,
|
||||
} from "@mantine/hooks";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { NEW_RouterInvestasi } from "../../../../lib/router_hipmi/router_investasi";
|
||||
import { apiNewGetOneInvestasiById } from "../../_lib/api_fetch_new_investasi";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { gs_investas_menu } from "../../g_state";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
|
||||
export function Investasi_ViewProsesPembelian({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
}) {
|
||||
export function Investasi_ViewProsesPembelian() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const router = useRouter();
|
||||
const focusTrapRef = useFocusTrap();
|
||||
const [data, setData] = useState(dataInvestasi);
|
||||
const [maxPembelian, setMaxPembelian] = useState(Number(data.sisaLembar));
|
||||
const [data, setData] = useState<MODEL_INVESTASI | null>(null);
|
||||
const [maxPembelian, setMaxPembelian] = useState<number>(0);
|
||||
const [total, setTotal] = useLocalStorage({
|
||||
key: "total_investasi",
|
||||
defaultValue: 0,
|
||||
@@ -38,6 +39,32 @@ export function Investasi_ViewProsesPembelian({
|
||||
});
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
handleLoadData();
|
||||
}, []);
|
||||
|
||||
const handleLoadData = async () => {
|
||||
try {
|
||||
const response = await apiNewGetOneInvestasiById({ id: param.id });
|
||||
|
||||
if (response.success) {
|
||||
setData(response.data);
|
||||
setMaxPembelian(Number(response.data.sisaLembar));
|
||||
} else {
|
||||
setData(null);
|
||||
setMaxPembelian(0);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error get investasi", error);
|
||||
setData(null);
|
||||
setMaxPembelian(0);
|
||||
}
|
||||
};
|
||||
|
||||
if (!data) {
|
||||
return <CustomSkeleton height={400} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -120,7 +147,7 @@ export function Investasi_ViewProsesPembelian({
|
||||
router.push(NEW_RouterInvestasi.metode_pembayaran + data.id, {
|
||||
scroll: false,
|
||||
});
|
||||
setIsLoading(true)
|
||||
setIsLoading(true);
|
||||
}}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
|
||||
@@ -22,6 +22,8 @@ import _ from "lodash";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
export default function BeritaInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
|
||||
@@ -155,7 +155,11 @@ export const RouterInvestasi_OLD = {
|
||||
detail_saham_terbeli: "/dev/investasi/detail_saham_terbeli/",
|
||||
detail_prospektus: "/dev/investasi/detail_prospektus/",
|
||||
detail_dokumen: "/dev/investasi/detail_dokumen/",
|
||||
|
||||
// -- DELETE SOON -- //
|
||||
detail_berita: "/dev/investasi/detail_berita/",
|
||||
// -- DELETE SOON -- //
|
||||
|
||||
detail_draft: "/dev/investasi/detail_portofolio/draft/",
|
||||
detail_publish: "/dev/investasi/detail_portofolio/publish/",
|
||||
detail_review: "/dev/investasi/detail_portofolio/review/",
|
||||
|
||||
Reference in New Issue
Block a user