# feat :
## Deskripsi : - Notifikasi investasi ## Issue : Gerbang pembayaran
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { ActionIcon, Affix, Box, rem } from "@mantine/core";
|
||||
import { ActionIcon, Affix, Box, Center, rem } from "@mantine/core";
|
||||
import { useWindowScroll } from "@mantine/hooks";
|
||||
import { IconPencilPlus } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_CardPublish from "../component/card_view/box_publish";
|
||||
import ComponentDonasi_CardPublish from "../component/card_view/card_publish";
|
||||
import { MODEL_DONASI } from "../model/interface";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import _ from "lodash";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { donasi_funGetAllPublish } from "../fun/get/get_list_beranda";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
|
||||
export default function MainDonasi({
|
||||
listDonasi,
|
||||
@@ -18,6 +21,7 @@ export default function MainDonasi({
|
||||
listDonasi: MODEL_DONASI[];
|
||||
}) {
|
||||
const [data, setData] = useState(listDonasi);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -26,14 +30,32 @@ export default function MainDonasi({
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
data.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ScrollOnly
|
||||
height="82vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await donasi_funGetAllPublish({
|
||||
page: activePage + 1,
|
||||
});
|
||||
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<ComponentDonasi_CardPublish
|
||||
data={e as any}
|
||||
data={item as any}
|
||||
path={RouterDonasi.detail_main}
|
||||
/>
|
||||
</Box>
|
||||
))
|
||||
)}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
AspectRatio,
|
||||
Badge,
|
||||
Box,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
@@ -25,105 +26,56 @@ 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";
|
||||
|
||||
export default function DonasiSayaDonasi({
|
||||
listInvoice,
|
||||
}: {
|
||||
listInvoice: MODEL_DONASI_INVOICE[];
|
||||
}) {
|
||||
const [invoice, setInvoice] = useState(listInvoice);
|
||||
const router = useRouter();
|
||||
const { height, width } = useViewportSize();
|
||||
|
||||
if (_.isEmpty(listInvoice))
|
||||
return <ComponentGlobal_IsEmptyData />;
|
||||
const [data, setData] = useState(listInvoice);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
{invoice.map((e, i) => (
|
||||
<Box
|
||||
style={{
|
||||
backgroundColor: AccentColor.blue,
|
||||
border: `2px solid ${AccentColor.darkblue}`,
|
||||
padding: "15px",
|
||||
cursor: "pointer",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
key={i}
|
||||
onClick={() =>
|
||||
onClick(router, e.donasiMaster_StatusInvoiceId, e.id, e.Donasi.id)
|
||||
}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={5}>
|
||||
<Stack spacing={5}>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={"xs"} fw={"bold"} truncate>
|
||||
{e.Donasi.title}
|
||||
</Text>
|
||||
<ComponentDonasi_TampilanHitungMundur
|
||||
durasi={e.Donasi.DonasiMaster_Durasi.name}
|
||||
publishTime={e.Donasi.publishTime}
|
||||
textSize={10}
|
||||
/>
|
||||
</Stack>
|
||||
<Progress value={+e.Donasi.progres} color="orange" />
|
||||
<Group position="apart">
|
||||
<Stack spacing={0}>
|
||||
<Text fz={10}>Donasi Saya</Text>
|
||||
<Text fz={10} fw={"bold"} c={"orange"} truncate>
|
||||
<TampilanRupiahDonasi nominal={+e.nominal} />
|
||||
</Text>
|
||||
</Stack>
|
||||
</Group>
|
||||
<Badge size="xs" variant="filled" color="yellow">
|
||||
<Text>{e.DonasiMaster_StatusInvoice.name}</Text>
|
||||
</Badge>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={7}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<Image
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_gambar + `${e.Donasi.imagesId}`}
|
||||
radius={"md"}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{/* {width > 575 ? "" : <Divider />} */}
|
||||
</Stack>
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
<Box>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="82vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await donasi_funGetAllInvoiceByAuthorId({
|
||||
page: activePage + 1,
|
||||
});
|
||||
|
||||
function HitungMundur({
|
||||
durasi,
|
||||
publishTime,
|
||||
}: {
|
||||
durasi: string;
|
||||
publishTime: Date;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={0} align="center">
|
||||
<Text fz={"xs"}>Sisa hari </Text>
|
||||
<Text span inherit fw={"bold"} fz={"xs"}>
|
||||
{Number(durasi) -
|
||||
moment(new Date()).diff(new Date(publishTime), "days") <=
|
||||
0
|
||||
? 0
|
||||
: Number(durasi) -
|
||||
moment(new Date()).diff(new Date(publishTime), "days")}
|
||||
</Text>
|
||||
</Stack>
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<ComponentDonasi_CardInvoice
|
||||
data={item as any}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -143,7 +95,7 @@ async function onClick(
|
||||
if (status === "3") {
|
||||
return router.push(RouterDonasi.invoice + `${invoiceId}`);
|
||||
} else {
|
||||
toast("gagal");
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Melihat Invoice");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import {
|
||||
Box
|
||||
} from "@mantine/core";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import { ComponentDonasi_CardStatus } from "../../component/card_view/card_status";
|
||||
import { donasi_funGetAllStatusDraft } from "../../fun/get/status/get_all_status_draft";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
|
||||
export default function PostingDraftDonasi({
|
||||
@@ -14,18 +16,51 @@ export default function PostingDraftDonasi({
|
||||
}: {
|
||||
listDraft: MODEL_DONASI[];
|
||||
}) {
|
||||
if (_.isEmpty(listDraft)) return <ComponentGlobal_IsEmptyData />;
|
||||
const [data, setData] = useState(listDraft);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
{listDraft.map((e, i) => (
|
||||
{/* {listDraft.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentDonasi_CardStatus
|
||||
data={e}
|
||||
path={RouterDonasi.detail_draft}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
))} */}
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<Box>
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await donasi_funGetAllStatusDraft({
|
||||
page: activePage + 1,
|
||||
});
|
||||
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<ComponentDonasi_CardStatus
|
||||
data={item}
|
||||
path={RouterDonasi.detail_draft}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
</Box>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import ComponentDonasi_CardPublish from "../../component/card_view/box_publish";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { Box } from "@mantine/core";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_CardPublish from "../../component/card_view/card_publish";
|
||||
import { donasi_funGetAllStatusPublish } from "../../fun/get/status/get_all_status_publish";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
|
||||
export default function PostingPublishDonasi({
|
||||
listPublish,
|
||||
@@ -14,27 +17,42 @@ export default function PostingPublishDonasi({
|
||||
listPublish: MODEL_DONASI[];
|
||||
}) {
|
||||
const [data, setData] = useState(listPublish);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
data.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentDonasi_CardPublish
|
||||
data={e}
|
||||
path={RouterDonasi.detail_publish}
|
||||
/>
|
||||
</Box>
|
||||
))
|
||||
<Box >
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await donasi_funGetAllStatusPublish({
|
||||
page: activePage + 1,
|
||||
});
|
||||
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<ComponentDonasi_CardPublish
|
||||
data={item}
|
||||
path={RouterDonasi.detail_publish}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
</Box>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
// return (
|
||||
// <>
|
||||
// <ComponentDonasi_CardPublish dataDonasi={listPublish} path={RouterDonasi.detail_publish} />
|
||||
// </>
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
Divider,
|
||||
Grid,
|
||||
Image,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { useViewportSize } from "@mantine/hooks";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_IsEmptyData from "../../component/is_empty_data";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { ComponentDonasi_CardStatus } from "../../component/card_view/card_status";
|
||||
import { donasi_funGetAllStatusReject } from "../../fun/get/status/get_all_status_reject";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
|
||||
export default function PostingRejectDonasi({
|
||||
listReject,
|
||||
@@ -26,73 +17,42 @@ export default function PostingRejectDonasi({
|
||||
listReject: MODEL_DONASI[];
|
||||
}) {
|
||||
const [data, setData] = useState(listReject);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
{data.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentDonasi_CardStatus
|
||||
data={e}
|
||||
path={RouterDonasi.detail_reject}
|
||||
/>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<Box>
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await donasi_funGetAllStatusReject({
|
||||
page: activePage + 1,
|
||||
});
|
||||
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<ComponentDonasi_CardStatus
|
||||
data={item}
|
||||
path={RouterDonasi.detail_reject}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
</Box>
|
||||
))}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
// if (_.isEmpty(listReject))
|
||||
// return <ComponentDonasi_IsEmptyData text="Tidak ada data" />;
|
||||
|
||||
// return (
|
||||
// <>
|
||||
// <SimpleGrid
|
||||
// cols={4}
|
||||
// spacing="lg"
|
||||
// breakpoints={[
|
||||
// { maxWidth: "62rem", cols: 3, spacing: "md" },
|
||||
// { maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
// { maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
// ]}
|
||||
// >
|
||||
// {donasi.map((e, i) => (
|
||||
// <Box
|
||||
// key={i}
|
||||
// onClick={() => router.push(RouterDonasi.detail_reject + `${e.id}`)}
|
||||
// >
|
||||
// <Stack>
|
||||
// <Grid>
|
||||
// <Grid.Col span={7}>
|
||||
// <AspectRatio ratio={16 / 9}>
|
||||
// <Paper radius={"md"}>
|
||||
// <Image
|
||||
// alt="Foto"
|
||||
// src={RouterDonasi.api_gambar + `${e.imagesId}`}
|
||||
// radius={"md"}
|
||||
// />
|
||||
// </Paper>
|
||||
// </AspectRatio>
|
||||
// </Grid.Col>
|
||||
// <Grid.Col span={5}>
|
||||
// <Stack spacing={"xs"}>
|
||||
// <Text fz={"sm"} fw={"bold"} lineClamp={2}>
|
||||
// {e.title}
|
||||
// </Text>
|
||||
// <Stack spacing={0}>
|
||||
// <Text fz={"sm"} fw={"bold"}>
|
||||
// Alasan ditolak
|
||||
// </Text>
|
||||
// <Text fz={"sm"} lineClamp={2}>
|
||||
// {e.catatan}
|
||||
// </Text>
|
||||
// </Stack>
|
||||
// </Stack>
|
||||
// </Grid.Col>
|
||||
// </Grid>
|
||||
// {width > 575 ? "" : <Divider />}
|
||||
// </Stack>
|
||||
// </Box>
|
||||
// ))}
|
||||
// </SimpleGrid>
|
||||
// </>
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -1,29 +1,58 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { Box } from "@mantine/core";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import _ from "lodash";
|
||||
import { ComponentDonasi_CardStatus } from "../../component/card_view/card_status";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { donasi_funGetAllStatusReview } from "../../fun/get/status/get_all_status_review";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function PostingReviewDonasi({
|
||||
listReview,
|
||||
}: {
|
||||
listReview: MODEL_DONASI[];
|
||||
}) {
|
||||
if (_.isEmpty(listReview)) return <ComponentGlobal_IsEmptyData />;
|
||||
const [data, setData] = useState(listReview);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
{listReview.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentDonasi_CardStatus
|
||||
data={e}
|
||||
path={RouterDonasi.detail_review}
|
||||
/>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
// --- Main component --- //
|
||||
<Box>
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await donasi_funGetAllStatusReview({
|
||||
page: activePage + 1,
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<ComponentDonasi_CardStatus
|
||||
data={item}
|
||||
path={RouterDonasi.detail_review}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
</Box>
|
||||
))}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export default function GalangDanaDonasi({
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Stack >
|
||||
<Tabs.List grow>
|
||||
{listPosting.map((e, i) => (
|
||||
<Tabs.Tab
|
||||
@@ -98,7 +98,7 @@ export default function GalangDanaDonasi({
|
||||
))}
|
||||
</Tabs.List>
|
||||
{listPosting.map((e, i) => (
|
||||
<Tabs.Panel key={e.id} value={e.value} pt="xs">
|
||||
<Tabs.Panel key={e.id} value={e.value} >
|
||||
{e.path}
|
||||
</Tabs.Panel>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user