Merge pull request #233 from bipproduction/Nico/10Jan2025
Fix Button Loading All Menu Execpt Job Vacancy
This commit is contained in:
@@ -4,6 +4,7 @@ import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_b
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const donasiId = params.id
|
||||
const dataDonasi = await Donasi_getOneById(donasiId);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { useAtom } from "jotai";
|
||||
import { gs_donasi_tabs_posting } from "../../global_state";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
|
||||
export function Donasi_ComponentButtonDeleteDonasiById({
|
||||
donasiId,
|
||||
@@ -25,6 +26,7 @@ export function Donasi_ComponentButtonDeleteDonasiById({
|
||||
imageId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [tabsPostingDonasi, setTabsPostingDonasi] = useAtom(
|
||||
gs_donasi_tabs_posting
|
||||
@@ -32,28 +34,35 @@ export function Donasi_ComponentButtonDeleteDonasiById({
|
||||
|
||||
async function onDelete() {
|
||||
const del = await Donasi_funDeleteDonasiById(donasiId);
|
||||
if (del.status === 200) {
|
||||
const deleteImageDonasi = await funGlobal_DeleteFileById({
|
||||
fileId: imageId as any,
|
||||
});
|
||||
try {
|
||||
setLoading(true);
|
||||
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 ");
|
||||
}
|
||||
|
||||
const deleteImageCerita = await funGlobal_DeleteFileById({
|
||||
fileId: imageCeritaId as any,
|
||||
});
|
||||
|
||||
if (!deleteImageCerita.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
}
|
||||
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
setTabsPostingDonasi("Draft");
|
||||
ComponentGlobal_NotifikasiBerhasil(del.message);
|
||||
} else {
|
||||
setLoading(false);
|
||||
ComponentGlobal_NotifikasiGagal(del.message);
|
||||
}
|
||||
|
||||
const deleteImageCerita = await funGlobal_DeleteFileById({
|
||||
fileId: imageCeritaId as any,
|
||||
});
|
||||
|
||||
if (!deleteImageCerita.success) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar ");
|
||||
}
|
||||
|
||||
router.replace(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
setTabsPostingDonasi("Draft");
|
||||
ComponentGlobal_NotifikasiBerhasil(del.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(del.message);
|
||||
} catch (error) {
|
||||
setLoading(false);
|
||||
clientLogger.error("Error delete donasi", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,12 +84,13 @@ export function Donasi_ComponentButtonDeleteDonasiById({
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button radius={"xl"} color="red" onClick={() => onDelete()}>
|
||||
<Button c={AccentColor.white} loading={isLoading} loaderPosition="center" radius={"xl"} style={{ backgroundColor: MainColor.red}} onClick={() => onDelete()}>
|
||||
Hapus
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -17,11 +17,15 @@ import { MODEL_DONASI } from "../../model/interface";
|
||||
import { IRealtimeData } from "@/app/lib/global_state";
|
||||
import { WibuRealtime } from "wibu-pkg";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||
import funDeleteDonasi from "@/app_modules/investasi/fun/fun_delete_donasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global";
|
||||
|
||||
export default function DetailDraftDonasi({
|
||||
dataDonasi,
|
||||
}: {
|
||||
dataDonasi: MODEL_DONASI;
|
||||
dataDonasi: MODEL_DONASI;
|
||||
}) {
|
||||
const [data, setData] = useState(dataDonasi);
|
||||
|
||||
@@ -45,15 +49,19 @@ export default function DetailDraftDonasi({
|
||||
|
||||
function ButtonAjukanPenggalangan({
|
||||
dataDonasi,
|
||||
|
||||
}: {
|
||||
dataDonasi: MODEL_DONASI;
|
||||
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [isLoadingAjukan, setLoadingAjukan] = useState(false);
|
||||
const [isLoadingDelete, setLoadingDelete] = useState(false);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
|
||||
async function onChangeStatus() {
|
||||
const res = await Donasi_funGantiStatus(dataDonasi.id, "2");
|
||||
try {
|
||||
if (res.status === 200) {
|
||||
|
||||
const dataNotifikasi: IRealtimeData = {
|
||||
@@ -81,13 +89,18 @@ function ButtonAjukanPenggalangan({
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
setLoading(true);
|
||||
setLoadingAjukan(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
|
||||
router.push(RouterDonasi.status_galang_dana({ id: "2" }));
|
||||
}
|
||||
} else {
|
||||
setLoadingAjukan(false);
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
setLoadingAjukan(false);
|
||||
clientLogger.error("Error ajukan donasi", error);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
@@ -107,7 +120,8 @@ function ButtonAjukanPenggalangan({
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
buttonKiri={
|
||||
<Button c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -117,7 +131,7 @@ function ButtonAjukanPenggalangan({
|
||||
backgroundColor: AccentColor.yellow
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
loading={isLoadingAjukan}
|
||||
radius={"xl"}
|
||||
c={MainColor.darkblue}
|
||||
onClick={() => onChangeStatus()}
|
||||
|
||||
@@ -127,7 +127,8 @@ function ButtonAction({
|
||||
opened={openModaEdit}
|
||||
close={() => setOpenModalEdit(false)}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModalEdit(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalEdit(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -151,7 +152,8 @@ function ButtonAction({
|
||||
opened={openModalDelete}
|
||||
close={() => setOpenModalDelete(false)}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -160,7 +162,8 @@ function ButtonAction({
|
||||
loaderPosition="center"
|
||||
loading={isLoadingDelete}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
style={{ backgroundColor: MainColor.red }}
|
||||
c={AccentColor.white}
|
||||
onClick={() => onDelete()}
|
||||
>
|
||||
Hapus
|
||||
|
||||
@@ -111,7 +111,8 @@ function ButtonBatalReview({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
buttonKiri={
|
||||
<Button c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ function ButtonAction({
|
||||
opened={openModal1}
|
||||
close={() => setOpenModal1(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ color: AccentColor.white }} radius={"xl"} onClick={() => setOpenModal1(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal1(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -185,7 +185,7 @@ function ButtonAction({
|
||||
opened={openModal2}
|
||||
close={() => setOpenModal2(false)}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModal2(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal2(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -197,7 +197,8 @@ function ButtonAction({
|
||||
onClick={() => {
|
||||
onDelete();
|
||||
}}
|
||||
color="red"
|
||||
style={{ backgroundColor: MainColor.red }}
|
||||
c={AccentColor.white}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
|
||||
@@ -109,7 +109,7 @@ function ButtonAction({ eventId, }: { eventId: string }) {
|
||||
opened={openModal1}
|
||||
close={() => setOpenModal1(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ color: AccentColor.white }} radius={"xl"} onClick={() => setOpenModal1(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal1(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -135,7 +135,7 @@ function ButtonAction({ eventId, }: { eventId: string }) {
|
||||
opened={openModal2}
|
||||
close={() => setOpenModal2(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ color: AccentColor.white }} radius={"xl"} onClick={() => setOpenModal2(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal2(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -143,9 +143,9 @@ function ButtonAction({ eventId, }: { eventId: string }) {
|
||||
<Button
|
||||
loading={isLoading2 ? true : false}
|
||||
loaderPosition="center"
|
||||
style={{ color: AccentColor.white }}
|
||||
style={{ backgroundColor: MainColor.red }}
|
||||
radius={"xl"}
|
||||
color={"red"}
|
||||
c={AccentColor.white}
|
||||
onClick={() => {
|
||||
onDelete(router, eventId, setLoading2);
|
||||
}}
|
||||
|
||||
@@ -49,7 +49,7 @@ function ButtonAction({ eventId }: { eventId: string }) {
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ color: AccentColor.white }} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
||||
import funDeleteInvestasi from "@/app_modules/investasi/fun/fun_delete_investasi";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
@@ -39,72 +40,83 @@ export default function Investasi_ViewDetailDraft({
|
||||
statusId: "2",
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Berhasil Diajukan");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "2" }));
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Mengajukan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Berhasil Diajukan");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "2" }));
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Mengajukan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
}
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
clientLogger.error("Error update investasi", error);
|
||||
}
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
const res = await funDeleteInvestasi(data.id);
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
setIsLoadingDelete(true);
|
||||
|
||||
const delImage = await funGlobal_DeleteFileById({
|
||||
fileId: data.imageId,
|
||||
});
|
||||
if (!delImage.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus image ");
|
||||
}
|
||||
|
||||
const delFileProspektus = await funGlobal_DeleteFileById({
|
||||
fileId: data.prospektusFileId,
|
||||
});
|
||||
if (!delFileProspektus.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus prospektus ");
|
||||
}
|
||||
|
||||
if (!_.isEmpty(data.DokumenInvestasi)) {
|
||||
for (let i of data.DokumenInvestasi) {
|
||||
const delFileDokumen = await funGlobal_DeleteFileById({
|
||||
fileId: i.fileId,
|
||||
});
|
||||
|
||||
if (!delFileDokumen.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||
"Gagal hapus prospektus "
|
||||
);
|
||||
if (res.status === 200) {
|
||||
|
||||
const delImage = await funGlobal_DeleteFileById({
|
||||
fileId: data.imageId,
|
||||
});
|
||||
if (!delImage.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus image ");
|
||||
}
|
||||
|
||||
const delFileProspektus = await funGlobal_DeleteFileById({
|
||||
fileId: data.prospektusFileId,
|
||||
});
|
||||
if (!delFileProspektus.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal hapus prospektus ");
|
||||
}
|
||||
|
||||
if (!_.isEmpty(data.DokumenInvestasi)) {
|
||||
for (let i of data.DokumenInvestasi) {
|
||||
const delFileDokumen = await funGlobal_DeleteFileById({
|
||||
fileId: i.fileId,
|
||||
});
|
||||
|
||||
if (!delFileDokumen.success) {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||
"Gagal hapus prospektus "
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setOpenModal(false);
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
setIsLoadingDelete(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
setIsLoadingDelete(false);
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setOpenModal(false);
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
setIsLoadingDelete(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
} catch (error) {
|
||||
setIsLoadingDelete(false);
|
||||
clientLogger.error("Error delete investasi", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +155,8 @@ export default function Investasi_ViewDetailDraft({
|
||||
close={() => setOpenModal(false)}
|
||||
title={"Anda yakin ingin mengajukan review ?"}
|
||||
buttonKiri={
|
||||
<Button style={{ color: AccentColor.white }} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
@@ -170,7 +183,8 @@ export default function Investasi_ViewDetailDraft({
|
||||
close={() => setOpenModalDelete(false)}
|
||||
title={"Anda yakin ingin menghapus ?"}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalDelete(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
||||
import funDeleteInvestasi from "@/app_modules/investasi/fun/fun_delete_investasi";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -24,8 +25,10 @@ export default function Investasi_ViewDetailReject({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState(dataInvestasi);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [openModalDel, setOpenModalDel] = useState(false);
|
||||
const [openModalEdit, setOpenModalEdit] = useState(false);
|
||||
const [isLoadingDel, setLoadingDel] = useState(false);
|
||||
const [isLoadingEdit, setLoadingEdit] = useState(false);
|
||||
|
||||
async function onAjukan() {
|
||||
const res = await investasi_funEditStatusById({
|
||||
@@ -33,18 +36,25 @@ export default function Investasi_ViewDetailReject({
|
||||
statusId: "3",
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
||||
try {
|
||||
setLoadingEdit(true);
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Project Diajukan Kembali");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
} else {
|
||||
setLoadingEdit(false);
|
||||
ComponentGlobal_NotifikasiGagal("Gagal Pengajuan");
|
||||
}
|
||||
} catch (error) {
|
||||
setLoadingEdit(false);
|
||||
clientLogger.error("Error ajukan kembali", error);
|
||||
}
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
const res = await funDeleteInvestasi(data.id);
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
setLoadingDel(true);
|
||||
|
||||
const delImage = await funGlobal_DeleteFileById({
|
||||
fileId: data.imageId,
|
||||
@@ -75,12 +85,12 @@ export default function Investasi_ViewDetailReject({
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setOpenModal(false);
|
||||
setOpenModalDel(false);
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "4" }));
|
||||
setLoading(false);
|
||||
setLoadingDel(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
setLoading(false);
|
||||
setLoadingDel(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,19 +99,20 @@ export default function Investasi_ViewDetailReject({
|
||||
{/* Pop up */}
|
||||
<UIGlobal_Modal
|
||||
title={"Anda Yakin Menghapus Data?"}
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
opened={openModalDel}
|
||||
close={() => setOpenModalDel(false)}
|
||||
buttonKiri={
|
||||
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalDel(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
color="red"
|
||||
bg={"red"}
|
||||
loading={isLoadingDel}
|
||||
c={AccentColor.white}
|
||||
style={{ backgroundColor: MainColor.red}}
|
||||
radius={"xl"}
|
||||
onClick={() => onDelete()}
|
||||
>
|
||||
@@ -110,6 +121,30 @@ export default function Investasi_ViewDetailReject({
|
||||
}
|
||||
/>
|
||||
|
||||
<UIGlobal_Modal
|
||||
title={"Anda Yakin Mengedit Kembali?"}
|
||||
opened={openModalEdit}
|
||||
close={() => setOpenModalEdit(false)}
|
||||
buttonKiri={
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModalEdit(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingEdit}
|
||||
style={{ backgroundColor: AccentColor.yellow }}
|
||||
c={MainColor.darkblue}
|
||||
radius={"xl"}
|
||||
onClick={() => onAjukan()}
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
<Stack>
|
||||
{/* Alasan */}
|
||||
<ComponentGlobal_BoxInformation informasi={data.catatan} isReport />
|
||||
@@ -121,7 +156,7 @@ export default function Investasi_ViewDetailReject({
|
||||
<Button
|
||||
radius={"xl"}
|
||||
style={{ backgroundColor: AccentColor.yellow }}
|
||||
onClick={() => onAjukan()}
|
||||
onClick={() => setOpenModalEdit(true)}
|
||||
c={MainColor.darkblue}
|
||||
>
|
||||
Edit Kembali
|
||||
@@ -132,7 +167,7 @@ export default function Investasi_ViewDetailReject({
|
||||
radius={"xl"}
|
||||
style={{ backgroundColor: MainColor.red }}
|
||||
c={AccentColor.white}
|
||||
onClick={() => setOpenModal(true)}
|
||||
onClick={() => setOpenModalDel(true)}
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Investasi_ComponentDetailDataNonPublish } from "@/app_modules/investasi
|
||||
import { MODEL_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
import { investasi_funEditStatusById } from "@/app_modules/investasi/fun/edit/fun_edit_status_by_id";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -29,31 +30,36 @@ export default function Investasi_ViewDetailReview({
|
||||
investasiId: data.id,
|
||||
statusId: "3",
|
||||
});
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan");
|
||||
router.replace(NEW_RouterInvestasi.portofolio({ id: "3" }));
|
||||
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
userId: res.data?.authorId,
|
||||
pesan: res.data?.title,
|
||||
status: res.data?.MasterStatusInvestasi?.name,
|
||||
kategoriApp: "INVESTASI",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
}
|
||||
setLoading(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
setLoading(false);
|
||||
}
|
||||
} catch (error) {
|
||||
setLoading(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
setLoading(false);
|
||||
clientLogger.error("Error ajukan kembali", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,13 +88,13 @@ export default function Investasi_ViewDetailReview({
|
||||
close={() => setOpenModal(false)}
|
||||
title={"Anda yakin ingin batalkan review?"}
|
||||
buttonKiri={
|
||||
<Button style={{ color: AccentColor.white }} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
|
||||
style={{
|
||||
transition: "0.5s", color: "black",
|
||||
backgroundColor: AccentColor.yellow
|
||||
|
||||
22
src/app_modules/investasi/fun/fun_delete_donasi.ts
Normal file
22
src/app_modules/investasi/fun/fun_delete_donasi.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
'use server';
|
||||
|
||||
import { prisma } from "@/app/lib";
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function funDeleteDonasi(id: string) {
|
||||
const res = await prisma.donasi.delete({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal Hapus Data" };
|
||||
|
||||
revalidatePath(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
revalidatePath(RouterDonasi.status_galang_dana({ id: "4" }));
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil Hapus",
|
||||
};
|
||||
}
|
||||
@@ -163,6 +163,7 @@ function ButtonAction({
|
||||
onClick={() => {
|
||||
setOpenModal1(false);
|
||||
}}
|
||||
style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
@@ -190,7 +191,7 @@ function ButtonAction({
|
||||
close={() => setOpenModal2(false)}
|
||||
buttonKiri={
|
||||
<Button
|
||||
c={AccentColor.white}
|
||||
style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setOpenModal2(false);
|
||||
|
||||
@@ -110,6 +110,7 @@ function ButtonAction({ voteId }: { voteId: string }) {
|
||||
buttonKiri={
|
||||
<Button
|
||||
radius={"xl"}
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
onClick={() => {
|
||||
setOpenModal1(false);
|
||||
@@ -145,6 +146,8 @@ function ButtonAction({ voteId }: { voteId: string }) {
|
||||
onClick={() => {
|
||||
setOpenModal2(false);
|
||||
}}
|
||||
style={{ backgroundColor: AccentColor.blue }}
|
||||
c={AccentColor.white}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
|
||||
@@ -105,7 +105,7 @@ function ButtonAction({
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
buttonKiri={
|
||||
<Button c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
<Button style={{ backgroundColor: AccentColor.blue}} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user