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