fix
## Deskripsi: - Optimalisasi admin voting ## No issue
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import { Stack } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import { Document, Page, pdfjs } from "react-pdf";
|
||||
import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||
import "react-pdf/dist/Page/TextLayer.css";
|
||||
import styles from "./styles.module.css";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
// import { useState } from "react";
|
||||
// import { Document, Page, pdfjs } from "react-pdf";
|
||||
// import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||
// import "react-pdf/dist/Page/TextLayer.css";
|
||||
// import styles from "./styles.module.css";
|
||||
// import { GlobalWorkerOptions } from "pdfjs-dist";
|
||||
|
||||
// pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
||||
// "pdfjs-dist/build/pdf.worker.min.mjs",
|
||||
// import.meta.url
|
||||
// ).toString();
|
||||
// GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.5.136/pdf.worker.js`;
|
||||
|
||||
export function Investasi_ViewFileViewer({
|
||||
fileId,
|
||||
@@ -17,7 +15,12 @@ export function Investasi_ViewFileViewer({
|
||||
fileId: string;
|
||||
path: string;
|
||||
}) {
|
||||
return <Stack>{/* <MyFile file={path + fileId} /> */}</Stack>;
|
||||
return (
|
||||
<Stack>
|
||||
Maintenance
|
||||
{/* <MyFile file={path + fileId} /> */}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
// function MyFile({ file }: { file: any }) {
|
||||
@@ -28,15 +31,19 @@ export function Investasi_ViewFileViewer({
|
||||
// setNumPages(numPages);
|
||||
// }
|
||||
|
||||
// return<>
|
||||
// <Text>Maintenance</Text>
|
||||
// </>
|
||||
|
||||
// return (
|
||||
// <div>
|
||||
// <Document
|
||||
// className={styles.file_view}
|
||||
// // className={styles.file_view}
|
||||
// file={file}
|
||||
// onLoadSuccess={onDocumentLoadSuccess}
|
||||
|
||||
// >
|
||||
// <Page className={styles.page} pageNumber={pageNumber} />
|
||||
// <Page pageNumber={pageNumber} />
|
||||
// </Document>
|
||||
// {/* <p>
|
||||
// Page {pageNumber} of {numPages}
|
||||
|
||||
68
src/app_modules/investasi/_view/main/view_transaksi.tsx
Normal file
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 { useRouter } from "next/navigation";
|
||||
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({
|
||||
dataInvoice,
|
||||
}: {
|
||||
dataInvoice: any;
|
||||
dataInvoice: MODEL_INVOICE_INVESTASI;
|
||||
}) {
|
||||
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 [image, setImage] = useState<any | null>(null);
|
||||
// const [active, setActive] = useAtom(gs_donasi_hot_menu);
|
||||
// const [image, setImage] = useState<any | null>(null);
|
||||
|
||||
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 (
|
||||
<>
|
||||
@@ -48,10 +68,6 @@ export function Investasi_ViewInvoice({
|
||||
}}
|
||||
>
|
||||
<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>
|
||||
|
||||
<Paper
|
||||
@@ -67,8 +83,8 @@ export function Investasi_ViewInvoice({
|
||||
>
|
||||
<Stack spacing={"md"}>
|
||||
<Stack spacing={0}>
|
||||
<Text>Bank {invoice?.DonasiMaster_Bank?.name}</Text>
|
||||
<Text>PT. Himpunan Pengusaha Badung</Text>
|
||||
<Text>Bank {data?.MasterBank?.namaBank}</Text>
|
||||
<Text>{data?.MasterBank?.namaAkun}</Text>
|
||||
</Stack>
|
||||
<Paper
|
||||
style={{
|
||||
@@ -84,13 +100,13 @@ export function Investasi_ViewInvoice({
|
||||
<Grid.Col span={8}>
|
||||
<Group position="left" align="center" h={"100%"}>
|
||||
<Title order={4} color={MainColor.yellow}>
|
||||
{invoice?.DonasiMaster_Bank?.norek}
|
||||
{data?.MasterBank?.norek}
|
||||
</Title>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Group position="right">
|
||||
<CopyButton value={invoice?.DonasiMaster_Bank?.norek}>
|
||||
<CopyButton value={data?.MasterBank?.norek}>
|
||||
{({ copied, copy }) => (
|
||||
<Button
|
||||
style={{
|
||||
@@ -141,13 +157,13 @@ export function Investasi_ViewInvoice({
|
||||
<Grid.Col span={8}>
|
||||
<Group position="left" align="center" h={"100%"}>
|
||||
<Title order={4} color="white">
|
||||
<TampilanRupiahDonasi nominal={+(+invoice.nominal)} />
|
||||
<TampilanRupiahDonasi nominal={+(+data.nominal)} />
|
||||
</Title>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Group position="right">
|
||||
<CopyButton value={"" + +invoice.nominal}>
|
||||
<CopyButton value={"" + +data.nominal}>
|
||||
{({ copied, copy }) => (
|
||||
<Button
|
||||
style={{
|
||||
@@ -167,9 +183,6 @@ export function Investasi_ViewInvoice({
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
{/* <Text fz={"xs"} c={"gray"}>
|
||||
Sudah termasuk biaya admin Rp. 2.500,-
|
||||
</Text> */}
|
||||
</Stack>
|
||||
</Paper>
|
||||
|
||||
@@ -189,13 +202,8 @@ export function Investasi_ViewInvoice({
|
||||
<FileButton
|
||||
onChange={async (files: any | null) => {
|
||||
try {
|
||||
// const buffer = URL.createObjectURL(
|
||||
// new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
// );
|
||||
// console.log(buffer, "ini buffer");
|
||||
// console.log(files, " ini file");
|
||||
setFile(files);
|
||||
// onUpload(invoice.id, files);
|
||||
// onUpload({ invoiceId: data.id, file: files });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -241,23 +249,16 @@ export function Investasi_ViewInvoice({
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
// onClick={() => onClick(router, invoice.id, setActive)}
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
onClick={() => {
|
||||
router.push(NEW_RouterInvestasi.proses_transaksi + "1", {
|
||||
scroll: false,
|
||||
});
|
||||
onUpload();
|
||||
}}
|
||||
>
|
||||
Saya Sudah Transfer
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
disabled
|
||||
radius={"xl"}
|
||||
// bg={"orange"}
|
||||
// color="orange"
|
||||
// onClick={() => onClick(router, invoice.id)}
|
||||
>
|
||||
<Button disabled radius={"xl"}>
|
||||
Menunggu Bukti Transfer
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -7,11 +7,18 @@ import { Button, Paper, Radio, Stack, Text, Title } from "@mantine/core";
|
||||
import { useLocalStorage } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
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({
|
||||
listBank,
|
||||
investasiId,
|
||||
}: {
|
||||
listBank: any[];
|
||||
listBank: MODEL_MASTER_BANK[];
|
||||
investasiId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [bank, setBank] = useState(listBank);
|
||||
@@ -21,9 +28,25 @@ export function Investasi_ViewMetodePembayaran({
|
||||
key: "total_investasi",
|
||||
defaultValue: 0,
|
||||
});
|
||||
const [jumlah, setJumlah] = useLocalStorage({
|
||||
key: "jumlah_investasi",
|
||||
defaultValue: 0,
|
||||
});
|
||||
|
||||
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 (
|
||||
@@ -57,7 +80,7 @@ export function Investasi_ViewMetodePembayaran({
|
||||
value={e.id}
|
||||
label={
|
||||
<Title order={6} color="white">
|
||||
{e.name}
|
||||
{e.namaBank}
|
||||
</Title>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
@@ -11,8 +12,10 @@ import {
|
||||
Text,
|
||||
Title,
|
||||
} 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 (
|
||||
<>
|
||||
<Stack>
|
||||
@@ -78,17 +81,17 @@ export function Investasi_ViewProsesTransaksi() {
|
||||
Klik pada logo Whatsapp ini.
|
||||
</Text>
|
||||
</Stack>
|
||||
{/* <Link
|
||||
color="white"
|
||||
style={{
|
||||
color: "black",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
target="_blank"
|
||||
href={`https://wa.me/+${nomorAdmin.nomor}?text=Hallo Admin , Saya ada kendala dalam proses transfer donasi!`}
|
||||
>
|
||||
<IconBrandWhatsapp size={40} color={Warna.hijau_cerah} />
|
||||
</Link> */}
|
||||
<Link
|
||||
color="white"
|
||||
style={{
|
||||
color: "black",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
target="_blank"
|
||||
href={`https://wa.me/+${nomorAdmin.nomor}?text=Hallo Admin , Saya ada kendala dalam proses transfer investasi !`}
|
||||
>
|
||||
<IconBrandWhatsapp size={40} color={Warna.hijau_cerah} />
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
</Paper>
|
||||
|
||||
Reference in New Issue
Block a user