Review Investasi
# feat - Ubah status ke review dan sebaliknya - Lihat dokumen, prospektus, dan berita di review status ### no issue
BIN
public/file/2b0beec8-412d-4520-a065-b962a9548ca7.pdf
Normal file
89784
public/file/365505fc-514e-43f3-b42a-05fe43f1230e.pdf
Normal file
89784
public/file/3e3d4fc6-16a7-4708-873c-e25016ddfd8c.pdf
Normal file
BIN
public/file/6103af36-5cbc-40f9-946b-7cd729cab4d0.pdf
Normal file
BIN
public/file/6f2b9d35-63ba-442a-9a4f-e7b169493247.pdf
Normal file
89784
public/file/ab736f58-2682-4937-9cf4-f01a1047c544.pdf
Normal file
BIN
public/file/d47071ec-ee52-4ffb-b1ac-329024f613b1.pdf
Normal file
BIN
public/file/e7ebff27-de30-43e5-9d2c-6729330dd7c1.pdf
Normal file
BIN
public/file/f62c43c1-527f-41d6-932d-c59dc702ec72.pdf
Normal file
BIN
public/investasi/0586a59e-c9f6-430e-8ab2-39893b44329b.jpeg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/investasi/0674ece7-0c60-4837-bd0f-b48f721f7b51.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/1e76b0f1-adb6-4cf0-9cb0-f57dc808e03a.jpeg
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
public/investasi/2ea17fd1-4744-456d-974b-fa19a41cc226.jpeg
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
public/investasi/300b993e-efd7-474c-ac69-868c784c5f2d.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/3cb66df4-e951-45bc-93c6-e82a2264db92.png
Normal file
|
After Width: | Height: | Size: 263 KiB |
BIN
public/investasi/49d62fec-09bf-4aaf-8ceb-8ec4d00cd4b0.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/4c7b6b7c-a471-4f92-b111-f027594bb156.jpg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
public/investasi/4de17529-13b1-4854-a775-39d28302a502.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/5fd64e08-55e9-4818-b2ad-03015612b780.jpeg
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/investasi/6395116c-7bd9-4592-b6bf-e4aff1beddf1.jpeg
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
public/investasi/63f19e1c-6b38-455d-943e-38bb93270830.jpeg
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
public/investasi/698ecd92-2aae-47df-8ef0-47c6603ee571.jpeg
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
public/investasi/749ae185-d91d-4c2f-8b7c-b83525f74226.jpeg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
public/investasi/7693566b-439d-457d-9d18-67eb7923a4c4.jpeg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
public/investasi/88744f51-37e5-487d-93e3-dcdf59bc6760.jpeg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
public/investasi/8e969e06-aef0-4288-bcfc-5e06b743f3f6.jpg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
public/investasi/93f944d8-d090-4834-85b8-c4f8164a968d.jpeg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
public/investasi/97d8f318-59cb-4932-95c8-9570bcf4c93c.png
Normal file
|
After Width: | Height: | Size: 263 KiB |
BIN
public/investasi/9c7cd515-1142-493d-9ccb-5abc9889e1d5.jpeg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
public/investasi/9eaba1eb-05c8-4564-a51b-195a02d84655.png
Normal file
|
After Width: | Height: | Size: 387 KiB |
BIN
public/investasi/a4a5c3bb-e808-40d5-a8b5-3959ea0b16f4.jpeg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/investasi/a52eef2e-4113-4558-9763-d43f26afd89f.jpeg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
public/investasi/af481564-be60-41c2-a32d-979a10e93e7b.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/b00ee03d-7b5c-4b0a-be79-6a443e87dc8f.jpeg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
public/investasi/d3552789-90f8-4930-bb83-9d1bd0cc9fc0.png
Normal file
|
After Width: | Height: | Size: 263 KiB |
BIN
public/investasi/d7256337-5a81-4adb-bbc9-f6b29580b903.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/d79935f7-7ff4-43af-a702-483ba670db48.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/e09a8cc9-b2ad-4019-aee9-ebb11535685a.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/e0db580f-b928-4749-895f-f0a8904c2a28.png
Normal file
|
After Width: | Height: | Size: 263 KiB |
BIN
public/investasi/e0ff8838-6d2b-485f-875f-2e18cd07d193.jpg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
public/investasi/e65752a5-2dd5-4676-bff0-7055bab1416a.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/e8a99050-f0b8-4131-9a4b-973cf47be021.jpg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
public/investasi/f75e8156-da79-4847-99a2-4f2439829ae0.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
public/investasi/f7ed1437-5df5-4ad7-8493-cb3a857daf38.jpeg
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
@@ -1,9 +1,13 @@
|
||||
import { BeritaInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
|
||||
const dataInvestasi = await getOneInvestasiById(params.id)
|
||||
|
||||
return (
|
||||
<>
|
||||
<BeritaInvestasi id={params.id}/>
|
||||
<BeritaInvestasi dataInvestasi={dataInvestasi as any}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { DetailBeritaInvestasi } from "@/app_modules/investasi";
|
||||
import getOneBeritaInvestasiById from "@/app_modules/investasi/fun/get_one_berita_by_id";
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
// console.log(params.id)
|
||||
const dataBerita = await getOneBeritaInvestasiById(params.id)
|
||||
// console.log(dataBerita)
|
||||
|
||||
export default async function Page() {
|
||||
return <>
|
||||
<DetailBeritaInvestasi/>
|
||||
<DetailBeritaInvestasi dataBerita={dataBerita as any}/>
|
||||
</>
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
import { DetailDokumenInvestasi } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
export default async function Page() {
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
const dataInvestasi = await getOneInvestasiById(params.id)
|
||||
// console.log(params.id)
|
||||
return<>
|
||||
<DetailDokumenInvestasi/>
|
||||
<DetailDokumenInvestasi dataInvestasi={dataInvestasi as any}/>
|
||||
</>
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
import { DetailPropektus } from "@/app_modules/investasi";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
export default async function Page({params}:{params: {id: string}}) {
|
||||
const dataInvestasi = await getOneInvestasiById(params.id)
|
||||
|
||||
|
||||
export default async function Page(params:any) {
|
||||
return<>
|
||||
<DetailPropektus/>
|
||||
<DetailPropektus dataInvestasi={dataInvestasi as any}/>
|
||||
</>
|
||||
}
|
||||
@@ -16,12 +16,14 @@ export const RouterInvestasi = {
|
||||
status_transaksi: "/dev/investasi/status_transaksi/berhasil",
|
||||
status_transaksi_gagal: "/dev/investasi/status_transaksi/gagal",
|
||||
metode_transfer: "/dev/investasi/metode_transfer",
|
||||
|
||||
// edit //
|
||||
edit: "/dev/investasi/edit/",
|
||||
edit_intro: "/dev/investasi/edit_intro/",
|
||||
edit_prospektus: "/dev/investasi/edit_prospektus/",
|
||||
edit_dokumen: "/dev/investasi/edit_dokumen/",
|
||||
edit_berita: "/dev/investasi/edit_berita/",
|
||||
|
||||
// detail //
|
||||
detail_saham_terbeli: "/dev/investasi/detail_saham_terbeli/",
|
||||
detail_prospektus: "/dev/investasi/detail_prospektus/",
|
||||
|
||||
@@ -3,48 +3,70 @@
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function BeritaInvestasi({ id }: { id: string }) {
|
||||
export default function BeritaInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [berita, setBerita] = useState(dataInvestasi);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper
|
||||
|
||||
w={"100%"}
|
||||
bg={"gray"}
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterInvestasi.detail_berita + `${id}`)}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>Judul berita</Title>
|
||||
<Text fz={"xs"}>{moment(Date.now()).local().format("LL")}</Text>
|
||||
</Group>
|
||||
{!_.isEmpty(berita.BeritaInvestasi) ? (
|
||||
berita.BeritaInvestasi.map((e) => (
|
||||
<Paper
|
||||
key={e.id}
|
||||
w={"100%"}
|
||||
bg={"gray"}
|
||||
p={"sm"}
|
||||
onClick={() =>
|
||||
router.push(RouterInvestasi.detail_berita + `${e.id}`)
|
||||
}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>{e.title}</Title>
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("LL")}</Text>
|
||||
</Group>
|
||||
|
||||
<Grid pt={5}>
|
||||
<Grid.Col span={8}>
|
||||
<Text fz={12}>
|
||||
Lorem ipsum dolor sit amet consectetur, adipisicing elit....
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<AspectRatio ratio={16 / 9} h={50} w={100}>
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Grid pt={5}>
|
||||
<Grid.Col span={8}>
|
||||
<Text lineClamp={3} fz={12}>
|
||||
{e.deskripsi}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<AspectRatio ratio={16 / 9} h={50} w={100}>
|
||||
<Image alt="" src={RouterInvestasi.api_gambar + `${e.imagesId}`} />
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))
|
||||
) : (
|
||||
<Center>
|
||||
<Title order={6}>Tidak Ada Berita</Title>
|
||||
</Center>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ export default function InvestasiCreate({
|
||||
// toast(res.message);
|
||||
setChangeColor(1);
|
||||
setActiveTab("Draft");
|
||||
return router.push(RouterInvestasi.dialog_create)
|
||||
router.push(RouterInvestasi.dialog_create)
|
||||
} else {
|
||||
return toast(res.message);
|
||||
toast(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,21 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { AspectRatio, Image, Stack, Text, Title } from "@mantine/core";
|
||||
import { AspectRatio, Group, Image, Stack, Text, Title } from "@mantine/core";
|
||||
import { Model_Berita_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import moment from "moment";
|
||||
|
||||
export default function DetailBeritaInvestasi() {
|
||||
export default function DetailBeritaInvestasi({
|
||||
dataBerita,
|
||||
}: {
|
||||
dataBerita: Model_Berita_Investasi;
|
||||
}) {
|
||||
const [berita, setBerita] = useState(dataBerita);
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Title>Judul berita</Title>
|
||||
<AspectRatio ratio={16/9}>
|
||||
<Image src={"/aset/no-img.png"} alt=""/>
|
||||
</AspectRatio>
|
||||
<Text>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum eaque sint
|
||||
consequuntur consectetur ratione nostrum quasi aspernatur quae? Facere
|
||||
repudiandae illum laborum eum recusandae, id cumque in quaerat eveniet
|
||||
beatae.
|
||||
</Text>
|
||||
<Stack spacing={"lg"}>
|
||||
<Stack spacing={0}>
|
||||
<Title>{berita.title}</Title>
|
||||
<Text fz={12}>{moment(berita.createdAt).format("lll")}</Text>
|
||||
</Stack>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
src={RouterInvestasi.api_gambar + `${berita.imagesId}`}
|
||||
alt=""
|
||||
/>
|
||||
</AspectRatio>
|
||||
<Text>{berita.deskripsi}</Text>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import { Paper, Grid, Center, Text } from "@mantine/core";
|
||||
import { Paper, Grid, Center, Text, Title } from "@mantine/core";
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import Link from "next/link";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function DetailDokumenInvestasi() {
|
||||
export default function DetailDokumenInvestasi({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const [dokumen, setDokumen] = useState(dataInvestasi);
|
||||
return (
|
||||
<>
|
||||
<Link
|
||||
href={"/aset/dummy_file.pdf"}
|
||||
{!_.isEmpty(dokumen.DokumenInvestasi) ? (
|
||||
dokumen.DokumenInvestasi.map((e) => (
|
||||
<Link
|
||||
key={e.id}
|
||||
href={`/file/${e.url}`}
|
||||
target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
>
|
||||
@@ -21,7 +32,7 @@ export default function DetailDokumenInvestasi() {
|
||||
onClick={() => ""}
|
||||
>
|
||||
<Grid.Col span={10}>
|
||||
<Text>Nama File.pdf</Text>
|
||||
<Text>{e.title}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
@@ -31,6 +42,12 @@ export default function DetailDokumenInvestasi() {
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Link>
|
||||
))
|
||||
) : (
|
||||
<Center>
|
||||
<Title order={6}>Tidak Ada File</Title>
|
||||
</Center>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -111,6 +111,10 @@ export default function DetailDraftInvestasi({
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>{investasi.MasterPembagianDeviden.name} bulan </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text>{investasi.MasterPencarianInvestor.name} Hari </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
|
||||
@@ -42,19 +42,19 @@ export default function DetailReviewInvestasi({dataInvestasi}:{dataInvestasi: MO
|
||||
id: 1,
|
||||
name: "Prospektus",
|
||||
icon: <IconBookDownload size={70} />,
|
||||
route: RouterInvestasi.edit_prospektus,
|
||||
route: RouterInvestasi.detail_prospektus,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Dokumen",
|
||||
icon: <IconFileDescription size={70} />,
|
||||
route: RouterInvestasi.edit_dokumen,
|
||||
route: RouterInvestasi.detail_dokumen,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Berita",
|
||||
icon: <IconSpeakerphone size={70} />,
|
||||
route: RouterInvestasi.edit_berita,
|
||||
route: RouterInvestasi.berita,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -106,6 +106,10 @@ export default function DetailReviewInvestasi({dataInvestasi}:{dataInvestasi: MO
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>{investasi.MasterPembagianDeviden.name} Bulan </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text>{investasi.MasterPencarianInvestor.name} Hari </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
@@ -132,7 +136,7 @@ export default function DetailReviewInvestasi({dataInvestasi}:{dataInvestasi: MO
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${"1"}`)}
|
||||
onClick={() => router.push(e.route + `${investasi.id}`)}
|
||||
>
|
||||
<Paper h={100} w={100} bg={"gray.4"} withBorder py={"xs"}>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
|
||||
@@ -1,36 +1,53 @@
|
||||
"use client";
|
||||
|
||||
import { Paper, Grid, Center, Text } from "@mantine/core";
|
||||
import { Paper, Grid, Center, Text, Title } from "@mantine/core";
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
MODEL_Investasi,
|
||||
Model_Prospektus_Investasi,
|
||||
} from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function DetailPropektus({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const [prospek, setProspek] = useState(dataInvestasi);
|
||||
|
||||
export default function DetailPropektus() {
|
||||
return (
|
||||
<>
|
||||
<Link
|
||||
href={"/aset/dummy_file.pdf"}
|
||||
target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
>
|
||||
<Paper w={"100%"} h={50} bg={"gray"} mb={"md"}>
|
||||
<Grid
|
||||
align="center"
|
||||
justify="center"
|
||||
h={50}
|
||||
px={"sm"}
|
||||
onClick={() => ""}
|
||||
>
|
||||
<Grid.Col span={10}>
|
||||
<Text>Nama File.pdf</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<IconChevronRight />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Link>
|
||||
{prospek.ProspektusInvestasi !== null ? (
|
||||
<Link
|
||||
href={`/file/${prospek.ProspektusInvestasi.url}`}
|
||||
target="_blank"
|
||||
style={{ textDecorationLine: "none" }}
|
||||
>
|
||||
<Paper w={"100%"} h={50} bg={"gray"} mb={"md"}>
|
||||
<Grid
|
||||
align="center"
|
||||
justify="center"
|
||||
h={50}
|
||||
px={"sm"}
|
||||
onClick={() => ""}
|
||||
>
|
||||
<Grid.Col span={10}>
|
||||
<Text>Prospektus_{prospek.title}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Center>
|
||||
<IconChevronRight />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Link>
|
||||
) : (
|
||||
<Center>
|
||||
<Title order={6}>Tidak Ada File</Title>
|
||||
</Center>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
Text,
|
||||
ActionIcon,
|
||||
Group,
|
||||
Modal,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconChevronRight,
|
||||
@@ -23,6 +24,8 @@ import _ from "lodash";
|
||||
import funDeleteDokumenInvestasi from "../fun/fun_delete_dokumen";
|
||||
import toast from "react-simple-toasts";
|
||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
|
||||
export default function EditDokumenInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -30,24 +33,39 @@ export default function EditDokumenInvestasi({
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const [dokumen, setDokumen] = useState(dataInvestasi);
|
||||
const [idDel, setDel] = useState<any | null>();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
|
||||
async function onDelete(id: string) {
|
||||
await funDeleteDokumenInvestasi(id)
|
||||
.then( async (res) => {
|
||||
if(res.status === 200){
|
||||
toast(res.message)
|
||||
const load = await funLoadDataInvestasi(dokumen.id)
|
||||
setDokumen(load as any)
|
||||
|
||||
|
||||
await funDeleteDokumenInvestasi(id).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
toast(res.message);
|
||||
|
||||
const load = await funLoadDataInvestasi(dokumen.id);
|
||||
setDokumen(load as any);
|
||||
} else {
|
||||
toast(res.message)
|
||||
toast(res.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(dokukem, null, 2)}</pre> */}
|
||||
{/* <Modal opened={opened} onClose={close} centered title="Hapus dokumen ?">
|
||||
<Group position="center">
|
||||
<Button radius={50}>Batal</Button>
|
||||
<Button
|
||||
radius={50}
|
||||
bg={Warna.merah}
|
||||
color="red"
|
||||
onClick={() => onDelete(idDel)}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
</Modal> */}
|
||||
|
||||
{!_.isEmpty(dokumen.DokumenInvestasi) ? (
|
||||
dokumen.DokumenInvestasi.map((e) => (
|
||||
@@ -65,16 +83,17 @@ export default function EditDokumenInvestasi({
|
||||
|
||||
<Grid.Col span={4}>
|
||||
<Group position="center">
|
||||
<Link
|
||||
href={`/file/${e.url}`}
|
||||
target="_blank"
|
||||
|
||||
>
|
||||
<Link href={`/file/${e.url}`} target="_blank">
|
||||
<ActionIcon variant="transparent">
|
||||
<IconWorldShare color="green" />
|
||||
</ActionIcon>
|
||||
</Link>
|
||||
<ActionIcon variant="transparent" onClick={() => onDelete(e.id)}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
onDelete(e.id)
|
||||
}}
|
||||
>
|
||||
<IconTrash color="red" />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
@@ -84,7 +103,7 @@ export default function EditDokumenInvestasi({
|
||||
))
|
||||
) : (
|
||||
<Center>
|
||||
<Title order={4}>Tidak ada file</Title>
|
||||
<Title order={5}>Tidak ada file</Title>
|
||||
</Center>
|
||||
)}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
Image,
|
||||
NumberInput,
|
||||
Stack,
|
||||
Modal,
|
||||
} from "@mantine/core";
|
||||
import { IconCamera, IconChevronRight } from "@tabler/icons-react";
|
||||
import Link from "next/link";
|
||||
@@ -30,6 +31,7 @@ import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import _ from "lodash";
|
||||
import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
|
||||
import funEditInvestasi from "../fun/fun_edit_investasi";
|
||||
import { useDisclosure, useWindowScroll } from "@mantine/hooks";
|
||||
|
||||
export default function EditIntroInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -43,6 +45,9 @@ export default function EditIntroInvestasi({
|
||||
listPembagian: MODEL_DEFAULT_MASTER[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [scroll, scrollTo] = useWindowScroll();
|
||||
|
||||
const [edit_inves, setEdit_inves] = useState(dataInvestasi);
|
||||
const [img, setImg] = useState<any | null>();
|
||||
const [fl, setFl] = useState<File | null>(null);
|
||||
@@ -56,29 +61,40 @@ export default function EditIntroInvestasi({
|
||||
}
|
||||
|
||||
async function onUpdate() {
|
||||
const body = edit_inves;
|
||||
if (_.values(edit_inves).includes("")) return toast("Lengkapi data");
|
||||
// if (!fl) return toast("File Kosong");
|
||||
|
||||
const fd = new FormData();
|
||||
fd.append("file", fl as any);
|
||||
// router.back()
|
||||
|
||||
// await funEditInvestasi(fd, edit_inves).then((res) =>
|
||||
// res.status === 200 ? router.back() : toast(res.message)
|
||||
// );
|
||||
|
||||
await funEditInvestasi(fd, edit_inves).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
toast(res.message);
|
||||
router.replace(RouterInvestasi.edit + `${edit_inves.id}`);
|
||||
} else {
|
||||
toast(res.message);
|
||||
}
|
||||
await funEditInvestasi(fd, body).then(async (res) => {
|
||||
res.status === 200
|
||||
? (toast(res.message), router.back())
|
||||
: toast(res.message);
|
||||
// if (res.status === 200) {
|
||||
// router.back()
|
||||
// } else {
|
||||
// toast(res.message);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
title="Simpan perubahan data ?"
|
||||
withCloseButton={false}
|
||||
>
|
||||
<Group position="center">
|
||||
<Button onClick={close} bg={"red"} color="red">Batal</Button>
|
||||
<Button onClick={onUpdate} bg={Warna.hijau_muda} color="green">Simpan</Button>
|
||||
</Group>
|
||||
</Modal>
|
||||
|
||||
<Box>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
{img ? (
|
||||
@@ -102,7 +118,7 @@ export default function EditIntroInvestasi({
|
||||
accept="image/png,image/jpeg"
|
||||
>
|
||||
{(props) => (
|
||||
<Button {...props} w={350} radius={50}>
|
||||
<Button {...props} radius={50}>
|
||||
<IconCamera />
|
||||
</Button>
|
||||
)}
|
||||
@@ -233,7 +249,8 @@ export default function EditIntroInvestasi({
|
||||
bg={Warna.hijau_muda}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onUpdate();
|
||||
scrollTo({y: 0})
|
||||
open();
|
||||
}}
|
||||
>
|
||||
Update
|
||||
|
||||
@@ -50,8 +50,8 @@ export default function EditProspektusInvestasi({
|
||||
>
|
||||
<Grid.Col span={10}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>Prospektus_{prospek.title}</Text>
|
||||
{/* <IconFileTypePdf /> */}
|
||||
<Text lineClamp={1}>Prospektus_{prospek.title}</Text>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function funDeleteBeritaInvestasi(id: string, idInvestasi: string) {
|
||||
|
||||
export default async function funDeleteBeritaInvestasi(id: string) {
|
||||
const res = await prisma.beritaInvestasi.delete({
|
||||
where: {
|
||||
id: id,
|
||||
@@ -12,7 +14,6 @@ export default async function funDeleteBeritaInvestasi(id: string, idInvestasi:
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal hapus" };
|
||||
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berita terhapus",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export default async function funDeleteDokumenInvestasi(idDokumen: string) {
|
||||
|
||||
const res = await prisma.dokumenInvestasi.delete({
|
||||
where: {
|
||||
id: idDokumen,
|
||||
@@ -12,7 +11,6 @@ export default async function funDeleteDokumenInvestasi(idDokumen: string) {
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal hapus" };
|
||||
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
message: "Dokumen terhapus",
|
||||
|
||||
@@ -8,17 +8,13 @@ import fs from "fs";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
async function up1(data: any) {}
|
||||
|
||||
async function up2(data: any, formData: any) {}
|
||||
|
||||
export default async function funEditInvestasi(
|
||||
formData: FormData,
|
||||
data: MODEL_Investasi
|
||||
) {
|
||||
const file = formData.get("file")?.length;
|
||||
const file = formData.get("file");
|
||||
|
||||
if (file === undefined) {
|
||||
if (file !== "null") {
|
||||
const file: any = formData.get("file");
|
||||
const fName = file.name;
|
||||
const fExt =
|
||||
@@ -37,63 +33,34 @@ export default async function funEditInvestasi(
|
||||
if (!updateImage) return { status: 400, message: "Gagal upload gambar" };
|
||||
const upFolder = Buffer.from(await file.arrayBuffer());
|
||||
fs.writeFileSync(`./public/investasi/${updateImage.url}`, upFolder);
|
||||
}
|
||||
|
||||
const editInves = await prisma.investasi.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
title: data.title,
|
||||
targetDana: data.targetDana,
|
||||
hargaLembar: data.hargaLembar,
|
||||
totalLembar: data.totalLembar,
|
||||
roi: data.roi,
|
||||
masterPencarianInvestorId: data.MasterPencarianInvestor.id,
|
||||
masterPembagianDevidenId: data.MasterPembagianDeviden.id,
|
||||
masterPeriodeDevidenId: data.MasterPeriodeDeviden.id,
|
||||
},
|
||||
});
|
||||
const editInves = await prisma.investasi.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
title: data.title,
|
||||
targetDana: data.targetDana,
|
||||
hargaLembar: data.hargaLembar,
|
||||
totalLembar: data.totalLembar,
|
||||
roi: data.roi,
|
||||
masterPencarianInvestorId: data.MasterPencarianInvestor.id,
|
||||
masterPembagianDevidenId: data.MasterPembagianDeviden.id,
|
||||
masterPeriodeDevidenId: data.MasterPeriodeDeviden.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!editInves) {
|
||||
return {
|
||||
status: 400,
|
||||
message: "Gagal update",
|
||||
};
|
||||
}
|
||||
|
||||
revalidatePath(RouterInvestasi.detail_draft);
|
||||
if (!editInves) {
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil Disimpan",
|
||||
};
|
||||
} else {
|
||||
const editInves = await prisma.investasi.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
title: data.title,
|
||||
targetDana: data.targetDana,
|
||||
hargaLembar: data.hargaLembar,
|
||||
totalLembar: data.totalLembar,
|
||||
roi: data.roi,
|
||||
masterPencarianInvestorId: data.MasterPencarianInvestor.id,
|
||||
masterPembagianDevidenId: data.MasterPembagianDeviden.id,
|
||||
masterPeriodeDevidenId: data.MasterPeriodeDeviden.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!editInves) {
|
||||
return {
|
||||
status: 400,
|
||||
message: "Gagal update",
|
||||
};
|
||||
}
|
||||
|
||||
revalidatePath(RouterInvestasi.detail_draft);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil Disimpan",
|
||||
status: 400,
|
||||
message: "Gagal update",
|
||||
};
|
||||
}
|
||||
|
||||
revalidatePath(RouterInvestasi.edit);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil Disimpan",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function funLoadDataInvestasi(id: string) {
|
||||
const data = await prisma.investasi.findUnique({
|
||||
|
||||
@@ -24,9 +24,10 @@ import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import deleteBeritaInvestasi from "../fun/fun_delete_berita";
|
||||
import getOneInvestasiById from "../fun/get_one_investasi_by_id";
|
||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
||||
import funDeleteBeritaInvestasi from "../fun/fun_delete_berita";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export default function ListEditBeritaInvestasi({
|
||||
dataInvestasi,
|
||||
@@ -34,14 +35,14 @@ export default function ListEditBeritaInvestasi({
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [investasi, setInvestasi] = useState<MODEL_Investasi>(dataInvestasi);
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
|
||||
async function onDelete(idBerita: string, idInvestasi: string) {
|
||||
await deleteBeritaInvestasi(idBerita, idInvestasi).then( async(res) => {
|
||||
async function onDelete(idBerita: string) {
|
||||
await funDeleteBeritaInvestasi(idBerita).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
const loadData = await funLoadDataInvestasi(idInvestasi);
|
||||
setInvestasi(loadData as any)
|
||||
const load = await funLoadDataInvestasi(investasi.id)
|
||||
toast(res.message);
|
||||
return setInvestasi(load as any)
|
||||
} else {
|
||||
toast(res.message);
|
||||
}
|
||||
@@ -57,7 +58,6 @@ export default function ListEditBeritaInvestasi({
|
||||
<Center>
|
||||
<Title order={6}>Berita Kosong</Title>
|
||||
</Center>
|
||||
<Divider />
|
||||
</Box>
|
||||
) : (
|
||||
""
|
||||
@@ -87,7 +87,7 @@ export default function ListEditBeritaInvestasi({
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
onDelete(v.id, dataInvestasi.id);
|
||||
onDelete(v.id);
|
||||
}}
|
||||
>
|
||||
Hapus
|
||||
@@ -120,6 +120,7 @@ export default function ListEditBeritaInvestasi({
|
||||
</Stack>
|
||||
</Paper>
|
||||
))}
|
||||
<Divider my={"lg"} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface Model_Berita_Investasi {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
interface Model_Prospektus_Investasi {
|
||||
export interface Model_Prospektus_Investasi {
|
||||
id: string
|
||||
url: string
|
||||
active: boolean;
|
||||
@@ -51,7 +51,7 @@ interface Model_Prospektus_Investasi {
|
||||
investasiId: string
|
||||
}
|
||||
|
||||
interface Model_Dokumen_Investasi {
|
||||
export interface Model_Dokumen_Investasi {
|
||||
id: string
|
||||
title: string
|
||||
url: string
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function UploadDokumenInvestasi({
|
||||
fd.append("file", pdf as any);
|
||||
|
||||
await funUploadDokumenInvestasi(fd, body).then((res) => {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
if (res.status === 201) {
|
||||
toast("Berhasil upload");
|
||||
router.back();
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function UploadProspektusInvestasi({
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await file.arrayBuffer())])
|
||||
);
|
||||
console.log(buffer);
|
||||
// console.log(buffer);
|
||||
setFile(buffer);
|
||||
setPdf(file);
|
||||
}}
|
||||
|
||||