Fix
## Deskripsi: - Cek notif ## No Issue
This commit is contained in:
@@ -11,12 +11,8 @@ export default function ComponentGlobal_IsEmptyData({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Center
|
||||
h={height ? `${height}vh` : "70vh"}
|
||||
fz={"sm"}
|
||||
fw={"bold"}
|
||||
>
|
||||
<Text c={"gray"}>{text ? text : "Tidak Ada Data"}</Text>
|
||||
<Center h={height ? `${height}vh` : "70vh"} fz={"sm"} fw={"bold"}>
|
||||
<Text c={"gray"}>{text ? text : "Tidak ada data"}</Text>
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -12,7 +12,6 @@ import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json";
|
||||
import forum_kategori_report from "../../../bin/seeder/forum/master_report.json";
|
||||
import forum_status_posting from "../../../bin/seeder/forum/master_status.json";
|
||||
import jenisProgres from "../../../bin/seeder/investasi/master_progres.json";
|
||||
import namaBank from "../../../bin/seeder/investasi/nama_bank.json";
|
||||
import pembagianDeviden from "../../../bin/seeder/investasi/pembagian_deviden.json";
|
||||
import pencarianInvestor from "../../../bin/seeder/investasi/pencarian_investor.json";
|
||||
import periodeDeviden from "../../../bin/seeder/investasi/periode_deviden.json";
|
||||
@@ -25,6 +24,7 @@ import userSeeder from "../../../bin/seeder/user_seeder.json";
|
||||
import voting_status from "../../../bin/seeder/voting/master_status.json";
|
||||
import { master_kategori_app } from "@/bin/seeder/master";
|
||||
import { new_status_transaksi_investasi } from "@/bin/seeder/investasi";
|
||||
import { master_nama_bank } from "@/bin/seeder/master";
|
||||
|
||||
export async function generate_seeder() {
|
||||
for (let i of userRole) {
|
||||
@@ -143,24 +143,26 @@ export async function generate_seeder() {
|
||||
});
|
||||
}
|
||||
|
||||
for (let i of namaBank) {
|
||||
for (let i of master_nama_bank) {
|
||||
await prisma.masterBank.upsert({
|
||||
where: {
|
||||
id: i.id.toString(),
|
||||
},
|
||||
create: {
|
||||
id: i.id.toString(),
|
||||
name: i.name,
|
||||
namaBank: i.namaBank,
|
||||
namaAkun: i.namaAkun,
|
||||
norek: i.norek.toString(),
|
||||
},
|
||||
update: {
|
||||
id: i.id.toString(),
|
||||
name: i.name,
|
||||
namaBank: i.namaBank,
|
||||
namaAkun: i.namaAkun,
|
||||
norek: i.norek.toString(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (let i of statusTransaksiInvestasi) {
|
||||
await prisma.masterStatusTransaksiInvestasi.upsert({
|
||||
where: {
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function funGlobal_getAllBank() {
|
||||
id: "asc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
|
||||
@@ -13,7 +13,8 @@ export default async function adminAppInformation_createBank({
|
||||
const create = await prisma.masterBank.create({
|
||||
data: {
|
||||
id: idBank.toString(),
|
||||
name: data.name,
|
||||
namaBank: data.name,
|
||||
namaAkun: data.akun,
|
||||
norek: data.norek,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_MASTER_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
|
||||
export default async function adminAppInformation_updateStatusBankById({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_DATA_BANK;
|
||||
data: MODEL_MASTER_BANK;
|
||||
}) {
|
||||
const updt = await prisma.masterBank.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
active: data.active,
|
||||
isActive: data.isActive,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_MASTER_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
|
||||
export default async function adminAppInformation_updateDataBankById({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_DATA_BANK;
|
||||
data: MODEL_MASTER_BANK;
|
||||
}) {
|
||||
const updt = await prisma.masterBank.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
name: data.name,
|
||||
namaBank: data.namaBank,
|
||||
norek: data.norek,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_MASTER_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
@@ -34,7 +34,7 @@ import adminAppInformation_updateDataBankById from "../fun/update/fun_update_dat
|
||||
export default function InformasiBank({
|
||||
listBank,
|
||||
}: {
|
||||
listBank: MODEL_DATA_BANK[];
|
||||
listBank: MODEL_MASTER_BANK[];
|
||||
}) {
|
||||
const [data, setData] = useState(listBank);
|
||||
const [isCreate, setIsCreate] = useState(false);
|
||||
@@ -119,7 +119,7 @@ export default function InformasiBank({
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>
|
||||
<Text>{e?.name}</Text>
|
||||
<Text>{e?.namaBank}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
@@ -133,7 +133,7 @@ export default function InformasiBank({
|
||||
color="orange"
|
||||
onLabel="ON"
|
||||
offLabel="OFF"
|
||||
checked={e?.active}
|
||||
checked={e?.isActive}
|
||||
onChange={(val) => {
|
||||
setIsActivation(true);
|
||||
setUpdateStatus({
|
||||
@@ -154,7 +154,7 @@ export default function InformasiBank({
|
||||
setIsCreate(false);
|
||||
setUpdateData({
|
||||
id: e?.id,
|
||||
name: e?.name,
|
||||
name: e?.namaBank,
|
||||
norek: e?.norek,
|
||||
});
|
||||
}}
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function Donasi_getMasterBank() {
|
||||
// createdAt: "asc",
|
||||
// },
|
||||
where: {
|
||||
active: true,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { ActionIcon, Affix, Box, Center, rem } from "@mantine/core";
|
||||
import { useWindowScroll } from "@mantine/hooks";
|
||||
import { IconPencilPlus } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
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 { Box, Center } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_CardPublish from "../component/card_view/card_publish";
|
||||
import { MODEL_DONASI } from "../model/interface";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import _ from "lodash";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { donasi_funGetAllPublish } from "../fun/get/get_list_beranda";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { MODEL_DONASI } from "../model/interface";
|
||||
|
||||
export default function MainDonasi({
|
||||
listDonasi,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_MASTER_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
|
||||
|
||||
export interface MODEL_DONASI {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { MODEL_DATA_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import { MODEL_MASTER_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Paper, Radio, Stack, Title } from "@mantine/core";
|
||||
@@ -22,7 +22,7 @@ export default function Donasi_MetodePembayaran({
|
||||
donasiId,
|
||||
authorId,
|
||||
}: {
|
||||
listBank: MODEL_DATA_BANK[];
|
||||
listBank: MODEL_MASTER_BANK[];
|
||||
donasiId: string;
|
||||
authorId: string;
|
||||
}) {
|
||||
@@ -110,7 +110,7 @@ export default function Donasi_MetodePembayaran({
|
||||
value={e.id}
|
||||
label={
|
||||
<Title order={6} color="white">
|
||||
{e.name}
|
||||
{e.namaBank}
|
||||
</Title>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -13,6 +13,7 @@ export function ComponentEvent_CardBeranda({ data }: { data: any }) {
|
||||
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
|
||||
@@ -44,7 +44,10 @@ import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_
|
||||
import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id";
|
||||
import { forum_getOnePostingById } from "../../fun/get/get_one_posting_by_id";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function ComponentForum_DetailHeader({
|
||||
data,
|
||||
@@ -148,16 +151,27 @@ function ComponentForum_DetailButtonMore_V2({
|
||||
const [loadingEdit, setLoadingEdit] = useState(false);
|
||||
const [loadingReport, setLoadingReport] = useState(false);
|
||||
|
||||
// if (loadingEdit) return <ComponentGlobal_V2_LoadingPage />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Drawer
|
||||
// className={classes.radiusCustom}
|
||||
styles={{
|
||||
content: {
|
||||
backgroundColor: MainColor.darkblue,
|
||||
borderTop: `1px solid ${AccentColor.blue}`,
|
||||
padding: 0,
|
||||
position: "absolute",
|
||||
margin: "auto",
|
||||
backgroundColor: "transparent",
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 500,
|
||||
},
|
||||
body: {
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderTop: `2px solid ${AccentColor.blue}`,
|
||||
borderRight: `1px solid ${AccentColor.blue}`,
|
||||
borderLeft: `1px solid ${AccentColor.blue}`,
|
||||
borderRadius: "20px 20px 0px 0px",
|
||||
color: "white",
|
||||
paddingBottom: "5%",
|
||||
},
|
||||
}}
|
||||
opened={opened}
|
||||
@@ -338,7 +352,9 @@ function ButtonDelete({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Title order={6} color="white">Yakin menghapus posting ini ?</Title>
|
||||
<Title order={6} color="white">
|
||||
Yakin menghapus posting ini ?
|
||||
</Title>
|
||||
<Group position="center">
|
||||
<Button radius={"xl"} onClick={() => setOpenDel(false)}>
|
||||
Batal
|
||||
|
||||
@@ -68,8 +68,22 @@ export default function ComponentForum_ForumkuMoreButton({
|
||||
<Drawer
|
||||
styles={{
|
||||
content: {
|
||||
backgroundColor: MainColor.darkblue,
|
||||
borderTop: `1px solid ${AccentColor.blue}`,
|
||||
padding: 0,
|
||||
position: "absolute",
|
||||
margin: "auto",
|
||||
backgroundColor: "transparent",
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 500,
|
||||
},
|
||||
body: {
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderTop: `2px solid ${AccentColor.blue}`,
|
||||
borderRight: `1px solid ${AccentColor.blue}`,
|
||||
borderLeft: `1px solid ${AccentColor.blue}`,
|
||||
borderRadius: "20px 20px 0px 0px",
|
||||
color: "white",
|
||||
paddingBottom: "5%",
|
||||
},
|
||||
}}
|
||||
opened={opened}
|
||||
|
||||
@@ -62,12 +62,22 @@ export default function ComponentForum_KomentarButtonMore({
|
||||
<Drawer
|
||||
styles={{
|
||||
content: {
|
||||
backgroundColor: MainColor.darkblue,
|
||||
borderTop: `1px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px 10px 0px 0px",
|
||||
padding: 0,
|
||||
position: "absolute",
|
||||
margin: "auto",
|
||||
backgroundColor: "transparent",
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 500,
|
||||
},
|
||||
header: {
|
||||
borderRadius: "10px 10px 0px 0px",
|
||||
body: {
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderTop: `2px solid ${AccentColor.blue}`,
|
||||
borderRight: `1px solid ${AccentColor.blue}`,
|
||||
borderLeft: `1px solid ${AccentColor.blue}`,
|
||||
borderRadius: "20px 20px 0px 0px",
|
||||
color: "white",
|
||||
paddingBottom: "5%",
|
||||
},
|
||||
}}
|
||||
opened={opened}
|
||||
|
||||
@@ -69,8 +69,22 @@ export default function ComponentForum_BerandaMoreButton({
|
||||
<Drawer
|
||||
styles={{
|
||||
content: {
|
||||
backgroundColor: MainColor.darkblue,
|
||||
borderTop: `1px solid ${AccentColor.blue}`,
|
||||
padding: 0,
|
||||
position: "absolute",
|
||||
margin: "auto",
|
||||
backgroundColor: "transparent",
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 500,
|
||||
},
|
||||
body: {
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderTop: `2px solid ${AccentColor.blue}`,
|
||||
borderRight: `1px solid ${AccentColor.blue}`,
|
||||
borderLeft: `1px solid ${AccentColor.blue}`,
|
||||
borderRadius: "20px 20px 0px 0px",
|
||||
color: "white",
|
||||
paddingBottom: "5%",
|
||||
},
|
||||
}}
|
||||
opened={opened}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { ComponentInvestasi_FrameFileView } from "./file_view/frame_file_view";
|
||||
import { ComponentInvestasi_BoxMetodePembayaran } from "./transaksi/box_metode_pembayaran";
|
||||
import { ComponentInvestasi_BoxPembelian } from "./transaksi/box_pembelian";
|
||||
import { ComponentInvestasi_ProsesAccAdmin } from "./transaksi/proses_acc_admin";
|
||||
import { ComponentInvestasi_ViewInvoice } from "./transaksi/view_invoice";
|
||||
import { Investasi_ComponentCardBeranda } from "./main/comp_card_beranda";
|
||||
import { Investasi_ComponentFooterMain } from "./main/comp_footer_main";
|
||||
import { Investasi_ComponentButtonUpdateBeranda } from "./main/comp_update_beranda";
|
||||
|
||||
export { ComponentInvestasi_BoxPembelian };
|
||||
export { ComponentInvestasi_BoxMetodePembayaran };
|
||||
export { ComponentInvestasi_FrameFileView };
|
||||
export { ComponentInvestasi_ViewInvoice };
|
||||
export { ComponentInvestasi_ProsesAccAdmin };
|
||||
export { Investasi_ComponentFooterMain };
|
||||
export { Investasi_ComponentCardBeranda };
|
||||
export { Investasi_ComponentButtonUpdateBeranda };
|
||||
|
||||
161
src/app_modules/investasi/_component/main/comp_card_beranda.tsx
Normal file
161
src/app_modules/investasi/_component/main/comp_card_beranda.tsx
Normal file
@@ -0,0 +1,161 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
Card,
|
||||
CardSection,
|
||||
AspectRatio,
|
||||
Box,
|
||||
Stack,
|
||||
Title,
|
||||
Progress,
|
||||
Group,
|
||||
Image,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/_global/loading_card";
|
||||
|
||||
export function Investasi_ComponentCardBeranda({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoadingDetail, setLoadingDetail] = useState(false);
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderRadius: "10px",
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
marginInline: "15px",
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoadingDetail(true);
|
||||
setVisible(true);
|
||||
router.push(RouterInvestasi_OLD.detail + `${data?.id}`);
|
||||
}}
|
||||
>
|
||||
<CardSection py={"md"} px={"sm"}>
|
||||
<AspectRatio ratio={1 / 1} mah={250}>
|
||||
<Box style={{ borderRadius: "7px" }}>
|
||||
{data.imagesId ? (
|
||||
<Image
|
||||
radius={"sm"}
|
||||
alt="Foto"
|
||||
src={RouterInvestasi_OLD.api_gambar + `${data?.imagesId}`}
|
||||
w={200}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Box>
|
||||
</AspectRatio>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<Stack>
|
||||
<Title align="center" order={3}>
|
||||
{data?.title}
|
||||
</Title>
|
||||
{/* <Progress
|
||||
label={(+e.progress).toFixed(2) + " %"}
|
||||
value={+e.progress}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/> */}
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+data?.totalLembar - +data?.sisaLembar) /
|
||||
+data?.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+data?.totalLembar - +data?.sisaLembar) /
|
||||
+data?.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Stack>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<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?.MasterPencarianInvestor.name -
|
||||
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 truncate>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(data?.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(data?.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</CardSection>
|
||||
{visible ? <ComponentGlobal_CardLoadingOverlay /> : ""}
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { SimpleGrid, Stack, ActionIcon, Text } from "@mantine/core";
|
||||
import {
|
||||
IconChartHistogram,
|
||||
IconChartPie,
|
||||
IconCash,
|
||||
IconNotes,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_investas_menu } from "../../g_state";
|
||||
|
||||
const listFooter = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Bursa",
|
||||
route: RouterInvestasi_OLD.main,
|
||||
icon: <IconChartHistogram />,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Portofolio",
|
||||
route: RouterInvestasi_OLD.main_porto,
|
||||
icon: <IconChartPie />,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Saham Saya",
|
||||
route: RouterInvestasi_OLD.main_investasi,
|
||||
icon: <IconCash />,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Transaksi",
|
||||
route: RouterInvestasi_OLD.main_transaksi,
|
||||
icon: <IconNotes />,
|
||||
},
|
||||
];
|
||||
|
||||
export function Investasi_ComponentFooterMain() {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid cols={listFooter.length} h={"9vh"} mx={"xs"}>
|
||||
{listFooter.map((e, i) => (
|
||||
<Stack key={i} align="center" justify="center" spacing={0}>
|
||||
<ActionIcon
|
||||
// disabled={e.path === "" ? true : false}
|
||||
variant="transparent"
|
||||
c={hotMenu === i ? MainColor.yellow : "white"}
|
||||
onClick={() => {
|
||||
router.push(e.route);
|
||||
setHotMenu(i);
|
||||
}}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
<Text
|
||||
c={hotMenu === i ? MainColor.yellow : "white"}
|
||||
fz={"xs"}
|
||||
lineClamp={1}
|
||||
>
|
||||
{e.name}
|
||||
</Text>
|
||||
</Stack>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { Affix, Button, Center, rem } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import { investasi_funGetAllPublish } from "../../fun/get_all_investasi";
|
||||
import { data } from "autoprefixer";
|
||||
|
||||
export function Investasi_ComponentButtonUpdateBeranda({
|
||||
onLoadData,
|
||||
}: {
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
async function onLoaded() {
|
||||
try {
|
||||
await investasi_funGetAllPublish({ page: 1 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
const loadData = await investasi_funGetAllPublish({ page: 1 });
|
||||
|
||||
onLoadData({
|
||||
data: loadData,
|
||||
isNewPost: false,
|
||||
});
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Affix position={{ top: rem(100) }} w={"100%"}>
|
||||
<Center>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
border: `1px solid ${AccentColor.skyblue}`,
|
||||
}}
|
||||
bg={AccentColor.blue}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
onClick={() => onLoaded()}
|
||||
>
|
||||
Update beranda
|
||||
</Button>
|
||||
</Center>
|
||||
</Affix>
|
||||
</>
|
||||
);
|
||||
}
|
||||
32
src/app_modules/investasi/_fun/create/fun_create_invoice.ts
Normal file
32
src/app_modules/investasi/_fun/create/fun_create_invoice.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
interface Model_Invoice_Masuk {
|
||||
total: number;
|
||||
jumlah: number;
|
||||
pilihBank: string;
|
||||
investasiId: string;
|
||||
}
|
||||
export async function investasi_funCreateInvoice({
|
||||
data,
|
||||
}: {
|
||||
data: Model_Invoice_Masuk;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
|
||||
const create = await prisma.investasi_Invoice.create({
|
||||
data: {
|
||||
nominal: "" + data.total,
|
||||
lembarTerbeli: "" + data.jumlah ,
|
||||
masterBankId: data.pilihBank,
|
||||
authorId: authorId,
|
||||
investasiId: data.investasiId,
|
||||
statusInvoiceId: "3",
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal membuat invoice" };
|
||||
return { status: 201, data: create, message: "Berhasil membuat invoice" };
|
||||
}
|
||||
21
src/app_modules/investasi/_fun/get/fun_get_invoice_by_id.ts
Normal file
21
src/app_modules/investasi/_fun/get/fun_get_invoice_by_id.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function investasi_funGetInvoiceById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {
|
||||
const data = await prisma.investasi_Invoice.findFirst({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
},
|
||||
include: {
|
||||
MasterBank: true,
|
||||
StatusInvoice: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -96,11 +96,12 @@ export interface Model_Dokumen_Investasi {
|
||||
investasiId: string;
|
||||
}
|
||||
|
||||
export interface MODEL_DATA_BANK {
|
||||
export interface MODEL_MASTER_BANK {
|
||||
id: string;
|
||||
name: string;
|
||||
namaBank: string;
|
||||
namaAkun: string
|
||||
norek: string;
|
||||
active: boolean;
|
||||
isActive: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { Investasi_UiFileView } from "./file_view";
|
||||
import { Investasi_UiInvoice } from "./transaksi/invoice";
|
||||
import { Investasi_UiMetodePembayaran } from "./transaksi/metode_pembayaran";
|
||||
import { Investasi_UiProsesPembelian } from "./transaksi/proses_pembelian";
|
||||
import { Investasi_UiProsesTransaksi } from "./transaksi/proses_transaksi";
|
||||
import { Investasi_UiFileView } from "./ui_file_view";
|
||||
import { Investasi_UiInvoice } from "./transaksi/ui_invoice";
|
||||
import { Investasi_UiMetodePembayaran } from "./transaksi/ui_metode_pembayaran";
|
||||
import { Investasi_UiProsesPembelian } from "./transaksi/ui_proses_pembelian";
|
||||
import { Investasi_UiProsesTransaksi } from "./transaksi/ui_proses_transaksi";
|
||||
import { Investasi_UiBeranda } from "./main/ui_beranda";
|
||||
import { Investasi_UiLayoutMain } from "./main/ui_layout_main";
|
||||
|
||||
export { Investasi_UiProsesPembelian };
|
||||
export { Investasi_UiMetodePembayaran };
|
||||
export { Investasi_UiFileView };
|
||||
export { Investasi_UiInvoice };
|
||||
export { Investasi_UiProsesTransaksi };
|
||||
export { Investasi_UiBeranda };
|
||||
export { Investasi_UiLayoutMain };
|
||||
|
||||
20
src/app_modules/investasi/_ui/main/ui_beranda.tsx
Normal file
20
src/app_modules/investasi/_ui/main/ui_beranda.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import React, { useState } from "react";
|
||||
import { Investasi_ComponentButtonUpdateBeranda } from "../../_component/main/comp_update_beranda";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { Investasi_ViewBeranda } from "../../_view";
|
||||
|
||||
export function Investasi_UiBeranda({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ViewBeranda dataInvestasi={dataInvestasi} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
32
src/app_modules/investasi/_ui/main/ui_layout_main.tsx
Normal file
32
src/app_modules/investasi/_ui/main/ui_layout_main.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { gs_investas_menu } from "../../g_state";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import { Investasi_ComponentFooterMain } from "../../_component";
|
||||
|
||||
export function Investasi_UiLayoutMain({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
routerLeft={RouterCrowd.main}
|
||||
title="Investasi"
|
||||
/>
|
||||
}
|
||||
footer={<Investasi_ComponentFooterMain />}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { ComponentInvestasi_ViewInvoice } from "../../_component";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { Investasi_ViewInvoice } from "../../_view";
|
||||
|
||||
export function Investasi_UiInvoice() {
|
||||
return (
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Invoice" />}
|
||||
>
|
||||
<ComponentInvestasi_ViewInvoice dataInvoice={{}} />
|
||||
<Investasi_ViewInvoice dataInvoice={{}} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
);
|
||||
}
|
||||
@@ -2,15 +2,19 @@
|
||||
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { ComponentInvestasi_BoxMetodePembayaran } from "../../_component";
|
||||
import { Investasi_ViewMetodePembayaran } from "../../_view";
|
||||
|
||||
export function Investasi_UiMetodePembayaran({ listBank }: { listBank: any[] }) {
|
||||
export function Investasi_UiMetodePembayaran({
|
||||
listBank,
|
||||
}: {
|
||||
listBank: any[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Metode Pembayaran" />}
|
||||
>
|
||||
<ComponentInvestasi_BoxMetodePembayaran listBank={listBank} />
|
||||
<Investasi_ViewMetodePembayaran listBank={listBank} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { ComponentInvestasi_BoxPembelian } from "../../_component";
|
||||
|
||||
import { Investasi_ViewProsesPembelian } from "../../_view";
|
||||
|
||||
export function Investasi_UiProsesPembelian({
|
||||
dataInvestasi,
|
||||
@@ -15,7 +14,7 @@ export function Investasi_UiProsesPembelian({
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Pembelian Saham" />}
|
||||
>
|
||||
<ComponentInvestasi_BoxPembelian dataInvestasi={dataInvestasi} />
|
||||
<Investasi_ViewProsesPembelian dataInvestasi={dataInvestasi} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
@@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { ComponentInvestasi_ProsesAccAdmin } from "../../_component";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import { Investasi_ViewProsesTransaksi } from "../../_view";
|
||||
|
||||
export function Investasi_UiProsesTransaksi() {
|
||||
return (
|
||||
@@ -16,7 +16,7 @@ export function Investasi_UiProsesTransaksi() {
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ComponentInvestasi_ProsesAccAdmin />
|
||||
<Investasi_ViewProsesTransaksi />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
@@ -1,14 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { ComponentInvestasi_FrameFileView } from "../_component";
|
||||
import { MODEl_PROSPEKTUS_INVESTASI } from "../_lib/interface";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { ActionIcon, Box, Container, Group, Header, rem } from "@mantine/core";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { IconChevronLeft, IconX } from "@tabler/icons-react";
|
||||
import { ActionIcon, Box, Container, Group, Header, rem } from "@mantine/core";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Investasi_ViewFileViewer } from "../_view";
|
||||
|
||||
export function Investasi_UiFileView({ prospekId }: { prospekId: string }) {
|
||||
return (
|
||||
@@ -31,7 +28,7 @@ export function Investasi_UiFileView({ prospekId }: { prospekId: string }) {
|
||||
<Container mih={"100vh"} p={0} size={rem(500)} bg={MainColor.black}>
|
||||
<HeaderView />
|
||||
|
||||
<ComponentInvestasi_FrameFileView
|
||||
<Investasi_ViewFileViewer
|
||||
fileId={prospekId}
|
||||
path={RouterInvestasi_OLD.api_file_prospektus}
|
||||
/>
|
||||
@@ -1,27 +1,23 @@
|
||||
import { Stack } from "@mantine/core";
|
||||
// import { useState } from "react";
|
||||
// import { Document, Page, pdfjs } from "react-pdf";
|
||||
// import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||
// import "react-pdf/dist/Page/TextLayer.css";
|
||||
// import styles from "./styles.module.css";
|
||||
import { useState } from "react";
|
||||
import { Document, Page, pdfjs } from "react-pdf";
|
||||
import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||
import "react-pdf/dist/Page/TextLayer.css";
|
||||
import styles from "./styles.module.css";
|
||||
|
||||
// pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
||||
// "pdfjs-dist/build/pdf.worker.min.mjs",
|
||||
// import.meta.url
|
||||
// ).toString();
|
||||
|
||||
export function ComponentInvestasi_FrameFileView({
|
||||
export function Investasi_ViewFileViewer({
|
||||
fileId,
|
||||
path,
|
||||
}: {
|
||||
fileId: string;
|
||||
path: string;
|
||||
}) {
|
||||
return (
|
||||
<Stack>
|
||||
{/* <MyFile file={path + fileId} /> */}
|
||||
</Stack>
|
||||
);
|
||||
return <Stack>{/* <MyFile file={path + fileId} /> */}</Stack>;
|
||||
}
|
||||
|
||||
// function MyFile({ file }: { file: any }) {
|
||||
13
src/app_modules/investasi/_view/index.ts
Normal file
13
src/app_modules/investasi/_view/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Investasi_ViewFileViewer } from "./file_view/view_file_viewer";
|
||||
import { Investasi_ViewBeranda } from "./main/view_beranda";
|
||||
import { Investasi_ViewInvoice } from "./transaksi/view_invoice";
|
||||
import { Investasi_ViewMetodePembayaran } from "./transaksi/view_metode_pembayaran";
|
||||
import { Investasi_ViewProsesPembelian } from "./transaksi/view_proses_pembelian";
|
||||
import { Investasi_ViewProsesTransaksi } from "./transaksi/view_proses_transaksi";
|
||||
|
||||
export { Investasi_ViewProsesPembelian };
|
||||
export { Investasi_ViewMetodePembayaran };
|
||||
export { Investasi_ViewInvoice };
|
||||
export { Investasi_ViewProsesTransaksi };
|
||||
export { Investasi_ViewFileViewer };
|
||||
export { Investasi_ViewBeranda };
|
||||
73
src/app_modules/investasi/_view/main/view_beranda.tsx
Normal file
73
src/app_modules/investasi/_view/main/view_beranda.tsx
Normal file
@@ -0,0 +1,73 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/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 { Box, Center } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import { Investasi_ComponentButtonUpdateBeranda } from "../../_component";
|
||||
import { Investasi_ComponentCardBeranda } from "../../_component/main/comp_card_beranda";
|
||||
import { investasi_funGetAllPublish } from "../../fun/get_all_investasi";
|
||||
|
||||
export function Investasi_ViewBeranda({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: any[];
|
||||
}) {
|
||||
const [data, setData] = useState(dataInvestasi);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
const [isNewPost, setIsNewPost] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
mqtt_client.subscribe("Beranda_Investasi");
|
||||
|
||||
mqtt_client.on("message", (topic, message) => {
|
||||
const newPost = JSON.parse(message.toString());
|
||||
setIsNewPost(newPost);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{isNewPost && (
|
||||
<Investasi_ComponentButtonUpdateBeranda
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setIsNewPost(val.isNewPost);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Box>
|
||||
<ComponentGlobal_CreateButton path={RouterInvestasi_OLD.create} />
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="82vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await investasi_funGetAllPublish({
|
||||
page: activePage + 1,
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => <Investasi_ComponentCardBeranda data={item as any} />}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import { IconCamera, IconCircleCheck } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function ComponentInvestasi_ViewInvoice({
|
||||
export function Investasi_ViewInvoice({
|
||||
dataInvoice,
|
||||
}: {
|
||||
dataInvoice: any;
|
||||
@@ -8,7 +8,7 @@ import { useLocalStorage } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function ComponentInvestasi_BoxMetodePembayaran({
|
||||
export function Investasi_ViewMetodePembayaran({
|
||||
listBank,
|
||||
}: {
|
||||
listBank: any[];
|
||||
@@ -20,7 +20,7 @@ import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { gs_investas_menu } from "../../g_state";
|
||||
import { NEW_RouterInvestasi } from "../../../../app/lib/router_hipmi/router_investasi";
|
||||
|
||||
export function ComponentInvestasi_BoxPembelian({
|
||||
export function Investasi_ViewProsesPembelian({
|
||||
dataInvestasi,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
@@ -1,21 +1,18 @@
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
Stack,
|
||||
Paper,
|
||||
Title,
|
||||
Center,
|
||||
Loader,
|
||||
Group,
|
||||
Loader,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconBrandWhatsapp } from "@tabler/icons-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export function ComponentInvestasi_ProsesAccAdmin() {
|
||||
export function Investasi_ViewProsesTransaksi() {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
@@ -3,7 +3,10 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import moment from "moment";
|
||||
|
||||
export async function investasi_funGetAllPublish() {
|
||||
export async function investasi_funGetAllPublish({ page }: { page: number }) {
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.investasi.findMany({
|
||||
where: {
|
||||
masterStatusInvestasiId: "1",
|
||||
@@ -23,8 +26,6 @@ export async function investasi_funGetAllPublish() {
|
||||
moment(new Date()).diff(new Date(a.countDown as any), "days") <=
|
||||
0
|
||||
) {
|
||||
// console.log(a.MasterPencarianInvestor?.name);
|
||||
|
||||
await prisma.investasi.update({
|
||||
where: {
|
||||
id: a.id,
|
||||
@@ -51,34 +52,25 @@ export async function investasi_funGetAllPublish() {
|
||||
// klo ada, update status
|
||||
|
||||
const dataFix = await prisma.investasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: [
|
||||
{
|
||||
masterProgresInvestasiId: "asc",
|
||||
},
|
||||
{
|
||||
countDown: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
masterStatusInvestasiId: "1",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
progress: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
imagesId: true,
|
||||
include: {
|
||||
ProspektusInvestasi: true,
|
||||
MasterPembagianDeviden: true,
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
MasterProgresInvestasi: true,
|
||||
countDown: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export default async function getNorekInvestasi(id: string) {
|
||||
const res = await prisma.masterBank.findUnique({
|
||||
where: { id: id },
|
||||
select: {
|
||||
name: true,
|
||||
namaBank: true,
|
||||
norek: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import MainInvestasi from "./main/view";
|
||||
import LayoutMainInvestasi from "./main/layout";
|
||||
import InvestasiCreate from "./create/view";
|
||||
import InvestasiCreateLayout from "./create/layout";
|
||||
import UploadGambarInvestasi from "./upload/view";
|
||||
@@ -69,8 +67,6 @@ import StatusPesananInvetsatsi from "./status_pesanan/view";
|
||||
import LayoutStatusPesananInvestasi from "./status_pesanan/layout";
|
||||
|
||||
export {
|
||||
MainInvestasi,
|
||||
LayoutMainInvestasi,
|
||||
InvestasiCreate,
|
||||
InvestasiCreateLayout,
|
||||
UploadGambarInvestasi,
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import {
|
||||
ActionIcon,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconCash,
|
||||
IconChartHistogram,
|
||||
IconChartPie,
|
||||
IconNotes,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { gs_investas_menu } from "../g_state";
|
||||
|
||||
export default function LayoutMainInvestasi({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [active, setActive] = useAtom(gs_investas_menu);
|
||||
|
||||
const listFooter = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Bursa",
|
||||
route: RouterInvestasi_OLD.main,
|
||||
icon: <IconChartHistogram />,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Portofolio",
|
||||
route: RouterInvestasi_OLD.main_porto,
|
||||
icon: <IconChartPie />,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Saham Saya",
|
||||
route: RouterInvestasi_OLD.main_investasi,
|
||||
icon: <IconCash />,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Transaksi",
|
||||
route: RouterInvestasi_OLD.main_transaksi,
|
||||
icon: <IconNotes />,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
routerLeft={RouterCrowd.main}
|
||||
title="Investasi"
|
||||
// icon={<IconPencilPlus />}
|
||||
// route2={"/dev/investasi/create"}
|
||||
/>
|
||||
}
|
||||
footer={
|
||||
<SimpleGrid cols={listFooter.length} h={"9vh"} mx={"xs"}>
|
||||
{listFooter.map((e, i) => (
|
||||
<Stack key={i} align="center" justify="center" spacing={0}>
|
||||
<ActionIcon
|
||||
// disabled={e.path === "" ? true : false}
|
||||
variant="transparent"
|
||||
c={active === i ? MainColor.yellow : "white"}
|
||||
onClick={
|
||||
() => {
|
||||
router.push(e.route);
|
||||
setActive(i);
|
||||
}
|
||||
// e.route === ""
|
||||
// ? ComponentGlobal_NotifikasiPeringatan("Cooming Soon")
|
||||
// : (router.replace(e.route), setActive(i))
|
||||
}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
<Text
|
||||
c={active === i ? MainColor.yellow : "white"}
|
||||
fz={"xs"}
|
||||
lineClamp={1}
|
||||
>
|
||||
{e.name}
|
||||
</Text>
|
||||
</Stack>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
|
||||
// <Footer height={"10vh"} bg={"black"}>
|
||||
// <Grid align="center" h={"10vh"} pt={"xs"} grow>
|
||||
|
||||
// {listFooter.map((e, k) => (
|
||||
// <Grid.Col
|
||||
// key={e.id}
|
||||
// span={3}
|
||||
// onClick={() => {
|
||||
// router.push(e.route);
|
||||
// setActive(k);
|
||||
// }}
|
||||
// >
|
||||
// <Center h={"100%"}>
|
||||
// <Flex direction={"column"} align={"center"} w={"100%"}>
|
||||
// <ActionIcon
|
||||
// variant="transparent"
|
||||
// c={active === k ? "blue" : "white"}
|
||||
// >
|
||||
// {e.icon}
|
||||
// </ActionIcon>
|
||||
// <Text c={active === k ? "blue" : "white"} fz={"xs"}>
|
||||
// {e.name}
|
||||
// </Text>
|
||||
// </Flex>
|
||||
// </Center>
|
||||
// </Grid.Col>
|
||||
// ))}
|
||||
// </Grid>
|
||||
// </Footer>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import {
|
||||
Affix,
|
||||
AspectRatio,
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
CardSection,
|
||||
Group,
|
||||
Image,
|
||||
Progress,
|
||||
rem,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useShallowEffect, useWindowScroll } from "@mantine/hooks";
|
||||
import { IconCircleCheck, IconXboxX } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { investasi_funGetAllPublish } from "../fun/get_all_investasi";
|
||||
|
||||
export default function MainInvestasi({
|
||||
listData,
|
||||
}: {
|
||||
listData: MODEL_INVESTASI[];
|
||||
}) {
|
||||
// console.log(listData)
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(listData);
|
||||
const [isLoadingDetail, setLoadingDetail] = useState(false);
|
||||
const [isNewPost, setIsNewPost] = useState(false);
|
||||
|
||||
// console.log(dataWaktuHabis)
|
||||
|
||||
useShallowEffect(() => {
|
||||
mqtt_client.subscribe("Beranda_Investasi");
|
||||
|
||||
mqtt_client.on("message", (topic, message) => {
|
||||
const newPost = JSON.parse(message.toString());
|
||||
setIsNewPost(newPost);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{isNewPost && (
|
||||
<Affix position={{ top: rem(100) }} w={"100%"}>
|
||||
<ButtonUpdateBeranda
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setIsNewPost(val.isNewPost);
|
||||
}}
|
||||
/>
|
||||
</Affix>
|
||||
)}
|
||||
|
||||
<ComponentGlobal_CreateButton path={RouterInvestasi_OLD.create} />
|
||||
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
data.map((e) => (
|
||||
<Card
|
||||
key={e.id}
|
||||
style={{
|
||||
padding: "15px",
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderRadius: "10px",
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
marginInline: "15px",
|
||||
}}
|
||||
onClick={() => {
|
||||
setLoadingDetail(true);
|
||||
router.push(RouterInvestasi_OLD.detail + `${e.id}`);
|
||||
}}
|
||||
>
|
||||
<CardSection py={"md"} px={"sm"}>
|
||||
<AspectRatio ratio={1 / 1} mah={250}>
|
||||
<Box style={{ borderRadius: "7px" }}>
|
||||
{e.imagesId ? (
|
||||
<Image
|
||||
radius={"sm"}
|
||||
alt="Foto"
|
||||
src={RouterInvestasi_OLD.api_gambar + `${e.imagesId}`}
|
||||
w={200}
|
||||
/>
|
||||
) : (
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
)}
|
||||
</Box>
|
||||
</AspectRatio>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<Stack>
|
||||
<Title align="center" order={3}>
|
||||
{e.title}
|
||||
</Title>
|
||||
{/* <Progress
|
||||
label={(+e.progress).toFixed(2) + " %"}
|
||||
value={+e.progress}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/> */}
|
||||
<Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
((+e.totalLembar - +e.sisaLembar) / +e.totalLembar) *
|
||||
100
|
||||
).toFixed(1) +
|
||||
"%"
|
||||
}
|
||||
value={
|
||||
+(
|
||||
((+e.totalLembar - +e.sisaLembar) / +e.totalLembar) *
|
||||
100
|
||||
).toFixed(1)
|
||||
}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
</Stack>
|
||||
</CardSection>
|
||||
|
||||
<CardSection p={"md"}>
|
||||
<Group position="right">
|
||||
{e.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>
|
||||
{+e.MasterPencarianInvestor.name -
|
||||
moment(new Date()).diff(new Date(e.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 truncate>Sisa waktu:</Text>
|
||||
<Text truncate>
|
||||
{Number(e.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(e.countDown),
|
||||
"days"
|
||||
)}
|
||||
</Text>
|
||||
<Text truncate>Hari</Text>
|
||||
</Group>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</CardSection>
|
||||
</Card>
|
||||
))
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ButtonUpdateBeranda({
|
||||
onLoadData,
|
||||
}: {
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
async function onLoaded() {
|
||||
const loadData = await investasi_funGetAllPublish();
|
||||
onLoadData({
|
||||
data: loadData,
|
||||
isNewPost: false,
|
||||
});
|
||||
|
||||
setIsLoading(true);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<center>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
border: `1px solid ${AccentColor.skyblue}`,
|
||||
}}
|
||||
bg={AccentColor.blue}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
onClick={() => onLoaded()}
|
||||
>
|
||||
Update beranda
|
||||
</Button>
|
||||
</center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import toast from "react-simple-toasts";
|
||||
import {
|
||||
MODEL_INVESTASI,
|
||||
MODEL_Transaksi_Investasi,
|
||||
MODEL_DATA_BANK,
|
||||
MODEL_MASTER_BANK,
|
||||
} from "../_lib/interface";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_TransferValue } from "../g_state";
|
||||
@@ -36,7 +36,7 @@ export default function MetodeTransferInvestasi({
|
||||
authorId,
|
||||
}: {
|
||||
dataInvestasi: MODEL_INVESTASI;
|
||||
namaBank: MODEL_DATA_BANK[];
|
||||
namaBank: MODEL_MASTER_BANK[];
|
||||
authorId: string;
|
||||
}) {
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
@@ -66,7 +66,7 @@ export default function MetodeTransferInvestasi({
|
||||
if (res.status === 200) {
|
||||
setTransferValue({
|
||||
...transferValue,
|
||||
namaBank: res.res?.name as any,
|
||||
namaBank: res.res?.namaBank as any,
|
||||
nomorRekening: res.res?.norek as any,
|
||||
});
|
||||
} else {
|
||||
@@ -100,7 +100,7 @@ export default function MetodeTransferInvestasi({
|
||||
<Flex direction={"column"} gap={"lg"} mt="xs">
|
||||
{bank.map((e) => (
|
||||
<Box key={e.id}>
|
||||
<Radio value={e.id} label={e.name} />
|
||||
<Radio value={e.id} label={e.namaBank} />
|
||||
</Box>
|
||||
))}
|
||||
</Flex>
|
||||
|
||||
@@ -1,32 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Center,
|
||||
Group,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { Box, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import toast from "react-simple-toasts";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
MODEL_Transaksi_Investasi,
|
||||
Model_Status_Transaksi_Investasi,
|
||||
} from "../_lib/interface";
|
||||
import { useState } from "react";
|
||||
import moment from "moment";
|
||||
import funCountDown from "../fun/fun_countdown_investasi";
|
||||
import funGantiStatusTransaksi_Investasi from "../fun/fun_ganti_status_transaksi";
|
||||
import { useInterval, useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function TransaksiInvestasi({
|
||||
statusTransaksi,
|
||||
@@ -58,7 +43,7 @@ export default function TransaksiInvestasi({
|
||||
}
|
||||
}
|
||||
|
||||
if (_.isEmpty(transaksi)) return <ComponentGlobal_IsEmptyData />;
|
||||
if (_.isEmpty(transaksi)) return <ComponentGlobal_IsEmptyData text="Tidak ada transaksi" />;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -251,10 +251,11 @@ function ButtonAction({ value, file }: { value: MODEL_JOB; file: FormData }) {
|
||||
pesan: create.data?.title as any,
|
||||
title: "Job baru",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
// console.log(notif);
|
||||
// console.log(notif); .
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
@@ -303,8 +306,7 @@ function ButtonAction({
|
||||
if (res.status === 201) {
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Membuat Profile", 3000);
|
||||
// setTimeout(() => router.push(RouterHome.main_home), 2000);
|
||||
router.push(RouterHome.main_home);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,15 @@ export default async function notifikasiToAdmin_funCreate({
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
}) {
|
||||
|
||||
const getAdmin = await prisma.user.findMany({
|
||||
where: {
|
||||
active: true,
|
||||
masterUserRoleId: "2",
|
||||
NOT: {
|
||||
masterUserRoleId: "1",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// console.log(getAdmin);
|
||||
|
||||
for (let a of getAdmin) {
|
||||
const create = await prisma.notifikasi.create({
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user