fix: donasi
deskripsi: - ubah use server menjadi API src/app/dev/(user)/donasi/detail/donasi_saya/[id]/page.tsx src/app/dev/(user)/donasi/detail/main/[id]/layout.tsx src/app/dev/(user)/donasi/detail/main/[id]/page.tsx src/app/dev/(user)/donasi/detail/publish/[id]/page.tsx src/app/dev/(user)/donasi/detail/reject/[id]/page.tsx src/app_modules/admin/donasi/detail/detail_review.tsx src/app_modules/donasi/detail/detail_draft/index.tsx src/app_modules/donasi/detail/detail_publish/index.tsx src/app_modules/donasi/detail/detail_reject/index.tsx src/app_modules/donasi/detail/detail_review/index.tsx No Issue
This commit is contained in:
@@ -6,12 +6,16 @@ import { Donasi_getOneInvoiceById } from "@/app_modules/donasi/fun/get/get_one_i
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let invoiceId = params.id;
|
||||
const dataDonasi = await Donasi_getOneInvoiceById(invoiceId);
|
||||
const countDonatur= await Donasi_getCountDonatur(dataDonasi?.donasiId as any)
|
||||
|
||||
const countDonatur = await Donasi_getCountDonatur(
|
||||
dataDonasi?.donasiId as any
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<DetailDonasiSaya dataDonasi={dataDonasi as any} countDonatur={countDonatur} />
|
||||
<DetailDonasiSaya
|
||||
dataDonasi={dataDonasi as any}
|
||||
countDonatur={countDonatur}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
import { LayoutDetailMainDonasiNew } from "@/app_modules/donasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({ children, params, }: { children: React.ReactNode; params: { id: string }; }) {
|
||||
// const donasiId = params.id;
|
||||
// const getData = await Donasi_getOneById(donasiId);
|
||||
// const authorId = getData?.authorId;
|
||||
// const userLoginId = await funGetUserIdByToken();
|
||||
export default async function Layout({ children }: { children: React.ReactNode; }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <LayoutDetailMainDonasi
|
||||
donasiId={donasiId}
|
||||
authorId={authorId as any}
|
||||
userLoginId={userLoginId as string}
|
||||
>
|
||||
{children}
|
||||
</LayoutDetailMainDonasi> */}
|
||||
|
||||
<LayoutDetailMainDonasiNew>
|
||||
{children}
|
||||
</LayoutDetailMainDonasiNew>
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
import DetailMainDonasiNew from "@/app_modules/donasi/detail/detail_main/index_new";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
// let donasiId = params.id;
|
||||
// const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
// const dataDonasi = await Donasi_getOneById(donasiId);
|
||||
// const countDonatur = await Donasi_getCountDonatur(donasiId);
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
{/* <DetailMainDonasi
|
||||
dataDonasi={dataDonasi as any}
|
||||
countDonatur={countDonatur}
|
||||
userLoginId={userLoginId as string}
|
||||
/> */}
|
||||
<DetailMainDonasiNew />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { DetailPublishDonasi } from "@/app_modules/donasi";
|
||||
import { Donasi_getCountDonatur } from "@/app_modules/donasi/fun/count/get_count_donatur";
|
||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const dataPublish = await Donasi_getOneById(params.id);
|
||||
const countDonatur = await Donasi_getCountDonatur(params.id);
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<DetailPublishDonasi
|
||||
dataPublish={dataPublish as any}
|
||||
countDonatur={countDonatur}
|
||||
userLoginId={userLoginId as string}
|
||||
/>
|
||||
<DetailPublishDonasi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { DetailRejectDonasi } from "@/app_modules/donasi";
|
||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
let donasiId= params.id
|
||||
const dataReject = await Donasi_getOneById(donasiId)
|
||||
const fileIdImageCerita = dataReject?.CeritaDonasi?.imageId
|
||||
|
||||
return (
|
||||
<>
|
||||
<DetailRejectDonasi dataReject={dataReject as any} fileIdImageCerita={fileIdImageCerita as any}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<DetailRejectDonasi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function AdminDonasi_DetailReview() {
|
||||
try {
|
||||
const response = await apiGetAdminDonasiById({
|
||||
id: params.id,
|
||||
})
|
||||
});
|
||||
|
||||
if (response?.success && response?.data) {
|
||||
setData(response.data);
|
||||
@@ -50,14 +50,14 @@ export default function AdminDonasi_DetailReview() {
|
||||
clientLogger.error("Invalid data format recieved:", error);
|
||||
setData(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
loadInitialData();
|
||||
})
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{!data ? (
|
||||
<SkeletonAdminDetailDonasiReview />
|
||||
<SkeletonAdminDetailDonasiReview />
|
||||
) : (
|
||||
<>
|
||||
<ButtonOnHeader donasi={data} setData={setData} />
|
||||
@@ -77,7 +77,7 @@ export default function AdminDonasi_DetailReview() {
|
||||
</SimpleGrid>
|
||||
</>
|
||||
)}
|
||||
</Stack >
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -92,8 +92,10 @@ function ButtonOnHeader({
|
||||
const router = useRouter();
|
||||
const [isLoadingPublish, setLoadingPublish] = useState(false);
|
||||
const [isLoadingReject, setLoadingReject] = useState(false);
|
||||
const [openedPublish, { open: openPublish, close: closePublish }] = useDisclosure(false);
|
||||
const [openedReject, { open: openReject, close: closeReject }] = useDisclosure(false);
|
||||
const [openedPublish, { open: openPublish, close: closePublish }] =
|
||||
useDisclosure(false);
|
||||
const [openedReject, { open: openReject, close: closeReject }] =
|
||||
useDisclosure(false);
|
||||
const [catatan, setCatatan] = useState("");
|
||||
|
||||
async function onPublish() {
|
||||
@@ -152,7 +154,6 @@ function ButtonOnHeader({
|
||||
title: "Donasi baru terpublish",
|
||||
};
|
||||
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
@@ -161,13 +162,11 @@ function ButtonOnHeader({
|
||||
}
|
||||
}
|
||||
|
||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||
setData(newData);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(
|
||||
"Berhasil Mengubah Status Donasi"
|
||||
);
|
||||
router.back()
|
||||
setLoadingPublish(false);
|
||||
router.back();
|
||||
} else {
|
||||
setLoadingPublish(false);
|
||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||
@@ -190,46 +189,52 @@ function ButtonOnHeader({
|
||||
"Lengkapi Alasan Penolakan"
|
||||
);
|
||||
|
||||
const checkStatus = await donasi_checkStatus({ id: donasi.id });
|
||||
try {
|
||||
setLoadingReject(true);
|
||||
const checkStatus = await donasi_checkStatus({ id: donasi.id });
|
||||
|
||||
if (checkStatus) {
|
||||
const res = await AdminDonasi_funUpdateStatusReject(
|
||||
donasi.id,
|
||||
"4",
|
||||
catatan
|
||||
);
|
||||
if (res.status === 200) {
|
||||
const dataNotifikasi: IRealtimeData = {
|
||||
appId: res.data?.id as string,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "DONASI",
|
||||
title: "Donasi anda di tolak !",
|
||||
};
|
||||
if (checkStatus) {
|
||||
const res = await AdminDonasi_funUpdateStatusReject(
|
||||
donasi.id,
|
||||
"4",
|
||||
catatan
|
||||
);
|
||||
if (res.status === 200) {
|
||||
const dataNotifikasi: IRealtimeData = {
|
||||
appId: res.data?.id as string,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "DONASI",
|
||||
title: "Donasi anda di tolak !",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||
setData(newData);
|
||||
close();
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoadingReject(true);
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
closeReject();
|
||||
router.back()
|
||||
}
|
||||
} else {
|
||||
setLoadingReject(false);
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
setLoadingReject(false);
|
||||
ComponentGlobal_NotifikasiPeringatan("Status donasi telah diubah user");
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan("Status donasi telah diubah user");
|
||||
} catch (error) {
|
||||
setLoadingReject(false);
|
||||
console.error("Error to reject donasi", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,10 +337,6 @@ function ButtonOnHeader({
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{/* <Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
|
||||
@@ -23,33 +23,33 @@ import { useParams } from "next/navigation";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
|
||||
export default function DetailDraftDonasi() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const [data, setData] = useState({} as MODEL_DONASI);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useShallowEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
async function getData() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetOneDonasiById(param.id, "semua");
|
||||
|
||||
if (response.success) {
|
||||
setData(response.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
const param = useParams<{ id: string }>();
|
||||
const [data, setData] = useState({} as MODEL_DONASI);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useShallowEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
async function getData() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetOneDonasiById(param.id, "semua");
|
||||
|
||||
if (response.success) {
|
||||
setData(response.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <CustomSkeleton height={400} />;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <CustomSkeleton height={400} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xl"} py={"md"}>
|
||||
@@ -108,7 +108,7 @@ function ButtonAjukanPenggalangan({
|
||||
});
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
|
||||
router.push(RouterDonasi.status_galang_dana({ id: "2" }));
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "2" }));
|
||||
}
|
||||
} else {
|
||||
setLoadingAjukan(false);
|
||||
|
||||
@@ -1,34 +1,74 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Stack
|
||||
} from "@mantine/core";
|
||||
import { Stack } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_CeritaPenggalangMain from "../../component/detail_main/cerita_penggalang";
|
||||
import { ComponentDonasi_DetailDataMain } from "../../component/detail_main/detail_data_donasi";
|
||||
import ComponentDonasi_InformasiPenggalangMain from "../../component/detail_main/informasi_penggalang";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { apiGetOneDonasiById } from "../../lib/api_donasi";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useParams } from "next/navigation";
|
||||
import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global";
|
||||
|
||||
export default function DetailPublishDonasi({
|
||||
dataPublish,
|
||||
countDonatur,
|
||||
userLoginId
|
||||
}: {
|
||||
dataPublish: MODEL_DONASI;
|
||||
countDonatur: number,
|
||||
userLoginId: string
|
||||
}) {
|
||||
const [donasi, setDonasi] = useState(dataPublish);
|
||||
export default function DetailPublishDonasi() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const [data, setData] = useState<MODEL_DONASI | null>(null);
|
||||
const [countDonatur, setCountDonatur] = useState<number | null>(null);
|
||||
const [userLoginId, setUserLoginId] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
handleGetUserId();
|
||||
onLoadData();
|
||||
}, []);
|
||||
|
||||
async function handleGetUserId() {
|
||||
try {
|
||||
const response = await apiNewGetUserIdByToken();
|
||||
if (response) {
|
||||
setUserLoginId(response.userId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function onLoadData() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetOneDonasiById(param.id, "semua");
|
||||
const responseCountDonatur = await apiGetOneDonasiById(param.id, "count");
|
||||
|
||||
if (response.success) {
|
||||
setData(response.data);
|
||||
}
|
||||
if (responseCountDonatur.success) {
|
||||
setCountDonatur(responseCountDonatur.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (loading || !userLoginId || !data || countDonatur === null) {
|
||||
return <CustomSkeleton height={400} />;
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(donasi,null,2)}</pre> */}
|
||||
<Stack spacing={"xl"} pb={"lg"}>
|
||||
<ComponentDonasi_DetailDataMain donasi={donasi} countDonatur={countDonatur} userLoginId={userLoginId}/>
|
||||
<ComponentDonasi_InformasiPenggalangMain author={donasi.Author}/>
|
||||
<ComponentDonasi_CeritaPenggalangMain donasi={donasi} />
|
||||
<ComponentDonasi_DetailDataMain
|
||||
donasi={data as any}
|
||||
countDonatur={countDonatur as any}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
<ComponentDonasi_InformasiPenggalangMain author={data?.Author as any} />
|
||||
<ComponentDonasi_CeritaPenggalangMain donasi={data as any} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_DetailDataGalangDana from "../../component/detail_galang_dana/detail_data_donasi";
|
||||
import ComponentDonasi_CeritaPenggalangMain from "../../component/detail_main/cerita_penggalang";
|
||||
@@ -18,15 +18,38 @@ import { Donasi_funDeleteDonasiById } from "../../fun/delete/fin_delete_donasi_b
|
||||
import { Donasi_funGantiStatus } from "../../fun/update/fun_ganti_status";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { apiGetOneDonasiById } from "../../lib/api_donasi";
|
||||
|
||||
export default function DetailRejectDonasi() {
|
||||
const param = useParams<{ id: string }>();
|
||||
const [data, setData] = useState({} as MODEL_DONASI);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useShallowEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
async function getData() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await apiGetOneDonasiById(param.id, "semua");
|
||||
|
||||
if (response.success) {
|
||||
setData(response.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <CustomSkeleton height={400} />;
|
||||
}
|
||||
|
||||
export default function DetailRejectDonasi({
|
||||
dataReject,
|
||||
fileIdImageCerita,
|
||||
}: {
|
||||
dataReject: MODEL_DONASI;
|
||||
fileIdImageCerita: string;
|
||||
}) {
|
||||
const [data, setData] = useState(dataReject);
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xl"} pb={"md"}>
|
||||
@@ -35,7 +58,7 @@ export default function DetailRejectDonasi({
|
||||
<ComponentDonasi_CeritaPenggalangMain donasi={data} />
|
||||
<ButtonAction
|
||||
donasiId={data.id}
|
||||
fileIdImageCerita={fileIdImageCerita}
|
||||
fileIdImageCerita={data.CeritaDonasi.imageId}
|
||||
imageId={data.imageId}
|
||||
/>
|
||||
</Stack>
|
||||
@@ -59,44 +82,54 @@ function ButtonAction({
|
||||
const [isLoadingDelete, setLoadingDelete] = useState(false);
|
||||
|
||||
async function onChangeStatus() {
|
||||
await Donasi_funGantiStatus(donasiId, "3").then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoadingEdit(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
setLoadingEdit(true);
|
||||
}
|
||||
});
|
||||
try {
|
||||
setLoadingEdit(true);
|
||||
await Donasi_funGantiStatus(donasiId, "3").then((res) => {
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
setLoadingEdit(true);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
setLoadingEdit(false);
|
||||
}
|
||||
}
|
||||
async function onDelete() {
|
||||
const del = await Donasi_funDeleteDonasiById(donasiId);
|
||||
if (del.status === 200) {
|
||||
try {
|
||||
setLoadingDelete(true);
|
||||
const deleteImageDonasi = await funGlobal_DeleteFileById({
|
||||
fileId: imageId as any,
|
||||
});
|
||||
const del = await Donasi_funDeleteDonasiById(donasiId);
|
||||
if (del.status === 200) {
|
||||
const deleteImageDonasi = await funGlobal_DeleteFileById({
|
||||
fileId: imageId as any,
|
||||
});
|
||||
|
||||
if (!deleteImageDonasi.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
if (!deleteImageDonasi.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
setLoadingDelete(false);
|
||||
}
|
||||
|
||||
const deleteImageCerita = await funGlobal_DeleteFileById({
|
||||
fileId: fileIdImageCerita as any,
|
||||
});
|
||||
|
||||
if (!deleteImageCerita.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
setLoadingDelete(false);
|
||||
}
|
||||
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "4" }));
|
||||
ComponentGlobal_NotifikasiBerhasil(del.message);
|
||||
setLoadingDelete(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(del.message);
|
||||
setLoadingDelete(false);
|
||||
}
|
||||
|
||||
const deleteImageCerita = await funGlobal_DeleteFileById({
|
||||
fileId: fileIdImageCerita as any,
|
||||
});
|
||||
|
||||
if (!deleteImageCerita.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
setLoadingDelete(false);
|
||||
}
|
||||
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "4" }));
|
||||
ComponentGlobal_NotifikasiBerhasil(del.message);
|
||||
setLoadingDelete(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(del.message);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
setLoadingDelete(false);
|
||||
}
|
||||
}
|
||||
@@ -105,7 +138,7 @@ function ButtonAction({
|
||||
<Group grow>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
style={{ backgroundColor: AccentColor.yellow}}
|
||||
style={{ backgroundColor: AccentColor.yellow }}
|
||||
c={MainColor.darkblue}
|
||||
onClick={() => setOpenModalEdit(true)}
|
||||
>
|
||||
@@ -127,8 +160,12 @@ function ButtonAction({
|
||||
opened={openModaEdit}
|
||||
close={() => setOpenModalEdit(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalEdit(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModalEdit(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -152,8 +189,12 @@ function ButtonAction({
|
||||
opened={openModalDelete}
|
||||
close={() => setOpenModalDelete(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||
<Button
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => setOpenModalDelete(false)}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ function ButtonBatalReview({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
});
|
||||
}
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan");
|
||||
router.push(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
} else {
|
||||
setLoading(false);
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
|
||||
Reference in New Issue
Block a user