fix
## Deskripsi: - Optimalisasi admin voting ## No issue
@@ -76,7 +76,6 @@
|
|||||||
"react-pdf": "^9.1.0",
|
"react-pdf": "^9.1.0",
|
||||||
"react-quill": "^2.0.0",
|
"react-quill": "^2.0.0",
|
||||||
"react-responsive-carousel": "^3.2.23",
|
"react-responsive-carousel": "^3.2.23",
|
||||||
"react-simple-toasts": "^5.10.0",
|
|
||||||
"react-toastify": "^9.1.3",
|
"react-toastify": "^9.1.3",
|
||||||
"socket.io-client": "^4.7.2",
|
"socket.io-client": "^4.7.2",
|
||||||
"tailwindcss": "3.3.3",
|
"tailwindcss": "3.3.3",
|
||||||
|
|||||||
BIN
public/file/2cd52f2b-adc2-4406-9ac4-fee79b2211cb.pdf
Normal file
BIN
public/investasi/aecade9f-a9c6-4c65-b0f6-24ac3e074a58.jpg
Normal file
|
After Width: | Height: | Size: 609 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/map/foto/46652933-8736-44d7-8a0b-d2a7ba80847d.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
public/map/foto/827d47a1-7578-4a6e-8441-6f557ca0e610.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/map/pin/285525f9-7e90-454c-8615-3cccd731441b.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
public/map/pin/3ff6721e-6f70-49a1-ba30-e9a0256fbea6.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
public/portofolio/logo/178ae3d7-57e9-474b-8dc7-1b1441eb1055.jpg
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
public/portofolio/logo/e33d3035-9513-479d-8fb8-2788206bde03.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
@@ -1,8 +1,9 @@
|
|||||||
import { AdminVote_Riwayat } from "@/app_modules/admin/vote";
|
import { AdminVote_Riwayat } from "@/app_modules/admin/vote";
|
||||||
|
import { adminVote_funGetListRiwayat } from "@/app_modules/admin/vote/fun";
|
||||||
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
|
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const dataVote = await AdminVote_getListTableByStatusId("0");
|
const dataVote = await adminVote_funGetListRiwayat({page: 1});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { AdminVote_TablePublish } from "@/app_modules/admin/vote";
|
import { AdminVote_TablePublish } from "@/app_modules/admin/vote";
|
||||||
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
|
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
|
||||||
|
import { adminVote_funGetListPublish } from "@/app_modules/admin/vote/fun/get/status/get_list_publish";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const dataVote = await AdminVote_getListTableByStatusId("1")
|
const dataVote = await adminVote_funGetListPublish({page: 1});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { AdminVote_TableReject } from "@/app_modules/admin/vote";
|
import { AdminVote_TableReject } from "@/app_modules/admin/vote";
|
||||||
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
|
import { adminVote_funGetListReject } from "@/app_modules/admin/vote/fun";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const dataVote = await AdminVote_getListTableByStatusId("4");
|
const dataVote = await adminVote_funGetListReject({ page: 1 });
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminVote_TableReject dataVote={dataVote as any}/>
|
<AdminVote_TableReject dataVote={dataVote as any} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { AdminVote_TableReview } from "@/app_modules/admin/vote";
|
import { AdminVote_TableReview } from "@/app_modules/admin/vote";
|
||||||
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
|
import { adminVote_funGetListReview } from "@/app_modules/admin/vote/fun";
|
||||||
|
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listVote = await AdminVote_getListTableByStatusId("2")
|
const listVote = await adminVote_funGetListReview({ page: 1 });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
|
||||||
|
|
||||||
export default async function Page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<ComponentAdminGlobal_LoadingPage />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -8,26 +8,26 @@ import { unsealData } from "iron-session";
|
|||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import funCountDown from "@/app_modules/investasi/fun/fun_countdown_investasi";
|
import funCountDown from "@/app_modules/investasi/fun/fun_countdown_investasi";
|
||||||
import funCekSisaWaktuTransaksiInvestasi from "@/app_modules/investasi/fun/fun_cek_sisa_waktu";
|
import funCekSisaWaktuTransaksiInvestasi from "@/app_modules/investasi/fun/fun_cek_sisa_waktu";
|
||||||
|
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
import { investasi_funGetTransaksiByUserId } from "@/app_modules/investasi/_fun";
|
||||||
|
import { Investasi_UiDaftarTransaksi } from "@/app_modules/investasi/_ui";
|
||||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const c = cookies().get("ssn");
|
const userId = await user_getOneUserId();
|
||||||
const tkn = JSON.parse(
|
|
||||||
await unsealData(c?.value as string, {
|
|
||||||
password: config.server.password,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
const userId = tkn.id;
|
|
||||||
const statusTransaksi = await getMaster_StatusTransaksiInvestasi();
|
const statusTransaksi = await getMaster_StatusTransaksiInvestasi();
|
||||||
const listTransaksi = await getListAllTransaksiById_Investasi(userId);
|
const listTransaksi = await getListAllTransaksiById_Investasi(userId);
|
||||||
// console.log(listTransaksi)
|
|
||||||
|
// NEW
|
||||||
|
const dataTransaksi = await investasi_funGetTransaksiByUserId({page: 1});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TransaksiInvestasi
|
{/* <TransaksiInvestasi
|
||||||
statusTransaksi={statusTransaksi as any}
|
statusTransaksi={statusTransaksi as any}
|
||||||
listTransaksi={listTransaksi as any}
|
listTransaksi={listTransaksi as any}
|
||||||
/>
|
/> */}
|
||||||
|
<Investasi_UiDaftarTransaksi dataTransaksi={dataTransaksi}/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
import { investasi_funGetInvoiceById } from "@/app_modules/investasi/_fun/get/fun_get_invoice_by_id";
|
||||||
import { Investasi_UiInvoice } from "@/app_modules/investasi/_ui";
|
import { Investasi_UiInvoice } from "@/app_modules/investasi/_ui";
|
||||||
|
|
||||||
export default function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
const invoiceId = params.id;
|
const invoiceId = params.id;
|
||||||
|
const dataInvoice = await investasi_funGetInvoiceById({ invoiceId: invoiceId });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Investasi_UiInvoice />
|
<Investasi_UiInvoice dataInvoice={dataInvoice as any} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default async function Page({ params }: { params: { id: string } }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Investasi_UiMetodePembayaran listBank={listBank} />
|
<Investasi_UiMetodePembayaran listBank={listBank} investasiId={investasiId} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
|
import { funGlobal_getNomorAdmin } from "@/app_modules/_global/fun/get";
|
||||||
import { Investasi_UiProsesTransaksi } from "@/app_modules/investasi/_ui";
|
import { Investasi_UiProsesTransaksi } from "@/app_modules/investasi/_ui";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
const invoiceId = params.id;
|
const invoiceId = params.id;
|
||||||
|
const nomorAdmin = await funGlobal_getNomorAdmin();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Investasi_UiProsesTransaksi />
|
<Investasi_UiProsesTransaksi nomorAdmin={nomorAdmin} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/app_modules/_global/fun/get/fun_get_nomor_admin.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export async function funGlobal_getNomorAdmin() {
|
||||||
|
const data = await prisma.nomorAdmin.findFirst({
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { funGlobal_getNomorAdmin } from "./fun_get_nomor_admin";
|
||||||
import { funGlobal_getMasterKategoriApp } from "./fun_master_kategori_app";
|
import { funGlobal_getMasterKategoriApp } from "./fun_master_kategori_app";
|
||||||
|
|
||||||
export { funGlobal_getMasterKategoriApp };
|
export { funGlobal_getMasterKategoriApp };
|
||||||
|
export { funGlobal_getNomorAdmin };
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export function AdminInvestasi_ViewDaftarInvestor() {
|
||||||
|
return <>ini daftar investor</>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||||
|
import { MODEL_DONASI_INVOICE } from "@/app_modules/donasi/model/interface";
|
||||||
|
import {
|
||||||
|
Stack,
|
||||||
|
Group,
|
||||||
|
Title,
|
||||||
|
ActionIcon,
|
||||||
|
Select,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Table,
|
||||||
|
Center,
|
||||||
|
Pagination,
|
||||||
|
Badge,
|
||||||
|
Button,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconReload } from "@tabler/icons-react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export function AdminInvestasi_ViewDaftarTransaksi({
|
||||||
|
dataTransaksi,
|
||||||
|
}: {
|
||||||
|
dataTransaksi: any;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
const [data, setData] = useState<MODEL_DONASI_INVOICE[]>(
|
||||||
|
dataTransaksi.data
|
||||||
|
);
|
||||||
|
const [isNPage, setNPage] = useState(dataTransaksi.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSelect, setSelect] = useState("");
|
||||||
|
|
||||||
|
const tableRows = data?.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.Author.username}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.DonasiMaster_Bank?.name}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<TampilanRupiahDonasi nominal={+e?.nominal} />
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", { dateStyle: "full" }).format(
|
||||||
|
e?.createdAt
|
||||||
|
)}
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Badge w={150} variant="dot">
|
||||||
|
{e?.DonasiMaster_StatusInvoice?.name}
|
||||||
|
</Badge>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
{e?.donasiMaster_StatusInvoiceId === "1" ||
|
||||||
|
e?.donasiMaster_StatusInvoiceId === "2" ? (
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
RouterAdminDonasi.transfer_invoice + `${e?.imagesId}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Cek
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
)}
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
test
|
||||||
|
{/* <Center>
|
||||||
|
{e?.donasiMaster_StatusInvoiceId === "1" ? (
|
||||||
|
<Button radius={"xl"} disabled>
|
||||||
|
Selesai
|
||||||
|
</Button>
|
||||||
|
) : e?.DonasiMaster_StatusInvoice?.id === "2" ? (
|
||||||
|
<ButtonAccept
|
||||||
|
invoiceId={e?.id}
|
||||||
|
donasiId={dataDonasi?.id}
|
||||||
|
nominal={+e?.nominal}
|
||||||
|
danaTerkumpul={+dataDonasi?.terkumpul}
|
||||||
|
target={+dataDonasi?.target}
|
||||||
|
onSuccessDonasi={(val) => {
|
||||||
|
onSuccessDonasi(val);
|
||||||
|
}}
|
||||||
|
onSuccessDonatur={(val) => {
|
||||||
|
setListDonatur(val.data);
|
||||||
|
setNPage(val.nPage);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Text>-</Text>
|
||||||
|
)}
|
||||||
|
</Center> */}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(dataDonasi, null, 2)}</pre> */}
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"gray.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Transaksi</Title>
|
||||||
|
<Group>
|
||||||
|
<ActionIcon
|
||||||
|
size={"lg"}
|
||||||
|
radius={"xl"}
|
||||||
|
variant="light"
|
||||||
|
onClick={() => {
|
||||||
|
// onRelaod();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconReload />
|
||||||
|
</ActionIcon>
|
||||||
|
<Select
|
||||||
|
placeholder="Pilih status"
|
||||||
|
value={isSelect}
|
||||||
|
data={[]}
|
||||||
|
// data={listMasterStatus.map((e) => ({
|
||||||
|
// value: e.id,
|
||||||
|
// label: e.name,
|
||||||
|
// }))}
|
||||||
|
// onChange={(val) => {
|
||||||
|
// onSelect(val);
|
||||||
|
// }}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"xl"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={1500}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Nama Investor</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Nama Bank</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Jumlah Investasi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Tanggal</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Status</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Bukti Transfer</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{tableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={isActivePage}
|
||||||
|
total={isNPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
// onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
|
import { SimpleGrid } from "@mantine/core";
|
||||||
|
import { ComponentAdminInvestasi_DetailDataAuthor } from "../../_component/detail_data_author";
|
||||||
|
import { ComponentAdminInvestasi_DetailData } from "../../_component/detail_data_investasi";
|
||||||
|
import { ComponentAdminInvestasi_DetailGambar } from "../../_component/detail_gambar_investasi";
|
||||||
|
import { ComponentAdminInvestasi_UIDetailFile } from "../../_component/ui_detail_file";
|
||||||
|
|
||||||
|
export function AdminInvestasi_ViewDetailData({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data: MODEL_INVESTASI;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SimpleGrid
|
||||||
|
cols={3}
|
||||||
|
spacing="lg"
|
||||||
|
breakpoints={[
|
||||||
|
{ maxWidth: "62rem", cols: 3, spacing: "md" },
|
||||||
|
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||||
|
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{/* Data Author */}
|
||||||
|
<ComponentAdminInvestasi_DetailDataAuthor data={data.author} />
|
||||||
|
|
||||||
|
{/* Data Foto */}
|
||||||
|
<ComponentAdminInvestasi_DetailGambar imagesId={data.imagesId} />
|
||||||
|
|
||||||
|
{/* Data Detail */}
|
||||||
|
<ComponentAdminInvestasi_DetailData data={data} />
|
||||||
|
</SimpleGrid>
|
||||||
|
<ComponentAdminInvestasi_UIDetailFile
|
||||||
|
title={data.title}
|
||||||
|
dataProspektus={data.ProspektusInvestasi}
|
||||||
|
listDokumen={data.DokumenInvestasi}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
7
src/app_modules/admin/investasi/_view/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { AdminInvestasi_ViewDaftarInvestor } from "./detail/view_daftar_investor";
|
||||||
|
import { AdminInvestasi_ViewDaftarTransaksi } from "./detail/view_daftar_transaksi";
|
||||||
|
import { AdminInvestasi_ViewDetailData } from "./detail/view_detail_data";
|
||||||
|
|
||||||
|
export { AdminInvestasi_ViewDetailData };
|
||||||
|
export { AdminInvestasi_ViewDaftarTransaksi };
|
||||||
|
export { AdminInvestasi_ViewDaftarInvestor };
|
||||||
@@ -1,159 +1,69 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import {
|
import { Button, Group, Stack } from "@mantine/core";
|
||||||
AspectRatio,
|
import { IconCircleCheck } from "@tabler/icons-react";
|
||||||
Box,
|
import { useState } from "react";
|
||||||
Center,
|
|
||||||
Grid,
|
|
||||||
Image,
|
|
||||||
List,
|
|
||||||
Paper,
|
|
||||||
SimpleGrid,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
ThemeIcon,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import {
|
||||||
import { IconCircleCheck, IconHome } from "@tabler/icons-react";
|
AdminInvestasi_ViewDaftarInvestor,
|
||||||
import investasi from "../../notifikasi/route_setting/investasi";
|
AdminInvestasi_ViewDaftarTransaksi,
|
||||||
|
AdminInvestasi_ViewDetailData,
|
||||||
|
} from "../_view";
|
||||||
|
|
||||||
export function AdminInvestasi_DetailPublish({
|
export function AdminInvestasi_DetailPublish({
|
||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
data: MODEL_INVESTASI;
|
data: MODEL_INVESTASI;
|
||||||
}) {
|
}) {
|
||||||
|
const [selectPage, setSelectPage] = useState("1");
|
||||||
|
const listPage = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
name: "Detail Data",
|
||||||
|
icon: <IconCircleCheck />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
name: "Daftar Transaksi",
|
||||||
|
icon: <IconCircleCheck />,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: "3",
|
||||||
|
// name: "Daftar Investor",
|
||||||
|
// icon: <IconCircleCheck />,
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack px={"lg"}>
|
||||||
<ComponentAdminGlobal_BackButton />
|
<ComponentAdminGlobal_BackButton />
|
||||||
<SimpleGrid cols={2}>
|
|
||||||
<InformasiAuthor data={data} />
|
<Group>
|
||||||
<InformasiDataInvestasi data={data} />
|
{listPage.map((e) => (
|
||||||
</SimpleGrid>
|
<Button
|
||||||
|
key={e.id}
|
||||||
|
color={selectPage == e.id ? "green" : "gray"}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => setSelectPage(e.id)}
|
||||||
|
style={{
|
||||||
|
transition: "all 0.3s",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{e.name}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
{selectPage == "1" ? (
|
||||||
|
<AdminInvestasi_ViewDetailData data={data} />
|
||||||
|
) : null}
|
||||||
|
{selectPage == "2" ? (
|
||||||
|
<AdminInvestasi_ViewDaftarTransaksi dataTransaksi={{}} />
|
||||||
|
) : null}
|
||||||
|
{selectPage == "3" ? <AdminInvestasi_ViewDaftarInvestor /> : null}
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function InformasiAuthor({ data }: { data: MODEL_INVESTASI }) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Paper withBorder>
|
|
||||||
<Stack p={"lg"} spacing={"xl"}>
|
|
||||||
<Title align="center" order={3}>
|
|
||||||
{data.title}
|
|
||||||
</Title>
|
|
||||||
|
|
||||||
<AspectRatio ratio={1 / 1} mah={300}>
|
|
||||||
<Center>
|
|
||||||
<Image
|
|
||||||
bg={"blue"}
|
|
||||||
style={{ borderRadius: "10px" }}
|
|
||||||
radius={"md"}
|
|
||||||
width={250}
|
|
||||||
alt=""
|
|
||||||
src={RouterInvestasi_OLD.api_gambar + `${data.imagesId}`}
|
|
||||||
/>
|
|
||||||
</Center>
|
|
||||||
</AspectRatio>
|
|
||||||
|
|
||||||
<Stack spacing={"sm"}>
|
|
||||||
<Title order={4}>Informasi pemilik</Title>
|
|
||||||
|
|
||||||
<List
|
|
||||||
spacing="xs"
|
|
||||||
size="sm"
|
|
||||||
center
|
|
||||||
icon={
|
|
||||||
<ThemeIcon color="teal" size={24} radius="xl">
|
|
||||||
<IconCircleCheck size="1rem" />
|
|
||||||
</ThemeIcon>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<List.Item>{data.author.username}</List.Item>
|
|
||||||
<List.Item>+{data.author.nomor}</List.Item>
|
|
||||||
<List.Item>{data.author.Profile.email}</List.Item>
|
|
||||||
</List>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</Paper>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function InformasiDataInvestasi({ data }: { data: MODEL_INVESTASI }) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Paper withBorder p={"lg"}>
|
|
||||||
<Stack>
|
|
||||||
<Title order={3}>Rincian Data Investasi</Title>
|
|
||||||
<Grid justify="center">
|
|
||||||
<Grid.Col>
|
|
||||||
<Grid mt={"md"} justify="center">
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
<Stack>
|
|
||||||
<Box>
|
|
||||||
<Text>Dana Dibutuhkan</Text>
|
|
||||||
<Text fw={"bold"}>
|
|
||||||
Rp.{" "}
|
|
||||||
{new Intl.NumberFormat("id-ID", {
|
|
||||||
maximumFractionDigits: 10,
|
|
||||||
}).format(+data.targetDana)}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Harga Per Lembar</Text>
|
|
||||||
<Text fw={"bold"}>
|
|
||||||
Rp.{" "}
|
|
||||||
{new Intl.NumberFormat("id-ID", {
|
|
||||||
maximumFractionDigits: 10,
|
|
||||||
}).format(+data.hargaLembar)}{" "}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Jadwal Pembagian</Text>
|
|
||||||
<Text fw={"bold"}>
|
|
||||||
{data.MasterPembagianDeviden.name} bulan{" "}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Pencarian Investor</Text>
|
|
||||||
<Text fw={"bold"}>
|
|
||||||
{data.MasterPencarianInvestor.name} hari{" "}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
<Stack>
|
|
||||||
<Box>
|
|
||||||
<Text>ROI</Text>
|
|
||||||
<Text fw={"bold"}>{data.roi} %</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Total Lembar</Text>
|
|
||||||
<Text fw={"bold"}>
|
|
||||||
{" "}
|
|
||||||
{new Intl.NumberFormat("id-ID", {
|
|
||||||
maximumFractionDigits: 10,
|
|
||||||
}).format(+data.totalLembar)}{" "}
|
|
||||||
lembar
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Pembagian Deviden</Text>
|
|
||||||
<Text fw={"bold"}>{data.MasterPeriodeDeviden.name}</Text>
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</Paper>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,38 +1,13 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||||
import { BeritaInvestasi } from "@/app_modules/investasi";
|
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import {
|
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||||
AspectRatio,
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
|
||||||
Image,
|
|
||||||
Modal,
|
|
||||||
Paper,
|
|
||||||
SimpleGrid,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
Textarea,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import {
|
|
||||||
IconAlertHexagonFilled,
|
|
||||||
IconCheck,
|
|
||||||
IconFileTypePdf,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import Link from "next/link";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import "react-simple-toasts/dist/theme/dark.css";
|
|
||||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
@@ -44,7 +19,6 @@ import { ComponentAdminInvestasi_DetailGambar } from "../_component/detail_gamba
|
|||||||
import { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
import { ComponentAdminInvestasi_UIDetailFile } from "../_component/ui_detail_file";
|
||||||
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
import { adminInvestasi_funEditStatusPublishById } from "../fun/edit/fun_status_publish_by_id";
|
||||||
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
||||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
|
||||||
|
|
||||||
export default function AdminInvestasi_DetailReview({
|
export default function AdminInvestasi_DetailReview({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
@@ -180,6 +154,7 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
cols={3}
|
cols={3}
|
||||||
spacing="lg"
|
spacing="lg"
|
||||||
@@ -207,245 +182,4 @@ export default function AdminInvestasi_DetailReview({
|
|||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Group position="apart" px={"md"}>
|
|
||||||
<ComponentAdminGlobal_BackButton
|
|
||||||
path={RouterAdminInvestasi.table_review}
|
|
||||||
/>
|
|
||||||
<Group>
|
|
||||||
<Center>
|
|
||||||
{!publish || data.MasterStatusInvestasi.id === "4" ? (
|
|
||||||
""
|
|
||||||
) : (
|
|
||||||
<Button
|
|
||||||
radius={50}
|
|
||||||
bg={"green"}
|
|
||||||
color="green"
|
|
||||||
leftIcon={<IconCheck />}
|
|
||||||
onClick={() => {
|
|
||||||
onPublish();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Publish
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</Center>
|
|
||||||
{data.MasterStatusInvestasi.id === "3" ? (
|
|
||||||
""
|
|
||||||
) : (
|
|
||||||
<Button
|
|
||||||
radius={50}
|
|
||||||
bg={"red"}
|
|
||||||
color="red"
|
|
||||||
onClick={() => setOpenModal(true)}
|
|
||||||
rightIcon={<IconAlertHexagonFilled />}
|
|
||||||
>
|
|
||||||
Reject
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
|
|
||||||
<Divider my={"md"} />
|
|
||||||
|
|
||||||
<Stack spacing={"lg"}>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
{/* Title */}
|
|
||||||
<Center my={"sm"}>
|
|
||||||
<Title order={4} mb={"xs"}>
|
|
||||||
{data.title}
|
|
||||||
</Title>
|
|
||||||
</Center>
|
|
||||||
<Paper withBorder mb={"md"} mah={300} maw={400} mx={"auto"} p={5}>
|
|
||||||
<AspectRatio ratio={16 / 9}>
|
|
||||||
<Image
|
|
||||||
alt=""
|
|
||||||
src={RouterInvestasi_OLD.api_gambar + `${data.imagesId}`}
|
|
||||||
/>
|
|
||||||
</AspectRatio>
|
|
||||||
</Paper>
|
|
||||||
</Grid.Col>
|
|
||||||
|
|
||||||
{/* Rincian Data */}
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
<Grid mt={"md"}>
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
<Stack>
|
|
||||||
<Box>
|
|
||||||
<Text>Dana Dibutuhkan</Text>
|
|
||||||
<Text>
|
|
||||||
Rp.{" "}
|
|
||||||
{new Intl.NumberFormat("id-ID", {
|
|
||||||
maximumFractionDigits: 10,
|
|
||||||
}).format(+data.targetDana)}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Harga Per Lembar</Text>
|
|
||||||
<Text>
|
|
||||||
Rp.{" "}
|
|
||||||
{new Intl.NumberFormat("id-ID", {
|
|
||||||
maximumFractionDigits: 10,
|
|
||||||
}).format(+data.hargaLembar)}{" "}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Jadwal Pembagian</Text>
|
|
||||||
<Text>{data.MasterPembagianDeviden.name} bulan </Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Pencarian Investor</Text>
|
|
||||||
<Text>{data.MasterPencarianInvestor.name} hari </Text>
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
<Stack>
|
|
||||||
<Box>
|
|
||||||
<Text>ROI</Text>
|
|
||||||
<Text>{data.roi} %</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Total Lembar</Text>
|
|
||||||
<Text>
|
|
||||||
{" "}
|
|
||||||
{new Intl.NumberFormat("id-ID", {
|
|
||||||
maximumFractionDigits: 10,
|
|
||||||
}).format(+data.totalLembar)}{" "}
|
|
||||||
lembar
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text>Pembagian Deviden</Text>
|
|
||||||
<Text>{data.MasterPeriodeDeviden.name}</Text>
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
{/* Note */}
|
|
||||||
{!publish || data.MasterStatusInvestasi.id === "4" ? (
|
|
||||||
""
|
|
||||||
) : (
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Text fw={"bold"}>Note :</Text>
|
|
||||||
<Text fw={"lighter"} fs={"italic"}>
|
|
||||||
Cek kembali kelengkapan file prospektus & semua dokumen
|
|
||||||
terkait investasi sebelum mem-publish. Jika kelengkapan file
|
|
||||||
kurang lengkap maka reject dan berikan pesan terkait
|
|
||||||
kekurangnya.
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
{publish &&
|
|
||||||
data.MasterStatusInvestasi.id === "3" &&
|
|
||||||
_.isEmpty(data.BeritaInvestasi) ? (
|
|
||||||
<BeritaInvestasi dataInvestasi={data} />
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</Grid.Col>
|
|
||||||
{/* Note dan dokumen */}
|
|
||||||
<Grid.Col span={6}>
|
|
||||||
<Stack>
|
|
||||||
{/* File file */}
|
|
||||||
<Stack>
|
|
||||||
{/* Prospektus */}
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Title order={6}>Prospektus :</Title>
|
|
||||||
{data.ProspektusInvestasi === null ? (
|
|
||||||
<Text>Tidak ada file</Text>
|
|
||||||
) : (
|
|
||||||
<Paper p={"xs"}>
|
|
||||||
<Group>
|
|
||||||
<IconFileTypePdf />
|
|
||||||
<Text>Prospektus_{data.title}</Text>
|
|
||||||
<Link
|
|
||||||
target="_blank"
|
|
||||||
href={
|
|
||||||
RouterInvestasi_OLD.api_file_prospektus +
|
|
||||||
`${
|
|
||||||
data.ProspektusInvestasi === null
|
|
||||||
? ""
|
|
||||||
: data.ProspektusInvestasi.id
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Button compact radius={50}>
|
|
||||||
Buka
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</Group>
|
|
||||||
</Paper>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
{/* Dokumen */}
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Title order={6}>Dokumen :</Title>
|
|
||||||
{_.isEmpty(data.DokumenInvestasi) ? (
|
|
||||||
<Text>Tidak ada dokumen</Text>
|
|
||||||
) : (
|
|
||||||
data.DokumenInvestasi.map((e) => (
|
|
||||||
<Paper p={"xs"} key={e.id}>
|
|
||||||
<Group>
|
|
||||||
<IconFileTypePdf />
|
|
||||||
<Text>{e.title}</Text>
|
|
||||||
<Link
|
|
||||||
target="_blank"
|
|
||||||
href={
|
|
||||||
RouterInvestasi_OLD.api_file_dokumen + `${e.id}`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Button compact radius={50}>
|
|
||||||
Buka
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</Group>
|
|
||||||
</Paper>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Modal
|
|
||||||
centered
|
|
||||||
opened={openModal}
|
|
||||||
onClose={() => setOpenModal(false)}
|
|
||||||
// withCloseButton={false}
|
|
||||||
title="Masukan alasan penolakan"
|
|
||||||
>
|
|
||||||
<Textarea
|
|
||||||
mb={"md"}
|
|
||||||
autosize
|
|
||||||
minRows={2}
|
|
||||||
maxRows={4}
|
|
||||||
value={data.catatan === null ? [] : data.catatan}
|
|
||||||
onChange={(val) =>
|
|
||||||
setData({
|
|
||||||
...data,
|
|
||||||
catatan: val.target.value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Group position="right">
|
|
||||||
<Button radius={50} compact onClick={() => onReject()}>
|
|
||||||
Simpan
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
</Modal>
|
|
||||||
</Stack>
|
|
||||||
{/* <pre>{JSON.stringify(investasi, null, 2)}</pre> */}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||||
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
@@ -12,7 +13,7 @@ import {
|
|||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
Title
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconSearch } from "@tabler/icons-react";
|
import { IconSearch } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -21,7 +22,6 @@ import { useState } from "react";
|
|||||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||||
import { adminInvestasi_funGetAllPublish } from "../fun/get/get_all_publish";
|
import { adminInvestasi_funGetAllPublish } from "../fun/get/get_all_publish";
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
|
||||||
|
|
||||||
export default function Admin_TablePublishInvestasi({
|
export default function Admin_TablePublishInvestasi({
|
||||||
dataInvestsi,
|
dataInvestsi,
|
||||||
@@ -45,6 +45,8 @@ function TableView({ listData }: { listData: any }) {
|
|||||||
const [nPage, setNPage] = useState(listData.nPage);
|
const [nPage, setNPage] = useState(listData.nPage);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
const [isSearch, setSearch] = useState("");
|
const [isSearch, setSearch] = useState("");
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
|
||||||
async function onSearch(s: string) {
|
async function onSearch(s: string) {
|
||||||
setSearch(s);
|
setSearch(s);
|
||||||
@@ -99,12 +101,16 @@ function TableView({ listData }: { listData: any }) {
|
|||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
<Button
|
<Button
|
||||||
|
loading={isLoading && idData === e.id}
|
||||||
|
loaderPosition="center"
|
||||||
bg={"green"}
|
bg={"green"}
|
||||||
color="green"
|
color="green"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
router.push(RouterAdminInvestasi.detail_publish +`${e.id}`)
|
setIdData(e.id);
|
||||||
}
|
setLoading(true);
|
||||||
|
router.push(RouterAdminInvestasi.detail_publish + `${e.id}`);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
@@ -122,6 +122,8 @@ function TableView({ listData }: { listData: any }) {
|
|||||||
const [nPage, setNPage] = useState(listData.nPage);
|
const [nPage, setNPage] = useState(listData.nPage);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
const [isSearch, setSearch] = useState("");
|
const [isSearch, setSearch] = useState("");
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
|
||||||
async function onSearch(s: string) {
|
async function onSearch(s: string) {
|
||||||
setSearch(s);
|
setSearch(s);
|
||||||
@@ -165,11 +167,15 @@ function TableView({ listData }: { listData: any }) {
|
|||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
<Button
|
<Button
|
||||||
|
loading={isLoading && idData === e.id}
|
||||||
|
loaderPosition="center"
|
||||||
color="orange"
|
color="orange"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
router.push(RouterAdminInvestasi.detail_reject + `${e.id}`)
|
setIdData(e.id);
|
||||||
}
|
setLoading(true);
|
||||||
|
router.push(RouterAdminInvestasi.detail_reject + `${e.id}`);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||||
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
@@ -50,6 +50,8 @@ function TableView({ listData }: { listData: any }) {
|
|||||||
const [nPage, setNPage] = useState(listData.nPage);
|
const [nPage, setNPage] = useState(listData.nPage);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
const [isSearch, setSearch] = useState("");
|
const [isSearch, setSearch] = useState("");
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
|
||||||
async function onSearch(s: string) {
|
async function onSearch(s: string) {
|
||||||
setSearch(s);
|
setSearch(s);
|
||||||
@@ -106,11 +108,15 @@ function TableView({ listData }: { listData: any }) {
|
|||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={200}>
|
||||||
<Button
|
<Button
|
||||||
|
loading={isLoading && idData === e.id}
|
||||||
|
loaderPosition="center"
|
||||||
color="orange"
|
color="orange"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`)
|
setIdData(e.id);
|
||||||
}
|
setLoading(true);
|
||||||
|
router.push(RouterAdminInvestasi_OLD.konfirmasi + `${e.id}`);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,29 +1,25 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
|
||||||
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
||||||
import {
|
import {
|
||||||
Stack,
|
|
||||||
Center,
|
|
||||||
Spoiler,
|
|
||||||
Button,
|
|
||||||
Modal,
|
|
||||||
Paper,
|
|
||||||
Title,
|
|
||||||
Grid,
|
|
||||||
Avatar,
|
|
||||||
Group,
|
|
||||||
Divider,
|
|
||||||
Box,
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { IconBan, IconEyeCheck } from "@tabler/icons-react";
|
import { IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||||
import { IconEyeShare } from "@tabler/icons-react";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
@@ -31,6 +27,8 @@ import { useState } from "react";
|
|||||||
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
||||||
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
|
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
|
||||||
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
|
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
|
||||||
|
import { adminVote_funGetListRiwayat } from "../../fun";
|
||||||
|
import { IconCircleCheckFilled } from "@tabler/icons-react";
|
||||||
|
|
||||||
export default function AdminVote_Riwayat({
|
export default function AdminVote_Riwayat({
|
||||||
dataVote,
|
dataVote,
|
||||||
@@ -40,46 +38,73 @@ export default function AdminVote_Riwayat({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Riwayat" />
|
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||||
<TableStatus listPublish={dataVote} />
|
<TableStatus listPublish={dataVote} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [data, setData] = useState(listPublish);
|
const [data, setData] = useState<MODEL_VOTING[]>(listPublish.data);
|
||||||
const [hasil, setHasil] = useState<any[]>();
|
const [hasil, setHasil] = useState<any[]>();
|
||||||
const [kontributor, setKontributor] = useState<any[]>();
|
const [kontributor, setKontributor] = useState<any[]>();
|
||||||
const [voteId, setVoteId] = useState("");
|
const [voteId, setVoteId] = useState("");
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminVote_funGetListRiwayat({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminVote_funGetListRiwayat({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
const TableRows = data.map((e, i) => (
|
const TableRows = data.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
<Button
|
<Button
|
||||||
loading={
|
loading={
|
||||||
e.id === voteId ? (loading === true ? true : false) : false
|
e?.id === voteId ? (loading === true ? true : false) : false
|
||||||
}
|
}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="green"
|
color="green"
|
||||||
leftIcon={<IconEyeCheck />}
|
leftIcon={<IconCircleCheckFilled />}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setVoteId(e.id);
|
setVoteId(e?.id);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
await new Promise((r) => setTimeout(r, 500));
|
await new Promise((r) => setTimeout(r, 500));
|
||||||
onList(e.id, setHasil, setKontributor, setLoading, open);
|
onList(e?.id, setHasil, setKontributor, setLoading, open);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Hasil Voting
|
Lihat Hasil
|
||||||
</Button>
|
</Button>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>{e.title}</Center>
|
<Center>{e?.Author?.username}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.title}</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
@@ -89,27 +114,27 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
maxHeight={50}
|
maxHeight={50}
|
||||||
showLabel="tampilkan"
|
showLabel="tampilkan"
|
||||||
>
|
>
|
||||||
{e.deskripsi}
|
{e?.deskripsi}
|
||||||
</Spoiler>
|
</Spoiler>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<th>
|
<th>
|
||||||
<Stack>
|
<Stack>
|
||||||
{e.Voting_DaftarNamaVote.map((v) => (
|
{e?.Voting_DaftarNamaVote.map((v) => (
|
||||||
<Box key={v.id}>
|
<Box key={v?.id}>
|
||||||
<Text>- {v.value}</Text>
|
<Text>- {v?.value}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
{e.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
{e?.awalVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
{e.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
{e?.akhirVote.toLocaleDateString("id-ID", { dateStyle: "long" })}
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -117,6 +142,76 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"gray.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Riwayat</Title>
|
||||||
|
<TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Masukan judul"
|
||||||
|
onChange={(val) => {
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={1500}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Judul</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Deskripsi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Pilihan</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Mulai Vote</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Selesai Vote</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{TableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={isActivePage}
|
||||||
|
total={isNPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
@@ -128,54 +223,6 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
kontributor={kontributor}
|
kontributor={kontributor}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Box>
|
|
||||||
<Box bg={"gray.1"} p={"xs"}>
|
|
||||||
<Title order={6} c={"gray"}>
|
|
||||||
RIWAYAT
|
|
||||||
</Title>
|
|
||||||
</Box>
|
|
||||||
<Table
|
|
||||||
withBorder
|
|
||||||
verticalSpacing={"md"}
|
|
||||||
horizontalSpacing={"xl"}
|
|
||||||
p={"md"}
|
|
||||||
striped
|
|
||||||
highlightOnHover
|
|
||||||
>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<Center>Aksi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Judul</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Deskripsi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Pilihan</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Mulai Vote</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Selesai Vote</Center>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{TableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
<Center>
|
|
||||||
{_.isEmpty(TableRows) ? (
|
|
||||||
<Center h={"50vh"}>
|
|
||||||
<Title order={6}>Tidak Ada Data</Title>
|
|
||||||
</Center>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,31 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
|
||||||
import {
|
import {
|
||||||
MODEL_EVENT,
|
|
||||||
MODEL_EVENT_PESERTA,
|
|
||||||
} from "@/app_modules/event/model/interface";
|
|
||||||
import {
|
|
||||||
MODEL_VOTE_KONTRIBUTOR,
|
|
||||||
MODEL_VOTING,
|
|
||||||
MODEL_VOTING_DAFTAR_NAMA_VOTE,
|
|
||||||
} from "@/app_modules/vote/model/interface";
|
|
||||||
import {
|
|
||||||
Avatar,
|
|
||||||
Badge,
|
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
Modal,
|
||||||
|
Pagination,
|
||||||
Paper,
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
Spoiler,
|
Spoiler,
|
||||||
Stack,
|
Stack,
|
||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
|
TextInput,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
|
import { IconCircleCheckFilled, IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
||||||
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
|
import { AdminVote_getHasilById } from "../../fun/get/get_hasil_by_id";
|
||||||
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
|
import { AdminVote_getListKontributorById } from "../../fun/get/get_list_kontributor_by_id";
|
||||||
import ComponentAdminVote_DetailHasil from "../../component/detail_hasil";
|
import { adminVote_funGetListPublish } from "../../fun/get/status/get_list_publish";
|
||||||
|
|
||||||
export default function AdminVote_TablePublish({
|
export default function AdminVote_TablePublish({
|
||||||
dataVote,
|
dataVote,
|
||||||
@@ -48,22 +35,46 @@ export default function AdminVote_TablePublish({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Publish" />
|
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||||
<TableStatus listPublish={dataVote} />
|
<TableStatus listPublish={dataVote} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [data, setData] = useState(listPublish);
|
const [data, setData] = useState<MODEL_VOTING[]>(listPublish.data);
|
||||||
const [hasil, setHasil] = useState<any[]>();
|
const [hasil, setHasil] = useState<any[]>();
|
||||||
const [kontributor, setKontributor] = useState<any[]>();
|
const [kontributor, setKontributor] = useState<any[]>();
|
||||||
const [voteId, setVoteId] = useState("");
|
const [voteId, setVoteId] = useState("");
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminVote_funGetListPublish({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminVote_funGetListPublish({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
const TableRows = data.map((e, i) => (
|
const TableRows = data.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
@@ -74,7 +85,7 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
}
|
}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="green"
|
color="green"
|
||||||
leftIcon={<IconEyeCheck />}
|
leftIcon={<IconCircleCheckFilled />}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setVoteId(e?.id);
|
setVoteId(e?.id);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -87,7 +98,7 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>{e?.Author?.Profile?.name}</Center>
|
<Center>{e?.Author?.username}</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>{e?.title}</Center>
|
<Center>{e?.title}</Center>
|
||||||
@@ -128,6 +139,76 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"green.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Publish</Title>
|
||||||
|
<TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Masukan judul"
|
||||||
|
onChange={(val) => {
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={1500}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Judul</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Deskripsi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Pilihan</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Mulai Vote</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Selesai Vote</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{TableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={isActivePage}
|
||||||
|
total={isNPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
@@ -139,57 +220,6 @@ function TableStatus({ listPublish }: { listPublish: MODEL_VOTING[] }) {
|
|||||||
kontributor={kontributor}
|
kontributor={kontributor}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Box>
|
|
||||||
<Box bg={"green.1"} p={"xs"}>
|
|
||||||
<Title order={6} c={"green"}>
|
|
||||||
PUBLISH
|
|
||||||
</Title>
|
|
||||||
</Box>
|
|
||||||
<Table
|
|
||||||
withBorder
|
|
||||||
verticalSpacing={"md"}
|
|
||||||
horizontalSpacing={"xl"}
|
|
||||||
p={"md"}
|
|
||||||
striped
|
|
||||||
highlightOnHover
|
|
||||||
>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<Center>Aksi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Author</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Judul</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Deskripsi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Pilihan</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Mulai Vote</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Selesai Vote</Center>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{TableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
<Center>
|
|
||||||
{_.isEmpty(TableRows) ? (
|
|
||||||
<Center h={"50vh"}>
|
|
||||||
<Title order={6}>Tidak Ada Data</Title>
|
|
||||||
</Center>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
|
||||||
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
import { MODEL_VOTING } from "@/app_modules/vote/model/interface";
|
||||||
import {
|
import {
|
||||||
Avatar,
|
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
Modal,
|
||||||
|
Pagination,
|
||||||
Paper,
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Spoiler,
|
Spoiler,
|
||||||
@@ -20,40 +18,80 @@ import {
|
|||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
Textarea,
|
Textarea,
|
||||||
|
TextInput,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { IconBan, IconEyeShare } from "@tabler/icons-react";
|
import { IconBan, IconSearch } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { adminVote_funGetListReject } from "../../fun";
|
||||||
import { AdminVote_funEditCatatanRejectById } from "../../fun/edit/fun_edit_catatan_reject_by_id";
|
import { AdminVote_funEditCatatanRejectById } from "../../fun/edit/fun_edit_catatan_reject_by_id";
|
||||||
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
|
||||||
|
|
||||||
export default function AdminVote_TableReject({
|
export default function AdminVote_TableReject({ dataVote }: { dataVote: any }) {
|
||||||
dataVote,
|
|
||||||
}: {
|
|
||||||
dataVote: MODEL_VOTING[];
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Reject" />
|
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||||
<TableStatus listData={dataVote} />
|
<TableStatus listData={dataVote} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
function TableStatus({ listData }: { listData: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [data, setData] = useState(listData);
|
const [data, setData] = useState<MODEL_VOTING[]>(listData.data);
|
||||||
const [votingId, setVotingId] = useState("");
|
const [votingId, setVotingId] = useState("");
|
||||||
const [catatan, setCatatan] = useState("");
|
const [catatan, setCatatan] = useState("");
|
||||||
|
|
||||||
|
const [isNPage, setNPage] = useState(listData.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminVote_funGetListReject({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminVote_funGetListReject({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onReject(
|
||||||
|
votingId: string,
|
||||||
|
catatan: string,
|
||||||
|
close: any,
|
||||||
|
setData: any
|
||||||
|
) {
|
||||||
|
const res = await AdminVote_funEditCatatanRejectById(votingId, catatan);
|
||||||
|
if (res.status === 200) {
|
||||||
|
const loadData = await adminVote_funGetListReject({
|
||||||
|
page: 1,
|
||||||
|
search: isSearch,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
setActivePage(1);
|
||||||
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
close();
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const TableRows = data.map((e, i) => (
|
const TableRows = data.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
@@ -129,53 +167,32 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
opened={opened}
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
onClose={close}
|
<Group
|
||||||
centered
|
position="apart"
|
||||||
withCloseButton={false}
|
bg={"red.4"}
|
||||||
size={"lg"}
|
p={"xs"}
|
||||||
>
|
style={{ borderRadius: "6px" }}
|
||||||
<Stack>
|
>
|
||||||
<Textarea
|
<Title order={4}>Reject</Title>
|
||||||
minRows={2}
|
<TextInput
|
||||||
maxRows={5}
|
icon={<IconSearch size={20} />}
|
||||||
maxLength={300}
|
radius={"xl"}
|
||||||
autosize
|
placeholder="Masukan judul"
|
||||||
label="Masukan Alasan Penolakan"
|
|
||||||
placeholder="Contoh: Karena deskripsi kurang lengkap, dll"
|
|
||||||
value={catatan}
|
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setCatatan(val.target.value);
|
onSearch(val.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Group position="right">
|
</Group>
|
||||||
<Button
|
|
||||||
radius={"xl"}
|
|
||||||
onClick={() => {
|
|
||||||
onReject(votingId, catatan, close, setData);
|
|
||||||
console.log(catatan);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Simpan
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
</Stack>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<Box>
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
<Box bg={"red.1"} p={"xs"}>
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
<Title order={6} c={"red"}>
|
|
||||||
REJECT
|
|
||||||
</Title>
|
|
||||||
</Box>
|
|
||||||
<ScrollArea w={"100%"}>
|
|
||||||
<Box w={2000}>
|
|
||||||
<Table
|
<Table
|
||||||
withBorder
|
|
||||||
verticalSpacing={"md"}
|
verticalSpacing={"md"}
|
||||||
horizontalSpacing={"xl"}
|
horizontalSpacing={"md"}
|
||||||
p={"md"}
|
p={"md"}
|
||||||
|
w={1500}
|
||||||
striped
|
striped
|
||||||
highlightOnHover
|
highlightOnHover
|
||||||
>
|
>
|
||||||
@@ -209,39 +226,56 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>{TableRows}</tbody>
|
<tbody>{TableRows}</tbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</ScrollArea>
|
||||||
</ScrollArea>
|
|
||||||
<Center>
|
<Center mt={"xl"}>
|
||||||
{_.isEmpty(TableRows) ? (
|
<Pagination
|
||||||
<Center h={"50vh"}>
|
value={isActivePage}
|
||||||
<Title order={6}>Tidak Ada Data</Title>
|
total={isNPage}
|
||||||
</Center>
|
onChange={(val) => {
|
||||||
) : (
|
onPageClick(val);
|
||||||
""
|
}}
|
||||||
)}
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</Box>
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
opened={opened}
|
||||||
|
onClose={close}
|
||||||
|
centered
|
||||||
|
withCloseButton={false}
|
||||||
|
size={"md"}
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Textarea
|
||||||
|
minRows={2}
|
||||||
|
maxRows={5}
|
||||||
|
maxLength={300}
|
||||||
|
autosize
|
||||||
|
label="Masukan Alasan Penolakan"
|
||||||
|
placeholder="Contoh: Karena deskripsi kurang lengkap, dll"
|
||||||
|
value={catatan}
|
||||||
|
onChange={(val) => {
|
||||||
|
setCatatan(val.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Group position="right">
|
||||||
|
<Button radius={"xl"} onClick={() => close()}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onReject(votingId, catatan, close, setData);
|
||||||
|
console.log(catatan);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onReject(
|
|
||||||
votingId: string,
|
|
||||||
catatan: string,
|
|
||||||
close: any,
|
|
||||||
setData: any
|
|
||||||
) {
|
|
||||||
await AdminVote_funEditCatatanRejectById(votingId, catatan).then(
|
|
||||||
async (res) => {
|
|
||||||
if (res.status === 200) {
|
|
||||||
await AdminVote_getListTableByStatusId("4").then((val) => {
|
|
||||||
setData(val);
|
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
|
||||||
close();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,16 +8,19 @@ import {
|
|||||||
Center,
|
Center,
|
||||||
Group,
|
Group,
|
||||||
Modal,
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Spoiler,
|
Spoiler,
|
||||||
Stack,
|
Stack,
|
||||||
Table,
|
Table,
|
||||||
Text,
|
Text,
|
||||||
Textarea,
|
Textarea,
|
||||||
|
TextInput,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { IconBan, IconEyeShare } from "@tabler/icons-react";
|
import { IconBan, IconEyeShare, IconSearch } from "@tabler/icons-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
@@ -31,6 +34,8 @@ import { AdminEvent_funEditCatatanById } from "../../fun/edit/fun_edit_status_re
|
|||||||
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
|
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||||
|
import { adminVote_funGetListReview } from "../../fun";
|
||||||
|
import { IconCircleCheckFilled } from "@tabler/icons-react";
|
||||||
|
|
||||||
export default function AdminVote_TableReview({
|
export default function AdminVote_TableReview({
|
||||||
listVote,
|
listVote,
|
||||||
@@ -40,26 +45,50 @@ export default function AdminVote_TableReview({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name="Voting: Table Review" />
|
<ComponentAdminGlobal_HeaderTamplate name="Voting" />
|
||||||
<TableStatus listData={listVote} />
|
<TableStatus listData={listVote} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
function TableStatus({ listData }: { listData: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [data, setData] = useState(listData);
|
const [data, setData] = useState<MODEL_VOTING[]>(listData.data);
|
||||||
const [votingId, setVotingId] = useState("");
|
const [votingId, setVotingId] = useState("");
|
||||||
const [catatan, setCatatan] = useState("");
|
const [catatan, setCatatan] = useState("");
|
||||||
const [isLoadingPublish, setLoadingPublish] = useState(false);
|
const [isLoadingPublish, setLoadingPublish] = useState(false);
|
||||||
const [isSaveLoading, setSaveLoading] = useState(false);
|
const [isSaveLoading, setSaveLoading] = useState(false);
|
||||||
|
|
||||||
|
const [isNPage, setNPage] = useState(listData.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminVote_funGetListReview({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminVote_funGetListReview({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
const TableRows = data.map((e, i) => (
|
const TableRows = data.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center>{e?.Author?.Profile?.name}</Center>
|
<Center>{e?.Author?.username}</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>{e.title}</Center>
|
<Center>{e.title}</Center>
|
||||||
@@ -105,7 +134,7 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
|||||||
}
|
}
|
||||||
w={120}
|
w={120}
|
||||||
color={"green"}
|
color={"green"}
|
||||||
leftIcon={<IconEyeShare />}
|
leftIcon={<IconCircleCheckFilled />}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
onPublish(
|
onPublish(
|
||||||
@@ -138,12 +167,83 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"orange.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Review</Title>
|
||||||
|
<TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Masukan judul"
|
||||||
|
onChange={(val) => {
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"md"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={1500}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Judul</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Deskripsi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Pilihan</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Mulai Vote</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Selesai Vote</Center>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{TableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={isActivePage}
|
||||||
|
total={isNPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
centered
|
centered
|
||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
size={"lg"}
|
size={"md"}
|
||||||
>
|
>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Textarea
|
<Textarea
|
||||||
@@ -174,63 +274,6 @@ function TableStatus({ listData }: { listData: MODEL_VOTING[] }) {
|
|||||||
</Group>
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Box>
|
|
||||||
<Box bg={"orange.1"} p={"xs"}>
|
|
||||||
<Title order={6} c={"orange"}>
|
|
||||||
REVIEW
|
|
||||||
</Title>
|
|
||||||
</Box>
|
|
||||||
<ScrollArea w={"100%"}>
|
|
||||||
<Box>
|
|
||||||
<Table
|
|
||||||
withBorder
|
|
||||||
verticalSpacing={"md"}
|
|
||||||
horizontalSpacing={"xl"}
|
|
||||||
p={"md"}
|
|
||||||
striped
|
|
||||||
highlightOnHover
|
|
||||||
>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<Center>Author</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Judul</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Deskripsi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Pilihan</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Mulai Vote</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Selesai Vote</Center>
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th>
|
|
||||||
<Center>Aksi</Center>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{TableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
</Box>
|
|
||||||
</ScrollArea>
|
|
||||||
<Center>
|
|
||||||
{_.isEmpty(TableRows) ? (
|
|
||||||
<Center h={"50vh"}>
|
|
||||||
<Title order={6}>Tidak Ada Data</Title>
|
|
||||||
</Center>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminVote_funGetListReject({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 10;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const data = await prisma.voting.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
updatedAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "4",
|
||||||
|
isActive: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Voting_Kontributor: true,
|
||||||
|
Voting_DaftarNamaVote: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.voting.count({
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "4",
|
||||||
|
isActive: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminVote_funGetListReview({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 10;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const data = await prisma.voting.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "2",
|
||||||
|
isActive: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Voting_Kontributor: true,
|
||||||
|
Voting_DaftarNamaVote: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.voting.count({
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "2",
|
||||||
|
isActive: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
73
src/app_modules/admin/vote/fun/get/status/fun_get_riwayat.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
"use server"
|
||||||
|
|
||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminVote_funGetListRiwayat({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 10;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const data = await prisma.voting.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "1",
|
||||||
|
isActive: true,
|
||||||
|
akhirVote: {
|
||||||
|
lte: new Date(),
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Voting_Kontributor: true,
|
||||||
|
Voting_DaftarNamaVote: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.voting.count({
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "1",
|
||||||
|
isActive: true,
|
||||||
|
akhirVote: {
|
||||||
|
lte: new Date(),
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
|
export async function adminVote_funGetListPublish({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 10;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const data = await prisma.voting.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "1",
|
||||||
|
isActive: true,
|
||||||
|
akhirVote: {
|
||||||
|
gte: new Date(),
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Voting_Kontributor: true,
|
||||||
|
Voting_DaftarNamaVote: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.voting.count({
|
||||||
|
where: {
|
||||||
|
voting_StatusId: "1",
|
||||||
|
isActive: true,
|
||||||
|
akhirVote: {
|
||||||
|
gte: new Date(),
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: data,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
7
src/app_modules/admin/vote/fun/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { adminVote_funGetListReject } from "./get/status/fun_get_list_reject";
|
||||||
|
import { adminVote_funGetListReview } from "./get/status/fun_get_list_review";
|
||||||
|
import { adminVote_funGetListRiwayat } from "./get/status/fun_get_riwayat";
|
||||||
|
|
||||||
|
export { adminVote_funGetListReview };
|
||||||
|
export { adminVote_funGetListReject };
|
||||||
|
export { adminVote_funGetListRiwayat };
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
|
||||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import { Affix, Box, Button, Center, Loader, rem } from "@mantine/core";
|
import { Box, Center, Loader } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { ScrollOnly } from "next-scroll-loader";
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { ComponentColab_ButtonUpdateBeranda } from "../component/button/button_update_beranda";
|
||||||
import { ComponentColab_CardBeranda } from "../component/card_view/card_beranda";
|
import { ComponentColab_CardBeranda } from "../component/card_view/card_beranda";
|
||||||
import colab_getListAllProyek from "../fun/get/get_list_all_proyek";
|
import colab_getListAllProyek from "../fun/get/get_list_all_proyek";
|
||||||
import { MODEL_COLLABORATION } from "../model/interface";
|
import { MODEL_COLLABORATION } from "../model/interface";
|
||||||
import { ComponentColab_ButtonUpdateBeranda } from "../component/button/button_update_beranda";
|
|
||||||
|
|
||||||
export default function Colab_Beranda({
|
export default function Colab_Beranda({
|
||||||
listData,
|
listData,
|
||||||
|
|||||||
@@ -2,31 +2,15 @@
|
|||||||
|
|
||||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import {
|
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||||
ActionIcon,
|
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||||
Center,
|
import { ActionIcon, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||||
Footer,
|
import { IconHome, IconMessages, IconUsersGroup } from "@tabler/icons-react";
|
||||||
Grid,
|
|
||||||
Indicator,
|
|
||||||
SimpleGrid,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import {
|
|
||||||
IconBell,
|
|
||||||
IconHome,
|
|
||||||
IconMessages,
|
|
||||||
IconUsersGroup,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import ComponentColab_HeaderTamplate from "../component/header_tamplate";
|
|
||||||
import { gs_colab_hot_menu } from "../global_state";
|
import { gs_colab_hot_menu } from "../global_state";
|
||||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
|
||||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
|
||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
|
||||||
|
|
||||||
export default function LayoutColab_Main({
|
export default function LayoutColab_Main({
|
||||||
children,
|
children,
|
||||||
@@ -85,7 +69,7 @@ export default function LayoutColab_Main({
|
|||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
header={
|
header={
|
||||||
<UIGlobal_LayoutHeaderTamplate
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
title="Project Collaboration"
|
title="Collaboration"
|
||||||
routerLeft={RouterHome.main_home}
|
routerLeft={RouterHome.main_home}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -98,7 +82,7 @@ export default function LayoutColab_Main({
|
|||||||
variant="transparent"
|
variant="transparent"
|
||||||
c={hotMenu === e.id ? MainColor.yellow : "white"}
|
c={hotMenu === e.id ? MainColor.yellow : "white"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.replace(e.path, {scroll: false});
|
router.replace(e.path, { scroll: false });
|
||||||
setHotMenu(e.id);
|
setHotMenu(e.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { useAtom } from "jotai";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { gs_donasi_tabs_posting } from "../../global_state";
|
import { gs_donasi_tabs_posting } from "../../global_state";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import { MODEL_CERITA_DONASI } from "../../model/interface";
|
import { MODEL_CERITA_DONASI } from "../../model/interface";
|
||||||
import { NotifPeringatan } from "../../component/notifikasi/notif_peringatan";
|
import { NotifPeringatan } from "../../component/notifikasi/notif_peringatan";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -32,6 +31,8 @@ import {
|
|||||||
MainColor,
|
MainColor,
|
||||||
} from "@/app_modules/_global/color/color_pallet";
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
|
||||||
export default function EditCeritaPenggalangDonasi({
|
export default function EditCeritaPenggalangDonasi({
|
||||||
dataCerita,
|
dataCerita,
|
||||||
@@ -230,10 +231,10 @@ async function onUpdate(
|
|||||||
if (_.values(body).includes("")) return NotifPeringatan("Lengkapi Data");
|
if (_.values(body).includes("")) return NotifPeringatan("Lengkapi Data");
|
||||||
await Donasi_funUpdateCerita(body as any, gambar).then((res) => {
|
await Donasi_funUpdateCerita(body as any, gambar).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
NotifBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,18 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
import {
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
AspectRatio,
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
Badge,
|
import { Box, Center } from "@mantine/core";
|
||||||
Box,
|
|
||||||
Center,
|
|
||||||
Grid,
|
|
||||||
Group,
|
|
||||||
Image,
|
|
||||||
Paper,
|
|
||||||
Progress,
|
|
||||||
Stack,
|
|
||||||
Text
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { useViewportSize } from "@mantine/hooks";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import ComponentDonasi_TampilanHitungMundur from "../component/tampilan_hitung_mundur";
|
|
||||||
import TampilanRupiahDonasi from "../component/tampilan_rupiah";
|
|
||||||
import { MODEL_DONASI_INVOICE } from "../model/interface";
|
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
|
||||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
|
||||||
import { ScrollOnly } from "next-scroll-loader";
|
|
||||||
import ComponentDonasi_CardPublish from "../component/card_view/card_publish";
|
|
||||||
import { donasi_funGetAllPublish } from "../fun/get/get_list_beranda";
|
|
||||||
import { donasi_funGetAllInvoiceByAuthorId } from "../fun/get/get_all_invoice_by_author_id";
|
|
||||||
import { ComponentDonasi_CardInvoice } from "../component/card_view/card_invoice";
|
import { ComponentDonasi_CardInvoice } from "../component/card_view/card_invoice";
|
||||||
|
import { donasi_funGetAllInvoiceByAuthorId } from "../fun/get/get_all_invoice_by_author_id";
|
||||||
|
import { MODEL_DONASI_INVOICE } from "../model/interface";
|
||||||
|
|
||||||
export default function DonasiSayaDonasi({
|
export default function DonasiSayaDonasi({
|
||||||
listInvoice,
|
listInvoice,
|
||||||
@@ -68,11 +48,7 @@ export default function DonasiSayaDonasi({
|
|||||||
return loadData;
|
return loadData;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(item) => (
|
{(item) => <ComponentDonasi_CardInvoice data={item as any} />}
|
||||||
<ComponentDonasi_CardInvoice
|
|
||||||
data={item as any}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ScrollOnly>
|
</ScrollOnly>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
|
import {
|
||||||
|
AccentColor,
|
||||||
|
MainColor,
|
||||||
|
} 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 notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||||
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
@@ -18,21 +26,11 @@ import { useAtom } from "jotai";
|
|||||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { NotifBerhasil } from "../../component/notifikasi/notif_berhasil";
|
|
||||||
import { NotifGagal } from "../../component/notifikasi/notif_gagal";
|
|
||||||
import TampilanRupiahDonasi from "../../component/tampilan_rupiah";
|
import TampilanRupiahDonasi from "../../component/tampilan_rupiah";
|
||||||
import { Donasi_funUploadBuktiTransferById } from "../../fun/update/fun_update_invoice";
|
import { Donasi_funUploadBuktiTransferById } from "../../fun/update/fun_update_invoice";
|
||||||
import { Donasi_funUpdateStatusInvoice } from "../../fun/update/fun_update_status_invoice";
|
import { Donasi_funUpdateStatusInvoice } from "../../fun/update/fun_update_status_invoice";
|
||||||
import { gs_donasi_hot_menu } from "../../global_state";
|
import { gs_donasi_hot_menu } from "../../global_state";
|
||||||
import { MODEL_DONASI_INVOICE } from "../../model/interface";
|
import { MODEL_DONASI_INVOICE } from "../../model/interface";
|
||||||
import {
|
|
||||||
AccentColor,
|
|
||||||
MainColor,
|
|
||||||
} 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 notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
|
||||||
|
|
||||||
export default function Donasi_InvoiceProses({
|
export default function Donasi_InvoiceProses({
|
||||||
dataInvoice,
|
dataInvoice,
|
||||||
@@ -315,9 +313,9 @@ async function onUpload(invoiceId: string, file: FormData) {
|
|||||||
|
|
||||||
await Donasi_funUploadBuktiTransferById(invoiceId, gambar).then((res) => {
|
await Donasi_funUploadBuktiTransferById(invoiceId, gambar).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
NotifBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
} else {
|
} else {
|
||||||
NotifGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export function Home_UiView({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Project Collaboration",
|
name: "Collaboration",
|
||||||
icon: <IconAffiliate size={50} />,
|
icon: <IconAffiliate size={50} />,
|
||||||
link: RouterColab.splash,
|
link: RouterColab.splash,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Investasi_ComponentCardBeranda } from "./main/comp_card_beranda";
|
import { Investasi_ComponentCardBeranda } from "./main/comp_card_beranda";
|
||||||
|
import { Investasi_ComponentCardDaftarTransaksi } from "./main/comp_card_daftar_transaksi";
|
||||||
import { Investasi_ComponentFooterMain } from "./main/comp_footer_main";
|
import { Investasi_ComponentFooterMain } from "./main/comp_footer_main";
|
||||||
import { Investasi_ComponentButtonUpdateBeranda } from "./main/comp_update_beranda";
|
import { Investasi_ComponentButtonUpdateBeranda } from "./main/comp_update_beranda";
|
||||||
|
|
||||||
export { Investasi_ComponentFooterMain };
|
export { Investasi_ComponentFooterMain };
|
||||||
export { Investasi_ComponentCardBeranda };
|
export { Investasi_ComponentCardBeranda };
|
||||||
export { Investasi_ComponentButtonUpdateBeranda };
|
export { Investasi_ComponentButtonUpdateBeranda };
|
||||||
|
export { Investasi_ComponentCardDaftarTransaksi };
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Paper,
|
||||||
|
Group,
|
||||||
|
Title,
|
||||||
|
Stack,
|
||||||
|
Center,
|
||||||
|
Badge,
|
||||||
|
Text,
|
||||||
|
Card,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import moment from "moment";
|
||||||
|
import { MODEL_INVOICE_INVESTASI } from "../../_lib/interface";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
|
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/_global/loading_card";
|
||||||
|
|
||||||
|
export function Investasi_ComponentCardDaftarTransaksi({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data: MODEL_INVOICE_INVESTASI;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
async function onClick({
|
||||||
|
invoiceId,
|
||||||
|
statusInvoiceId,
|
||||||
|
}: {
|
||||||
|
invoiceId: string;
|
||||||
|
statusInvoiceId: string;
|
||||||
|
}) {
|
||||||
|
// Proses
|
||||||
|
if (statusInvoiceId === "2") {
|
||||||
|
setVisible(true);
|
||||||
|
return router.push(NEW_RouterInvestasi.proses_transaksi + invoiceId, {
|
||||||
|
scroll: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Menunggu
|
||||||
|
if (statusInvoiceId === "3") {
|
||||||
|
setVisible(true);
|
||||||
|
return router.push(NEW_RouterInvestasi.invoice + invoiceId, {
|
||||||
|
scroll: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentGlobal_NotifikasiPeringatan("Status Belum Tersedia");
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Card
|
||||||
|
style={{
|
||||||
|
padding: "15px",
|
||||||
|
backgroundColor: AccentColor.darkblue,
|
||||||
|
border: `2px solid ${AccentColor.blue}`,
|
||||||
|
borderRadius: "10px",
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
mb={"md"}
|
||||||
|
onClick={() =>
|
||||||
|
onClick({
|
||||||
|
invoiceId: data.id,
|
||||||
|
statusInvoiceId: data.statusInvoiceId,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Group position="apart">
|
||||||
|
<Title order={6}>{data.Investasi.title}</Title>
|
||||||
|
<Title order={5}>
|
||||||
|
Rp.
|
||||||
|
{new Intl.NumberFormat("id-ID", {
|
||||||
|
maximumFractionDigits: 10,
|
||||||
|
}).format(+data.nominal)}
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<Group position="apart">
|
||||||
|
<Stack spacing={0}>
|
||||||
|
{/* <Text fz={"xs"}>Bank {data.namaBank}</Text> */}
|
||||||
|
<Text fz={"xs"}>{moment(data.createdAt).format("ll")}</Text>
|
||||||
|
</Stack>
|
||||||
|
<Text>{data.lembarTerbeli} Lembar</Text>
|
||||||
|
</Group>
|
||||||
|
<Center mt={"sm"}>
|
||||||
|
<Badge>{data.StatusInvoice.name}</Badge>
|
||||||
|
</Center>
|
||||||
|
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||||
|
</Card>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
|
||||||
|
export async function investasi_funGetTransaksiByUserId({
|
||||||
|
page,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
}) {
|
||||||
|
const authorId = await user_getOneUserId();
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const data = await prisma.investasi_Invoice.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
authorId: authorId,
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Investasi: true,
|
||||||
|
MasterBank: true,
|
||||||
|
StatusInvoice: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
import { investasi_funGetProspekById } from "./get/fun_get_file_by_prospek_id";
|
import { investasi_funGetProspekById } from "./get/fun_get_file_by_prospek_id";
|
||||||
import { investasi_funGetOneInvestasiById } from "./get/fun_get_one_by_id";
|
import { investasi_funGetOneInvestasiById } from "./get/fun_get_one_by_id";
|
||||||
|
import { investasi_funGetTransaksiByUserId } from "./get/fun_get_all_transaksi_by_user_id";
|
||||||
|
import { investasi_funUploadBuktiTransferById } from "./upload/fun_upload_bukti_transfer";
|
||||||
|
|
||||||
export { investasi_funGetOneInvestasiById };
|
export { investasi_funGetOneInvestasiById };
|
||||||
export { investasi_funGetProspekById };
|
export { investasi_funGetProspekById };
|
||||||
|
export { investasi_funUploadBuktiTransferById };
|
||||||
|
export { investasi_funGetTransaksiByUserId };
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { v4 } from "uuid";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
|
export async function investasi_funUploadBuktiTransferById({
|
||||||
|
invoiceId,
|
||||||
|
file,
|
||||||
|
}: {
|
||||||
|
invoiceId: string;
|
||||||
|
file: FormData;
|
||||||
|
}) {
|
||||||
|
// console.log(file);
|
||||||
|
const gambar: any = file.get("file");
|
||||||
|
const fileName = gambar.name;
|
||||||
|
const fileExtension = _.lowerCase(gambar.name.split(".").pop());
|
||||||
|
const fileRandomName = v4(fileName) + "." + fileExtension;
|
||||||
|
console.log(gambar);
|
||||||
|
|
||||||
|
const upload = await prisma.images.create({
|
||||||
|
data: {
|
||||||
|
url: fileRandomName,
|
||||||
|
label: "INVESTASI_INVOICE",
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!upload) return { status: 400, message: "Gagal upload gambar" };
|
||||||
|
const uploadFolder = Buffer.from(await gambar.arrayBuffer());
|
||||||
|
fs.writeFileSync(`./public/investasi/invoice/${upload.url}`, uploadFolder);
|
||||||
|
|
||||||
|
const updateFile = await prisma.investasi_Invoice.update({
|
||||||
|
where: {
|
||||||
|
id: invoiceId,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
imagesId: upload.id,
|
||||||
|
statusInvoiceId: "2",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!updateFile) return { status: 400, message: "Gagal update gambar" };
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
message: "Berhasil upload",
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -99,7 +99,7 @@ export interface Model_Dokumen_Investasi {
|
|||||||
export interface MODEL_MASTER_BANK {
|
export interface MODEL_MASTER_BANK {
|
||||||
id: string;
|
id: string;
|
||||||
namaBank: string;
|
namaBank: string;
|
||||||
namaAkun: string
|
namaAkun: string;
|
||||||
norek: string;
|
norek: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
@@ -114,3 +114,29 @@ export interface Model_Status_Transaksi_Investasi {
|
|||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
updatedAt: Date;
|
updatedAt: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MODEL_INVOICE_INVESTASI {
|
||||||
|
id: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
nominal: string;
|
||||||
|
lembarTerbeli: string;
|
||||||
|
Investasi: MODEL_INVESTASI;
|
||||||
|
investasiId: string;
|
||||||
|
masterBankId: string;
|
||||||
|
statusInvoiceId: string;
|
||||||
|
authorId: string;
|
||||||
|
imagesId: string;
|
||||||
|
MasterBank: MODEL_MASTER_BANK;
|
||||||
|
StatusInvoice: MODEL_STATUS_INVOICE_INVESTASI;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MODEL_STATUS_INVOICE_INVESTASI {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { Investasi_UiProsesPembelian } from "./transaksi/ui_proses_pembelian";
|
|||||||
import { Investasi_UiProsesTransaksi } from "./transaksi/ui_proses_transaksi";
|
import { Investasi_UiProsesTransaksi } from "./transaksi/ui_proses_transaksi";
|
||||||
import { Investasi_UiBeranda } from "./main/ui_beranda";
|
import { Investasi_UiBeranda } from "./main/ui_beranda";
|
||||||
import { Investasi_UiLayoutMain } from "./main/ui_layout_main";
|
import { Investasi_UiLayoutMain } from "./main/ui_layout_main";
|
||||||
|
import { Investasi_UiDaftarTransaksi } from "./main/ui_transaksi";
|
||||||
|
|
||||||
export { Investasi_UiProsesPembelian };
|
export { Investasi_UiProsesPembelian };
|
||||||
export { Investasi_UiMetodePembayaran };
|
export { Investasi_UiMetodePembayaran };
|
||||||
@@ -13,3 +14,4 @@ export { Investasi_UiInvoice };
|
|||||||
export { Investasi_UiProsesTransaksi };
|
export { Investasi_UiProsesTransaksi };
|
||||||
export { Investasi_UiBeranda };
|
export { Investasi_UiBeranda };
|
||||||
export { Investasi_UiLayoutMain };
|
export { Investasi_UiLayoutMain };
|
||||||
|
export { Investasi_UiDaftarTransaksi };
|
||||||
|
|||||||
15
src/app_modules/investasi/_ui/main/ui_transaksi.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Investasi_ViewDaftarTransaksi } from "../../_view/main/view_transaksi";
|
||||||
|
|
||||||
|
export function Investasi_UiDaftarTransaksi({
|
||||||
|
dataTransaksi,
|
||||||
|
}: {
|
||||||
|
dataTransaksi: any[];
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Investasi_ViewDaftarTransaksi dataTransaksi={dataTransaksi} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,13 +3,42 @@
|
|||||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||||
import { Investasi_ViewInvoice } from "../../_view";
|
import { Investasi_ViewInvoice } from "../../_view";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { gs_investas_menu } from "../../g_state";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { ActionIcon, Loader } from "@mantine/core";
|
||||||
|
import { IconX } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
export function Investasi_UiInvoice({ dataInvoice }: { dataInvoice : any}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
export function Investasi_UiInvoice() {
|
|
||||||
return (
|
return (
|
||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
header={<UIGlobal_LayoutHeaderTamplate title="Invoice" />}
|
header={
|
||||||
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
|
title="Invoice"
|
||||||
|
customButtonLeft={
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => {
|
||||||
|
setHotMenu(3);
|
||||||
|
setLoading(true);
|
||||||
|
router.push(RouterInvestasi_OLD.main_transaksi);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isLoading ? <Loader color="yellow" /> : <IconX />}
|
||||||
|
</ActionIcon>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Investasi_ViewInvoice dataInvoice={{}} />
|
<Investasi_ViewInvoice dataInvoice={dataInvoice} />
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,20 @@ import { Investasi_ViewMetodePembayaran } from "../../_view";
|
|||||||
|
|
||||||
export function Investasi_UiMetodePembayaran({
|
export function Investasi_UiMetodePembayaran({
|
||||||
listBank,
|
listBank,
|
||||||
|
investasiId,
|
||||||
}: {
|
}: {
|
||||||
listBank: any[];
|
listBank: any[];
|
||||||
|
investasiId: string
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
header={<UIGlobal_LayoutHeaderTamplate title="Metode Pembayaran" />}
|
header={<UIGlobal_LayoutHeaderTamplate title="Metode Pembayaran" />}
|
||||||
>
|
>
|
||||||
<Investasi_ViewMetodePembayaran listBank={listBank} />
|
<Investasi_ViewMetodePembayaran
|
||||||
|
listBank={listBank}
|
||||||
|
investasiId={investasiId}
|
||||||
|
/>
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,19 +4,41 @@ import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_ta
|
|||||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||||
import { IconX } from "@tabler/icons-react";
|
import { IconX } from "@tabler/icons-react";
|
||||||
import { Investasi_ViewProsesTransaksi } from "../../_view";
|
import { Investasi_ViewProsesTransaksi } from "../../_view";
|
||||||
|
import { ActionIcon, Loader } from "@mantine/core";
|
||||||
|
import { gs_donasi_hot_menu } from "@/app_modules/donasi/global_state";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { gs_investas_menu } from "../../g_state";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export function Investasi_UiProsesTransaksi({ nomorAdmin }: { nomorAdmin : any}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [hotMenu, setHotMenu] = useAtom(gs_investas_menu);
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
export function Investasi_UiProsesTransaksi() {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
header={
|
header={
|
||||||
<UIGlobal_LayoutHeaderTamplate
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
title="Proses Transaksi"
|
title="Proses Transaksi"
|
||||||
iconLeft={<IconX />}
|
customButtonLeft={
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => {
|
||||||
|
setHotMenu(3);
|
||||||
|
setLoading(true);
|
||||||
|
router.push(RouterInvestasi_OLD.main_transaksi);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isLoading ? <Loader color="yellow" /> : <IconX />}
|
||||||
|
</ActionIcon>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Investasi_ViewProsesTransaksi />
|
<Investasi_ViewProsesTransaksi nomorAdmin={nomorAdmin} />
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import { Stack } from "@mantine/core";
|
import { Stack, Text } from "@mantine/core";
|
||||||
import { useState } from "react";
|
// import { useState } from "react";
|
||||||
import { Document, Page, pdfjs } from "react-pdf";
|
// import { Document, Page, pdfjs } from "react-pdf";
|
||||||
import "react-pdf/dist/Page/AnnotationLayer.css";
|
// import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||||
import "react-pdf/dist/Page/TextLayer.css";
|
// import "react-pdf/dist/Page/TextLayer.css";
|
||||||
import styles from "./styles.module.css";
|
// import styles from "./styles.module.css";
|
||||||
|
// import { GlobalWorkerOptions } from "pdfjs-dist";
|
||||||
|
|
||||||
// pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
// GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.5.136/pdf.worker.js`;
|
||||||
// "pdfjs-dist/build/pdf.worker.min.mjs",
|
|
||||||
// import.meta.url
|
|
||||||
// ).toString();
|
|
||||||
|
|
||||||
export function Investasi_ViewFileViewer({
|
export function Investasi_ViewFileViewer({
|
||||||
fileId,
|
fileId,
|
||||||
@@ -17,7 +15,12 @@ export function Investasi_ViewFileViewer({
|
|||||||
fileId: string;
|
fileId: string;
|
||||||
path: string;
|
path: string;
|
||||||
}) {
|
}) {
|
||||||
return <Stack>{/* <MyFile file={path + fileId} /> */}</Stack>;
|
return (
|
||||||
|
<Stack>
|
||||||
|
Maintenance
|
||||||
|
{/* <MyFile file={path + fileId} /> */}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function MyFile({ file }: { file: any }) {
|
// function MyFile({ file }: { file: any }) {
|
||||||
@@ -28,15 +31,19 @@ export function Investasi_ViewFileViewer({
|
|||||||
// setNumPages(numPages);
|
// setNumPages(numPages);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// return<>
|
||||||
|
// <Text>Maintenance</Text>
|
||||||
|
// </>
|
||||||
|
|
||||||
// return (
|
// return (
|
||||||
// <div>
|
// <div>
|
||||||
// <Document
|
// <Document
|
||||||
// className={styles.file_view}
|
// // className={styles.file_view}
|
||||||
// file={file}
|
// file={file}
|
||||||
// onLoadSuccess={onDocumentLoadSuccess}
|
// onLoadSuccess={onDocumentLoadSuccess}
|
||||||
|
|
||||||
// >
|
// >
|
||||||
// <Page className={styles.page} pageNumber={pageNumber} />
|
// <Page pageNumber={pageNumber} />
|
||||||
// </Document>
|
// </Document>
|
||||||
// {/* <p>
|
// {/* <p>
|
||||||
// Page {pageNumber} of {numPages}
|
// Page {pageNumber} of {numPages}
|
||||||
|
|||||||
68
src/app_modules/investasi/_view/main/view_transaksi.tsx
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import {
|
||||||
|
NEW_RouterInvestasi,
|
||||||
|
RouterInvestasi_OLD,
|
||||||
|
} from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import {
|
||||||
|
Stack,
|
||||||
|
Box,
|
||||||
|
Paper,
|
||||||
|
Group,
|
||||||
|
Title,
|
||||||
|
Text,
|
||||||
|
Center,
|
||||||
|
Badge,
|
||||||
|
Loader,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import moment from "moment";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { MODEL_INVOICE_INVESTASI } from "../../_lib/interface";
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
|
import _ from "lodash";
|
||||||
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
|
import { ComponentColab_CardBeranda } from "@/app_modules/colab/component/card_view/card_beranda";
|
||||||
|
import colab_getListAllProyek from "@/app_modules/colab/fun/get/get_list_all_proyek";
|
||||||
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
|
import { Investasi_ComponentCardDaftarTransaksi } from "../../_component";
|
||||||
|
|
||||||
|
export function Investasi_ViewDaftarTransaksi({
|
||||||
|
dataTransaksi,
|
||||||
|
}: {
|
||||||
|
dataTransaksi: MODEL_INVOICE_INVESTASI[];
|
||||||
|
}) {
|
||||||
|
const [data, setData] = useState(dataTransaksi);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{_.isEmpty(data) ? (
|
||||||
|
<ComponentGlobal_IsEmptyData />
|
||||||
|
) : (
|
||||||
|
<Box>
|
||||||
|
<ScrollOnly
|
||||||
|
height="82vh"
|
||||||
|
renderLoading={() => (
|
||||||
|
<Center mt={"lg"}>
|
||||||
|
<Loader color={"yellow"} />
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
data={data}
|
||||||
|
setData={setData}
|
||||||
|
moreData={async () => {
|
||||||
|
const loadData = await colab_getListAllProyek({
|
||||||
|
page: activePage + 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
setActivePage((val) => val + 1);
|
||||||
|
|
||||||
|
return loadData;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(item) => <Investasi_ComponentCardDaftarTransaksi data={item} />}
|
||||||
|
</ScrollOnly>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -21,17 +21,37 @@ import {
|
|||||||
import { IconCamera, IconCircleCheck } from "@tabler/icons-react";
|
import { IconCamera, IconCircleCheck } from "@tabler/icons-react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { MODEL_INVOICE_INVESTASI } from "../../_lib/interface";
|
||||||
|
import { investasi_funUploadBuktiTransferById } from "../../_fun";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
|
||||||
export function Investasi_ViewInvoice({
|
export function Investasi_ViewInvoice({
|
||||||
dataInvoice,
|
dataInvoice,
|
||||||
}: {
|
}: {
|
||||||
dataInvoice: any;
|
dataInvoice: MODEL_INVOICE_INVESTASI;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [invoice, setDataInvoice] = useState(dataInvoice);
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [data, setData] = useState(dataInvoice);
|
||||||
const [file, setFile] = useState<File | null>(null);
|
const [file, setFile] = useState<File | null>(null);
|
||||||
const [image, setImage] = useState<any | null>(null);
|
// const [image, setImage] = useState<any | null>(null);
|
||||||
// const [active, setActive] = useAtom(gs_donasi_hot_menu);
|
|
||||||
|
async function onUpload() {
|
||||||
|
const gambar = new FormData();
|
||||||
|
gambar.append("file", file as any);
|
||||||
|
|
||||||
|
const res = await investasi_funUploadBuktiTransferById({
|
||||||
|
invoiceId: data.id,
|
||||||
|
file: gambar,
|
||||||
|
});
|
||||||
|
if (res.status !== 200) return ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
setLoading(true);
|
||||||
|
router.push(NEW_RouterInvestasi.proses_transaksi + data.id, {
|
||||||
|
scroll: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -48,10 +68,6 @@ export function Investasi_ViewInvoice({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Title order={5}>Mohon transfer ke rekening dibawah</Title>
|
<Title order={5}>Mohon transfer ke rekening dibawah</Title>
|
||||||
<Group spacing={"xs"}>
|
|
||||||
<Text>untuk diteruskan ke </Text>
|
|
||||||
<Text fw={"bold"}>{invoice?.Donasi?.Author.username}</Text>
|
|
||||||
</Group>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Paper
|
<Paper
|
||||||
@@ -67,8 +83,8 @@ export function Investasi_ViewInvoice({
|
|||||||
>
|
>
|
||||||
<Stack spacing={"md"}>
|
<Stack spacing={"md"}>
|
||||||
<Stack spacing={0}>
|
<Stack spacing={0}>
|
||||||
<Text>Bank {invoice?.DonasiMaster_Bank?.name}</Text>
|
<Text>Bank {data?.MasterBank?.namaBank}</Text>
|
||||||
<Text>PT. Himpunan Pengusaha Badung</Text>
|
<Text>{data?.MasterBank?.namaAkun}</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Paper
|
<Paper
|
||||||
style={{
|
style={{
|
||||||
@@ -84,13 +100,13 @@ export function Investasi_ViewInvoice({
|
|||||||
<Grid.Col span={8}>
|
<Grid.Col span={8}>
|
||||||
<Group position="left" align="center" h={"100%"}>
|
<Group position="left" align="center" h={"100%"}>
|
||||||
<Title order={4} color={MainColor.yellow}>
|
<Title order={4} color={MainColor.yellow}>
|
||||||
{invoice?.DonasiMaster_Bank?.norek}
|
{data?.MasterBank?.norek}
|
||||||
</Title>
|
</Title>
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Group position="right">
|
<Group position="right">
|
||||||
<CopyButton value={invoice?.DonasiMaster_Bank?.norek}>
|
<CopyButton value={data?.MasterBank?.norek}>
|
||||||
{({ copied, copy }) => (
|
{({ copied, copy }) => (
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
@@ -141,13 +157,13 @@ export function Investasi_ViewInvoice({
|
|||||||
<Grid.Col span={8}>
|
<Grid.Col span={8}>
|
||||||
<Group position="left" align="center" h={"100%"}>
|
<Group position="left" align="center" h={"100%"}>
|
||||||
<Title order={4} color="white">
|
<Title order={4} color="white">
|
||||||
<TampilanRupiahDonasi nominal={+(+invoice.nominal)} />
|
<TampilanRupiahDonasi nominal={+(+data.nominal)} />
|
||||||
</Title>
|
</Title>
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Group position="right">
|
<Group position="right">
|
||||||
<CopyButton value={"" + +invoice.nominal}>
|
<CopyButton value={"" + +data.nominal}>
|
||||||
{({ copied, copy }) => (
|
{({ copied, copy }) => (
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
@@ -167,9 +183,6 @@ export function Investasi_ViewInvoice({
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Paper>
|
</Paper>
|
||||||
{/* <Text fz={"xs"} c={"gray"}>
|
|
||||||
Sudah termasuk biaya admin Rp. 2.500,-
|
|
||||||
</Text> */}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
@@ -189,13 +202,8 @@ export function Investasi_ViewInvoice({
|
|||||||
<FileButton
|
<FileButton
|
||||||
onChange={async (files: any | null) => {
|
onChange={async (files: any | null) => {
|
||||||
try {
|
try {
|
||||||
// const buffer = URL.createObjectURL(
|
|
||||||
// new Blob([new Uint8Array(await files.arrayBuffer())])
|
|
||||||
// );
|
|
||||||
// console.log(buffer, "ini buffer");
|
|
||||||
// console.log(files, " ini file");
|
|
||||||
setFile(files);
|
setFile(files);
|
||||||
// onUpload(invoice.id, files);
|
// onUpload({ invoiceId: data.id, file: files });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
@@ -241,23 +249,16 @@ export function Investasi_ViewInvoice({
|
|||||||
bg={MainColor.yellow}
|
bg={MainColor.yellow}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
c={"black"}
|
c={"black"}
|
||||||
// onClick={() => onClick(router, invoice.id, setActive)}
|
loaderPosition="center"
|
||||||
|
loading={isLoading}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.push(NEW_RouterInvestasi.proses_transaksi + "1", {
|
onUpload();
|
||||||
scroll: false,
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Saya Sudah Transfer
|
Saya Sudah Transfer
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button disabled radius={"xl"}>
|
||||||
disabled
|
|
||||||
radius={"xl"}
|
|
||||||
// bg={"orange"}
|
|
||||||
// color="orange"
|
|
||||||
// onClick={() => onClick(router, invoice.id)}
|
|
||||||
>
|
|
||||||
Menunggu Bukti Transfer
|
Menunggu Bukti Transfer
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -7,11 +7,18 @@ import { Button, Paper, Radio, Stack, Text, Title } from "@mantine/core";
|
|||||||
import { useLocalStorage } from "@mantine/hooks";
|
import { useLocalStorage } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { MODEL_MASTER_BANK } from "../../_lib/interface";
|
||||||
|
import { investasi_funCreateInvoice } from "../../_fun/create/fun_create_invoice";
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { data } from "autoprefixer";
|
||||||
|
|
||||||
export function Investasi_ViewMetodePembayaran({
|
export function Investasi_ViewMetodePembayaran({
|
||||||
listBank,
|
listBank,
|
||||||
|
investasiId,
|
||||||
}: {
|
}: {
|
||||||
listBank: any[];
|
listBank: MODEL_MASTER_BANK[];
|
||||||
|
investasiId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [bank, setBank] = useState(listBank);
|
const [bank, setBank] = useState(listBank);
|
||||||
@@ -21,9 +28,25 @@ export function Investasi_ViewMetodePembayaran({
|
|||||||
key: "total_investasi",
|
key: "total_investasi",
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
});
|
});
|
||||||
|
const [jumlah, setJumlah] = useLocalStorage({
|
||||||
|
key: "jumlah_investasi",
|
||||||
|
defaultValue: 0,
|
||||||
|
});
|
||||||
|
|
||||||
async function onProses() {
|
async function onProses() {
|
||||||
router.push(NEW_RouterInvestasi.invoice + "1", { scroll: false });
|
const res = await investasi_funCreateInvoice({
|
||||||
|
data: {
|
||||||
|
total: total,
|
||||||
|
pilihBank: pilihBank,
|
||||||
|
investasiId: investasiId,
|
||||||
|
jumlah: jumlah,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status !== 201)
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
router.push(NEW_RouterInvestasi.invoice + res.data?.id, { scroll: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -57,7 +80,7 @@ export function Investasi_ViewMetodePembayaran({
|
|||||||
value={e.id}
|
value={e.id}
|
||||||
label={
|
label={
|
||||||
<Title order={6} color="white">
|
<Title order={6} color="white">
|
||||||
{e.name}
|
{e.namaBank}
|
||||||
</Title>
|
</Title>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { Warna } from "@/app/lib/warna";
|
||||||
import {
|
import {
|
||||||
AccentColor,
|
AccentColor,
|
||||||
MainColor,
|
MainColor,
|
||||||
@@ -11,8 +12,10 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
|
import { IconBrandWhatsapp } from "@tabler/icons-react";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
export function Investasi_ViewProsesTransaksi() {
|
export function Investasi_ViewProsesTransaksi({ nomorAdmin }: { nomorAdmin : any}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
@@ -78,17 +81,17 @@ export function Investasi_ViewProsesTransaksi() {
|
|||||||
Klik pada logo Whatsapp ini.
|
Klik pada logo Whatsapp ini.
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
{/* <Link
|
<Link
|
||||||
color="white"
|
color="white"
|
||||||
style={{
|
style={{
|
||||||
color: "black",
|
color: "black",
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
}}
|
}}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={`https://wa.me/+${nomorAdmin.nomor}?text=Hallo Admin , Saya ada kendala dalam proses transfer donasi!`}
|
href={`https://wa.me/+${nomorAdmin.nomor}?text=Hallo Admin , Saya ada kendala dalam proses transfer investasi !`}
|
||||||
>
|
>
|
||||||
<IconBrandWhatsapp size={40} color={Warna.hijau_cerah} />
|
<IconBrandWhatsapp size={40} color={Warna.hijau_cerah} />
|
||||||
</Link> */}
|
</Link>
|
||||||
</Group>
|
</Group>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { Warna } from "@/app/lib/warna";
|
import {
|
||||||
|
AccentColor,
|
||||||
|
MainColor,
|
||||||
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
import {
|
import {
|
||||||
ComponentGlobal_WarningMaxUpload,
|
ComponentGlobal_WarningMaxUpload,
|
||||||
maksimalUploadFile,
|
maksimalUploadFile,
|
||||||
} from "@/app_modules/_global/component/waring_popup";
|
} from "@/app_modules/_global/component/waring_popup";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||||
|
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||||
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import {
|
import {
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
Box,
|
Box,
|
||||||
@@ -28,17 +35,8 @@ import { useAtom } from "jotai";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import { funCreateInvestasi } from "../fun/fun_create_investasi";
|
import { funCreateInvestasi } from "../fun/fun_create_investasi";
|
||||||
import { gs_investasi_status, gs_investas_menu } from "../g_state";
|
import { gs_investas_menu, gs_investasi_status } from "../g_state";
|
||||||
import {
|
|
||||||
AccentColor,
|
|
||||||
MainColor,
|
|
||||||
} from "@/app_modules/_global/color/color_pallet";
|
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
|
||||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
|
||||||
|
|
||||||
export default function InvestasiCreate({
|
export default function InvestasiCreate({
|
||||||
id,
|
id,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { IconCamera, IconUpload } from "@tabler/icons-react";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import funCreateBeritaInvestasi from "../fun/fun_create_berita";
|
import funCreateBeritaInvestasi from "../fun/fun_create_berita";
|
||||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
@@ -45,7 +44,7 @@ export default function CreateBeritaInvestasi({
|
|||||||
async function onCreate() {
|
async function onCreate() {
|
||||||
const body = value;
|
const body = value;
|
||||||
|
|
||||||
if (_.values(body).includes("")) return toast("Lengkapi data");
|
if (_.values(body).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi data");
|
||||||
if (!fl) return ComponentGlobal_NotifikasiPeringatan("File Kosong");
|
if (!fl) return ComponentGlobal_NotifikasiPeringatan("File Kosong");
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
|
|||||||
@@ -1,44 +1,18 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { Warna } from "@/app/lib/warna";
|
import { Button, Stack } from "@mantine/core";
|
||||||
import {
|
|
||||||
ActionIcon,
|
|
||||||
AspectRatio,
|
|
||||||
Avatar,
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Flex,
|
|
||||||
Grid,
|
|
||||||
Group,
|
|
||||||
Image,
|
|
||||||
Paper,
|
|
||||||
Slider,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import {
|
|
||||||
IconBookDownload,
|
|
||||||
IconFileDescription,
|
|
||||||
IconSpeakerphone,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { gs_investasi_status } from "../../g_state";
|
import { gs_investasi_status } from "../../g_state";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
|
||||||
import funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
|
||||||
import { useState } from "react";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
import { ComponentInvestasi_DetailDataNonPublish } from "../../component/detail/detai_data_non_publish";
|
|
||||||
import { investasi_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
|
||||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||||
|
import { ComponentInvestasi_DetailDataNonPublish } from "../../component/detail/detai_data_non_publish";
|
||||||
|
import { investasi_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
|
|
||||||
export default function DetailReviewInvestasi({
|
export default function DetailReviewInvestasi({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
|
|||||||
@@ -3,11 +3,8 @@
|
|||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { Box, Center, Loader, Stack, Text, Title } from "@mantine/core";
|
import { Box, Center, Loader, Stack, Text, Title } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { IconCircleCheck } from "@tabler/icons-react";
|
|
||||||
import moment from "moment";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import Countdown from "react-countdown";
|
import Countdown from "react-countdown";
|
||||||
|
|
||||||
export default function CountDownTransaksiInvestasi() {
|
export default function CountDownTransaksiInvestasi() {
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
|
||||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||||
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
|
||||||
import { AppShell, Button, Center, Footer } from "@mantine/core";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
|
|
||||||
export default function LayoutEditBeritaInvestasi({
|
export default function LayoutEditBeritaInvestasi({
|
||||||
children,
|
children,
|
||||||
@@ -19,11 +15,6 @@ export default function LayoutEditBeritaInvestasi({
|
|||||||
<>
|
<>
|
||||||
<AppComponentGlobal_LayoutTamplate
|
<AppComponentGlobal_LayoutTamplate
|
||||||
header={<ComponentGlobal_HeaderTamplate title="Edit Berita" />}
|
header={<ComponentGlobal_HeaderTamplate title="Edit Berita" />}
|
||||||
// footer={
|
|
||||||
// <Footer height={70} sx={{ borderStyle: "none" }}>
|
|
||||||
|
|
||||||
// </Footer>
|
|
||||||
// }
|
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</AppComponentGlobal_LayoutTamplate>
|
</AppComponentGlobal_LayoutTamplate>
|
||||||
|
|||||||
@@ -1,31 +1,26 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { Warna } from "@/app/lib/warna";
|
||||||
import {
|
import {
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
FileButton,
|
FileButton,
|
||||||
FileInput,
|
|
||||||
Group,
|
Group,
|
||||||
Image,
|
Image,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
|
||||||
TextInput,
|
TextInput,
|
||||||
Textarea,
|
Textarea,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconCamera, IconUpload } from "@tabler/icons-react";
|
import { IconCamera } from "@tabler/icons-react";
|
||||||
import {
|
|
||||||
MODEL_INVESTASI,
|
|
||||||
Model_Berita_Investasi,
|
|
||||||
} from "../_lib/interface";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Model_Berita_Investasi } from "../_lib/interface";
|
||||||
import funEditBeritaInvestasi from "../fun/fun_edit_berita";
|
import funEditBeritaInvestasi from "../fun/fun_edit_berita";
|
||||||
import deleteBeritaInvestasi from "../fun/fun_delete_berita";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
|
||||||
export default function EditBeritaInvestasi({
|
export default function EditBeritaInvestasi({
|
||||||
dataBerita,
|
dataBerita,
|
||||||
@@ -39,7 +34,7 @@ export default function EditBeritaInvestasi({
|
|||||||
|
|
||||||
async function onUpdate() {
|
async function onUpdate() {
|
||||||
const body = edit;
|
const body = edit;
|
||||||
if (_.values(body).includes("")) return toast("Lengkapi data");
|
if (_.values(body).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi data");
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("file", fl as any);
|
fd.append("file", fl as any);
|
||||||
@@ -48,12 +43,11 @@ export default function EditBeritaInvestasi({
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
toast(res.message)
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
|
||||||
import {
|
import {
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
Button,
|
Button,
|
||||||
@@ -9,7 +8,6 @@ import {
|
|||||||
FileButton,
|
FileButton,
|
||||||
Group,
|
Group,
|
||||||
Image,
|
Image,
|
||||||
Modal,
|
|
||||||
NumberInput,
|
NumberInput,
|
||||||
Paper,
|
Paper,
|
||||||
Select,
|
Select,
|
||||||
@@ -21,25 +19,25 @@ import { IconUpload } from "@tabler/icons-react";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import {
|
||||||
|
AccentColor,
|
||||||
|
MainColor,
|
||||||
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||||
import {
|
import {
|
||||||
ComponentGlobal_WarningMaxUpload,
|
ComponentGlobal_WarningMaxUpload,
|
||||||
maksimalUploadFile,
|
maksimalUploadFile,
|
||||||
} from "@/app_modules/_global/component/waring_popup";
|
} from "@/app_modules/_global/component/waring_popup";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||||
import { useDisclosure, useWindowScroll } from "@mantine/hooks";
|
import { useDisclosure, useWindowScroll } from "@mantine/hooks";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import funEditInvestasi from "../fun/fun_edit_investasi";
|
|
||||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||||
import {
|
import funEditInvestasi from "../fun/fun_edit_investasi";
|
||||||
AccentColor,
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
MainColor,
|
|
||||||
} from "@/app_modules/_global/color/color_pallet";
|
|
||||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
|
||||||
|
|
||||||
export default function EditIntroInvestasi({
|
export default function EditIntroInvestasi({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
@@ -70,7 +68,8 @@ export default function EditIntroInvestasi({
|
|||||||
|
|
||||||
async function onUpdate() {
|
async function onUpdate() {
|
||||||
const body = edit_inves;
|
const body = edit_inves;
|
||||||
if (_.values(edit_inves).includes("")) return toast("Lengkapi data");
|
if (_.values(edit_inves).includes(""))
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi data");
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("file", fl as any);
|
fd.append("file", fl as any);
|
||||||
|
|||||||
@@ -1,36 +1,31 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
|
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
import UIGlobal_Drawer from "@/app_modules/_global/ui/ui_drawer";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
Box,
|
Box,
|
||||||
Center,
|
|
||||||
Divider,
|
|
||||||
Grid,
|
Grid,
|
||||||
Group,
|
Group,
|
||||||
Image,
|
Image,
|
||||||
Menu,
|
|
||||||
Paper,
|
Paper,
|
||||||
Spoiler,
|
Spoiler,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconDots, IconEdit } from "@tabler/icons-react";
|
import { IconEdit } from "@tabler/icons-react";
|
||||||
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import _ from "lodash";
|
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||||
import getOneInvestasiById from "../fun/get_one_investasi_by_id";
|
|
||||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
|
||||||
import funDeleteBeritaInvestasi from "../fun/fun_delete_berita";
|
import funDeleteBeritaInvestasi from "../fun/fun_delete_berita";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import funLoadDataInvestasi from "../fun/fun_load_data";
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
|
||||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
|
||||||
import UIGlobal_Drawer from "@/app_modules/_global/ui/ui_drawer";
|
|
||||||
|
|
||||||
export default function ListEditBeritaInvestasi({
|
export default function ListEditBeritaInvestasi({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
@@ -46,10 +41,10 @@ export default function ListEditBeritaInvestasi({
|
|||||||
await funDeleteBeritaInvestasi(idBerita).then(async (res) => {
|
await funDeleteBeritaInvestasi(idBerita).then(async (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const load = await funLoadDataInvestasi(investasi.id);
|
const load = await funLoadDataInvestasi(investasi.id);
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
return setInvestasi(load as any);
|
return setInvestasi(load as any);
|
||||||
} else {
|
} else {
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -79,7 +74,9 @@ export default function ListEditBeritaInvestasi({
|
|||||||
color: "white",
|
color: "white",
|
||||||
marginBottom: "15px",
|
marginBottom: "15px",
|
||||||
}}
|
}}
|
||||||
onClick={() => router.push(RouterInvestasi_OLD.detail_berita + v.id)}
|
onClick={() =>
|
||||||
|
router.push(RouterInvestasi_OLD.detail_berita + v.id)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Stack spacing={"xs"}>
|
<Stack spacing={"xs"}>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
|
|||||||
@@ -2,33 +2,25 @@
|
|||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { Warna } from "@/app/lib/warna";
|
import { Warna } from "@/app/lib/warna";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
import {
|
import {
|
||||||
Avatar,
|
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Flex,
|
Flex,
|
||||||
Group,
|
|
||||||
Paper,
|
Paper,
|
||||||
Radio,
|
Radio,
|
||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useAtom } from "jotai";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
import { MODEL_INVESTASI, MODEL_MASTER_BANK } from "../_lib/interface";
|
||||||
import {
|
|
||||||
MODEL_INVESTASI,
|
|
||||||
MODEL_Transaksi_Investasi,
|
|
||||||
MODEL_MASTER_BANK,
|
|
||||||
} from "../_lib/interface";
|
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import { gs_TransferValue } from "../g_state";
|
|
||||||
import getNorekInvestasi from "../fun/get_norek";
|
|
||||||
import _ from "lodash";
|
|
||||||
import funCreateTransaksiInvestasi from "../fun/fun_create_transaksi";
|
import funCreateTransaksiInvestasi from "../fun/fun_create_transaksi";
|
||||||
import { myConsole } from "@/app/fun/my_console";
|
import getNorekInvestasi from "../fun/get_norek";
|
||||||
|
import { gs_TransferValue } from "../g_state";
|
||||||
|
|
||||||
export default function MetodeTransferInvestasi({
|
export default function MetodeTransferInvestasi({
|
||||||
dataInvestasi,
|
dataInvestasi,
|
||||||
@@ -53,10 +45,10 @@ export default function MetodeTransferInvestasi({
|
|||||||
authorId
|
authorId
|
||||||
).then(async (res) => {
|
).then(async (res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
router.push(RouterInvestasi_OLD.transfer + `${res.res?.id}`);
|
router.push(RouterInvestasi_OLD.transfer + `${res.res?.id}`);
|
||||||
} else {
|
} else {
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -70,7 +62,7 @@ export default function MetodeTransferInvestasi({
|
|||||||
nomorRekening: res.res?.norek as any,
|
nomorRekening: res.res?.norek as any,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,20 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
import { Warna } from "@/app/lib/warna";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
Divider,
|
||||||
Grid,
|
|
||||||
Group,
|
Group,
|
||||||
NumberInput,
|
NumberInput,
|
||||||
Text,
|
Text,
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useCounter, useFocusTrap, useShallowEffect } from "@mantine/hooks";
|
import { useFocusTrap } from "@mantine/hooks";
|
||||||
import {
|
import { useAtom } from "jotai";
|
||||||
IconMinus,
|
|
||||||
IconNumber10Small,
|
|
||||||
IconPlus,
|
|
||||||
IconRefresh,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
import { MODEL_INVESTASI } from "../_lib/interface";
|
||||||
import { error } from "console";
|
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import { gs_TransferValue } from "../g_state";
|
import { gs_TransferValue } from "../g_state";
|
||||||
|
|
||||||
export default function ProsesInvestasi({
|
export default function ProsesInvestasi({
|
||||||
@@ -61,7 +48,6 @@ export default function ProsesInvestasi({
|
|||||||
const randomId = date.getTime();
|
const randomId = date.getTime();
|
||||||
|
|
||||||
async function onProses() {
|
async function onProses() {
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
transaction_details: {
|
transaction_details: {
|
||||||
order_id: "hipmi_" + `${randomId}`,
|
order_id: "hipmi_" + `${randomId}`,
|
||||||
@@ -69,7 +55,7 @@ export default function ProsesInvestasi({
|
|||||||
},
|
},
|
||||||
item_details: [
|
item_details: [
|
||||||
{
|
{
|
||||||
id: "item_"+ `${randomId}`,
|
id: "item_" + `${randomId}`,
|
||||||
name: investasi.title,
|
name: investasi.title,
|
||||||
price: Number(investasi.hargaLembar),
|
price: Number(investasi.hargaLembar),
|
||||||
quantity: transferValue.lembarTerbeli,
|
quantity: transferValue.lembarTerbeli,
|
||||||
|
|||||||
@@ -1,36 +1,29 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
|
||||||
import {
|
|
||||||
Box,
|
|
||||||
Group,
|
|
||||||
NumberInput,
|
|
||||||
Divider,
|
|
||||||
Center,
|
|
||||||
Button,
|
|
||||||
Text,
|
|
||||||
Container,
|
|
||||||
Flex,
|
|
||||||
TextInput,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { useFocusTrap, useShallowEffect } from "@mantine/hooks";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { MODEL_INVESTASI } from "../_lib/interface";
|
|
||||||
import { MODEL_PROFILE_OLD } from "@/app_modules/home/model/user_profile";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import getTokenTransaksi from "../fun/get_token_transaksi";
|
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import funUpdatePaymentInvestasi from "../fun/fun_update_payment";
|
|
||||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import { gs_investas_menu, gs_midtrans_snap } from "../g_state";
|
|
||||||
import funUpdateInvestasi from "../fun/fun_update_investasi";
|
|
||||||
import {
|
import {
|
||||||
AccentColor,
|
AccentColor,
|
||||||
MainColor,
|
MainColor,
|
||||||
} from "@/app_modules/_global/color/color_pallet";
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Divider,
|
||||||
|
Group,
|
||||||
|
NumberInput,
|
||||||
|
Text,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { useFocusTrap, useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import funUpdateInvestasi from "../fun/fun_update_investasi";
|
||||||
|
import funUpdatePaymentInvestasi from "../fun/fun_update_payment";
|
||||||
|
import getTokenTransaksi from "../fun/get_token_transaksi";
|
||||||
|
import { gs_investas_menu } from "../g_state";
|
||||||
|
|
||||||
export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
export default function ProsesTransaksiInvestasi({ dataInvestasi, userLogin }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -4,19 +4,15 @@ import { Warna } from "@/app/lib/warna";
|
|||||||
import {
|
import {
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
|
||||||
CopyButton,
|
|
||||||
FileButton,
|
FileButton,
|
||||||
Grid,
|
Grid,
|
||||||
Group,
|
Group,
|
||||||
Image,
|
Image,
|
||||||
Text,
|
Text
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { IconCamera } from "@tabler/icons-react";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
|
|
||||||
export default function UploadBuktiTransferInvestasi() {
|
export default function UploadBuktiTransferInvestasi() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -25,13 +21,12 @@ export default function UploadBuktiTransferInvestasi() {
|
|||||||
const [total, setTotal] = useState<any | null>(null);
|
const [total, setTotal] = useState<any | null>(null);
|
||||||
const [bank, setBank] = useState<any | null>(null);
|
const [bank, setBank] = useState<any | null>(null);
|
||||||
|
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
if (typeof window !== undefined) {
|
if (typeof window !== undefined) {
|
||||||
const totalHarga = localStorage.getItem("total_harga");
|
const totalHarga = localStorage.getItem("total_harga");
|
||||||
const pilihBank = localStorage.getItem("bank")
|
const pilihBank = localStorage.getItem("bank");
|
||||||
setTotal(totalHarga);
|
setTotal(totalHarga);
|
||||||
setBank(pilihBank)
|
setBank(pilihBank);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -45,7 +40,6 @@ export default function UploadBuktiTransferInvestasi() {
|
|||||||
<Grid.Col span={7}>
|
<Grid.Col span={7}>
|
||||||
<Text fw={"bold"}>Xendit</Text>
|
<Text fw={"bold"}>Xendit</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{/* Nomor rekening */}
|
{/* Nomor rekening */}
|
||||||
@@ -53,7 +47,7 @@ export default function UploadBuktiTransferInvestasi() {
|
|||||||
<Grid.Col span={5}>
|
<Grid.Col span={5}>
|
||||||
<Text>Nomor Rekening</Text>
|
<Text>Nomor Rekening</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={7} >
|
<Grid.Col span={7}>
|
||||||
<Text fw={"bold"}>{bank}</Text>
|
<Text fw={"bold"}>{bank}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
{/* <Grid.Col span={"auto"}>
|
{/* <Grid.Col span={"auto"}>
|
||||||
@@ -80,7 +74,6 @@ export default function UploadBuktiTransferInvestasi() {
|
|||||||
<Grid.Col span={7}>
|
<Grid.Col span={7}>
|
||||||
<Text fw={"bold"}>Rp. {total}</Text>
|
<Text fw={"bold"}>Rp. {total}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{/* Upload */}
|
{/* Upload */}
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
import {
|
||||||
|
AccentColor,
|
||||||
|
MainColor,
|
||||||
|
} 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 { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
import {
|
import {
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
|
||||||
FileButton,
|
FileButton,
|
||||||
Group,
|
Group,
|
||||||
Image,
|
Image,
|
||||||
@@ -16,15 +21,7 @@ import {
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import funUploadDokumenInvestasi from "../fun/fun_upload_dokumen";
|
import funUploadDokumenInvestasi from "../fun/fun_upload_dokumen";
|
||||||
import {
|
|
||||||
AccentColor,
|
|
||||||
MainColor,
|
|
||||||
} from "@/app_modules/_global/color/color_pallet";
|
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
|
||||||
|
|
||||||
export default function UploadDokumenInvestasi({
|
export default function UploadDokumenInvestasi({
|
||||||
idInves,
|
idInves,
|
||||||
@@ -42,7 +39,8 @@ export default function UploadDokumenInvestasi({
|
|||||||
idInves: idInves,
|
idInves: idInves,
|
||||||
title: title,
|
title: title,
|
||||||
};
|
};
|
||||||
if (_.values(body).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi nama dokumen");
|
if (_.values(body).includes(""))
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi nama dokumen");
|
||||||
if (!pdf) return ComponentGlobal_NotifikasiPeringatan("File Kosong");
|
if (!pdf) return ComponentGlobal_NotifikasiPeringatan("File Kosong");
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
@@ -51,7 +49,7 @@ export default function UploadDokumenInvestasi({
|
|||||||
await funUploadDokumenInvestasi(fd, body).then((res) => {
|
await funUploadDokumenInvestasi(fd, body).then((res) => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
setLoading(true)
|
setLoading(true);
|
||||||
ComponentGlobal_NotifikasiBerhasil("Berhasil upload");
|
ComponentGlobal_NotifikasiBerhasil("Berhasil upload");
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Warna } from "@/app/lib/warna";
|
|
||||||
import {
|
|
||||||
Group,
|
|
||||||
FileButton,
|
|
||||||
Button,
|
|
||||||
Box,
|
|
||||||
Paper,
|
|
||||||
AspectRatio,
|
|
||||||
Image,
|
|
||||||
Stack,
|
|
||||||
Center,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useState } from "react";
|
|
||||||
import toast from "react-simple-toasts";
|
|
||||||
import funUploadProspektusInvestasi from "../fun/fun_upload_prospek";
|
|
||||||
import funLoadDataInvestasi from "../fun/fun_load_data";
|
|
||||||
import {
|
import {
|
||||||
AccentColor,
|
AccentColor,
|
||||||
MainColor,
|
MainColor,
|
||||||
} from "@/app_modules/_global/color/color_pallet";
|
} 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 { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
|
import {
|
||||||
|
AspectRatio,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
FileButton,
|
||||||
|
Group,
|
||||||
|
Image,
|
||||||
|
Paper,
|
||||||
|
Stack
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import funUploadProspektusInvestasi from "../fun/fun_upload_prospek";
|
||||||
|
|
||||||
export default function UploadProspektusInvestasi({
|
export default function UploadProspektusInvestasi({
|
||||||
idInves,
|
idInves,
|
||||||
@@ -32,17 +31,17 @@ export default function UploadProspektusInvestasi({
|
|||||||
const [pdf, setPdf] = useState<File | null>(null);
|
const [pdf, setPdf] = useState<File | null>(null);
|
||||||
|
|
||||||
async function onUpload() {
|
async function onUpload() {
|
||||||
if (!pdf) return toast("File Kosong");
|
if (!pdf) return ComponentGlobal_NotifikasiPeringatan("File Kosong");
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("file", pdf as any);
|
fd.append("file", pdf as any);
|
||||||
|
|
||||||
await funUploadProspektusInvestasi(fd, idInves).then((res) => {
|
await funUploadProspektusInvestasi(fd, idInves).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
toast("Berhasil upload");
|
ComponentGlobal_NotifikasiBerhasil("Berhasil upload");
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
toast(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import toast from "react-simple-toasts";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
import { funGetListPortofolio } from "./get/get_list_portofolio";
|
import { funGetListPortofolio } from "./get/get_list_portofolio";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param id - profileId
|
* @param id - profileId
|
||||||
* @returns load list portofolio by Id
|
* @returns load list portofolio by Id
|
||||||
*/
|
*/
|
||||||
export async function loadListPortofolio(id: string) {
|
export async function loadListPortofolio(id: string) {
|
||||||
if (id === null) {
|
if (id === null) {
|
||||||
return toast("Id null");
|
return ComponentGlobal_NotifikasiPeringatan("Id null");
|
||||||
} else {
|
} else {
|
||||||
const data = await funGetListPortofolio(id).then((res) => res);
|
const data = await funGetListPortofolio(id).then((res) => res);
|
||||||
return data
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||