Merge pull request #141 from bipproduction/notifikasi/donasi
Fix: Donasi notifikasi
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||
|
||||
## [1.2.5](https://github.com/bipproduction/hipmi/compare/v1.2.4...v1.2.5) (2024-11-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Cookies ([038c40a](https://github.com/bipproduction/hipmi/commit/038c40a6fbc4062e1c3f1659ec0d1a4ab92205ae))
|
||||
* Donasi ([2335807](https://github.com/bipproduction/hipmi/commit/2335807b427ee24e7a28ae78a3ca9dae981a79e2))
|
||||
|
||||
## [1.2.4](https://github.com/bipproduction/hipmi/compare/v1.2.3...v1.2.4) (2024-11-25)
|
||||
|
||||
## [1.2.3](https://github.com/bipproduction/hipmi/compare/v1.2.2...v1.2.3) (2024-11-25)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "hipmi",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "npx tsx prisma/seed.ts --yes"
|
||||
"seed": "npx tsx prisma/seed.ts --yes"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev --experimental-https",
|
||||
|
||||
@@ -41,3 +41,7 @@ export const gs_eventTriggerBeranda = atom<boolean>(false);
|
||||
// voting
|
||||
export const gs_adminVoting_triggerReview = atom<boolean>(false);
|
||||
export const gs_votingTiggerBeranda = atom<boolean>(false);
|
||||
|
||||
// donasi
|
||||
export const gs_adminDonasi_triggerReview = atom<boolean>(false);
|
||||
export const gs_donasiTriggerBeranda = atom<boolean>(false);
|
||||
@@ -5,9 +5,11 @@ import { useAtom } from "jotai";
|
||||
import { WibuRealtime } from "wibu-pkg";
|
||||
import {
|
||||
gs_admin_ntf,
|
||||
gs_adminDonasi_triggerReview,
|
||||
gs_adminEvent_triggerReview,
|
||||
gs_adminJob_triggerReview,
|
||||
gs_adminVoting_triggerReview,
|
||||
gs_donasiTriggerBeranda,
|
||||
gs_eventTriggerBeranda,
|
||||
gs_jobTiggerBeranda,
|
||||
gs_realtimeData,
|
||||
@@ -61,6 +63,14 @@ export default function RealtimeProvider({
|
||||
gs_adminVoting_triggerReview
|
||||
);
|
||||
|
||||
// DONASI
|
||||
const [isAdminDonasi_TriggerReview, setIsAdminDonasi_TriggerReview] = useAtom(
|
||||
gs_adminDonasi_triggerReview
|
||||
);
|
||||
const [isTriggerDonasiBeranda, setIsTriggerDonasiBeranda] = useAtom(
|
||||
gs_donasiTriggerBeranda
|
||||
);
|
||||
|
||||
useShallowEffect(() => {
|
||||
// if (WIBU_REALTIME_TOKEN === undefined) return alert("gak dapet key");
|
||||
try {
|
||||
@@ -159,6 +169,27 @@ export default function RealtimeProvider({
|
||||
setNewUserNtf((e) => e + 1);
|
||||
}
|
||||
// ---------------------- VOTING ------------------------- //
|
||||
|
||||
// ---------------------- DONASI ------------------------- //
|
||||
if (
|
||||
data.type == "trigger" &&
|
||||
data.pushNotificationTo == "ADMIN" &&
|
||||
data.dataMessage?.kategoriApp == "DONASI"
|
||||
) {
|
||||
setIsAdminDonasi_TriggerReview(true);
|
||||
}
|
||||
|
||||
if (
|
||||
data.type == "trigger" &&
|
||||
data.pushNotificationTo == "USER" &&
|
||||
data.dataMessage?.kategoriApp == "DONASI" &&
|
||||
data.dataMessage.status == "Publish"
|
||||
) {
|
||||
console.log("masuk trigger ");
|
||||
setIsTriggerDonasiBeranda(true);
|
||||
}
|
||||
|
||||
// ---------------------- DONASI ------------------------- //
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { IRealtimeData } from "@/app/lib/global_state";
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import {
|
||||
Button,
|
||||
Group,
|
||||
Modal,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Textarea,
|
||||
} from "@mantine/core";
|
||||
import { Button, Group, SimpleGrid, Stack } from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { WibuRealtime } from "wibu-pkg";
|
||||
import { Admin_ComponentModalReport } from "../../_admin_global/_component";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||
@@ -24,7 +19,8 @@ import ComponentAdminDonasi_TampilanDetailDonasi from "../component/tampilan_det
|
||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||
import { AdminDonasi_funUpdateStatusPublish } from "../fun/update/fun_status_publish";
|
||||
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
||||
import { Admin_ComponentModalReport } from "../../_admin_global/_component";
|
||||
import { donasi_checkStatus } from "@/app_modules/donasi/fun";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
||||
|
||||
export default function AdminDonasi_DetailReview({
|
||||
dataReview,
|
||||
@@ -70,35 +66,51 @@ function ButtonOnHeader({
|
||||
const [catatan, setCatatan] = useState("");
|
||||
|
||||
async function onPulish() {
|
||||
const res = await AdminDonasi_funUpdateStatusPublish(donasi.id, "1");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "DONASI",
|
||||
title: "Donasi publish",
|
||||
};
|
||||
const checkStatus = await donasi_checkStatus({ id: donasi.id });
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
if (checkStatus) {
|
||||
const res = await AdminDonasi_funUpdateStatusPublish(donasi.id, "1");
|
||||
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 publish",
|
||||
};
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "trigger",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||
setData(newData);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(
|
||||
"Berhasil Mengubah Status Donasi"
|
||||
);
|
||||
setLoadingPublish(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||
"Gagal Mengubah Status Donasi"
|
||||
);
|
||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||
setData(newData);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(
|
||||
"Berhasil Mengubah Status Donasi"
|
||||
);
|
||||
setLoadingPublish(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal Mengubah Status Donasi");
|
||||
ComponentGlobal_NotifikasiPeringatan("Status donasi telah diubah user");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,39 +120,46 @@ function ButtonOnHeader({
|
||||
"Lengkapi Alasan Penolakan"
|
||||
);
|
||||
|
||||
const res = await AdminDonasi_funUpdateStatusReject(
|
||||
donasi.id,
|
||||
"4",
|
||||
catatan
|
||||
);
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
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 checkStatus = await donasi_checkStatus({ id: donasi.id });
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
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 (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "USER",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||
setData(newData);
|
||||
close();
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoadingReject(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
|
||||
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||
setData(newData);
|
||||
close();
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoadingReject(true);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
ComponentGlobal_NotifikasiPeringatan("Status donasi telah diubah user");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { gs_adminDonasi_triggerReview } from "@/app/lib/global_state";
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { ComponentGlobal_TampilanRupiah } from "@/app_modules/_global/component";
|
||||
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
||||
import {
|
||||
Affix,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Pagination,
|
||||
Paper,
|
||||
rem,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Table,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { IconEyeCheck, IconRefresh, IconSearch } from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import adminDonasi_getListReview from "../fun/get/get_list_review";
|
||||
import { ComponentGlobal_TampilanRupiah } from "@/app_modules/_global/component";
|
||||
|
||||
export default function AdminDonasi_TableReview({
|
||||
listReview,
|
||||
@@ -46,6 +51,29 @@ function TableStatus({ listReview }: { listReview: any }) {
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
// Realtime
|
||||
const [isAdminDonasi_TriggerReview, setIsAdminDonasi_TriggerReview] = useAtom(
|
||||
gs_adminDonasi_triggerReview
|
||||
);
|
||||
const [isShowReload, setIsShowReload] = useState(false);
|
||||
const [isLoadingReload, setLoadingReload] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (isAdminDonasi_TriggerReview) {
|
||||
setIsShowReload(true);
|
||||
}
|
||||
}, [isAdminDonasi_TriggerReview, setIsShowReload]);
|
||||
|
||||
async function onLoadData() {
|
||||
const loadData = await adminDonasi_getListReview({ page: 1 });
|
||||
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
setLoadingReload(false);
|
||||
setIsShowReload(false);
|
||||
setIsAdminDonasi_TriggerReview(false);
|
||||
}
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminDonasi_getListReview({
|
||||
@@ -129,6 +157,27 @@ function TableStatus({ listReview }: { listReview: any }) {
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
{isShowReload && (
|
||||
<Affix position={{ top: rem(200) }} w={"100%"}>
|
||||
<Center>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
border: `1px solid ${AccentColor.skyblue}`,
|
||||
}}
|
||||
bg={AccentColor.blue}
|
||||
loaderPosition="center"
|
||||
loading={isLoadingReload}
|
||||
radius={"xl"}
|
||||
opacity={0.8}
|
||||
onClick={() => onLoadData()}
|
||||
leftIcon={<IconRefresh />}
|
||||
>
|
||||
Update Data
|
||||
</Button>
|
||||
</Center>
|
||||
</Affix>
|
||||
)}
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
|
||||
@@ -196,8 +196,7 @@ export function Admin_NewLayout({
|
||||
setActiveChildId(val.childId);
|
||||
}}
|
||||
onToggleNavbar={(val: any) => {
|
||||
// console.log(val, "toggle navbar");
|
||||
// setDrawerNotifikasi(val);
|
||||
setDrawerNotifikasi(val);
|
||||
}}
|
||||
onLoadCountNotif={(val: any) => {
|
||||
setCountNtf(val);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/app/lib";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function admin_funDonasiCheckStatus({ id }: { id: string }) {
|
||||
const data = await prisma.donasi.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
select: {
|
||||
DonasiMaster_Status: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!data)
|
||||
return { status: 400, message: "Id tidak ditemukan", statusName: "" };
|
||||
return {
|
||||
status: 200,
|
||||
message: "Id ditemukan",
|
||||
statusName: _.lowerCase(data.DonasiMaster_Status?.name),
|
||||
};
|
||||
}
|
||||
@@ -1,50 +1,85 @@
|
||||
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||
import { data } from "autoprefixer";
|
||||
import _ from "lodash";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { IAdmin_ActivePage, IAdmin_ActiveChildId } from "./type_of_select_page";
|
||||
import { admin_funDonasiCheckStatus } from "../fun/get/fun_donasi_check_status";
|
||||
import adminNotifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_id";
|
||||
import adminNotifikasi_countNotifikasi from "../fun/count/count_is_read";
|
||||
import adminNotifikasi_getByUserId from "../fun/get/get_notifikasi_by_user_id";
|
||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||
|
||||
export default async function adminNotifikasi_findRouterDonasi({
|
||||
data,
|
||||
appId,
|
||||
notifikasiId,
|
||||
router,
|
||||
onLoadCountNotif,
|
||||
onLoadDataNotifikasi,
|
||||
onChangeNavbar,
|
||||
onToggleNavbar,
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
appId: string;
|
||||
notifikasiId: string;
|
||||
router: AppRouterInstance;
|
||||
onChangeNavbar: (val: any) => void;
|
||||
onToggleNavbar: (val: any) => void;
|
||||
onLoadCountNotif: (val: any) => void;
|
||||
onLoadDataNotifikasi: (val: any) => void;
|
||||
onChangeNavbar: (val: {
|
||||
id: IAdmin_ActivePage;
|
||||
childId: IAdmin_ActiveChildId;
|
||||
}) => void;
|
||||
}) {
|
||||
if (data.status === "Review") {
|
||||
const path = RouterAdminDonasi.table_review;
|
||||
router.push(path);
|
||||
onChangeNavbar({
|
||||
id: 3,
|
||||
childId: 33,
|
||||
const check = await admin_funDonasiCheckStatus({ id: appId });
|
||||
|
||||
if (check.status == 200) {
|
||||
const udpateReadNotifikasi = await adminNotifikasi_funUpdateIsReadById({
|
||||
notifId: notifikasiId,
|
||||
});
|
||||
|
||||
if (udpateReadNotifikasi.status == 200) {
|
||||
const loadCountNotif = await adminNotifikasi_countNotifikasi();
|
||||
onLoadCountNotif(loadCountNotif);
|
||||
|
||||
const loadListNotifikasi = await adminNotifikasi_getByUserId({
|
||||
page: 1,
|
||||
});
|
||||
onLoadDataNotifikasi(loadListNotifikasi);
|
||||
|
||||
const path = `/dev/admin/donasi/sub-menu/${check.statusName}`;
|
||||
|
||||
if (check.statusName == "draft") {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
||||
"Status telah dirubah oleh user"
|
||||
);
|
||||
} else {
|
||||
if (check.statusName == "publish") {
|
||||
onChangeNavbar({
|
||||
id: "Donasi",
|
||||
childId: "Donasi_2",
|
||||
});
|
||||
}
|
||||
|
||||
if (check.statusName == "review") {
|
||||
onChangeNavbar({
|
||||
id: "Donasi",
|
||||
childId: "Donasi_3",
|
||||
});
|
||||
}
|
||||
|
||||
if (check.statusName == "reject") {
|
||||
onChangeNavbar({
|
||||
id: "Donasi",
|
||||
childId: "Donasi_4",
|
||||
});
|
||||
}
|
||||
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiPeringatan("Status tidak ditemukan");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
data.status === "Menunggu" ||
|
||||
data.status === "Berhasil" ||
|
||||
data.status === "Proses" ||
|
||||
data.status === "Gagal"
|
||||
) {
|
||||
const path = RouterAdminDonasi_OLD.detail_publish + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
onChangeNavbar({
|
||||
id: 3,
|
||||
childId: 32,
|
||||
});
|
||||
}
|
||||
|
||||
// if (data.status === "Draft") {
|
||||
// router.push(routeName + "review");
|
||||
// onChangeNavbar({
|
||||
// id: 6,
|
||||
// childId: 63,
|
||||
// });
|
||||
// }
|
||||
|
||||
onToggleNavbar(true);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
gs_adminDonasi_triggerReview,
|
||||
gs_adminEvent_triggerReview,
|
||||
gs_adminJob_triggerReview,
|
||||
gs_adminVoting_triggerReview,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
IAdmin_ActivePage,
|
||||
} from "./route_setting/type_of_select_page";
|
||||
import { adminNotifikasi_findRouterVoting } from "./route_setting/voting";
|
||||
import adminNotifikasi_findRouterDonasi from "./route_setting/donasi";
|
||||
|
||||
export default function AdminNotifikasi_ViewCardDrawer({
|
||||
data,
|
||||
@@ -54,6 +56,9 @@ export default function AdminNotifikasi_ViewCardDrawer({
|
||||
const [isAdminVoting_TriggerReview, setIsAdminVoting_TriggerReview] = useAtom(
|
||||
gs_adminVoting_triggerReview
|
||||
);
|
||||
const [isAdminDonasi_TriggerReview, setIsAdminDonasi_TriggerReview] = useAtom(
|
||||
gs_adminDonasi_triggerReview
|
||||
);
|
||||
|
||||
async function onRead() {
|
||||
// ========================== JOB ========================== //
|
||||
@@ -84,6 +89,7 @@ export default function AdminNotifikasi_ViewCardDrawer({
|
||||
setIsAdminJob_TriggerReview(false);
|
||||
setVisible(false);
|
||||
setDataId("");
|
||||
onToggleNavbar(false);
|
||||
}
|
||||
}
|
||||
// ========================== JOB ========================== //
|
||||
@@ -117,6 +123,7 @@ export default function AdminNotifikasi_ViewCardDrawer({
|
||||
setIsAdminEvent_TriggerReview(false);
|
||||
setVisible(false);
|
||||
setDataId("");
|
||||
onToggleNavbar(false);
|
||||
}
|
||||
}
|
||||
// ========================== EVENT ========================== //
|
||||
@@ -150,10 +157,42 @@ export default function AdminNotifikasi_ViewCardDrawer({
|
||||
setIsAdminVoting_TriggerReview(false);
|
||||
setVisible(false);
|
||||
setDataId("");
|
||||
onToggleNavbar(false);
|
||||
}
|
||||
}
|
||||
// ========================== VOTING ========================== //
|
||||
|
||||
// ========================== DONASI ========================== //
|
||||
|
||||
if (data.kategoriApp == "DONASI") {
|
||||
const checkDonasi = await adminNotifikasi_findRouterDonasi({
|
||||
appId: data.appId,
|
||||
notifikasiId: data.id,
|
||||
router: router,
|
||||
onLoadCountNotif(val) {
|
||||
onLoadCountNotif(val);
|
||||
},
|
||||
onLoadDataNotifikasi(val) {
|
||||
onLoadDataNotifikasi(val);
|
||||
},
|
||||
onChangeNavbar(val) {
|
||||
onChangeNavbar({
|
||||
id: val.id,
|
||||
childId: val.childId,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
if (checkDonasi) {
|
||||
setIsAdminDonasi_TriggerReview(false);
|
||||
setVisible(false);
|
||||
setDataId("");
|
||||
onToggleNavbar(false);
|
||||
}
|
||||
}
|
||||
|
||||
// ========================== DONASI ========================== //
|
||||
|
||||
// // FORUM
|
||||
// e?.kategoriApp === "FORUM" &&
|
||||
// adminNotifikasi_findRouterForum({
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function Validasi({
|
||||
|
||||
if (res.status === 400) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterAuth.register + dataOtp.id, { scroll: false });
|
||||
router.push("/register/" + dataOtp.id, { scroll: false });
|
||||
}
|
||||
|
||||
if (res.status === 401) {
|
||||
@@ -88,7 +88,7 @@ export default function Validasi({
|
||||
});
|
||||
if (resAktivasi.status === 200) {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
router.push(RouterAuth.login, { scroll: false });
|
||||
router.push("/login", { scroll: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export default function Validasi({
|
||||
const res = await auth_funResendCode({ nomor: nomor });
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
router.push(RouterAuth.validasi + res.kodeId, { scroll: false });
|
||||
router.push("/validasi/" + res.kodeId, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/noti
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import {
|
||||
AspectRatio,
|
||||
Button,
|
||||
@@ -92,15 +91,6 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
});
|
||||
|
||||
if (res.status === 201) {
|
||||
// const dataNotif: any = {
|
||||
// appId: res.data?.id as any,
|
||||
// status: res.data?.DonasiMaster_Status?.name as any,
|
||||
// userId: res.data?.authorId as any,
|
||||
// pesan: res.data?.title as any,
|
||||
// kategoriApp: "DONASI",
|
||||
// title: "Donasi baru",
|
||||
// };
|
||||
|
||||
const dataNotifikasi: IRealtimeData = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
@@ -115,20 +105,16 @@ export default function CreateCeritaPenggalangDonasi({
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
// mqtt_client.publish(
|
||||
// "ADMIN",
|
||||
// JSON.stringify({
|
||||
// count: 1,
|
||||
// })
|
||||
// );
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "ADMIN",
|
||||
});
|
||||
|
||||
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "trigger",
|
||||
pushNotificationTo: "ADMIN",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
setDonasiHotMenu(1);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
|
||||
@@ -84,7 +84,6 @@ export default function CreateDonasi({
|
||||
if (res.status === 201) {
|
||||
setTabsPostingDonasi("Review");
|
||||
router.push(RouterDonasi.create_cerita_penggalang + `${res.donasiId}`);
|
||||
setLoading(false);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
setLoading(false);
|
||||
|
||||
@@ -14,6 +14,8 @@ import ComponentDonasi_DetailDataGalangDana from "../../component/detail_galang_
|
||||
import ComponentDonasi_CeritaPenggalangMain from "../../component/detail_main/cerita_penggalang";
|
||||
import { Donasi_funGantiStatus } from "../../fun/update/fun_ganti_status";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import { IRealtimeData } from "@/app/lib/global_state";
|
||||
import { WibuRealtime } from "wibu-pkg";
|
||||
|
||||
export default function DetailDraftDonasi({
|
||||
dataDonasi,
|
||||
@@ -52,7 +54,8 @@ function ButtonAjukanPenggalangan({
|
||||
async function onChangeStatus() {
|
||||
const res = await Donasi_funGantiStatus(dataDonasi.id, "2");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
|
||||
const dataNotifikasi: IRealtimeData = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
@@ -62,11 +65,20 @@ function ButtonAjukanPenggalangan({
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "ADMIN",
|
||||
});
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "trigger",
|
||||
pushNotificationTo: "ADMIN",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
|
||||
|
||||
@@ -3,18 +3,19 @@
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { UIGlobal_Modal } from "@/app_modules/_global/ui";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { 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";
|
||||
import { Donasi_funGantiStatus } from "../../fun/update/fun_ganti_status";
|
||||
import { gs_donasi_tabs_posting } from "../../global_state";
|
||||
import { MODEL_DONASI } from "../../model/interface";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { UIGlobal_Modal } from "@/app_modules/_global/ui";
|
||||
import { donasi_checkStatus } from "../../fun";
|
||||
import { WibuRealtime } from "wibu-pkg";
|
||||
import { IRealtimeData } from "@/app/lib/global_state";
|
||||
|
||||
export default function DetailReviewDonasi({
|
||||
dataDonasi,
|
||||
@@ -39,30 +40,53 @@ function ButtonBatalReview({ donasi }: { donasi: MODEL_DONASI }) {
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
|
||||
async function onChangeStatus() {
|
||||
const res = await Donasi_funGantiStatus(donasi.id, "3");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "DONASI",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
const check = await donasi_checkStatus({ id: donasi.id });
|
||||
if (check) {
|
||||
const res = await Donasi_funGantiStatus(donasi.id, "3");
|
||||
if (res.status === 200) {
|
||||
// const dataNotif = {
|
||||
// appId: res.data?.id as any,
|
||||
// status: res.data?.DonasiMaster_Status?.name as any,
|
||||
// userId: res.data?.authorId as any,
|
||||
// pesan: res.data?.title as any,
|
||||
// kategoriApp: "DONASI",
|
||||
// title: "Membatalkan review",
|
||||
// };
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
const dataNotifikasi: IRealtimeData = {
|
||||
appId: res.data?.id as any,
|
||||
status: res.data?.DonasiMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "DONASI",
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotifikasi as any,
|
||||
});
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan");
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
if (notif.status === 201) {
|
||||
WibuRealtime.setData({
|
||||
type: "notification",
|
||||
pushNotificationTo: "ADMIN",
|
||||
});
|
||||
|
||||
WibuRealtime.setData({
|
||||
type: "trigger",
|
||||
pushNotificationTo: "ADMIN",
|
||||
dataMessage: dataNotifikasi,
|
||||
});
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan");
|
||||
setLoading(true);
|
||||
router.push(RouterDonasi.status_galang_dana({ id: "3" }));
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
ComponentGlobal_NotifikasiPeringatan("Donasi telah direview admin");
|
||||
}
|
||||
}
|
||||
return (
|
||||
|
||||
17
src/app_modules/donasi/fun/get/fun_check_status.tsx
Normal file
17
src/app_modules/donasi/fun/get/fun_check_status.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/app/lib";
|
||||
|
||||
export async function donasi_checkStatus({ id }: { id: string }) {
|
||||
const checkStatus = await prisma.donasi.findFirst({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(checkStatus?.donasiMaster_StatusDonasiId, "ini status nya")
|
||||
|
||||
if (checkStatus?.donasiMaster_StatusDonasiId == "2") return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@ import { Donasi_getMasterKategori } from "./master/get_ketegori";
|
||||
import { Donasi_getMasterDurasi } from "./master/get_durasi";
|
||||
import { donasi_funUpdateKabar } from "./update/fun_update_kabar";
|
||||
import { donasi_funGetAllStatusById } from "./get/status/get_all_by_status_id";
|
||||
import { donasi_checkStatus } from "./get/fun_check_status";
|
||||
|
||||
export { Donasi_getMasterKategori, Donasi_getMasterDurasi };
|
||||
export { donasi_funUpdateKabar };
|
||||
export { donasi_funGetAllStatusById };
|
||||
export { donasi_checkStatus };
|
||||
|
||||
@@ -4,13 +4,17 @@ import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import { Affix, Box, Button, Center, rem } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import ComponentDonasi_CardPublish from "../component/card_view/card_publish";
|
||||
import { donasi_funGetAllPublish } from "../fun/get/get_list_beranda";
|
||||
import { MODEL_DONASI } from "../model/interface";
|
||||
import { gs_donasiTriggerBeranda } from "@/app/lib/global_state";
|
||||
import { useAtom } from "jotai";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
|
||||
export default function MainDonasi({
|
||||
listDonasi,
|
||||
@@ -20,9 +24,59 @@ export default function MainDonasi({
|
||||
const [data, setData] = useState(listDonasi);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
// Realtime
|
||||
const [isTriggerDonasiBeranda, setIsTriggerDonasiBeranda] = useAtom(
|
||||
gs_donasiTriggerBeranda
|
||||
);
|
||||
const [isShowUpdate, setIsShowUpdate] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (isTriggerDonasiBeranda) {
|
||||
setIsShowUpdate(true);
|
||||
}
|
||||
}, [isTriggerDonasiBeranda, setIsShowUpdate]);
|
||||
|
||||
async function onLoadData({ onPublish }: { onPublish: (val: any) => void }) {
|
||||
setIsLoading(true);
|
||||
const loadData = await donasi_funGetAllPublish({ page: 1 });
|
||||
onPublish(loadData);
|
||||
|
||||
setIsShowUpdate(false);
|
||||
setIsTriggerDonasiBeranda(false);
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
{isShowUpdate && (
|
||||
<Affix position={{ top: rem(100) }} w={"100%"}>
|
||||
<Center>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
border: `1px solid ${AccentColor.skyblue}`,
|
||||
}}
|
||||
bg={AccentColor.blue}
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
radius={"xl"}
|
||||
opacity={0.8}
|
||||
onClick={() => {
|
||||
onLoadData({
|
||||
onPublish(val) {
|
||||
setData(val);
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
Update beranda
|
||||
</Button>
|
||||
</Center>
|
||||
</Affix>
|
||||
)}
|
||||
|
||||
<ComponentGlobal_CreateButton path={RouterDonasi.create_donasi} />
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
|
||||
@@ -18,6 +18,8 @@ import { notifikasi_eventCheckStatus } from "./path/event";
|
||||
import { notifikasi_jobCheckStatus } from "./path/job";
|
||||
import { gs_vote_hotMenu } from "@/app_modules/vote/global_state";
|
||||
import { notifikasi_votingCheckStatus } from "./path/voting";
|
||||
import { redirectDonasiPage } from "./path/donasi";
|
||||
import { gs_donasi_hot_menu } from "@/app_modules/donasi/global_state";
|
||||
|
||||
export function ComponentNotifiaksi_CardView({
|
||||
data,
|
||||
@@ -35,6 +37,7 @@ export function ComponentNotifiaksi_CardView({
|
||||
const [jobMenuId, setJobMenuId] = useAtom(gs_job_hot_menu);
|
||||
const [eventMenuId, setEventMenuId] = useAtom(gs_event_hotMenu);
|
||||
const [votingMenu, setVotingMenu] = useAtom(gs_vote_hotMenu);
|
||||
const [donasiMenu, setDonasiMenu] = useAtom(gs_donasi_hot_menu);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -107,7 +110,7 @@ export function ComponentNotifiaksi_CardView({
|
||||
onSetVisible(val) {
|
||||
setVisible(val);
|
||||
},
|
||||
onSetEventMenuId(val) {
|
||||
onSetMenuId(val) {
|
||||
setVotingMenu(val);
|
||||
},
|
||||
onLoadCountNtf(val) {
|
||||
@@ -116,6 +119,27 @@ export function ComponentNotifiaksi_CardView({
|
||||
});
|
||||
}
|
||||
|
||||
if (data?.kategoriApp === "DONASI") {
|
||||
redirectDonasiPage({
|
||||
appId: data.appId,
|
||||
dataId: data.id,
|
||||
categoryPage: categoryPage,
|
||||
router: router,
|
||||
onLoadDataEvent(val) {
|
||||
onLoadData(val);
|
||||
},
|
||||
onSetVisible(val) {
|
||||
setVisible(val);
|
||||
},
|
||||
onSetMenuId(val) {
|
||||
setDonasiMenu(val);
|
||||
},
|
||||
onLoadCountNtf(val) {
|
||||
setLoadCountNtf(val);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// data?.kategoriApp === "FORUM" &&
|
||||
// redirectDetailForumPage({
|
||||
// data: data,
|
||||
@@ -146,15 +170,6 @@ export function ComponentNotifiaksi_CardView({
|
||||
// router: router,
|
||||
// });
|
||||
|
||||
// data.kategoriApp === "DONASI" &&
|
||||
// redirectDonasiPage({
|
||||
// data: data,
|
||||
// router: router,
|
||||
// onSetPage(val) {
|
||||
// // onSetMenu(val);
|
||||
// },
|
||||
// });
|
||||
|
||||
// data.kategoriApp === "INVESTASI" &&
|
||||
// redirectInvestasiPage({
|
||||
// data: data,
|
||||
|
||||
@@ -2,57 +2,55 @@ import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { MODEL_NOTIFIKASI } from "../../model/interface";
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { notifikasi_funDonasiCheckStatus } from "../../fun/check/fun_check_donasi_status";
|
||||
import notifikasi_getByUserId from "../../fun/get/get_notifiaksi_by_id";
|
||||
import notifikasi_countUserNotifikasi from "../../fun/count/fun_count_by_id";
|
||||
import notifikasi_funUpdateIsReadById from "../../fun/update/fun_update_is_read_by_user_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
||||
|
||||
export function redirectDonasiPage({
|
||||
data,
|
||||
export async function redirectDonasiPage({
|
||||
appId,
|
||||
dataId,
|
||||
categoryPage,
|
||||
router,
|
||||
onSetPage,
|
||||
onLoadDataEvent,
|
||||
onSetMenuId,
|
||||
onSetVisible,
|
||||
onLoadCountNtf,
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
appId: string;
|
||||
dataId: string;
|
||||
categoryPage: string;
|
||||
router: AppRouterInstance;
|
||||
onSetPage: (val: any) => void;
|
||||
onLoadDataEvent: (val: any) => void;
|
||||
onSetMenuId(val: number): void;
|
||||
onSetVisible(val: boolean): void;
|
||||
onLoadCountNtf(val: number): void;
|
||||
}) {
|
||||
const path = RouterDonasi.status_galang_dana({ id: "" });
|
||||
const check = await notifikasi_funDonasiCheckStatus({ id: appId });
|
||||
|
||||
if (data.status === "Publish") {
|
||||
onSetPage({
|
||||
menuId: 1,
|
||||
status: data.status,
|
||||
if (check.status == 200) {
|
||||
const loadListNotifikasi = await notifikasi_getByUserId({
|
||||
page: 1,
|
||||
kategoriApp: categoryPage as any,
|
||||
});
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
onLoadDataEvent(loadListNotifikasi);
|
||||
|
||||
if (data.status === "Reject") {
|
||||
onSetPage({
|
||||
menuId: 1,
|
||||
status: data.status,
|
||||
const loadCountNotifikasi = await notifikasi_countUserNotifikasi();
|
||||
onLoadCountNtf(loadCountNotifikasi);
|
||||
|
||||
const updateReadNotifikasi = await notifikasi_funUpdateIsReadById({
|
||||
notifId: dataId,
|
||||
});
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Berhasil") {
|
||||
const pathInvoice = RouterDonasi.detail_donasi_saya + data.appId;
|
||||
onSetPage({
|
||||
menuId: 2,
|
||||
});
|
||||
router.push(pathInvoice, { scroll: false });
|
||||
}
|
||||
if (updateReadNotifikasi.status == 200) {
|
||||
onSetVisible(true);
|
||||
|
||||
if (data.status === "Donatur Baru") {
|
||||
const pathDetail = RouterDonasi.detail_publish + data.appId;
|
||||
onSetPage({
|
||||
menuId: 2,
|
||||
});
|
||||
router.push(pathDetail, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Kabar Donasi") {
|
||||
const pathKabar = RouterDonasi.detail_kabar + data.appId;
|
||||
router.push(pathKabar, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Pencairan Dana") {
|
||||
const pathPencairan = RouterDonasi.pencairan_dana + data.appId;
|
||||
router.push(pathPencairan, { scroll: false });
|
||||
const path = `/dev/donasi/detail/${check.statusName}/${appId}`;
|
||||
onSetMenuId(1);
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan("Status tidak ditemukan");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function notifikasi_votingCheckStatus({
|
||||
categoryPage,
|
||||
router,
|
||||
onLoadDataEvent,
|
||||
onSetEventMenuId,
|
||||
onSetMenuId,
|
||||
onSetVisible,
|
||||
onLoadCountNtf,
|
||||
}: {
|
||||
@@ -22,7 +22,7 @@ export async function notifikasi_votingCheckStatus({
|
||||
categoryPage: string;
|
||||
router: AppRouterInstance;
|
||||
onLoadDataEvent: (val: any) => void;
|
||||
onSetEventMenuId(val: number): void;
|
||||
onSetMenuId(val: number): void;
|
||||
onSetVisible(val: boolean): void;
|
||||
onLoadCountNtf(val: number): void;
|
||||
}) {
|
||||
@@ -46,7 +46,7 @@ export async function notifikasi_votingCheckStatus({
|
||||
onSetVisible(true);
|
||||
|
||||
const path = `/dev/vote/detail/${check.statusName}/${appId}`;
|
||||
onSetEventMenuId(1);
|
||||
onSetMenuId(1);
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/app/lib";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function notifikasi_funDonasiCheckStatus({ id }: { id: string }) {
|
||||
const data = await prisma.donasi.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
select: {
|
||||
DonasiMaster_Status: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!data)
|
||||
return { status: 400, message: "Job tidak ditemukan", statusName: "" };
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil di cek",
|
||||
statusName: _.lowerCase(data.DonasiMaster_Status?.name),
|
||||
};
|
||||
}
|
||||
@@ -83,7 +83,7 @@ function ButtonAction({
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan("Voting telah di terima admin");
|
||||
ComponentGlobal_NotifikasiPeringatan("Voting telah direview admin");
|
||||
}
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { ActionIcon, Box, Button, Stack, Title } from "@mantine/core";
|
||||
import { Box, Button, Stack } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
|
||||
import { IconPencilPlus } from "@tabler/icons-react";
|
||||
import _, { random } from "lodash";
|
||||
import UIGlobal_LayoutTamplate from "../_global/ui/ui_layout_tamplate";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { WibuRealtime } from "wibu";
|
||||
import { v4 } from "uuid";
|
||||
import { UIGlobal_LayoutHeaderTamplate } from "../_global/ui";
|
||||
|
||||
const newData = Array(20)
|
||||
.fill(0)
|
||||
|
||||
Reference in New Issue
Block a user