QC Investasi
# fix Tampilan admin investasi Tampilan admin donasi ## No issuee
This commit is contained in:
@@ -20,6 +20,8 @@ import { MODEL_DONASI } from "../model/interface";
|
||||
import { useViewportSize } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import ComponentDonasi_IsEmptyData from "./is_empty_data";
|
||||
|
||||
export default function ComponentDonasi_BoxPublish({
|
||||
dataDonasi,
|
||||
@@ -33,62 +35,66 @@ export default function ComponentDonasi_BoxPublish({
|
||||
const [donasi, setDonasi] = useState(dataDonasi);
|
||||
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(path + `${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"}>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={"sm"} fw={"bold"} lineClamp={2}>
|
||||
{e.title}
|
||||
</Text>
|
||||
<ComponentDonasi_TampilanHitungMundur
|
||||
durasi={e.DonasiMaster_Durasi.name}
|
||||
publishTime={e.publishTime}
|
||||
textSize={10}
|
||||
/>
|
||||
{_.isEmpty(dataDonasi) ? (
|
||||
<ComponentDonasi_IsEmptyData text="Tidak ada data" />
|
||||
) : (
|
||||
<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(path + `${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"}>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={"sm"} fw={"bold"} lineClamp={2}>
|
||||
{e.title}
|
||||
</Text>
|
||||
<ComponentDonasi_TampilanHitungMundur
|
||||
durasi={e.DonasiMaster_Durasi.name}
|
||||
publishTime={e.publishTime}
|
||||
textSize={10}
|
||||
/>
|
||||
</Stack>
|
||||
<Progress value={+e.progres} color="orange" />
|
||||
<Stack spacing={0}>
|
||||
<Text fz={"sm"}>Terkumpul</Text>
|
||||
<Text fz={"sm"} fw={"bold"} c={"orange"} truncate>
|
||||
<TampilanRupiahDonasi nominal={+e.terkumpul} />
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
<Progress value={+e.progres} color="orange" />
|
||||
<Stack spacing={0}>
|
||||
<Text fz={"sm"}>Terkumpul</Text>
|
||||
<Text fz={"sm"} fw={"bold"} c={"orange"} truncate>
|
||||
<TampilanRupiahDonasi nominal={+e.terkumpul} />
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{width > 575 ? "" : <Divider />}
|
||||
</Stack>
|
||||
</Box>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{width > 575 ? "" : <Divider />}
|
||||
</Stack>
|
||||
</Box>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,25 +14,25 @@ import {
|
||||
} from "@mantine/core";
|
||||
import TampilanRupiahDonasi from "../tampilan_rupiah";
|
||||
|
||||
export default function ComponentDonasi_DetailDataGalangDana({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
export default function ComponentDonasi_DetailDataGalangDana({
|
||||
donasi,
|
||||
}: {
|
||||
donasi: MODEL_DONASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Stack px={"xs"}>
|
||||
<Stack>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<Image
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_gambar + `${donasi.imagesId}`}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
<Image
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_gambar + `${donasi.imagesId}`}
|
||||
/>
|
||||
{/* <AspectRatio ratio={9 / 16} maw={500} mah={1000} bg={"blue"}>
|
||||
</AspectRatio> */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={4}>{donasi.title}</Title>
|
||||
<Text fz={10}>
|
||||
Durasi: {donasi.DonasiMaster_Durasi.name} hari
|
||||
</Text>
|
||||
<Text fz={10}>Durasi: {donasi.DonasiMaster_Durasi.name} hari</Text>
|
||||
</Stack>
|
||||
<Stack spacing={0}>
|
||||
<Group position="apart">
|
||||
|
||||
@@ -6,6 +6,7 @@ import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { Stack, Title, Paper, Group, ActionIcon, Text } from "@mantine/core";
|
||||
import { IconCircleChevronRight } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function ComponentDonasi_CeritaPenggalangMain({
|
||||
donasi,
|
||||
@@ -13,6 +14,7 @@ export default function ComponentDonasi_CeritaPenggalangMain({
|
||||
donasi: MODEL_DONASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"}>
|
||||
@@ -20,12 +22,18 @@ export default function ComponentDonasi_CeritaPenggalangMain({
|
||||
<Paper p={"sm"} withBorder>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Text>{moment(donasi.createdAt).format("ll")}</Text>
|
||||
<Text>
|
||||
{new Intl.DateTimeFormat("id-ID", { dateStyle: "full" }).format(
|
||||
donasi.createdAt
|
||||
)}
|
||||
</Text>
|
||||
<ActionIcon
|
||||
loading={isLoading ? true : false}
|
||||
variant="transparent"
|
||||
onClick={() =>
|
||||
router.push(RouterDonasi.cerita_penggalang + `${donasi.id}`)
|
||||
}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.cerita_penggalang + `${donasi.id}`);
|
||||
}}
|
||||
>
|
||||
<IconCircleChevronRight />
|
||||
</ActionIcon>
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
Divider,
|
||||
Image,
|
||||
Text,
|
||||
Center,
|
||||
Loader,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconClover,
|
||||
@@ -26,6 +28,8 @@ import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.share
|
||||
import { NotifPeringatan } from "../notifikasi/notif_peringatan";
|
||||
import { NotifBerhasil } from "../notifikasi/notif_berhasil";
|
||||
import { Donasi_findDonaturByTokenId } from "../../fun/get/get_donatur_by_token_id";
|
||||
import { useState } from "react";
|
||||
import ComponentGlobal_CardLoadingOverlay from "@/app_modules/component_global/loading_card";
|
||||
|
||||
export function ComponentDonasi_DetailDataMain({
|
||||
donasi,
|
||||
@@ -37,19 +41,28 @@ export function ComponentDonasi_DetailDataMain({
|
||||
userLoginId?: string | any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoadingDonatur, setLoadingDonatur] = useState(false);
|
||||
const [isLoadingKabar, setLoadingKabar] = useState(false);
|
||||
const [isLoadingPencairan, setLoadingPencairan] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Stack px={"xs"}>
|
||||
<Stack>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Center>
|
||||
<Image
|
||||
mah={500}
|
||||
maw={"auto"}
|
||||
radius={"md"}
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_gambar + `${donasi.imagesId}`}
|
||||
/>
|
||||
</Center>
|
||||
{/* <AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<Image
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_gambar + `${donasi.imagesId}`}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
<Stack spacing={0}>
|
||||
</AspectRatio> */}
|
||||
<Stack spacing={0} mt={"lg"}>
|
||||
<Title order={4}>{donasi.title}</Title>
|
||||
<ComponentDonasi_TampilanHitungMundur
|
||||
durasi={donasi.DonasiMaster_Durasi.name}
|
||||
@@ -84,11 +97,19 @@ export function ComponentDonasi_DetailDataMain({
|
||||
<Grid>
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
onClick={() => router.push(RouterDonasi.donatur + `${donasi.id}`)}
|
||||
onClick={() => {
|
||||
setLoadingDonatur(true);
|
||||
router.push(RouterDonasi.donatur + `${donasi.id}`);
|
||||
}}
|
||||
>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<Group>
|
||||
<IconClover color="skyblue" />
|
||||
{isLoadingDonatur ? (
|
||||
<Loader size={25} />
|
||||
) : (
|
||||
<IconClover color="skyblue" />
|
||||
)}
|
||||
|
||||
<Title order={6} c={"blue"}>
|
||||
{countDonatur}
|
||||
</Title>
|
||||
@@ -99,20 +120,34 @@ export function ComponentDonasi_DetailDataMain({
|
||||
<Divider orientation="vertical" />
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
onClick={() => router.push(RouterDonasi.kabar + `${donasi.id}`)}
|
||||
onClick={() => {
|
||||
setLoadingKabar(true);
|
||||
router.push(RouterDonasi.kabar + `${donasi.id}`);
|
||||
}}
|
||||
>
|
||||
<Stack spacing={"sm"} align="center">
|
||||
<IconMessageChatbot color="skyblue" />
|
||||
{isLoadingKabar ? (
|
||||
<Loader size={25} />
|
||||
) : (
|
||||
<IconMessageChatbot color="skyblue" />
|
||||
)}
|
||||
<Text fz={"xs"}>Kabar Terbaru</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Divider orientation="vertical" />
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
onClick={() => onPencairanDana(router, donasi, userLoginId)}
|
||||
onClick={() => {
|
||||
setLoadingPencairan(true);
|
||||
onPencairanDana(router, donasi, userLoginId);
|
||||
}}
|
||||
>
|
||||
<Stack spacing={"sm"} align="center">
|
||||
<IconMoneybag color="skyblue" />
|
||||
{isLoadingPencairan ? (
|
||||
<Loader size={25} />
|
||||
) : (
|
||||
<IconMoneybag color="skyblue" />
|
||||
)}
|
||||
<Text fz={"xs"}>Pencairan Dana</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
@@ -132,10 +167,10 @@ async function onPencairanDana(
|
||||
// console.log(donasi.authorId)
|
||||
const cek = await Donasi_findDonaturByTokenId(donasi.id, userLoginId);
|
||||
|
||||
if(userLoginId == donasi.authorId)
|
||||
return router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
if (userLoginId == donasi.authorId)
|
||||
return router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
|
||||
if (!cek ) return NotifPeringatan("Halaman khusus donatur");
|
||||
if (!cek) return NotifPeringatan("Halaman khusus donatur");
|
||||
router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
|
||||
// if (userLoginId != donasi.authorId)
|
||||
|
||||
@@ -1,50 +1,68 @@
|
||||
"use client"
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||
import { Stack, Title, Paper, Group, ActionIcon, Avatar, Text } from "@mantine/core";
|
||||
import {
|
||||
Stack,
|
||||
Title,
|
||||
Paper,
|
||||
Group,
|
||||
ActionIcon,
|
||||
Avatar,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { IconCircleChevronRight } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentDonasi_NotedBox from "../noted_box";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function ComponentDonasi_InformasiPenggalangMain({ author }: { author: MODEL_USER}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
export default function ComponentDonasi_InformasiPenggalangMain({
|
||||
author,
|
||||
}: {
|
||||
author: MODEL_USER;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(author, null, 2)}</pre> */}
|
||||
<Stack spacing={"xs"}>
|
||||
<Title order={4}>Informasi Penggalang Dana</Title>
|
||||
<Paper p={"sm"} withBorder>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={5}>Penggalang Dana</Title>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => router.push(RouterDonasi.penggalang_dana + `${author.id}`)}
|
||||
>
|
||||
<IconCircleChevronRight />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
<Group>
|
||||
<Avatar radius={"xl"} variant="filled" bg={"blue"}>
|
||||
{(() => {
|
||||
const usr = author.username;
|
||||
const splt = usr.split("");
|
||||
const Up = _.upperCase(splt[0]);
|
||||
|
||||
return Up;
|
||||
})()}
|
||||
</Avatar>
|
||||
<Text>{author.username}</Text>
|
||||
</Group>
|
||||
<ComponentDonasi_NotedBox
|
||||
informasi="Semua dana yang terkumpul akan disalurkan ke penggalang dana,
|
||||
<Stack spacing={"xs"}>
|
||||
<Title order={4}>Informasi Penggalang Dana</Title>
|
||||
<Paper p={"sm"} withBorder>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={5}>Penggalang Dana</Title>
|
||||
<ActionIcon
|
||||
loading={isLoading ? true : false}
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.penggalang_dana + `${author.id}`);
|
||||
}}
|
||||
>
|
||||
<IconCircleChevronRight />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
<Group>
|
||||
<Avatar radius={"xl"} variant="filled" bg={"blue"}>
|
||||
{(() => {
|
||||
const usr = author.username;
|
||||
const splt = usr.split("");
|
||||
const Up = _.upperCase(splt[0]);
|
||||
|
||||
return Up;
|
||||
})()}
|
||||
</Avatar>
|
||||
<Text>{author.username}</Text>
|
||||
</Group>
|
||||
<ComponentDonasi_NotedBox
|
||||
informasi="Semua dana yang terkumpul akan disalurkan ke penggalang dana,
|
||||
kabar penyaluran dapat dilihat di halaman kabar terbaru."
|
||||
/>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
/>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ import { Footer, Center, Button } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_proses_donasi } from "../global_state";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function ButtonDonasi({ donasiId }: { donasiId: string }) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [prosesDonasi, setProsesDonasi] = useAtom(gs_proses_donasi);
|
||||
|
||||
async function onClick() {
|
||||
@@ -16,6 +18,7 @@ export default function ButtonDonasi({ donasiId }: { donasiId: string }) {
|
||||
nominal: "",
|
||||
norek: "",
|
||||
});
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.masukan_donasi + `${donasiId}`);
|
||||
}
|
||||
|
||||
@@ -23,7 +26,13 @@ export default function ButtonDonasi({ donasiId }: { donasiId: string }) {
|
||||
<>
|
||||
<Footer height={70} px={"md"} sx={{ borderStyle: "none" }}>
|
||||
<Center h={70}>
|
||||
<Button w={"100%"} radius={"xl"} onClick={() => onClick()}>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
w={"100%"}
|
||||
radius={"xl"}
|
||||
onClick={() => onClick()}
|
||||
>
|
||||
Donasi
|
||||
</Button>
|
||||
</Center>
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function ComponentDonasi_HeaderTamplate({
|
||||
bg,
|
||||
}: {
|
||||
hideBack?: boolean;
|
||||
changeIconBack?: any
|
||||
changeIconBack?: any;
|
||||
route?: any;
|
||||
route2?: any;
|
||||
title: string;
|
||||
@@ -23,6 +23,9 @@ export default function ComponentDonasi_HeaderTamplate({
|
||||
bg?: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [isRightLoading, setRightLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header
|
||||
@@ -35,8 +38,10 @@ export default function ComponentDonasi_HeaderTamplate({
|
||||
<ActionIcon variant="transparent" disabled></ActionIcon>
|
||||
) : (
|
||||
<ActionIcon
|
||||
loading={isLoading ? true : false}
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
if (route === null || route === undefined) {
|
||||
return router.back();
|
||||
} else {
|
||||
@@ -44,7 +49,7 @@ export default function ComponentDonasi_HeaderTamplate({
|
||||
}
|
||||
}}
|
||||
>
|
||||
{changeIconBack ? changeIconBack: <IconChevronLeft />}
|
||||
{changeIconBack ? changeIconBack : <IconChevronLeft />}
|
||||
</ActionIcon>
|
||||
)}
|
||||
<Title order={5}>{title}</Title>
|
||||
@@ -54,8 +59,12 @@ export default function ComponentDonasi_HeaderTamplate({
|
||||
} else {
|
||||
return (
|
||||
<ActionIcon
|
||||
loading={isRightLoading ? true : false}
|
||||
variant="transparent"
|
||||
onClick={() => router.push(route2)}
|
||||
onClick={() => {
|
||||
setRightLoading(true);
|
||||
router.push(route2);
|
||||
}}
|
||||
>
|
||||
{icon}
|
||||
</ActionIcon>
|
||||
|
||||
17
src/app_modules/donasi/component/is_empty_data.tsx
Normal file
17
src/app_modules/donasi/component/is_empty_data.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { Center } from "@mantine/core";
|
||||
|
||||
export default function ComponentDonasi_IsEmptyData({
|
||||
text,
|
||||
}: {
|
||||
text?: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Center h={"50vh"} fz={"sm"} c="gray" fw={"bold"} style={{ zIndex: 1 }}>
|
||||
{text ? text : "Tidak ada data"}
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -25,6 +25,12 @@ import toast from "react-simple-toasts";
|
||||
import { Donasi_funCreate } from "../fun/create/fun_create_donasi";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { NotifPeringatan } from "../component/notifikasi/notif_peringatan";
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
||||
import { tree } from "next/dist/build/templates/app-page";
|
||||
import {
|
||||
ComponentGlobal_WarningMaxUpload,
|
||||
maksimalUploadFile,
|
||||
} from "@/app_modules/component_global/variabel_global";
|
||||
|
||||
export default function CreateCeritaPenggalangDonasi({
|
||||
dataTemporary,
|
||||
@@ -34,6 +40,8 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
userId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [tabsPostingDonasi, setTabsPostingDonasi] = useAtom(
|
||||
gs_donasi_tabs_posting
|
||||
);
|
||||
@@ -41,8 +49,7 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
pembukaan: "",
|
||||
cerita: "",
|
||||
namaBank: "",
|
||||
rekening: ""
|
||||
|
||||
rekening: "",
|
||||
});
|
||||
const [temporary, setTemporary] = useState(dataTemporary);
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
@@ -73,6 +80,7 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
|
||||
await Donasi_funCreate(body as any, gambar).then((res) => {
|
||||
if (res.status === 201) {
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.page_pop_up_create);
|
||||
setTabsPostingDonasi("Review");
|
||||
} else {
|
||||
@@ -87,35 +95,49 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
<Stack spacing={"sm"}>
|
||||
<ComponentDonasi_NotedBox informasi="Ceritakan dengan jujur & benar mengapa Penggalanagn Dana ini harus diadakan!" />
|
||||
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
withAsterisk
|
||||
label="Pembukaan"
|
||||
placeholder="Pembuka dari isi cerita"
|
||||
onChange={(val) =>
|
||||
setCreate({
|
||||
...create,
|
||||
pembukaan: val.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Stack spacing={5}>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
withAsterisk
|
||||
label="Pembukaan"
|
||||
placeholder="Pembuka dari isi cerita"
|
||||
maxLength={300}
|
||||
onChange={(val) =>
|
||||
setCreate({
|
||||
...create,
|
||||
pembukaan: val.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<ComponentGlobal_InputCountDown
|
||||
maxInput={300}
|
||||
lengthInput={create.pembukaan.length}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={10}
|
||||
withAsterisk
|
||||
label="Cerita"
|
||||
placeholder="Ceritakan alasan mengapa harus membuat Penggalangan Dana"
|
||||
onChange={(val) =>
|
||||
setCreate({
|
||||
...create,
|
||||
cerita: val.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Stack spacing={5}>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={10}
|
||||
withAsterisk
|
||||
label="Cerita"
|
||||
placeholder="Ceritakan alasan mengapa harus membuat Penggalangan Dana"
|
||||
maxLength={300}
|
||||
onChange={(val) =>
|
||||
setCreate({
|
||||
...create,
|
||||
cerita: val.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<ComponentGlobal_InputCountDown
|
||||
maxInput={300}
|
||||
lengthInput={create.cerita.length}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Stack spacing={"xs"}>
|
||||
<Center>
|
||||
@@ -125,10 +147,12 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
// console.log(buffer, "ini buffer");
|
||||
// console.log(files, " ini file");
|
||||
setImageCerita(buffer);
|
||||
setFile(files);
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setImageCerita(buffer);
|
||||
setFile(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -161,10 +185,10 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
</AspectRatio>
|
||||
) : (
|
||||
<Center>
|
||||
<Text fs={"italic"} fz={10}>
|
||||
Upload poster atau gambar penggalangan !
|
||||
</Text>
|
||||
</Center>
|
||||
<Text fs={"italic"} fz={10}>
|
||||
Upload poster atau gambar penggalangan !
|
||||
</Text>
|
||||
</Center>
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
@@ -175,26 +199,40 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
withAsterisk
|
||||
placeholder="Contoh: BNI, BCA, MANDIRI, DLL"
|
||||
label="Nama Bank"
|
||||
maxLength={50}
|
||||
onChange={(val) => {
|
||||
setCreate({
|
||||
...create,
|
||||
namaBank: _.upperCase(val.target.value)
|
||||
})
|
||||
namaBank: _.upperCase(val.target.value),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<TextInput
|
||||
withAsterisk
|
||||
placeholder="Maskuan nomor rekening"
|
||||
label="Nomor rekening"
|
||||
maxLength={100}
|
||||
onChange={(val) => {
|
||||
setCreate({
|
||||
...create,
|
||||
rekening: val.target.value
|
||||
})
|
||||
rekening: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
<Button w={"100%"} radius={"xl"} onClick={() => onCreate()}>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
disabled={
|
||||
_.values(create).includes("") || file === null ? true : false
|
||||
}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
w={"100%"}
|
||||
radius={"xl"}
|
||||
onClick={() => onCreate()}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
@@ -29,6 +29,11 @@ import toast from "react-simple-toasts";
|
||||
import _ from "lodash";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { NotifPeringatan } from "../component/notifikasi/notif_peringatan";
|
||||
import {
|
||||
ComponentGlobal_WarningMaxUpload,
|
||||
maksimalUploadFile,
|
||||
} from "@/app_modules/component_global/variabel_global";
|
||||
import { gs_donasi_tabs_posting } from "../global_state";
|
||||
|
||||
export default function CreateDonasi({
|
||||
masterKategori,
|
||||
@@ -38,6 +43,8 @@ export default function CreateDonasi({
|
||||
masterDurasi: MODEL_DONASI_ALL_MASTER[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [kategori, setKategori] = useState(masterKategori);
|
||||
const [durasi, setDurasi] = useState(masterDurasi);
|
||||
const [create, setCreate] = useState({
|
||||
@@ -46,15 +53,19 @@ export default function CreateDonasi({
|
||||
target: "",
|
||||
durasiId: "",
|
||||
});
|
||||
const [targetDana, setTargetDana] = useState("");
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
const [imageDonasi, setImageDonasi] = useState<any | null>();
|
||||
const [tabsPostingDonasi, setTabsPostingDonasi] = useAtom(
|
||||
gs_donasi_tabs_posting
|
||||
);
|
||||
|
||||
async function onCreate() {
|
||||
const body = {
|
||||
donasiMaster_KategoriId: create.kategoriId,
|
||||
donasiMaster_DurasiId: create.durasiId,
|
||||
title: create.title,
|
||||
target: create.target,
|
||||
target: targetDana,
|
||||
};
|
||||
|
||||
if (_.values(body).includes("")) return NotifPeringatan("Lengkapin Data");
|
||||
@@ -65,6 +76,8 @@ export default function CreateDonasi({
|
||||
|
||||
await Donasi_funCreateTemporary(body as any, gambar).then((res) => {
|
||||
if (res.status === 201) {
|
||||
setLoading(true);
|
||||
setTabsPostingDonasi("Review");
|
||||
router.push(RouterDonasi.create_cerita_penggalang + `${res.donasiId}`);
|
||||
} else {
|
||||
toast(res.message);
|
||||
@@ -97,18 +110,40 @@ export default function CreateDonasi({
|
||||
withAsterisk
|
||||
label="Judul Donasi"
|
||||
placeholder="Contoh: Renovasi Masjid pada kampung, dll"
|
||||
onChange={(val) =>
|
||||
setCreate({ ...create, title: val.target.value })
|
||||
}
|
||||
maxLength={100}
|
||||
onChange={(val) => {
|
||||
setCreate({ ...create, title: val.target.value });
|
||||
}}
|
||||
/>
|
||||
<TextInput
|
||||
type="number"
|
||||
icon={<Text fw={"bold"}>Rp.</Text>}
|
||||
min={0}
|
||||
withAsterisk
|
||||
label="Target Dana"
|
||||
placeholder="Masukan nominal angka"
|
||||
onChange={(val) =>
|
||||
setCreate({ ...create, target: val.target.value })
|
||||
}
|
||||
placeholder="0"
|
||||
value={create.target}
|
||||
onChange={(val) => {
|
||||
// console.log(val.currentTarget.value, "nilai");
|
||||
const match = val.currentTarget.value
|
||||
.replace(/\./g, "")
|
||||
.match(/^[0-9]+$/);
|
||||
|
||||
if (val.currentTarget.value === "")
|
||||
return setCreate({
|
||||
...create,
|
||||
target: 0 + "",
|
||||
});
|
||||
if (!match?.[0]) return null;
|
||||
|
||||
const nilai = val.currentTarget.value.replace(/\./g, "");
|
||||
const target = Intl.NumberFormat("id-ID").format(+nilai);
|
||||
|
||||
setTargetDana(nilai);
|
||||
setCreate({
|
||||
...create,
|
||||
target,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
label="Durasi"
|
||||
@@ -130,10 +165,13 @@ export default function CreateDonasi({
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
// console.log(buffer, "ini buffer");
|
||||
// console.log(files, " ini file");
|
||||
setImageDonasi(buffer);
|
||||
setFile(files);
|
||||
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setImageDonasi(buffer);
|
||||
setFile(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -142,7 +180,7 @@ export default function CreateDonasi({
|
||||
>
|
||||
{(props) => (
|
||||
<Button
|
||||
compact
|
||||
compact
|
||||
{...props}
|
||||
radius={"xl"}
|
||||
variant="outline"
|
||||
@@ -155,8 +193,8 @@ export default function CreateDonasi({
|
||||
</FileButton>
|
||||
</Center>
|
||||
{imageDonasi ? (
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<AspectRatio ratio={1 / 1} onChange={(val) => console.log(val)}>
|
||||
<Paper radius={"sm"} withBorder>
|
||||
<Image
|
||||
alt="Foto"
|
||||
src={imageDonasi ? imageDonasi : "/aset/no-img.png"}
|
||||
@@ -171,7 +209,19 @@ export default function CreateDonasi({
|
||||
</Center>
|
||||
)}
|
||||
</Stack>
|
||||
<Button my={"lg"} radius={"xl"} onClick={() => onCreate()}>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
disabled={
|
||||
_.values(create).includes("") || file === null ? true : false
|
||||
}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
my={"lg"}
|
||||
radius={"xl"}
|
||||
onClick={() => onCreate()}
|
||||
>
|
||||
Selanjutnya
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Stack,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import ComponentDonasi_HeaderTamplate from "../../component/header_tamplate";
|
||||
import {
|
||||
IconChevronLeft,
|
||||
@@ -28,13 +28,17 @@ import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/co
|
||||
|
||||
export default function LayoutDetailDraftDonasi({
|
||||
children,
|
||||
donasiId
|
||||
donasiId,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
donasiId: string
|
||||
donasiId: string;
|
||||
}) {
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const router = useRouter();
|
||||
const [isLoadingDonasi, setLoadingDonasi] = useState(false);
|
||||
const [isLoadingCerita, setLoadingCerita] = useState(false);
|
||||
const [isLoadingRekening, setLoadingRekening] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
@@ -62,29 +66,47 @@ export default function LayoutDetailDraftDonasi({
|
||||
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
||||
<Stack>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingDonasi ? true : false}
|
||||
style={{ transition: "0.5s" }}
|
||||
variant="outline"
|
||||
radius={"xl"}
|
||||
w={"100%"}
|
||||
color="blue"
|
||||
onClick={() => router.push(RouterDonasi.edit_donasi + `${donasiId}`)}
|
||||
onClick={() => {
|
||||
setLoadingDonasi(true);
|
||||
router.push(RouterDonasi.edit_donasi + `${donasiId}`);
|
||||
}}
|
||||
>
|
||||
Edit Donasi
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingCerita ? true : false}
|
||||
style={{ transition: "0.5s" }}
|
||||
variant="outline"
|
||||
radius={"xl"}
|
||||
w={"100%"}
|
||||
color="teal"
|
||||
onClick={() => router.push(RouterDonasi.edit_cerita_penggalang + `${donasiId}`)}
|
||||
onClick={() => {
|
||||
setLoadingCerita(true);
|
||||
router.push(RouterDonasi.edit_cerita_penggalang + `${donasiId}`);
|
||||
}}
|
||||
>
|
||||
Edit Cerita
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingRekening ? true : false}
|
||||
style={{ transition: "0.5s" }}
|
||||
variant="outline"
|
||||
radius={"xl"}
|
||||
w={"100%"}
|
||||
color="orange"
|
||||
onClick={() => router.push(RouterDonasi.edit_rekening + `${donasiId}`)}
|
||||
onClick={() => {
|
||||
setLoadingRekening(true);
|
||||
router.push(RouterDonasi.edit_rekening + `${donasiId}`);
|
||||
}}
|
||||
>
|
||||
Edit Rekening
|
||||
</Button>
|
||||
|
||||
@@ -15,11 +15,16 @@ export default function CeritaPenggalangDonasi({
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(data.imageCeritaDonasi, null, 2)}</pre> */}
|
||||
<Stack>
|
||||
{moment(data.createdAt).format("ll")}
|
||||
<Stack px={"xs"}>
|
||||
<Text>
|
||||
{new Intl.DateTimeFormat("id-ID", { dateStyle: "full" }).format(
|
||||
data.createdAt
|
||||
)}
|
||||
</Text>
|
||||
<Text fw={"bold"}> #HaloOrangBaik</Text>
|
||||
<Text>{data.pembukaan}</Text>
|
||||
<Image
|
||||
radius={"sm"}
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_image_cerita + `${data.imageCeritaDonasi.url}`}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import ComponentDonasi_IsEmptyData from "@/app_modules/donasi/component/is_empty_data";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import { MODEL_DONASI_INVOICE } from "@/app_modules/donasi/model/interface";
|
||||
import {
|
||||
@@ -14,12 +15,18 @@ import {
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconMoodSmile, IconMoodSmileBeam } from "@tabler/icons-react";
|
||||
import { size } from "lodash";
|
||||
import _, { size } from "lodash";
|
||||
import moment from "moment";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function DonaturDonasi({listDonatur}: {listDonatur: MODEL_DONASI_INVOICE[]}) {
|
||||
const [donatur, setDonatur] = useState(listDonatur)
|
||||
export default function DonaturDonasi({
|
||||
listDonatur,
|
||||
}: {
|
||||
listDonatur: MODEL_DONASI_INVOICE[];
|
||||
}) {
|
||||
const [donatur, setDonatur] = useState(listDonatur);
|
||||
if (_.isEmpty(donatur)) return <ComponentDonasi_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
@@ -31,31 +38,30 @@ export default function DonaturDonasi({listDonatur}: {listDonatur: MODEL_DONASI_
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
{donatur
|
||||
.map((e, i) => (
|
||||
<Paper key={i} bg={"gray.1"} p={"sm"}>
|
||||
<Grid>
|
||||
<Grid.Col span={3}>
|
||||
<Center h={"100%"}>
|
||||
{/* <Avatar variant="filled" radius={"xl"} size={"md"} /> */}
|
||||
<IconMoodSmileBeam size={50}/>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={9}>
|
||||
<Stack spacing={0}>
|
||||
<Title order={5}>{e.Author.username}</Title>
|
||||
<Group spacing={"xs"}>
|
||||
<Text fz={"xs"}>Berdonasi sebesar</Text>
|
||||
<Text truncate fw={"bold"}>
|
||||
<TampilanRupiahDonasi nominal={+e.nominal}/>
|
||||
</Text>
|
||||
</Group>
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
))}
|
||||
{donatur.map((e, i) => (
|
||||
<Paper key={i} bg={"gray.1"} p={"sm"}>
|
||||
<Grid>
|
||||
<Grid.Col span={3}>
|
||||
<Center h={"100%"}>
|
||||
{/* <Avatar variant="filled" radius={"xl"} size={"md"} /> */}
|
||||
<IconMoodSmileBeam size={50} />
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={9}>
|
||||
<Stack spacing={0}>
|
||||
<Title order={5}>{e.Author.username}</Title>
|
||||
<Group spacing={"xs"}>
|
||||
<Text fz={"xs"}>Berdonasi sebesar</Text>
|
||||
<Text truncate fw={"bold"}>
|
||||
<TampilanRupiahDonasi nominal={+e.nominal} />
|
||||
</Text>
|
||||
</Group>
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import ComponentDonasi_ListKabar from "@/app_modules/donasi/component/detail_main/list_kabar";
|
||||
import ComponentDonasi_IsEmptyData from "@/app_modules/donasi/component/is_empty_data";
|
||||
import { MODEL_DONASI_KABAR } from "@/app_modules/donasi/model/interface";
|
||||
import {
|
||||
ActionIcon,
|
||||
@@ -16,6 +17,7 @@ import {
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconCircleChevronRight } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
@@ -27,6 +29,9 @@ export default function KabarDonasi({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [kabar, setKabar] = useState(listKabar);
|
||||
|
||||
if (_.isEmpty(kabar)) return <ComponentDonasi_IsEmptyData />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
@@ -39,9 +44,12 @@ export default function KabarDonasi({
|
||||
]}
|
||||
>
|
||||
{kabar.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentDonasi_ListKabar kabar={e} route={RouterDonasi.detail_kabar} />
|
||||
</Box>
|
||||
<Box key={i}>
|
||||
<ComponentDonasi_ListKabar
|
||||
kabar={e}
|
||||
route={RouterDonasi.detail_kabar}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentDonasi_BoxPublish from "@/app_modules/donasi/component/box_publish";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import {
|
||||
@@ -45,7 +46,7 @@ export default function PenggalangDanaDonasi({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Stack >
|
||||
<InformasiPenggalang value={value as any} />
|
||||
<ComponentDonasi_BoxPublish
|
||||
dataDonasi={value.Donasi}
|
||||
@@ -59,6 +60,7 @@ export default function PenggalangDanaDonasi({
|
||||
function InformasiPenggalang({ value }: { value: MODEL_USER }) {
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
||||
<Paper radius={"md"}>
|
||||
<Stack
|
||||
bg={"gray.1"}
|
||||
@@ -75,10 +77,13 @@ function InformasiPenggalang({ value }: { value: MODEL_USER }) {
|
||||
>
|
||||
<Center h={"100%"}>
|
||||
<Image
|
||||
radius={"100%"}
|
||||
width={100}
|
||||
height={100}
|
||||
alt="Foto"
|
||||
src={"/aset/avatar.png"}
|
||||
src={
|
||||
RouterProfile.api_foto_profile + value?.Profile?.imagesId
|
||||
}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
|
||||
@@ -42,6 +42,7 @@ export default function DetailReviewDonasi({
|
||||
dataDonasi: MODEL_DONASI;
|
||||
}) {
|
||||
const [donasi, setDonasi] = useState(dataDonasi);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xl"}>
|
||||
@@ -54,6 +55,7 @@ export default function DetailReviewDonasi({
|
||||
}
|
||||
function ButtonBatalReview({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [tabsPostingDonasi, setTabsPostingDonasi] = useAtom(
|
||||
gs_donasi_tabs_posting
|
||||
);
|
||||
@@ -61,9 +63,10 @@ function ButtonBatalReview({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
async function onCLick() {
|
||||
await Donasi_funGantiStatus(donasi.id, "3").then((res) => {
|
||||
if (res.status === 200) {
|
||||
router.push(RouterDonasi.main_galang_dana);
|
||||
setTabsPostingDonasi("Draft");
|
||||
NotifBerhasil("Berhasil Dibatalkan");
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.main_galang_dana);
|
||||
} else {
|
||||
NotifPeringatan(res.message);
|
||||
}
|
||||
@@ -71,11 +74,19 @@ function ButtonBatalReview({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Button radius={"xl"} bg={"red"} color="red" onClick={() => onCLick()}>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
bg={"red"}
|
||||
color="red"
|
||||
onClick={() => onCLick()}
|
||||
>
|
||||
Batalkan Review
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ import { NotifPeringatan } from "../../component/notifikasi/notif_peringatan";
|
||||
import _ from "lodash";
|
||||
import { Donasi_funUpdateCerita } from "../../fun/update/fun_update_cerita_donasi";
|
||||
import { NotifBerhasil } from "../../component/notifikasi/notif_berhasil";
|
||||
import {
|
||||
ComponentGlobal_WarningMaxUpload,
|
||||
maksimalUploadFile,
|
||||
} from "@/app_modules/component_global/variabel_global";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
|
||||
export default function EditCeritaPenggalangDonasi({
|
||||
dataCerita,
|
||||
@@ -29,6 +34,8 @@ export default function EditCeritaPenggalangDonasi({
|
||||
dataCerita: MODEL_CERITA_DONASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [tabsPostingDonasi, setTabsPostingDonasi] = useAtom(
|
||||
gs_donasi_tabs_posting
|
||||
);
|
||||
@@ -48,6 +55,13 @@ export default function EditCeritaPenggalangDonasi({
|
||||
label="Pembukaan"
|
||||
placeholder="Pembuka dari isi cerita"
|
||||
value={value.pembukaan}
|
||||
error={
|
||||
value.pembukaan === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan pembukaan cerita" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) =>
|
||||
setValue({
|
||||
...value,
|
||||
@@ -64,8 +78,13 @@ export default function EditCeritaPenggalangDonasi({
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
setUpdateImage(buffer);
|
||||
setFile(files);
|
||||
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setUpdateImage(buffer);
|
||||
setFile(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -74,6 +93,7 @@ export default function EditCeritaPenggalangDonasi({
|
||||
>
|
||||
{(props) => (
|
||||
<Button
|
||||
compact
|
||||
{...props}
|
||||
radius={"xl"}
|
||||
variant="outline"
|
||||
@@ -108,6 +128,13 @@ export default function EditCeritaPenggalangDonasi({
|
||||
label="Cerita"
|
||||
placeholder="Ceritakan alasan mengapa harus membuat Penggalangan Dana"
|
||||
value={value.cerita}
|
||||
error={
|
||||
value.cerita === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan pembukaan cerita" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) =>
|
||||
setValue({
|
||||
...value,
|
||||
@@ -117,6 +144,14 @@ export default function EditCeritaPenggalangDonasi({
|
||||
/>
|
||||
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
disabled={
|
||||
value.cerita === "" || value.pembukaan === "" ? true : false
|
||||
}
|
||||
w={"100%"}
|
||||
radius={"xl"}
|
||||
onClick={() => onUpdate(router, value, file as any)}
|
||||
@@ -139,14 +174,14 @@ async function onUpdate(
|
||||
id: value.id,
|
||||
pembukaan: value.pembukaan,
|
||||
cerita: value.cerita,
|
||||
imagesId: value.imageCeritaDonasi.id
|
||||
imagesId: value.imageCeritaDonasi.id,
|
||||
};
|
||||
|
||||
const gambar = new FormData();
|
||||
gambar.append("file", file as any);
|
||||
|
||||
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) {
|
||||
NotifBerhasil(res.message);
|
||||
router.back();
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
Modal,
|
||||
Group,
|
||||
Title,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { IconCamera } from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
@@ -28,6 +29,11 @@ import { NotifBerhasil } from "../../component/notifikasi/notif_berhasil";
|
||||
import { NotifPeringatan } from "../../component/notifikasi/notif_peringatan";
|
||||
import _ from "lodash";
|
||||
import { Donasi_getOneById } from "../../fun/get/get_one_donasi_by_id";
|
||||
import {
|
||||
ComponentGlobal_WarningMaxUpload,
|
||||
maksimalUploadFile,
|
||||
} from "@/app_modules/component_global/variabel_global";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
|
||||
export default function EditDonasi({
|
||||
dataDonasi,
|
||||
@@ -39,6 +45,8 @@ export default function EditDonasi({
|
||||
masterDurasi: MODEL_DONASI_ALL_MASTER[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const [tabsPostingDonasi, setTabsPostingDonasi] = useAtom(
|
||||
gs_donasi_tabs_posting
|
||||
);
|
||||
@@ -91,10 +99,13 @@ export default function EditDonasi({
|
||||
const buffer = URL.createObjectURL(
|
||||
new Blob([new Uint8Array(await files.arrayBuffer())])
|
||||
);
|
||||
// console.log(buffer, "ini buffer");
|
||||
// console.log(files, " ini file");
|
||||
setUpdateImage(buffer);
|
||||
setFile(files);
|
||||
|
||||
if (files.size > maksimalUploadFile) {
|
||||
ComponentGlobal_WarningMaxUpload({});
|
||||
} else {
|
||||
setUpdateImage(buffer);
|
||||
setFile(files);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -103,11 +114,12 @@ export default function EditDonasi({
|
||||
>
|
||||
{(props) => (
|
||||
<Button
|
||||
compact
|
||||
{...props}
|
||||
radius={"xl"}
|
||||
variant="outline"
|
||||
w={150}
|
||||
leftIcon={<IconCamera />}
|
||||
w={150}
|
||||
>
|
||||
Upload
|
||||
</Button>
|
||||
@@ -121,6 +133,14 @@ export default function EditDonasi({
|
||||
label="Judul Donasi"
|
||||
placeholder="Contoh: Renovasi Masjid pada kampung, dll"
|
||||
value={value.title}
|
||||
maxLength={100}
|
||||
error={
|
||||
value.title === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan judul" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) =>
|
||||
setValue({
|
||||
...value,
|
||||
@@ -129,17 +149,39 @@ export default function EditDonasi({
|
||||
}
|
||||
/>
|
||||
<TextInput
|
||||
type="number"
|
||||
icon={<Text fw={"bold"}>Rp.</Text>}
|
||||
min={0}
|
||||
withAsterisk
|
||||
label="Target Dana"
|
||||
placeholder="Masukan nominal angka"
|
||||
value={+value.target ? +value.target : ""}
|
||||
onChange={(val) =>
|
||||
placeholder="0"
|
||||
value={value.target}
|
||||
error={
|
||||
value.target === "" || value.target === "0" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan target dana" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
const match = val.currentTarget.value
|
||||
.replace(/\./g, "")
|
||||
.match(/^[0-9]+$/);
|
||||
|
||||
if (val.currentTarget.value === "")
|
||||
return setValue({
|
||||
...value,
|
||||
target: 0 + "",
|
||||
});
|
||||
if (!match?.[0]) return null;
|
||||
|
||||
const nilai = val.currentTarget.value.replace(/\./g, "");
|
||||
const target = Intl.NumberFormat("id-ID").format(+nilai);
|
||||
|
||||
setValue({
|
||||
...value,
|
||||
target: val.target.value,
|
||||
})
|
||||
}
|
||||
target: target,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
label="Durasi"
|
||||
@@ -161,6 +203,12 @@ export default function EditDonasi({
|
||||
/>
|
||||
</Stack>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
disabled={value.title === "" || value.target === "0" ? true : false}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
my={"lg"}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
@@ -169,29 +217,11 @@ export default function EditDonasi({
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
{/* <Modal opened={opened} onClose={close} withCloseButton={false} centered >
|
||||
<ModalEdit />
|
||||
</Modal> */}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// function ModalEdit() {
|
||||
// return (
|
||||
// <>
|
||||
// <Stack>
|
||||
// <Title order={6}>Anda yakin menyimpan data ini ?</Title>
|
||||
// <Group position="center">
|
||||
// <Button variant="outline" >Batal</Button>
|
||||
// <Button>Simpan</Button>
|
||||
// </Group>
|
||||
// </Stack>
|
||||
|
||||
// </>
|
||||
// );
|
||||
// }
|
||||
|
||||
async function onUpdate(value: MODEL_DONASI, file: FormData, router: any) {
|
||||
const body = {
|
||||
id: value.id,
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.share
|
||||
import { Donasi_funUpdateRekening } from "../../fun/update/fun_update_rekening";
|
||||
import { NotifBerhasil } from "../../component/notifikasi/notif_berhasil";
|
||||
import { NotifGagal } from "../../component/notifikasi/notif_gagal";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
|
||||
export default function Donasi_EditRekening({
|
||||
dataDonasi,
|
||||
@@ -17,6 +18,7 @@ export default function Donasi_EditRekening({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [donasi, setDonasi] = useState(dataDonasi);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -27,6 +29,13 @@ export default function Donasi_EditRekening({
|
||||
label="Nama Bank"
|
||||
placeholder="Masukan Nama Bank"
|
||||
value={donasi.namaBank}
|
||||
error={
|
||||
donasi.namaBank === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan nama bank" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) =>
|
||||
setDonasi({
|
||||
...donasi,
|
||||
@@ -36,18 +45,37 @@ export default function Donasi_EditRekening({
|
||||
/>
|
||||
<TextInput
|
||||
withAsterisk
|
||||
type="number"
|
||||
label="Nomor Rekening"
|
||||
placeholder="Masukkan Nomor Rekening"
|
||||
value={donasi.rekening}
|
||||
error={
|
||||
donasi.rekening === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan nomor rekening" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) =>
|
||||
setDonasi({
|
||||
...donasi,
|
||||
rekening: val.target.value,
|
||||
rekening: val.currentTarget.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Stack>
|
||||
<Button radius={"xl"} onClick={() => onUpdate(router, donasi)}>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
disabled={
|
||||
donasi.namaBank === "" || donasi.rekening === "" ? true : false
|
||||
}
|
||||
radius={"xl"}
|
||||
onClick={() => onUpdate(router, donasi, setLoading)}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
</Stack>
|
||||
@@ -55,9 +83,14 @@ export default function Donasi_EditRekening({
|
||||
);
|
||||
}
|
||||
|
||||
async function onUpdate(router: AppRouterInstance, donasi: MODEL_DONASI) {
|
||||
async function onUpdate(
|
||||
router: AppRouterInstance,
|
||||
donasi: MODEL_DONASI,
|
||||
setLoading: any
|
||||
) {
|
||||
await Donasi_funUpdateRekening(donasi).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
router.back();
|
||||
NotifBerhasil(res.message);
|
||||
} else {
|
||||
|
||||
@@ -12,6 +12,13 @@ export async function Donasi_getAuthorById(authorId: string) {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
imagesId: true,
|
||||
},
|
||||
},
|
||||
Donasi: {
|
||||
where: {
|
||||
donasiMaster_StatusDonasiId: "1",
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function Donasi_getMasterKategori() {
|
||||
const data = await prisma.donasiMaster_Kategori.findMany({});
|
||||
const data = await prisma.donasiMaster_Kategori.findMany({
|
||||
orderBy: {
|
||||
createdAt: "asc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
ActionIcon,
|
||||
Affix,
|
||||
AspectRatio,
|
||||
Avatar,
|
||||
Badge,
|
||||
@@ -21,22 +23,51 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { useViewportSize } from "@mantine/hooks";
|
||||
import { useViewportSize, useWindowScroll } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_DONASI } from "../model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_BoxPublish from "../component/box_publish";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { IconPencilPlus } from "@tabler/icons-react";
|
||||
|
||||
export default function MainDonasi({
|
||||
listDonasi,
|
||||
}: {
|
||||
listDonasi: MODEL_DONASI[];
|
||||
}) {
|
||||
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [scroll, scrollTo] = useWindowScroll();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ComponentDonasi_BoxPublish dataDonasi={listDonasi} path={RouterDonasi.detail_main}/>
|
||||
<Affix position={{ bottom: rem(150), right: rem(30) }}>
|
||||
<ActionIcon
|
||||
loading={isLoading ? true : false}
|
||||
opacity={scroll.y > 0 ? 0.5 : ""}
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
size={"xl"}
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
bg={"orange"}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.create_donasi);
|
||||
}}
|
||||
>
|
||||
<IconPencilPlus color="white" />
|
||||
</ActionIcon>
|
||||
</Affix>
|
||||
|
||||
<ComponentDonasi_BoxPublish
|
||||
dataDonasi={listDonasi}
|
||||
path={RouterDonasi.detail_main}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import moment from "moment";
|
||||
import toast from "react-simple-toasts";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import _ from "lodash";
|
||||
import ComponentDonasi_IsEmptyData from "../component/is_empty_data";
|
||||
|
||||
export default function DonasiSayaDonasi({
|
||||
listInvoice,
|
||||
@@ -39,12 +40,10 @@ export default function DonasiSayaDonasi({
|
||||
const [invoice, setInvoice] = useState(listInvoice);
|
||||
const router = useRouter();
|
||||
const { height, width } = useViewportSize();
|
||||
if (_.isEmpty(invoice))
|
||||
return (
|
||||
<>
|
||||
<Center h={"80vh"}>Belum Ada Donasi</Center>
|
||||
</>
|
||||
);
|
||||
|
||||
if (_.isEmpty(listInvoice))
|
||||
return <ComponentDonasi_IsEmptyData text="Tidak ada data" />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function GalangDanaDonasi({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Affix position={{ bottom: rem(150), right: rem(20) }}>
|
||||
{/* <Affix position={{ bottom: rem(150), right: rem(20) }}>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
bg={"orange"}
|
||||
@@ -78,7 +78,7 @@ export default function GalangDanaDonasi({
|
||||
>
|
||||
Galang Dana
|
||||
</Button>
|
||||
</Affix>
|
||||
</Affix> */}
|
||||
<Stack>
|
||||
<Tabs
|
||||
color="orange"
|
||||
|
||||
@@ -23,6 +23,8 @@ import { useRouter } from "next/navigation";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import TampilanRupiahDonasi from "../../component/tampilan_rupiah";
|
||||
import ComponentDonasi_IsEmptyData from "../../component/is_empty_data";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function PostingDraftDonasi({
|
||||
listDraft,
|
||||
@@ -31,6 +33,10 @@ export default function PostingDraftDonasi({
|
||||
}) {
|
||||
const { height, width } = useViewportSize();
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(listDraft))
|
||||
return <ComponentDonasi_IsEmptyData text="Tidak ada data" />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
@@ -43,7 +49,10 @@ export default function PostingDraftDonasi({
|
||||
]}
|
||||
>
|
||||
{listDraft.map((e, i) => (
|
||||
<Box key={i} onClick={() => router.push(RouterDonasi.detail_draft + `${e.id}`)}>
|
||||
<Box
|
||||
key={i}
|
||||
onClick={() => router.push(RouterDonasi.detail_draft + `${e.id}`)}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={7}>
|
||||
|
||||
@@ -21,6 +21,8 @@ import { useRouter } from "next/navigation";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_IsEmptyData from "../../component/is_empty_data";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function PostingRejectDonasi({
|
||||
listReject,
|
||||
@@ -29,7 +31,11 @@ export default function PostingRejectDonasi({
|
||||
}) {
|
||||
const { height, width } = useViewportSize();
|
||||
const router = useRouter();
|
||||
const [donasi, setDonasi] = useState(listReject)
|
||||
const [donasi, setDonasi] = useState(listReject);
|
||||
|
||||
if (_.isEmpty(listReject))
|
||||
return <ComponentDonasi_IsEmptyData text="Tidak ada data" />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
@@ -41,45 +47,44 @@ export default function PostingRejectDonasi({
|
||||
{ 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}
|
||||
{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 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>
|
||||
))}
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{width > 575 ? "" : <Divider />}
|
||||
</Stack>
|
||||
</Box>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -22,6 +22,8 @@ import { useRouter } from "next/navigation";
|
||||
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import _ from "lodash";
|
||||
import ComponentDonasi_IsEmptyData from "../../component/is_empty_data";
|
||||
|
||||
export default function PostingReviewDonasi({
|
||||
listReview,
|
||||
@@ -30,6 +32,10 @@ export default function PostingReviewDonasi({
|
||||
}) {
|
||||
const { height, width } = useViewportSize();
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(listReview))
|
||||
return <ComponentDonasi_IsEmptyData text="Tidak ada data" />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid
|
||||
@@ -42,7 +48,10 @@ export default function PostingReviewDonasi({
|
||||
]}
|
||||
>
|
||||
{listReview.map((e, i) => (
|
||||
<Box key={i} onClick={() => router.push(RouterDonasi.detail_review + `${e.id}`)}>
|
||||
<Box
|
||||
key={i}
|
||||
onClick={() => router.push(RouterDonasi.detail_review + `${e.id}`)}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={7}>
|
||||
|
||||
@@ -47,6 +47,9 @@ export default function LayoutDonasi({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [active, setActive] = useAtom(gs_donasi_hot_menu);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [isRightLoading, setRightLoading] = useState(false);
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: 1,
|
||||
@@ -74,16 +77,26 @@ export default function LayoutDonasi({
|
||||
header={
|
||||
<Header height={50} sx={{ borderStyle: "none" }}>
|
||||
<Group h={50} position="apart" px={"md"}>
|
||||
<ActionIcon onClick={() => router.push(RouterCrowd.main)}>
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
loading={isLoading ? true : false}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterCrowd.main);
|
||||
}}
|
||||
>
|
||||
<IconChevronLeft />
|
||||
</ActionIcon>
|
||||
<Title order={5}>Donasi</Title>
|
||||
<ActionIcon
|
||||
radius={"md"}
|
||||
loading={isRightLoading ? true : false}
|
||||
variant="transparent"
|
||||
onClick={() =>
|
||||
router.push(RouterDonasi.notif_page + `${userId}`)
|
||||
}
|
||||
onClick={() => {
|
||||
setRightLoading(true);
|
||||
router.push(RouterDonasi.notif_page + `${userId}`);
|
||||
}}
|
||||
>
|
||||
{_.isEmpty(isRead) ? (
|
||||
<IconBell />
|
||||
|
||||
@@ -19,6 +19,8 @@ import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.share
|
||||
import { Donasi_funUpdateNotifById } from "../../fun/update/fun_update_notif_by_user_id";
|
||||
import { NotifGagal } from "../../component/notifikasi/notif_gagal";
|
||||
import { useRouter } from "next/navigation";
|
||||
import _ from "lodash";
|
||||
import ComponentDonasi_IsEmptyData from "../../component/is_empty_data";
|
||||
|
||||
export default function Donasi_NotifPage({
|
||||
dataNotif,
|
||||
@@ -27,6 +29,11 @@ export default function Donasi_NotifPage({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [notif, setNotif] = useState(dataNotif);
|
||||
|
||||
if (_.isEmpty(dataNotif)) {
|
||||
return <ComponentDonasi_IsEmptyData text="Tidak ada data" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_proses_donasi } from "../../global_state";
|
||||
import { gs_donasi_hot_menu, gs_proses_donasi } from "../../global_state";
|
||||
import { MODEL_DONASI, MODEL_DONASI_INVOICE } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import TampilanRupiahDonasi from "../../component/tampilan_rupiah";
|
||||
@@ -39,6 +39,7 @@ export default function Donasi_InvoiceProses({
|
||||
const router = useRouter();
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
const [image, setImage] = useState<any | null>(null);
|
||||
const [active, setActive] = useAtom(gs_donasi_hot_menu);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -174,38 +175,12 @@ export default function Donasi_InvoiceProses({
|
||||
</Stack>
|
||||
</Paper>
|
||||
|
||||
{/* <Paper p={"sm"} withBorder>
|
||||
<Stack>
|
||||
<Text>Detail donasi</Text>
|
||||
<Paper p={"md"} bg={"gray.2"}>
|
||||
<Stack spacing={"lg"}>
|
||||
<Stack spacing={"xs"}>
|
||||
<Title order={4}>{invoice.Donasi.title}</Title>
|
||||
<Stack spacing={0}>
|
||||
<Group spacing={5}>
|
||||
<Text>Kategori</Text>
|
||||
<Title order={5}>
|
||||
{invoice.Donasi.DonasiMaster_Ketegori.name}
|
||||
</Title>
|
||||
</Group>
|
||||
<ComponentDonasi_TampilanHitungMundur
|
||||
durasi={invoice.Donasi.DonasiMaster_Durasi.name}
|
||||
publishTime={invoice.Donasi.publishTime}
|
||||
textSize={16}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Stack>
|
||||
</Paper> */}
|
||||
|
||||
{file !== null ? (
|
||||
<Button
|
||||
radius={"xl"}
|
||||
bg={"orange"}
|
||||
color="orange"
|
||||
onClick={() => onClick(router, invoice.id)}
|
||||
onClick={() => onClick(router, invoice.id, setActive)}
|
||||
>
|
||||
Saya Sudah Transfer
|
||||
</Button>
|
||||
@@ -225,10 +200,15 @@ export default function Donasi_InvoiceProses({
|
||||
);
|
||||
}
|
||||
|
||||
async function onClick(router: AppRouterInstance, invoiceId: string) {
|
||||
async function onClick(
|
||||
router: AppRouterInstance,
|
||||
invoiceId: string,
|
||||
setActive: any
|
||||
) {
|
||||
await Donasi_funUpdateStatusInvoice(invoiceId, "2").then((res) => {
|
||||
if (res.status === 200) {
|
||||
NotifBerhasil(res.message);
|
||||
setActive(2);
|
||||
router.push(RouterDonasi.proses_transaksi + `${invoiceId}`);
|
||||
} else {
|
||||
NotifGagal(res.message);
|
||||
|
||||
@@ -51,7 +51,9 @@ const listNominal = [
|
||||
|
||||
export default function MasukanDonasi({ donasiId }: { donasiId: string }) {
|
||||
const router = useRouter();
|
||||
const [nominal, setNominal] = useState(0);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [nominal, setNominal] = useState("");
|
||||
const [value, setValue] = useState(0);
|
||||
const [prosesDonasi, setProsesDonasi] = useAtom(gs_proses_donasi);
|
||||
|
||||
async function onProses(nominal: number) {
|
||||
@@ -62,6 +64,7 @@ export default function MasukanDonasi({ donasiId }: { donasiId: string }) {
|
||||
...prosesDonasi,
|
||||
nominal: "" + nominal,
|
||||
});
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.metode_pembayaran + `${donasiId}`);
|
||||
}
|
||||
|
||||
@@ -97,24 +100,40 @@ export default function MasukanDonasi({ donasiId }: { donasiId: string }) {
|
||||
<Paper p={"sm"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Text>Nominal Lainnya</Text>
|
||||
<Grid>
|
||||
<Grid.Col span={1}>
|
||||
<Title order={4}>Rp.</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={11}>
|
||||
<NumberInput
|
||||
min={0}
|
||||
type="number"
|
||||
onChange={(val: number) => setNominal(val)}
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<TextInput
|
||||
icon={<Text fw={"bold"}>Rp.</Text>}
|
||||
placeholder="0"
|
||||
min={0}
|
||||
value={nominal}
|
||||
onChange={(val) => {
|
||||
const match = val.currentTarget.value
|
||||
.replace(/\./g, "")
|
||||
.match(/^[0-9]+$/);
|
||||
|
||||
if (val.currentTarget.value === "") return setNominal(0 + "");
|
||||
|
||||
if (!match?.[0]) return null;
|
||||
|
||||
const nilai = val.currentTarget.value.replace(/\./g, "");
|
||||
const target = Intl.NumberFormat("id-ID").format(+nilai);
|
||||
|
||||
setValue(+nilai);
|
||||
setNominal(target);
|
||||
}}
|
||||
/>
|
||||
<Text c={"gray"} fz={"xs"}>
|
||||
Minimal Donasi Rp. 10.000
|
||||
</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Button radius={"xl"} onClick={() => onProses(nominal)}>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={value === 0 || value < 10000}
|
||||
radius={"xl"}
|
||||
onClick={() => onProses(value)}
|
||||
>
|
||||
Lanjutan Pembayaran
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
@@ -39,13 +39,14 @@ const listBank = [
|
||||
export default function Donasi_MetodePembayaran({
|
||||
listBank,
|
||||
donasiId,
|
||||
authorId
|
||||
authorId,
|
||||
}: {
|
||||
listBank: Model_Nama_Bank[];
|
||||
donasiId: string;
|
||||
authorId: string
|
||||
authorId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [prosesDonasi, setProsesDonasi] = useAtom(gs_proses_donasi);
|
||||
const [pilihBank, setPilihBank] = useState("1");
|
||||
const [bank, setBank] = useState(listBank);
|
||||
@@ -55,13 +56,14 @@ export default function Donasi_MetodePembayaran({
|
||||
donasiId: donasiId,
|
||||
donasiMaster_BankId: pilihBank,
|
||||
nominal: prosesDonasi.nominal,
|
||||
authorId: authorId
|
||||
authorId: authorId,
|
||||
};
|
||||
|
||||
// console.log(body)
|
||||
|
||||
await Donasi_funCreateInvoice(body).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
NotifBerhasil(res.message);
|
||||
router.push(RouterDonasi.invoice + `${res.invoiceId}`);
|
||||
setProsesDonasi({
|
||||
@@ -94,7 +96,13 @@ export default function Donasi_MetodePembayaran({
|
||||
))}
|
||||
</Radio.Group>
|
||||
|
||||
<Button radius={"xl"} onClick={() => onProses()}>
|
||||
<Button
|
||||
style={{ transition: "0.5s" }}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
onClick={() => onProses()}
|
||||
>
|
||||
Pilih
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user