Fix: Upload image
- Upload image berita ke server wibu - Tampilan detail image di ambil dari server wibu ## No issue
This commit is contained in:
23
src/app_modules/investasi/_ui/create/ui_create_berita.tsx
Normal file
23
src/app_modules/investasi/_ui/create/ui_create_berita.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
UIGlobal_LayoutHeaderTamplate,
|
||||
UIGlobal_LayoutTamplate,
|
||||
} from "@/app_modules/_global/ui";
|
||||
import { Investasi_ViewCreateBerita } from "../../_view";
|
||||
|
||||
export function Investasi_UiCreateBerita({
|
||||
investasiId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Tambah Berita" />}
|
||||
>
|
||||
<Investasi_ViewCreateBerita investasiId={investasiId} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
115
src/app_modules/investasi/_ui/detail/ui_berita.tsx
Normal file
115
src/app_modules/investasi/_ui/detail/ui_berita.tsx
Normal file
@@ -0,0 +1,115 @@
|
||||
"use client";
|
||||
|
||||
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||
import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiGagal,
|
||||
ComponentGlobal_NotifikasiPeringatan,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
import {
|
||||
UIGlobal_DrawerCustom,
|
||||
UIGlobal_LayoutHeaderTamplate,
|
||||
UIGlobal_LayoutTamplate,
|
||||
UIGlobal_Modal
|
||||
} from "@/app_modules/_global/ui";
|
||||
import { ActionIcon, Button, Center, Stack, Text } from "@mantine/core";
|
||||
import { IconDotsVertical, IconTrash } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { investasi_funDeleteBerita } from "../../_fun";
|
||||
import { Investasi_ViewDetailBerita } from "../../_view";
|
||||
|
||||
export function Investasi_UiDetailBerita({ dataBerita }: { dataBerita: any }) {
|
||||
const router = useRouter();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [data, setData] = useState(dataBerita);
|
||||
|
||||
async function onDelete() {
|
||||
const del = await investasi_funDeleteBerita({
|
||||
beritaId: dataBerita.id,
|
||||
});
|
||||
|
||||
if (del.status === 200) {
|
||||
const deleteImage = await funGlobal_DeleteFileById({
|
||||
fileId: data.imageId,
|
||||
});
|
||||
|
||||
if (!deleteImage.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(del.message);
|
||||
setOpenModal(false);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(del.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Detail Berita"
|
||||
customButtonRight={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Investasi_ViewDetailBerita dataBerita={data} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
<UIGlobal_DrawerCustom
|
||||
opened={openDrawer}
|
||||
close={() => setOpenDrawer(false)}
|
||||
component={
|
||||
<Center>
|
||||
<Stack
|
||||
align="center"
|
||||
spacing={"xs"}
|
||||
onClick={() => {
|
||||
setOpenDrawer(false);
|
||||
setOpenModal(true);
|
||||
}}
|
||||
>
|
||||
<ActionIcon variant="transparent">
|
||||
<IconTrash color="red" />
|
||||
</ActionIcon>
|
||||
<Text c={"red"}>Hapus berita</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
}
|
||||
/>
|
||||
|
||||
<UIGlobal_Modal
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
title={"Anda yakin ingin menghapus berita ini ?"}
|
||||
buttonKiri={
|
||||
<Button radius="xl" onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
radius="xl"
|
||||
color="red"
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
21
src/app_modules/investasi/_ui/detail/ui_daftar_berita.tsx
Normal file
21
src/app_modules/investasi/_ui/detail/ui_daftar_berita.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
UIGlobal_LayoutHeaderTamplate,
|
||||
UIGlobal_LayoutTamplate,
|
||||
} from "@/app_modules/_global/ui";
|
||||
import { Investasi_ViewDaftarBerita } from "../../_view";
|
||||
|
||||
export function Investasi_UiDaftarBerita({
|
||||
dataBerita,
|
||||
}: {
|
||||
dataBerita: any[];
|
||||
}) {
|
||||
return (
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Daftar Berita" />}
|
||||
>
|
||||
<Investasi_ViewDaftarBerita dataBerita={dataBerita} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
);
|
||||
}
|
||||
79
src/app_modules/investasi/_ui/detail/ui_detail_main.tsx
Normal file
79
src/app_modules/investasi/_ui/detail/ui_detail_main.tsx
Normal file
@@ -0,0 +1,79 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
UIGlobal_Drawer,
|
||||
UIGlobal_LayoutHeaderTamplate,
|
||||
UIGlobal_LayoutTamplate,
|
||||
} from "@/app_modules/_global/ui";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
import { IconCategoryPlus, IconDotsVertical } from "@tabler/icons-react";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { Investasi_ViewDetailPublish } from "../../_view";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
NEW_RouterInvestasi,
|
||||
RouterInvestasi_OLD,
|
||||
} from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { IconDeviceIpadPlus } from "@tabler/icons-react";
|
||||
|
||||
export function Investasi_UiDetailMain({
|
||||
dataInvestasi,
|
||||
userLoginId,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Tambah & Edit Dokumen",
|
||||
icon: <IconCategoryPlus />,
|
||||
path: NEW_RouterInvestasi.rekap_dokumen({ id: dataInvestasi.id }),
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Tambah & Edit Berita",
|
||||
icon: <IconDeviceIpadPlus />,
|
||||
path: NEW_RouterInvestasi.rekap_berita({ id: dataInvestasi.id }),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Detail "
|
||||
customButtonRight={
|
||||
userLoginId === dataInvestasi.authorId ? (
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
) : (
|
||||
<ActionIcon disabled variant="transparent" />
|
||||
)
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Investasi_ViewDetailPublish
|
||||
dataInvestasi={dataInvestasi}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
<UIGlobal_Drawer
|
||||
opened={openDrawer}
|
||||
close={() => setOpenDrawer(false)}
|
||||
component={listPage}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -13,20 +13,23 @@ import {
|
||||
IconEdit,
|
||||
IconFilePencil,
|
||||
} from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import {
|
||||
Investasi_ViewDetailDraft,
|
||||
Investasi_ViewDetailPublish,
|
||||
Investasi_ViewDetailReject,
|
||||
Investasi_ViewDetailReview,
|
||||
} from "../../_view";
|
||||
|
||||
export function Investasi_UiDetailPortofolio({
|
||||
data,
|
||||
userLoginId,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
const listPage = [
|
||||
{
|
||||
@@ -86,9 +89,12 @@ export function Investasi_UiDetailPortofolio({
|
||||
/>
|
||||
}
|
||||
>
|
||||
{data.masterStatusInvestasiId === "1" && (
|
||||
<Investasi_ViewDetailPublish dataInvestasi={data} />
|
||||
)}
|
||||
{/* {data.masterStatusInvestasiId === "1" && (
|
||||
<Investasi_ViewDetailPublish
|
||||
dataInvestasi={data}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
)} */}
|
||||
|
||||
{data.masterStatusInvestasiId === "2" && (
|
||||
<Investasi_ViewDetailReview dataInvestasi={data} />
|
||||
|
||||
63
src/app_modules/investasi/_ui/detail/ui_rekap_berita.tsx
Normal file
63
src/app_modules/investasi/_ui/detail/ui_rekap_berita.tsx
Normal file
@@ -0,0 +1,63 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
UIGlobal_Drawer,
|
||||
UIGlobal_LayoutHeaderTamplate,
|
||||
UIGlobal_LayoutTamplate,
|
||||
} from "@/app_modules/_global/ui";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
import { IconCirclePlus, IconDotsVertical } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { Investasi_ViewRekapBerita } from "../../_view";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
export function Investasi_UiRekapBerita({
|
||||
investasiId,
|
||||
dataBerita,
|
||||
}: {
|
||||
investasiId: string;
|
||||
dataBerita: any[]
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Tambah Berita",
|
||||
icon: <IconCirclePlus />,
|
||||
path: NEW_RouterInvestasi.create_berita({ id: investasiId }),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Rekap Berita"
|
||||
customButtonRight={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setOpenDrawer(true);
|
||||
}}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
<Investasi_ViewRekapBerita dataBerita={dataBerita} />
|
||||
|
||||
<UIGlobal_Drawer
|
||||
opened={openDrawer}
|
||||
close={() => setOpenDrawer(false)}
|
||||
component={listPage}
|
||||
/>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
);
|
||||
}
|
||||
@@ -19,6 +19,11 @@ import { Investasi_UiEditInvestasi } from "./edit/ui_edit_investasi";
|
||||
import { Investasi_UiEditProspektus } from "./edit/ui_edit_prospektus";
|
||||
import { Investasi_UiCreateDocument } from "./create/ui_create_document";
|
||||
import { Investasi_UiRekapDokumen } from "./detail/ui_rekap_dokumen";
|
||||
import { Investasi_UiDetailMain } from "./detail/ui_detail_main";
|
||||
import { Investasi_UiDaftarBerita } from "./detail/ui_daftar_berita";
|
||||
import { Investasi_UiRekapBerita } from "./detail/ui_rekap_berita";
|
||||
import { Investasi_UiCreateBerita } from "./create/ui_create_berita";
|
||||
import { Investasi_UiDetailBerita } from "./detail/ui_berita";
|
||||
|
||||
export { Investasi_UiProsesPembelian };
|
||||
export { Investasi_UiMetodePembayaran };
|
||||
@@ -41,3 +46,8 @@ export { Investasi_UiEditInvestasi };
|
||||
export { Investasi_UiEditProspektus };
|
||||
export { Investasi_UiCreateDocument };
|
||||
export { Investasi_UiRekapDokumen };
|
||||
export { Investasi_UiDetailMain };
|
||||
export { Investasi_UiDaftarBerita };
|
||||
export { Investasi_UiRekapBerita };
|
||||
export { Investasi_UiCreateBerita };
|
||||
export { Investasi_UiDetailBerita };
|
||||
|
||||
Reference in New Issue
Block a user