Fix: Donasi
Deskripsi: - Fix notitikasi user to admin - Fix notifikasi admin to user
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user