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