fix notifikasi admin
This commit is contained in:
46
src/app/api/admin/notifikasi/count/route.tsx
Normal file
46
src/app/api/admin/notifikasi/count/route.tsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import { prisma } from "@/lib";
|
||||||
|
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Method not allowed" },
|
||||||
|
{ status: 405 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { searchParams } = new URL(request.url);
|
||||||
|
const userId = searchParams.get("id");
|
||||||
|
|
||||||
|
const data = await prisma.notifikasi.count({
|
||||||
|
where: {
|
||||||
|
adminId: userId,
|
||||||
|
userRoleId: "2",
|
||||||
|
isRead: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: true,
|
||||||
|
message: "Data fetched successfully",
|
||||||
|
data: data,
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error get count notifikasi", error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false,
|
||||||
|
message: "Failed to get count notifikasi",
|
||||||
|
data: null,
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
Center,
|
Center,
|
||||||
Divider,
|
Divider,
|
||||||
Group,
|
Group,
|
||||||
|
Indicator,
|
||||||
MediaQuery,
|
MediaQuery,
|
||||||
Popover,
|
Popover,
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
@@ -38,6 +39,7 @@ export function Admin_V3_ComponentButtonUserCircle({
|
|||||||
setOpenPop,
|
setOpenPop,
|
||||||
setNavbarOpen,
|
setNavbarOpen,
|
||||||
setDrawerNotifikasi,
|
setDrawerNotifikasi,
|
||||||
|
countNotifikasi,
|
||||||
}: {
|
}: {
|
||||||
dataUser: MODEL_USER | null;
|
dataUser: MODEL_USER | null;
|
||||||
openPop: boolean;
|
openPop: boolean;
|
||||||
@@ -47,6 +49,7 @@ export function Admin_V3_ComponentButtonUserCircle({
|
|||||||
// setNavbarOpen: (open: boolean) => void;
|
// setNavbarOpen: (open: boolean) => void;
|
||||||
setDrawerNotifikasi: React.Dispatch<React.SetStateAction<boolean>>;
|
setDrawerNotifikasi: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
// setDrawerNotifikasi: (open: boolean) => void;
|
// setDrawerNotifikasi: (open: boolean) => void;
|
||||||
|
countNotifikasi: number;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -82,11 +85,11 @@ export function Admin_V3_ComponentButtonUserCircle({
|
|||||||
label: "Notifikasi",
|
label: "Notifikasi",
|
||||||
color: "",
|
color: "",
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
// ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
"Notifikasi: Masih dalam pengembangan",
|
// "Notifikasi: Masih dalam pengembangan",
|
||||||
2000
|
// 2000
|
||||||
);
|
// );
|
||||||
// setDrawerNotifikasi(true);
|
setDrawerNotifikasi(true);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -109,11 +112,11 @@ export function Admin_V3_ComponentButtonUserCircle({
|
|||||||
label: "Notifikasi",
|
label: "Notifikasi",
|
||||||
color: "",
|
color: "",
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
ComponentAdminGlobal_NotifikasiPeringatan(
|
// ComponentAdminGlobal_NotifikasiPeringatan(
|
||||||
"Notifikasi: Masih dalam pengembangan",
|
// "Notifikasi: Masih dalam pengembangan",
|
||||||
2000
|
// 2000
|
||||||
);
|
// );
|
||||||
// setDrawerNotifikasi(true);
|
setDrawerNotifikasi(true);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -233,7 +236,23 @@ export function Admin_V3_ComponentButtonUserCircle({
|
|||||||
key={i}
|
key={i}
|
||||||
>
|
>
|
||||||
<Group onClick={e.onClick}>
|
<Group onClick={e.onClick}>
|
||||||
<e.icon size={18} color={e.color || "white"} />
|
{e.label == "Notifikasi" ? (
|
||||||
|
countNotifikasi == 0 ||
|
||||||
|
dataUser?.masterUserRoleId == "3" ? (
|
||||||
|
<IconBell color="white" />
|
||||||
|
) : (
|
||||||
|
<Indicator
|
||||||
|
|
||||||
|
color="yellow"
|
||||||
|
processing
|
||||||
|
label={<Text c="black" fz={10}>{countNotifikasi}</Text>}
|
||||||
|
>
|
||||||
|
<IconBell color="white" />
|
||||||
|
</Indicator>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<e.icon size={18} color={e.color || "white"} />
|
||||||
|
)}
|
||||||
<Text c={e.color || "white"} lineClamp={1}>
|
<Text c={e.color || "white"} lineClamp={1}>
|
||||||
{e.label}
|
{e.label}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -257,7 +276,22 @@ export function Admin_V3_ComponentButtonUserCircle({
|
|||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<e.icon size={18} color={e.color || "white"} />
|
{e.label == "Notifikasi" ? (
|
||||||
|
countNotifikasi == 0 ||
|
||||||
|
dataUser?.masterUserRoleId == "3" ? (
|
||||||
|
<IconBell size={18} color={e.color || "white"} />
|
||||||
|
) : (
|
||||||
|
<Indicator
|
||||||
|
color="yellow"
|
||||||
|
processing
|
||||||
|
label={<Text c="black" fz={10}>{countNotifikasi}</Text>}
|
||||||
|
>
|
||||||
|
<IconBell size={18} color={e.color || "white"} />
|
||||||
|
</Indicator>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<e.icon size={18} color={e.color || "white"} />
|
||||||
|
)}
|
||||||
<Text c={e.color || "white"} lineClamp={1}>
|
<Text c={e.color || "white"} lineClamp={1}>
|
||||||
{e.label}
|
{e.label}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import {
|
|||||||
import { Admin_V3_ComponentButtonUserCircle } from "./comp_button_user_circle";
|
import { Admin_V3_ComponentButtonUserCircle } from "./comp_button_user_circle";
|
||||||
import { Admin_V3_SkeletonNavbar } from "./skeleton_navbar";
|
import { Admin_V3_SkeletonNavbar } from "./skeleton_navbar";
|
||||||
import { Admin_V3_ViewDrawerNotifikasi } from "./notifikasi/view_drawer_notifikasi";
|
import { Admin_V3_ViewDrawerNotifikasi } from "./notifikasi/view_drawer_notifikasi";
|
||||||
|
import { apiGetCountNotifikasiByUserId } from "../notifikasi/lib/api_fetch_notifikasi";
|
||||||
|
|
||||||
export function Admin_V3_MainLayout({
|
export function Admin_V3_MainLayout({
|
||||||
children,
|
children,
|
||||||
@@ -60,6 +61,10 @@ export function Admin_V3_MainLayout({
|
|||||||
// Notifikasi
|
// Notifikasi
|
||||||
const [countNtf, setCountNtf] = useState(countNotifikasi);
|
const [countNtf, setCountNtf] = useState(countNotifikasi);
|
||||||
const [newAdminNtf, setNewAdminNtf] = useAtom(gs_admin_ntf);
|
const [newAdminNtf, setNewAdminNtf] = useAtom(gs_admin_ntf);
|
||||||
|
const [reloadNtf, setReloadNtf] = useState(false);
|
||||||
|
const [openPop, setOpenPop] = useState(false);
|
||||||
|
const [opened, handlers] = useDisclosure(false);
|
||||||
|
const [openedDrawer, handlersDrawer] = useDisclosure(false);
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
handleLoadUser();
|
handleLoadUser();
|
||||||
@@ -79,9 +84,33 @@ export function Admin_V3_MainLayout({
|
|||||||
setDataUser(null);
|
setDataUser(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const [openPop, setOpenPop] = useState(false);
|
|
||||||
const [opened, handlers] = useDisclosure(false);
|
useShallowEffect(() => {
|
||||||
const [openedDrawer, handlersDrawer] = useDisclosure(false);
|
setCountNtf((e) => e + newAdminNtf);
|
||||||
|
setNewAdminNtf(0);
|
||||||
|
}, [newAdminNtf, setNewAdminNtf]);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
handleLoadCountNotifikasi();
|
||||||
|
}, [reloadNtf]);
|
||||||
|
|
||||||
|
async function handleLoadCountNotifikasi() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetCountNotifikasiByUserId({ id: userLoginId });
|
||||||
|
if (response && response.success) {
|
||||||
|
setCountNtf(response.data);
|
||||||
|
setReloadNtf(false);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to fetch count notifikasi", response);
|
||||||
|
setCountNtf(0);
|
||||||
|
setReloadNtf(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching count notifikasi", error);
|
||||||
|
setCountNtf(0);
|
||||||
|
setReloadNtf(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -155,6 +184,7 @@ export function Admin_V3_MainLayout({
|
|||||||
setOpenPop={setOpenPop}
|
setOpenPop={setOpenPop}
|
||||||
setNavbarOpen={handlers.close}
|
setNavbarOpen={handlers.close}
|
||||||
setDrawerNotifikasi={handlersDrawer.toggle}
|
setDrawerNotifikasi={handlersDrawer.toggle}
|
||||||
|
countNotifikasi={countNtf}
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
</Header>
|
</Header>
|
||||||
@@ -203,6 +233,9 @@ export function Admin_V3_MainLayout({
|
|||||||
onToggleNavbar={(val: any) => {
|
onToggleNavbar={(val: any) => {
|
||||||
val === false && handlersDrawer.close();
|
val === false && handlersDrawer.close();
|
||||||
}}
|
}}
|
||||||
|
onLoadCountNotif={(val: boolean) => {
|
||||||
|
setReloadNtf(val);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/* <ComponentAdmin_UIDrawerNotifikasi
|
{/* <ComponentAdmin_UIDrawerNotifikasi
|
||||||
newAdminNtf={newAdminNtf}
|
newAdminNtf={newAdminNtf}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import {
|
|||||||
gs_adminDonasi_triggerReview,
|
gs_adminDonasi_triggerReview,
|
||||||
gs_adminEvent_triggerReview,
|
gs_adminEvent_triggerReview,
|
||||||
gs_adminJob_triggerReview,
|
gs_adminJob_triggerReview,
|
||||||
gs_adminVoting_triggerReview
|
gs_adminVoting_triggerReview,
|
||||||
|
ITypeStatusNotifikasi,
|
||||||
} from "@/lib/global_state";
|
} from "@/lib/global_state";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
||||||
@@ -16,19 +17,23 @@ import "moment/locale/id";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
|
import adminNotifikasi_findRouterDonasi from "../../notifikasi/route_setting/donasi";
|
||||||
|
import { adminNotifikasi_findRouterEvent } from "../../notifikasi/route_setting/event";
|
||||||
import adminNotifikasi_findRouterForum from "../../notifikasi/route_setting/forum";
|
import adminNotifikasi_findRouterForum from "../../notifikasi/route_setting/forum";
|
||||||
|
import adminNotifikasi_findRouterInvestasi from "../../notifikasi/route_setting/investasi";
|
||||||
import { adminNotifikasi_findRouterJob } from "../../notifikasi/route_setting/job";
|
import { adminNotifikasi_findRouterJob } from "../../notifikasi/route_setting/job";
|
||||||
import {
|
import {
|
||||||
IAdmin_ActiveChildId,
|
IAdmin_ActiveChildId,
|
||||||
IAdmin_ActivePage,
|
IAdmin_ActivePage,
|
||||||
} from "../../notifikasi/route_setting/type_of_select_page";
|
} from "../../notifikasi/route_setting/type_of_select_page";
|
||||||
|
import { adminNotifikasi_findRouterVoting } from "../../notifikasi/route_setting/voting";
|
||||||
|
|
||||||
export default function Admin_V3_ComponentCardNotifikasi({
|
export default function Admin_V3_ComponentCardNotifikasi({
|
||||||
data,
|
data,
|
||||||
activePage,
|
activePage,
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
onToggleNavbar,
|
onToggleNavbar,
|
||||||
// onLoadCountNotif,
|
onLoadCountNotif,
|
||||||
// onLoadDataNotifikasi,
|
// onLoadDataNotifikasi,
|
||||||
}: {
|
}: {
|
||||||
data: MODEL_NOTIFIKASI;
|
data: MODEL_NOTIFIKASI;
|
||||||
@@ -38,7 +43,7 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
childId: IAdmin_ActiveChildId;
|
childId: IAdmin_ActiveChildId;
|
||||||
}) => void;
|
}) => void;
|
||||||
onToggleNavbar: (val: any) => void;
|
onToggleNavbar: (val: any) => void;
|
||||||
// onLoadCountNotif: (val: any) => void;
|
onLoadCountNotif: (val: boolean) => void;
|
||||||
// onLoadDataNotifikasi: (val: any) => void;
|
// onLoadDataNotifikasi: (val: any) => void;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -84,6 +89,7 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
setVisible(false);
|
setVisible(false);
|
||||||
setDataId("");
|
setDataId("");
|
||||||
onToggleNavbar(false);
|
onToggleNavbar(false);
|
||||||
|
onLoadCountNotif(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -108,6 +114,7 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
setDataId("");
|
setDataId("");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
onToggleNavbar(false);
|
onToggleNavbar(false);
|
||||||
|
onLoadCountNotif(true);
|
||||||
} else {
|
} else {
|
||||||
ComponentAdminGlobal_NotifikasiPeringatan("Gagal memuat forum");
|
ComponentAdminGlobal_NotifikasiPeringatan("Gagal memuat forum");
|
||||||
}
|
}
|
||||||
@@ -116,143 +123,121 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
|
|
||||||
// ========================== EVENT ========================== //
|
// ========================== EVENT ========================== //
|
||||||
|
|
||||||
// if (data.kategoriApp == "EVENT") {
|
if (data.kategoriApp == "EVENT") {
|
||||||
// setDataId(data.id);
|
setDataId(data.id);
|
||||||
|
|
||||||
// const checkEvent = await adminNotifikasi_findRouterEvent({
|
const checkEvent = await adminNotifikasi_findRouterEvent({
|
||||||
// appId: data.appId,
|
appId: data.appId,
|
||||||
// notifikasiId: data.id,
|
notifikasiId: data.id,
|
||||||
// router: router,
|
router: router,
|
||||||
// activePage: activePage,
|
onChangeNavbar(val) {
|
||||||
// onLoadCountNotif(val) {
|
onChangeNavbar({
|
||||||
// onLoadCountNotif(val);
|
id: val.id,
|
||||||
// },
|
childId: val.childId,
|
||||||
// onLoadDataNotifikasi(val) {
|
});
|
||||||
// onLoadDataNotifikasi(val);
|
},
|
||||||
// },
|
});
|
||||||
// onChangeNavbar(val) {
|
|
||||||
// onChangeNavbar({
|
|
||||||
// id: val.id,
|
|
||||||
// childId: val.childId,
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (checkEvent) {
|
if (checkEvent) {
|
||||||
// setIsAdminEvent_TriggerReview(false);
|
setIsAdminEvent_TriggerReview(false);
|
||||||
// setVisible(false);
|
setVisible(false);
|
||||||
// setDataId("");
|
setDataId("");
|
||||||
// onToggleNavbar(false);
|
onToggleNavbar(false);
|
||||||
// }
|
onLoadCountNotif(true);
|
||||||
|
}
|
||||||
|
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// ========================== EVENT ========================== //
|
// ========================== EVENT ========================== //
|
||||||
|
|
||||||
// ========================== VOTING ========================== //
|
// ========================== VOTING ========================== //
|
||||||
|
|
||||||
// if (data.kategoriApp == "VOTING") {
|
if (data.kategoriApp == "VOTING") {
|
||||||
// setDataId(data.id);
|
setDataId(data.id);
|
||||||
|
|
||||||
// const checkVoting = await adminNotifikasi_findRouterVoting({
|
const checkVoting = await adminNotifikasi_findRouterVoting({
|
||||||
// router: router,
|
router: router,
|
||||||
// appId: data.appId,
|
appId: data.appId,
|
||||||
// notifikasiId: data.id,
|
notifikasiId: data.id,
|
||||||
// activePage: activePage,
|
onChangeNavbar(val) {
|
||||||
// onLoadCountNotif(val) {
|
onChangeNavbar({
|
||||||
// onLoadCountNotif(val);
|
id: val.id,
|
||||||
// },
|
childId: val.childId,
|
||||||
// onLoadDataNotifikasi(val) {
|
});
|
||||||
// onLoadDataNotifikasi(val);
|
},
|
||||||
// },
|
});
|
||||||
// onChangeNavbar(val) {
|
|
||||||
// onChangeNavbar({
|
|
||||||
// id: val.id,
|
|
||||||
// childId: val.childId,
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (checkVoting) {
|
if (checkVoting) {
|
||||||
// setIsAdminVoting_TriggerReview(false);
|
setIsAdminVoting_TriggerReview(false);
|
||||||
// setVisible(false);
|
setVisible(false);
|
||||||
// setDataId("");
|
setDataId("");
|
||||||
// onToggleNavbar(false);
|
onToggleNavbar(false);
|
||||||
// }
|
onLoadCountNotif(true);
|
||||||
|
}
|
||||||
|
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// ========================== VOTING ========================== //
|
// ========================== VOTING ========================== //
|
||||||
|
|
||||||
// ========================== DONASI ========================== //
|
// ========================== DONASI ========================== //
|
||||||
|
|
||||||
// if (data.kategoriApp == "DONASI") {
|
if (data.kategoriApp == "DONASI") {
|
||||||
// setDataId(data.id);
|
setDataId(data.id);
|
||||||
|
|
||||||
// const checkDonasi = await adminNotifikasi_findRouterDonasi({
|
const checkDonasi = await adminNotifikasi_findRouterDonasi({
|
||||||
// appId: data.appId,
|
appId: data.appId,
|
||||||
// notifikasiId: data.id,
|
notifikasiId: data.id,
|
||||||
// router: router,
|
router: router,
|
||||||
// status: data.status as ITypeStatusNotifikasi,
|
status: data.status as ITypeStatusNotifikasi,
|
||||||
// onLoadCountNotif(val) {
|
onChangeNavbar(val) {
|
||||||
// onLoadCountNotif(val);
|
onChangeNavbar({
|
||||||
// },
|
id: val.id,
|
||||||
// onLoadDataNotifikasi(val) {
|
childId: val.childId,
|
||||||
// onLoadDataNotifikasi(val);
|
});
|
||||||
// },
|
},
|
||||||
// onChangeNavbar(val) {
|
});
|
||||||
// onChangeNavbar({
|
|
||||||
// id: val.id,
|
|
||||||
// childId: val.childId,
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (checkDonasi) {
|
if (checkDonasi) {
|
||||||
// setIsAdminDonasi_TriggerReview(false);
|
setIsAdminDonasi_TriggerReview(false);
|
||||||
// setVisible(false);
|
setVisible(false);
|
||||||
// setDataId("");
|
setDataId("");
|
||||||
// onToggleNavbar(false);
|
onToggleNavbar(false);
|
||||||
// }
|
onLoadCountNotif(true);
|
||||||
|
}
|
||||||
|
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ========================== DONASI ========================== //
|
// ========================== DONASI ========================== //
|
||||||
|
|
||||||
// ========================== INVESTASI ========================== //
|
// ========================== INVESTASI ========================== //
|
||||||
|
|
||||||
// if (data.kategoriApp == "INVESTASI") {
|
if (data.kategoriApp == "INVESTASI") {
|
||||||
// setDataId(data.id);
|
setDataId(data.id);
|
||||||
|
|
||||||
// const checkInvestasi = await adminNotifikasi_findRouterInvestasi({
|
const checkInvestasi = await adminNotifikasi_findRouterInvestasi({
|
||||||
// appId: data.appId,
|
appId: data.appId,
|
||||||
// notifikasiId: data.id,
|
notifikasiId: data.id,
|
||||||
// status: data.status as ITypeStatusNotifikasi,
|
status: data.status as ITypeStatusNotifikasi,
|
||||||
// router: router,
|
router: router,
|
||||||
// onLoadCountNotif(val) {
|
onChangeNavbar(val) {
|
||||||
// onLoadCountNotif(val);
|
onChangeNavbar({
|
||||||
// },
|
id: val.id,
|
||||||
// onLoadDataNotifikasi(val) {
|
childId: val.childId,
|
||||||
// onLoadDataNotifikasi(val);
|
});
|
||||||
// },
|
},
|
||||||
// onChangeNavbar(val) {
|
});
|
||||||
// onChangeNavbar({
|
|
||||||
// id: val.id,
|
|
||||||
// childId: val.childId,
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (checkInvestasi) {
|
if (checkInvestasi) {
|
||||||
// setIsAdminDonasi_TriggerReview(false);
|
setIsAdminDonasi_TriggerReview(false);
|
||||||
// setVisible(false);
|
setVisible(false);
|
||||||
// setDataId("");
|
setDataId("");
|
||||||
// onToggleNavbar(false);
|
onToggleNavbar(false);
|
||||||
// }
|
onLoadCountNotif(true);
|
||||||
|
}
|
||||||
|
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ========================== INVESTASI ========================== //
|
// ========================== INVESTASI ========================== //
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -311,7 +296,7 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
</Card.Section>
|
</Card.Section>
|
||||||
<Card.Section px={"sm"} pb={"sm"}>
|
<Card.Section px={"sm"} pb={"sm"}>
|
||||||
<Stack spacing={0}>
|
<Stack spacing={0}>
|
||||||
<Text lineClamp={2} fw={"bold"} fz={"xs"}>
|
<Text lineClamp={2} fw={"bold"}>
|
||||||
{data.title}
|
{data.title}
|
||||||
</Text>
|
</Text>
|
||||||
{/* <Text lineClamp={2} fz={"xs"}>
|
{/* <Text lineClamp={2} fz={"xs"}>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export function Admin_V3_ViewDrawerNotifikasi({
|
|||||||
openedDrawer,
|
openedDrawer,
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
onToggleNavbar,
|
onToggleNavbar,
|
||||||
|
onLoadCountNotif,
|
||||||
}: {
|
}: {
|
||||||
userLoginId: string;
|
userLoginId: string;
|
||||||
openedDrawer: boolean;
|
openedDrawer: boolean;
|
||||||
@@ -39,6 +40,7 @@ export function Admin_V3_ViewDrawerNotifikasi({
|
|||||||
childId: IAdmin_ActiveChildId;
|
childId: IAdmin_ActiveChildId;
|
||||||
}) => void;
|
}) => void;
|
||||||
onToggleNavbar: (val: any) => void;
|
onToggleNavbar: (val: any) => void;
|
||||||
|
onLoadCountNotif: (val: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
// newAdminNtf,
|
// newAdminNtf,
|
||||||
// listNotifikasi,
|
// listNotifikasi,
|
||||||
@@ -171,14 +173,14 @@ export function Admin_V3_ViewDrawerNotifikasi({
|
|||||||
>
|
>
|
||||||
Tandai baca semua
|
Tandai baca semua
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{/* <Button
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleUpdateUnRead();
|
handleUpdateUnRead();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Tandai belum baca
|
Tandai belum baca
|
||||||
</Button>
|
</Button> */}
|
||||||
</Group>
|
</Group>
|
||||||
<Divider color={MainColor.white}/>
|
<Divider color={MainColor.white}/>
|
||||||
|
|
||||||
@@ -206,7 +208,9 @@ export function Admin_V3_ViewDrawerNotifikasi({
|
|||||||
activePage={activePage}
|
activePage={activePage}
|
||||||
onChangeNavbar={(val) => onChangeNavbar(val)}
|
onChangeNavbar={(val) => onChangeNavbar(val)}
|
||||||
onToggleNavbar={(val) => onToggleNavbar(val)}
|
onToggleNavbar={(val) => onToggleNavbar(val)}
|
||||||
// onLoadCountNotif={(val) => onLoadCountNotif(val)}
|
onLoadCountNotif={(val) => {
|
||||||
|
onLoadCountNotif(val)
|
||||||
|
}}
|
||||||
// onLoadDataNotifikasi={(val) => setData(val)}
|
// onLoadDataNotifikasi={(val) => setData(val)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
export { apiGetNotifikasiByUserId, apiPostIsReadNotifikasi };
|
export {
|
||||||
|
apiGetNotifikasiByUserId,
|
||||||
|
apiPostIsReadNotifikasi,
|
||||||
|
apiGetCountNotifikasiByUserId,
|
||||||
|
};
|
||||||
|
|
||||||
const apiGetNotifikasiByUserId = async ({
|
const apiGetNotifikasiByUserId = async ({
|
||||||
page,
|
page,
|
||||||
@@ -81,3 +85,37 @@ const apiPostIsReadNotifikasi = async ({
|
|||||||
throw error; // Re-throw the error to handle it in the calling function
|
throw error; // Re-throw the error to handle it in the calling function
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const apiGetCountNotifikasiByUserId = async ({id}: {id: string}) => {
|
||||||
|
try {
|
||||||
|
// Fetch token from cookie
|
||||||
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
|
if (!token) {
|
||||||
|
console.error("No token found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(`/api/admin/notifikasi/count?id=${id}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if the response is OK
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorData = await response.json().catch(() => null);
|
||||||
|
console.error("Failed to get count notifikasi admin", response.statusText, errorData);
|
||||||
|
throw new Error(errorData?.message || "Failed to get count notifikasi admin");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the JSON response
|
||||||
|
const data = await response.json();
|
||||||
|
return data
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error get count notifikasi admin", error);
|
||||||
|
throw error; // Re-throw the error to handle it in the calling function
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -13,16 +13,12 @@ export default async function adminNotifikasi_findRouterDonasi({
|
|||||||
notifikasiId,
|
notifikasiId,
|
||||||
status,
|
status,
|
||||||
router,
|
router,
|
||||||
onLoadCountNotif,
|
|
||||||
onLoadDataNotifikasi,
|
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
}: {
|
}: {
|
||||||
appId: string;
|
appId: string;
|
||||||
notifikasiId: string;
|
notifikasiId: string;
|
||||||
status: ITypeStatusNotifikasi;
|
status: ITypeStatusNotifikasi;
|
||||||
router: AppRouterInstance;
|
router: AppRouterInstance;
|
||||||
onLoadCountNotif: (val: any) => void;
|
|
||||||
onLoadDataNotifikasi: (val: any) => void;
|
|
||||||
onChangeNavbar: (val: {
|
onChangeNavbar: (val: {
|
||||||
id: IAdmin_ActivePage;
|
id: IAdmin_ActivePage;
|
||||||
childId: IAdmin_ActiveChildId;
|
childId: IAdmin_ActiveChildId;
|
||||||
@@ -39,13 +35,6 @@ export default async function adminNotifikasi_findRouterDonasi({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (udpateReadNotifikasi.status == 200) {
|
if (udpateReadNotifikasi.status == 200) {
|
||||||
const loadCountNotif = await adminNotifikasi_countNotifikasi();
|
|
||||||
onLoadCountNotif(loadCountNotif);
|
|
||||||
|
|
||||||
const loadListNotifikasi = await adminNotifikasi_getByUserId({
|
|
||||||
page: 1,
|
|
||||||
});
|
|
||||||
onLoadDataNotifikasi(loadListNotifikasi);
|
|
||||||
const path = RouterAdminDonasi_OLD.detail_publish + appId;
|
const path = RouterAdminDonasi_OLD.detail_publish + appId;
|
||||||
router.push(path, { scroll: false });
|
router.push(path, { scroll: false });
|
||||||
onChangeNavbar({
|
onChangeNavbar({
|
||||||
@@ -66,14 +55,6 @@ export default async function adminNotifikasi_findRouterDonasi({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (udpateReadNotifikasi.status == 200) {
|
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}`;
|
const path = `/dev/admin/donasi/sub-menu/${check.statusName}`;
|
||||||
|
|
||||||
if (check.statusName == "draft") {
|
if (check.statusName == "draft") {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import adminNotifikasi_countNotifikasi from "../fun/count/count_is_read";
|
|
||||||
import { admin_funEventCheckStatus } from "../fun/get";
|
import { admin_funEventCheckStatus } from "../fun/get";
|
||||||
import adminNotifikasi_getByUserId from "../fun/get/get_notifikasi_by_user_id";
|
|
||||||
import adminNotifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_id";
|
import adminNotifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_id";
|
||||||
import { IAdmin_ActiveChildId, IAdmin_ActivePage } from "./type_of_select_page";
|
import { IAdmin_ActiveChildId, IAdmin_ActivePage } from "./type_of_select_page";
|
||||||
|
|
||||||
@@ -10,17 +8,11 @@ export async function adminNotifikasi_findRouterEvent({
|
|||||||
appId,
|
appId,
|
||||||
notifikasiId,
|
notifikasiId,
|
||||||
router,
|
router,
|
||||||
activePage,
|
|
||||||
onLoadCountNotif,
|
|
||||||
onLoadDataNotifikasi,
|
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
}: {
|
}: {
|
||||||
appId: string;
|
appId: string;
|
||||||
notifikasiId: string;
|
notifikasiId: string;
|
||||||
router: AppRouterInstance;
|
router: AppRouterInstance;
|
||||||
activePage: number;
|
|
||||||
onLoadCountNotif: (val: any) => void;
|
|
||||||
onLoadDataNotifikasi: (val: any) => void;
|
|
||||||
onChangeNavbar: (val: {
|
onChangeNavbar: (val: {
|
||||||
id: IAdmin_ActivePage;
|
id: IAdmin_ActivePage;
|
||||||
childId: IAdmin_ActiveChildId;
|
childId: IAdmin_ActiveChildId;
|
||||||
@@ -34,14 +26,6 @@ export async function adminNotifikasi_findRouterEvent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (udpateReadNotifikasi.status == 200) {
|
if (udpateReadNotifikasi.status == 200) {
|
||||||
const loadCountNotif = await adminNotifikasi_countNotifikasi();
|
|
||||||
onLoadCountNotif(loadCountNotif);
|
|
||||||
|
|
||||||
const loadListNotifikasi = await adminNotifikasi_getByUserId({
|
|
||||||
page: 1,
|
|
||||||
});
|
|
||||||
onLoadDataNotifikasi(loadListNotifikasi);
|
|
||||||
|
|
||||||
const path = `/dev/admin/event/table/${check.statusName}`;
|
const path = `/dev/admin/event/table/${check.statusName}`;
|
||||||
|
|
||||||
if (check.statusName == "draft") {
|
if (check.statusName == "draft") {
|
||||||
|
|||||||
@@ -1,28 +1,22 @@
|
|||||||
import { ITypeStatusNotifikasi } from "@/lib/global_state";
|
import { ITypeStatusNotifikasi } from "@/lib/global_state";
|
||||||
|
import { RouterAdminInvestasi } from "@/lib/router_admin/router_admin_investasi";
|
||||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
import adminNotifikasi_countNotifikasi from "../fun/count/count_is_read";
|
|
||||||
import { admin_funInvestasiCheckStatus } from "../fun/get/fun_investasi_check_status";
|
import { admin_funInvestasiCheckStatus } from "../fun/get/fun_investasi_check_status";
|
||||||
import adminNotifikasi_getByUserId from "../fun/get/get_notifikasi_by_user_id";
|
|
||||||
import adminNotifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_id";
|
import adminNotifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_id";
|
||||||
import { IAdmin_ActiveChildId, IAdmin_ActivePage } from "./type_of_select_page";
|
import { IAdmin_ActiveChildId, IAdmin_ActivePage } from "./type_of_select_page";
|
||||||
import { RouterAdminInvestasi } from "@/lib/router_admin/router_admin_investasi";
|
|
||||||
|
|
||||||
export default async function adminNotifikasi_findRouterInvestasi({
|
export default async function adminNotifikasi_findRouterInvestasi({
|
||||||
appId,
|
appId,
|
||||||
notifikasiId,
|
notifikasiId,
|
||||||
status,
|
status,
|
||||||
router,
|
router,
|
||||||
onLoadCountNotif,
|
|
||||||
onLoadDataNotifikasi,
|
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
}: {
|
}: {
|
||||||
appId: string;
|
appId: string;
|
||||||
notifikasiId: string;
|
notifikasiId: string;
|
||||||
status: ITypeStatusNotifikasi;
|
status: ITypeStatusNotifikasi;
|
||||||
router: AppRouterInstance;
|
router: AppRouterInstance;
|
||||||
onLoadCountNotif: (val: any) => void;
|
|
||||||
onLoadDataNotifikasi: (val: any) => void;
|
|
||||||
onChangeNavbar: (val: {
|
onChangeNavbar: (val: {
|
||||||
id: IAdmin_ActivePage;
|
id: IAdmin_ActivePage;
|
||||||
childId: IAdmin_ActiveChildId;
|
childId: IAdmin_ActiveChildId;
|
||||||
@@ -38,13 +32,6 @@ export default async function adminNotifikasi_findRouterInvestasi({
|
|||||||
notifId: notifikasiId,
|
notifId: notifikasiId,
|
||||||
});
|
});
|
||||||
if (udpateReadNotifikasi.status == 200) {
|
if (udpateReadNotifikasi.status == 200) {
|
||||||
const loadCountNotif = await adminNotifikasi_countNotifikasi();
|
|
||||||
onLoadCountNotif(loadCountNotif);
|
|
||||||
|
|
||||||
const loadListNotifikasi = await adminNotifikasi_getByUserId({
|
|
||||||
page: 1,
|
|
||||||
});
|
|
||||||
onLoadDataNotifikasi(loadListNotifikasi);
|
|
||||||
const path = RouterAdminInvestasi.detail_publish + appId;
|
const path = RouterAdminInvestasi.detail_publish + appId;
|
||||||
router.push(path, { scroll: false });
|
router.push(path, { scroll: false });
|
||||||
|
|
||||||
@@ -67,14 +54,6 @@ export default async function adminNotifikasi_findRouterInvestasi({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (udpateReadNotifikasi.status == 200) {
|
if (udpateReadNotifikasi.status == 200) {
|
||||||
const loadCountNotif = await adminNotifikasi_countNotifikasi();
|
|
||||||
onLoadCountNotif(loadCountNotif);
|
|
||||||
|
|
||||||
const loadListNotifikasi = await adminNotifikasi_getByUserId({
|
|
||||||
page: 1,
|
|
||||||
});
|
|
||||||
onLoadDataNotifikasi(loadListNotifikasi);
|
|
||||||
|
|
||||||
const path = `/dev/admin/investasi/sub-menu/${check.statusName}`;
|
const path = `/dev/admin/investasi/sub-menu/${check.statusName}`;
|
||||||
|
|
||||||
if (check.statusName == "draft") {
|
if (check.statusName == "draft") {
|
||||||
|
|||||||
@@ -12,17 +12,11 @@ export async function adminNotifikasi_findRouterVoting({
|
|||||||
appId,
|
appId,
|
||||||
notifikasiId,
|
notifikasiId,
|
||||||
router,
|
router,
|
||||||
activePage,
|
|
||||||
onLoadCountNotif,
|
|
||||||
onLoadDataNotifikasi,
|
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
}: {
|
}: {
|
||||||
appId: string;
|
appId: string;
|
||||||
notifikasiId: string;
|
notifikasiId: string;
|
||||||
router: AppRouterInstance;
|
router: AppRouterInstance;
|
||||||
activePage: number;
|
|
||||||
onLoadCountNotif: (val: any) => void;
|
|
||||||
onLoadDataNotifikasi: (val: any) => void;
|
|
||||||
onChangeNavbar: (val: {
|
onChangeNavbar: (val: {
|
||||||
id: IAdmin_ActivePage;
|
id: IAdmin_ActivePage;
|
||||||
childId: IAdmin_ActiveChildId;
|
childId: IAdmin_ActiveChildId;
|
||||||
@@ -36,13 +30,6 @@ export async function adminNotifikasi_findRouterVoting({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (updateReadNotifikasi.status == 200) {
|
if (updateReadNotifikasi.status == 200) {
|
||||||
const loadCountNotif = await adminNotifikasi_countNotifikasi();
|
|
||||||
onLoadCountNotif(loadCountNotif);
|
|
||||||
|
|
||||||
const loadListNotifikasi = await adminNotifikasi_getByUserId({
|
|
||||||
page: 1,
|
|
||||||
});
|
|
||||||
onLoadDataNotifikasi(loadListNotifikasi);
|
|
||||||
|
|
||||||
const path = `/dev/admin/vote/child/table_${check.statusName}`;
|
const path = `/dev/admin/vote/child/table_${check.statusName}`;
|
||||||
|
|
||||||
|
|||||||
@@ -100,143 +100,143 @@ export default function AdminNotifikasi_ViewCardDrawer({
|
|||||||
|
|
||||||
// ========================== EVENT ========================== //
|
// ========================== EVENT ========================== //
|
||||||
|
|
||||||
if (data.kategoriApp == "EVENT") {
|
// if (data.kategoriApp == "EVENT") {
|
||||||
setDataId(data.id);
|
// setDataId(data.id);
|
||||||
|
|
||||||
const checkEvent = await adminNotifikasi_findRouterEvent({
|
// const checkEvent = await adminNotifikasi_findRouterEvent({
|
||||||
appId: data.appId,
|
// appId: data.appId,
|
||||||
notifikasiId: data.id,
|
// notifikasiId: data.id,
|
||||||
router: router,
|
// router: router,
|
||||||
activePage: activePage,
|
// activePage: activePage,
|
||||||
onLoadCountNotif(val) {
|
// onLoadCountNotif(val) {
|
||||||
onLoadCountNotif(val);
|
// onLoadCountNotif(val);
|
||||||
},
|
// },
|
||||||
onLoadDataNotifikasi(val) {
|
// onLoadDataNotifikasi(val) {
|
||||||
onLoadDataNotifikasi(val);
|
// onLoadDataNotifikasi(val);
|
||||||
},
|
// },
|
||||||
onChangeNavbar(val) {
|
// onChangeNavbar(val) {
|
||||||
onChangeNavbar({
|
// onChangeNavbar({
|
||||||
id: val.id,
|
// id: val.id,
|
||||||
childId: val.childId,
|
// childId: val.childId,
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (checkEvent) {
|
// if (checkEvent) {
|
||||||
setIsAdminEvent_TriggerReview(false);
|
// setIsAdminEvent_TriggerReview(false);
|
||||||
setVisible(false);
|
// setVisible(false);
|
||||||
setDataId("");
|
// setDataId("");
|
||||||
onToggleNavbar(false);
|
// onToggleNavbar(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// ========================== EVENT ========================== //
|
// // ========================== EVENT ========================== //
|
||||||
|
|
||||||
// ========================== VOTING ========================== //
|
// // ========================== VOTING ========================== //
|
||||||
|
|
||||||
if (data.kategoriApp == "VOTING") {
|
// if (data.kategoriApp == "VOTING") {
|
||||||
setDataId(data.id);
|
// setDataId(data.id);
|
||||||
|
|
||||||
const checkVoting = await adminNotifikasi_findRouterVoting({
|
// const checkVoting = await adminNotifikasi_findRouterVoting({
|
||||||
router: router,
|
// router: router,
|
||||||
appId: data.appId,
|
// appId: data.appId,
|
||||||
notifikasiId: data.id,
|
// notifikasiId: data.id,
|
||||||
activePage: activePage,
|
// activePage: activePage,
|
||||||
onLoadCountNotif(val) {
|
// onLoadCountNotif(val) {
|
||||||
onLoadCountNotif(val);
|
// onLoadCountNotif(val);
|
||||||
},
|
// },
|
||||||
onLoadDataNotifikasi(val) {
|
// onLoadDataNotifikasi(val) {
|
||||||
onLoadDataNotifikasi(val);
|
// onLoadDataNotifikasi(val);
|
||||||
},
|
// },
|
||||||
onChangeNavbar(val) {
|
// onChangeNavbar(val) {
|
||||||
onChangeNavbar({
|
// onChangeNavbar({
|
||||||
id: val.id,
|
// id: val.id,
|
||||||
childId: val.childId,
|
// childId: val.childId,
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (checkVoting) {
|
// if (checkVoting) {
|
||||||
setIsAdminVoting_TriggerReview(false);
|
// setIsAdminVoting_TriggerReview(false);
|
||||||
setVisible(false);
|
// setVisible(false);
|
||||||
setDataId("");
|
// setDataId("");
|
||||||
onToggleNavbar(false);
|
// onToggleNavbar(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// ========================== VOTING ========================== //
|
// // ========================== VOTING ========================== //
|
||||||
|
|
||||||
// ========================== DONASI ========================== //
|
// // ========================== DONASI ========================== //
|
||||||
|
|
||||||
if (data.kategoriApp == "DONASI") {
|
// if (data.kategoriApp == "DONASI") {
|
||||||
setDataId(data.id);
|
// setDataId(data.id);
|
||||||
|
|
||||||
const checkDonasi = await adminNotifikasi_findRouterDonasi({
|
// const checkDonasi = await adminNotifikasi_findRouterDonasi({
|
||||||
appId: data.appId,
|
// appId: data.appId,
|
||||||
notifikasiId: data.id,
|
// notifikasiId: data.id,
|
||||||
router: router,
|
// router: router,
|
||||||
status: data.status as ITypeStatusNotifikasi,
|
// status: data.status as ITypeStatusNotifikasi,
|
||||||
onLoadCountNotif(val) {
|
// onLoadCountNotif(val) {
|
||||||
onLoadCountNotif(val);
|
// onLoadCountNotif(val);
|
||||||
},
|
// },
|
||||||
onLoadDataNotifikasi(val) {
|
// onLoadDataNotifikasi(val) {
|
||||||
onLoadDataNotifikasi(val);
|
// onLoadDataNotifikasi(val);
|
||||||
},
|
// },
|
||||||
onChangeNavbar(val) {
|
// onChangeNavbar(val) {
|
||||||
onChangeNavbar({
|
// onChangeNavbar({
|
||||||
id: val.id,
|
// id: val.id,
|
||||||
childId: val.childId,
|
// childId: val.childId,
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (checkDonasi) {
|
// if (checkDonasi) {
|
||||||
setIsAdminDonasi_TriggerReview(false);
|
// setIsAdminDonasi_TriggerReview(false);
|
||||||
setVisible(false);
|
// setVisible(false);
|
||||||
setDataId("");
|
// setDataId("");
|
||||||
onToggleNavbar(false);
|
// onToggleNavbar(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// ========================== DONASI ========================== //
|
// // ========================== DONASI ========================== //
|
||||||
|
|
||||||
// ========================== INVESTASI ========================== //
|
// // ========================== INVESTASI ========================== //
|
||||||
|
|
||||||
if (data.kategoriApp == "INVESTASI") {
|
// if (data.kategoriApp == "INVESTASI") {
|
||||||
setDataId(data.id);
|
// setDataId(data.id);
|
||||||
|
|
||||||
const checkInvestasi = await adminNotifikasi_findRouterInvestasi({
|
// const checkInvestasi = await adminNotifikasi_findRouterInvestasi({
|
||||||
appId: data.appId,
|
// appId: data.appId,
|
||||||
notifikasiId: data.id,
|
// notifikasiId: data.id,
|
||||||
status: data.status as ITypeStatusNotifikasi,
|
// status: data.status as ITypeStatusNotifikasi,
|
||||||
router: router,
|
// router: router,
|
||||||
onLoadCountNotif(val) {
|
// onLoadCountNotif(val) {
|
||||||
onLoadCountNotif(val);
|
// onLoadCountNotif(val);
|
||||||
},
|
// },
|
||||||
onLoadDataNotifikasi(val) {
|
// onLoadDataNotifikasi(val) {
|
||||||
onLoadDataNotifikasi(val);
|
// onLoadDataNotifikasi(val);
|
||||||
},
|
// },
|
||||||
onChangeNavbar(val) {
|
// onChangeNavbar(val) {
|
||||||
onChangeNavbar({
|
// onChangeNavbar({
|
||||||
id: val.id,
|
// id: val.id,
|
||||||
childId: val.childId,
|
// childId: val.childId,
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (checkInvestasi) {
|
// if (checkInvestasi) {
|
||||||
setIsAdminDonasi_TriggerReview(false);
|
// setIsAdminDonasi_TriggerReview(false);
|
||||||
setVisible(false);
|
// setVisible(false);
|
||||||
setDataId("");
|
// setDataId("");
|
||||||
onToggleNavbar(false);
|
// onToggleNavbar(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// // FORUM
|
// // FORUM
|
||||||
// e?.kategoriApp === "FORUM" &&
|
// e?.kategoriApp === "FORUM" &&
|
||||||
|
|||||||
Reference in New Issue
Block a user