fix notifikasi admin
This commit is contained in:
@@ -82,11 +82,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,12 +109,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);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ export function Admin_V3_MainLayout({
|
|||||||
const [opened, handlers] = useDisclosure(false);
|
const [opened, handlers] = useDisclosure(false);
|
||||||
const [openedDrawer, handlersDrawer] = useDisclosure(false);
|
const [openedDrawer, handlersDrawer] = useDisclosure(false);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppShell
|
<AppShell
|
||||||
@@ -171,7 +170,7 @@ export function Admin_V3_MainLayout({
|
|||||||
color: AccentColor.white,
|
color: AccentColor.white,
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: AccentColor.darkblue,
|
backgroundColor: MainColor.darkblue,
|
||||||
color: AccentColor.white,
|
color: AccentColor.white,
|
||||||
},
|
},
|
||||||
close: {
|
close: {
|
||||||
@@ -202,7 +201,7 @@ export function Admin_V3_MainLayout({
|
|||||||
setActiveChildId(val.childId);
|
setActiveChildId(val.childId);
|
||||||
}}
|
}}
|
||||||
onToggleNavbar={(val: any) => {
|
onToggleNavbar={(val: any) => {
|
||||||
handlersDrawer.close
|
val === false && handlersDrawer.close();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/* <ComponentAdmin_UIDrawerNotifikasi
|
{/* <ComponentAdmin_UIDrawerNotifikasi
|
||||||
|
|||||||
@@ -1,26 +1,27 @@
|
|||||||
|
import { AccentColor } from "@/app_modules/_global/color";
|
||||||
|
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||||
|
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||||
import {
|
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 { AccentColor } from "@/app_modules/_global/color";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
|
||||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
|
||||||
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
||||||
import { IconCheck, IconChecks, IconSpeakerphone } from "@tabler/icons-react";
|
import { IconCheck, IconChecks, IconSpeakerphone } from "@tabler/icons-react";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import "moment/locale/id";
|
import "moment/locale/id";
|
||||||
import {
|
import { useRouter } from "next/navigation";
|
||||||
IAdmin_ActivePage,
|
import { useState } from "react";
|
||||||
IAdmin_ActiveChildId,
|
import { ComponentAdminGlobal_NotifikasiPeringatan } from "../../_admin_global/admin_notifikasi/notifikasi_peringatan";
|
||||||
} from "../../notifikasi/route_setting/type_of_select_page";
|
import adminNotifikasi_findRouterForum from "../../notifikasi/route_setting/forum";
|
||||||
import { adminNotifikasi_findRouterJob } from "../../notifikasi/route_setting/job";
|
import { adminNotifikasi_findRouterJob } from "../../notifikasi/route_setting/job";
|
||||||
|
import {
|
||||||
|
IAdmin_ActiveChildId,
|
||||||
|
IAdmin_ActivePage,
|
||||||
|
} from "../../notifikasi/route_setting/type_of_select_page";
|
||||||
|
|
||||||
export default function Admin_V3_ComponentCardNotifikasi({
|
export default function Admin_V3_ComponentCardNotifikasi({
|
||||||
data,
|
data,
|
||||||
@@ -70,13 +71,6 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
appId: data.appId,
|
appId: data.appId,
|
||||||
notifikasiId: data.id,
|
notifikasiId: data.id,
|
||||||
router: router,
|
router: router,
|
||||||
activePage: activePage,
|
|
||||||
// onLoadCountNotif(val) {
|
|
||||||
// onLoadCountNotif(val);
|
|
||||||
// },
|
|
||||||
// onLoadDataNotifikasi(val) {
|
|
||||||
// onLoadDataNotifikasi(val);
|
|
||||||
// },
|
|
||||||
onChangeNavbar(val) {
|
onChangeNavbar(val) {
|
||||||
onChangeNavbar({
|
onChangeNavbar({
|
||||||
id: val.id,
|
id: val.id,
|
||||||
@@ -96,6 +90,30 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
}
|
}
|
||||||
// ========================== JOB ========================== //
|
// ========================== JOB ========================== //
|
||||||
|
|
||||||
|
// ========================== FORUM ==============================//
|
||||||
|
|
||||||
|
if (data.kategoriApp === "FORUM") {
|
||||||
|
setDataId(data.id);
|
||||||
|
|
||||||
|
const checkForum = await adminNotifikasi_findRouterForum({
|
||||||
|
data: data,
|
||||||
|
router: router,
|
||||||
|
onChangeNavbar(val) {
|
||||||
|
onChangeNavbar(val);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (checkForum !== "") {
|
||||||
|
router.push(checkForum);
|
||||||
|
setDataId("");
|
||||||
|
setVisible(false);
|
||||||
|
onToggleNavbar(false);
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiPeringatan("Gagal memuat forum");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ========================== FORUM ==============================//
|
||||||
|
|
||||||
// ========================== EVENT ========================== //
|
// ========================== EVENT ========================== //
|
||||||
|
|
||||||
// if (data.kategoriApp == "EVENT") {
|
// if (data.kategoriApp == "EVENT") {
|
||||||
@@ -236,18 +254,7 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // FORUM
|
// ========================== INVESTASI ========================== //
|
||||||
// e?.kategoriApp === "FORUM" &&
|
|
||||||
// adminNotifikasi_findRouterForum({
|
|
||||||
// data: e,
|
|
||||||
// router: router,
|
|
||||||
// onChangeNavbar(val) {
|
|
||||||
// onChangeNavbar(val);
|
|
||||||
// },
|
|
||||||
// onToggleNavbar(val) {
|
|
||||||
// onToggleNavbar(val);
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
clientLogger.error("Error notifikasi function", error);
|
clientLogger.error("Error notifikasi function", error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -260,9 +267,10 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
transition: "0.5s",
|
transition: "0.5s",
|
||||||
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
mb={"15px"}
|
mb={"15px"}
|
||||||
c={"white"}
|
c={data.isRead ? "gray" : "white"}
|
||||||
key={data.id}
|
key={data.id}
|
||||||
bg={data.isRead ? AccentColor.blackgray : AccentColor.darkblue}
|
bg={data.isRead ? AccentColor.blackgray : AccentColor.darkblue}
|
||||||
sx={{
|
sx={{
|
||||||
@@ -306,9 +314,9 @@ export default function Admin_V3_ComponentCardNotifikasi({
|
|||||||
<Text lineClamp={2} fw={"bold"} fz={"xs"}>
|
<Text lineClamp={2} fw={"bold"} fz={"xs"}>
|
||||||
{data.title}
|
{data.title}
|
||||||
</Text>
|
</Text>
|
||||||
<Text lineClamp={2} fz={"xs"}>
|
{/* <Text lineClamp={2} fz={"xs"}>
|
||||||
{data.pesan}
|
{data.pesan}
|
||||||
</Text>
|
</Text> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Card.Section>
|
</Card.Section>
|
||||||
<Card.Section p={"sm"}>
|
<Card.Section p={"sm"}>
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
|
import {
|
||||||
|
MainColor
|
||||||
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||||
import {
|
import {
|
||||||
Box,
|
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
|
Divider,
|
||||||
Group,
|
Group,
|
||||||
Loader,
|
Loader,
|
||||||
Paper,
|
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { ScrollOnly } from "next-scroll-loader";
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
import adminNotifikasi_getByUserId from "../../notifikasi/fun/get/get_notifikasi_by_user_id";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
import {
|
||||||
apiGetNotifikasiByUserId,
|
apiGetNotifikasiByUserId,
|
||||||
apiPostIsReadNotifikasi,
|
apiPostIsReadNotifikasi,
|
||||||
} from "../../notifikasi/lib/api_fetch_notifikasi";
|
} from "../../notifikasi/lib/api_fetch_notifikasi";
|
||||||
import AdminNotifikasi_ViewCardDrawer from "../../notifikasi/view_card_drawer";
|
|
||||||
import Admin_V3_ComponentCardNotifikasi from "./comp_card_notifikasi";
|
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
|
||||||
import {
|
import {
|
||||||
IAdmin_ActivePage,
|
|
||||||
IAdmin_ActiveChildId,
|
IAdmin_ActiveChildId,
|
||||||
|
IAdmin_ActivePage,
|
||||||
} from "../../notifikasi/route_setting/type_of_select_page";
|
} from "../../notifikasi/route_setting/type_of_select_page";
|
||||||
|
import Admin_V3_ComponentCardNotifikasi from "./comp_card_notifikasi";
|
||||||
|
|
||||||
export function Admin_V3_ViewDrawerNotifikasi({
|
export function Admin_V3_ViewDrawerNotifikasi({
|
||||||
userLoginId,
|
userLoginId,
|
||||||
@@ -158,8 +158,12 @@ export function Admin_V3_ViewDrawerNotifikasi({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack pt={"sm"} pb={"xl"}>
|
<Stack pt={"sm"} pb={"xl"}>
|
||||||
<Group>
|
<Group position="right">
|
||||||
<Button
|
<Button
|
||||||
|
size="xs"
|
||||||
|
bg={MainColor.yellow}
|
||||||
|
color="yellow"
|
||||||
|
c={"black"}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleUpdateReadAll();
|
handleUpdateReadAll();
|
||||||
@@ -176,6 +180,7 @@ export function Admin_V3_ViewDrawerNotifikasi({
|
|||||||
Tandai belum baca
|
Tandai belum baca
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Divider color={MainColor.white}/>
|
||||||
|
|
||||||
{_.isEmpty(data) ? (
|
{_.isEmpty(data) ? (
|
||||||
<Center>
|
<Center>
|
||||||
|
|||||||
@@ -1,33 +1,45 @@
|
|||||||
import { RouterAdminForum } from "@/lib/router_admin/router_admin_forum";
|
import { RouterAdminForum } from "@/lib/router_admin/router_admin_forum";
|
||||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||||
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 { IAdmin_ActivePage, IAdmin_ActiveChildId } from "./type_of_select_page";
|
||||||
|
import adminNotifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_id";
|
||||||
|
|
||||||
export default async function adminNotifikasi_findRouterForum({
|
export default async function adminNotifikasi_findRouterForum({
|
||||||
data,
|
data,
|
||||||
router,
|
router,
|
||||||
onChangeNavbar,
|
onChangeNavbar,
|
||||||
onToggleNavbar,
|
|
||||||
}: {
|
}: {
|
||||||
data: MODEL_NOTIFIKASI;
|
data: MODEL_NOTIFIKASI;
|
||||||
router: AppRouterInstance;
|
router: AppRouterInstance;
|
||||||
onChangeNavbar: (val: any) => void;
|
onChangeNavbar: (val: {
|
||||||
onToggleNavbar: (val: any) => void;
|
id: IAdmin_ActivePage;
|
||||||
|
childId: IAdmin_ActiveChildId;
|
||||||
|
}) => void;
|
||||||
}) {
|
}) {
|
||||||
if (data.status === "Report Posting") {
|
const udpateReadNotifikasi = await adminNotifikasi_funUpdateIsReadById({
|
||||||
const routeName = RouterAdminForum.table_report_posting;
|
notifId: data.id,
|
||||||
router.push(routeName);
|
});
|
||||||
onChangeNavbar({
|
if (udpateReadNotifikasi.status == 200) {
|
||||||
id: 7,
|
let pagePath = "";
|
||||||
childId: 73,
|
if (data.status === "Report Posting") {
|
||||||
});
|
pagePath = RouterAdminForum.table_report_posting;
|
||||||
}
|
// router.push(routeName);
|
||||||
|
onChangeNavbar({
|
||||||
|
id: "Forum",
|
||||||
|
childId: "Forum_3",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (data.status === "Report Komentar") {
|
if (data.status === "Report Komentar") {
|
||||||
const routeName = RouterAdminForum.table_report_komentar;
|
pagePath = RouterAdminForum.table_report_komentar;
|
||||||
router.push(routeName);
|
// router.push(routeName);
|
||||||
onChangeNavbar({
|
onChangeNavbar({
|
||||||
id: 7,
|
id: "Forum",
|
||||||
childId: 74,
|
childId: "Forum_4",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
return pagePath;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,18 @@
|
|||||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
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 { admin_funCheckStatusJob } from "../fun/get/fun_check_status_job";
|
import { admin_funCheckStatusJob } from "../fun/get/fun_check_status_job";
|
||||||
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 { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { IAdmin_ActiveChildId, IAdmin_ActivePage } from "./type_of_select_page";
|
||||||
import adminNotifikasi_countNotifikasi from "../fun/count/count_is_read";
|
|
||||||
import adminNotifikasi_getByUserId from "../fun/get/get_notifikasi_by_user_id";
|
|
||||||
import { IAdmin_ActivePage, IAdmin_ActiveChildId } from "./type_of_select_page";
|
|
||||||
|
|
||||||
export async function adminNotifikasi_findRouterJob({
|
export async function adminNotifikasi_findRouterJob({
|
||||||
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;
|
||||||
@@ -35,14 +26,6 @@ export async function adminNotifikasi_findRouterJob({
|
|||||||
});
|
});
|
||||||
|
|
||||||
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/job/child/${check.statusName}`;
|
const path = `/dev/admin/job/child/${check.statusName}`;
|
||||||
|
|
||||||
if (check.statusName == "draft") {
|
if (check.statusName == "draft") {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
gs_adminVoting_triggerReview,
|
gs_adminVoting_triggerReview,
|
||||||
ITypeStatusNotifikasi,
|
ITypeStatusNotifikasi,
|
||||||
} from "@/lib/global_state";
|
} from "@/lib/global_state";
|
||||||
import { AccentColor } from "@/app_modules/_global/color";
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||||
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
||||||
@@ -263,11 +263,12 @@ export default function AdminNotifikasi_ViewCardDrawer({
|
|||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
transition: "0.5s",
|
transition: "0.5s",
|
||||||
|
border: `2px solid ${MainColor.soft_darkblue}`,
|
||||||
}}
|
}}
|
||||||
mb={"15px"}
|
mb={"15px"}
|
||||||
c={"white"}
|
c={"white"}
|
||||||
key={data.id}
|
key={data.id}
|
||||||
bg={data.isRead ? "gray" : AccentColor.darkblue}
|
bg={data.isRead ? "gray" : MainColor.darkblue}
|
||||||
sx={{
|
sx={{
|
||||||
borderColor: AccentColor.blue,
|
borderColor: AccentColor.blue,
|
||||||
borderStyle: "solid",
|
borderStyle: "solid",
|
||||||
|
|||||||
Reference in New Issue
Block a user