Compare commits
2 Commits
api-admin/
...
api-admin/
| Author | SHA1 | Date | |
|---|---|---|---|
| 57285e5697 | |||
| 1fd9694ebf |
@@ -22,11 +22,7 @@ import { useCallback, useState } from "react";
|
|||||||
export default function AdminForumDetailPosting() {
|
export default function AdminForumDetailPosting() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [openDrawerPage, setOpenDrawerPage] = useState(false);
|
const [openDrawerPage, setOpenDrawerPage] = useState(false);
|
||||||
const [selectedId, setSelectedId] = useState<any>();
|
|
||||||
|
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
const [listComment, setListComment] = useState<any[] | null>(null);
|
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
@@ -38,7 +34,6 @@ export default function AdminForumDetailPosting() {
|
|||||||
const response = await apiAdminForumPostingById({
|
const response = await apiAdminForumPostingById({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
});
|
});
|
||||||
console.log("[RES DATA]", JSON.stringify(response, null, 2));
|
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
@@ -86,14 +81,25 @@ export default function AdminForumDetailPosting() {
|
|||||||
<AdminBackButtonAntTitle
|
<AdminBackButtonAntTitle
|
||||||
title="Detail Posting"
|
title="Detail Posting"
|
||||||
rightComponent={
|
rightComponent={
|
||||||
<ActionIcon
|
data &&
|
||||||
icon={<IconDot size={16} color={MainColor.darkblue} />}
|
data?.isActive && (
|
||||||
onPress={() => setOpenDrawerPage(true)}
|
<ActionIcon
|
||||||
/>
|
icon={<IconDot size={16} color={MainColor.darkblue} />}
|
||||||
|
onPress={() => setOpenDrawerPage(true)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
{data && !data?.isActive && (
|
||||||
|
<BaseBox>
|
||||||
|
<TextCustom bold align="center" color="red">
|
||||||
|
Postingan ini telah di nonaktifkan
|
||||||
|
</TextCustom>
|
||||||
|
</BaseBox>
|
||||||
|
)}
|
||||||
|
|
||||||
<BaseBox>
|
<BaseBox>
|
||||||
<StackCustom gap={"sm"}>
|
<StackCustom gap={"sm"}>
|
||||||
{listDataAction.map((item, i) => (
|
{listDataAction.map((item, i) => (
|
||||||
@@ -112,47 +118,6 @@ export default function AdminForumDetailPosting() {
|
|||||||
<TextCustom>{(data && data?.diskusi) || "-"}</TextCustom>
|
<TextCustom>{(data && data?.diskusi) || "-"}</TextCustom>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
{/* <AdminComp_BoxTitle title="Komentar" rightComponent={rightComponent} /> */}
|
|
||||||
{/* <StackCustom>
|
|
||||||
<AdminTitleTable title1="Aksi" title2="Username" title3="Komentar" />
|
|
||||||
<Divider />
|
|
||||||
{!listComment ? (
|
|
||||||
<LoaderCustom />
|
|
||||||
) : _.isEmpty(listComment) ? (
|
|
||||||
<TextCustom align="center" color="gray">
|
|
||||||
Tidak ada komentar
|
|
||||||
</TextCustom>
|
|
||||||
) : (
|
|
||||||
listComment?.map((item: any, index: number) => (
|
|
||||||
<AdminTableValue
|
|
||||||
key={index}
|
|
||||||
value1={
|
|
||||||
<ActionIcon
|
|
||||||
icon={
|
|
||||||
<Ionicons
|
|
||||||
name="ellipsis-vertical-outline"
|
|
||||||
size={ICON_SIZE_BUTTON}
|
|
||||||
color="black"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
onPress={() => {
|
|
||||||
setSelectedId(index + 1);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
value2={
|
|
||||||
<TextCustom truncate={1}>
|
|
||||||
{item?.Author?.username || "-"}
|
|
||||||
</TextCustom>
|
|
||||||
}
|
|
||||||
value3={
|
|
||||||
<TextCustom truncate={2}>{item?.komentar || "-"}</TextCustom>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</StackCustom> */}
|
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
<DrawerCustom
|
<DrawerCustom
|
||||||
|
|||||||
@@ -1,41 +1,24 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
LoaderCustom,
|
||||||
AlertDefaultSystem,
|
StackCustom,
|
||||||
DrawerCustom,
|
TextCustom,
|
||||||
LoaderCustom,
|
ViewWrapper
|
||||||
MenuDrawerDynamicGrid,
|
|
||||||
StackCustom,
|
|
||||||
TextCustom,
|
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconView } from "@/components/_Icon/IconComponent";
|
|
||||||
import { IconOpenTo } from "@/components/_Icon/IconOpenTo";
|
import { IconOpenTo } from "@/components/_Icon/IconOpenTo";
|
||||||
import { IconTrash } from "@/components/_Icon/IconTrash";
|
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
||||||
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
|
||||||
import {
|
|
||||||
ICON_SIZE_BUTTON,
|
|
||||||
ICON_SIZE_MEDIUM,
|
|
||||||
ICON_SIZE_XLARGE,
|
|
||||||
} from "@/constants/constans-value";
|
|
||||||
import { apiAdminForumCommentById } from "@/service/api-admin/api-admin-forum";
|
import { apiAdminForumCommentById } from "@/service/api-admin/api-admin-forum";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
import Toast from "react-native-toast-message";
|
|
||||||
|
|
||||||
export default function AdminForumListComment() {
|
export default function AdminForumListComment() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
|
||||||
|
|
||||||
console.log("[ID]", id);
|
|
||||||
|
|
||||||
const [listComment, setListComment] = useState<any[] | null>(null);
|
const [listComment, setListComment] = useState<any[] | null>(null);
|
||||||
|
const [loadList, setLoadList] = useState(false);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
@@ -45,49 +28,32 @@ export default function AdminForumListComment() {
|
|||||||
|
|
||||||
const onLoadComment = async () => {
|
const onLoadComment = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoadList(true);
|
||||||
const response = await apiAdminForumCommentById({
|
const response = await apiAdminForumCommentById({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
category: "get-all",
|
category: "get-all",
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES COMMENT]", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setListComment(response.data);
|
setListComment(response.data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
setListComment([]);
|
setListComment([]);
|
||||||
|
} finally {
|
||||||
|
setLoadList(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlerAction = (item: { value: string; path: string }) => {
|
|
||||||
if (item.value === "delete") {
|
|
||||||
AlertDefaultSystem({
|
|
||||||
title: "Hapus Posting",
|
|
||||||
message: "Apakah Anda yakin ingin menghapus posting ini?",
|
|
||||||
textLeft: "Batal",
|
|
||||||
textRight: "Hapus",
|
|
||||||
onPressRight: () => {
|
|
||||||
Toast.show({
|
|
||||||
type: "success",
|
|
||||||
text1: "Posting berhasil dihapus",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
router.navigate(item.path as any);
|
|
||||||
}
|
|
||||||
setOpenDrawerAction(false);
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper
|
||||||
headerComponent={<AdminBackButtonAntTitle title="Daftar Komentar" />}
|
headerComponent={<AdminBackButtonAntTitle title="Daftar Komentar" />}
|
||||||
>
|
>
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<AdminTitleTable title1="Aksi" title2="Username" title3="Komentar" />
|
<AdminTitleTable title1="Aksi" title2="Report" title3="Komentar" />
|
||||||
<Divider />
|
<Divider />
|
||||||
{!listComment ? (
|
{loadList ? (
|
||||||
<LoaderCustom />
|
<LoaderCustom />
|
||||||
) : _.isEmpty(listComment) ? (
|
) : _.isEmpty(listComment) ? (
|
||||||
<TextCustom align="center" color="gray">
|
<TextCustom align="center" color="gray">
|
||||||
@@ -108,7 +74,7 @@ export default function AdminForumListComment() {
|
|||||||
}
|
}
|
||||||
value2={
|
value2={
|
||||||
<TextCustom truncate={1}>
|
<TextCustom truncate={1}>
|
||||||
{item?.Author?.username || "-"}
|
{item?.countReport || 0}
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
}
|
}
|
||||||
value3={
|
value3={
|
||||||
@@ -120,34 +86,6 @@ export default function AdminForumListComment() {
|
|||||||
</StackCustom>
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
<DrawerCustom
|
|
||||||
isVisible={openDrawerAction}
|
|
||||||
closeDrawer={() => setOpenDrawerAction(false)}
|
|
||||||
height={"auto"}
|
|
||||||
>
|
|
||||||
<MenuDrawerDynamicGrid
|
|
||||||
data={[
|
|
||||||
{
|
|
||||||
icon: <IconView />,
|
|
||||||
label: "Detail Komentar",
|
|
||||||
value: "detail",
|
|
||||||
path: `admin/forum/${id}/list-report-comment`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: (
|
|
||||||
<IconTrash size={ICON_SIZE_MEDIUM} color={MainColor.white} />
|
|
||||||
),
|
|
||||||
label: "Hapus Komentar",
|
|
||||||
value: "delete",
|
|
||||||
path: "",
|
|
||||||
color: MainColor.red,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
onPressItem={(item) => {
|
|
||||||
handlerAction(item as any);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</DrawerCustom>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
DrawerCustom,
|
DrawerCustom,
|
||||||
|
LoaderCustom,
|
||||||
MenuDrawerDynamicGrid,
|
MenuDrawerDynamicGrid,
|
||||||
Spacing,
|
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
@@ -19,18 +19,31 @@ import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
|||||||
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { apiAdminForumCommentById } from "@/service/api-admin/api-admin-forum";
|
import {
|
||||||
|
apiAdminForumCommentById,
|
||||||
|
apiAdminForumDeactivateComment,
|
||||||
|
apiAdminForumListReportCommentById,
|
||||||
|
} from "@/service/api-admin/api-admin-forum";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminForumReportComment() {
|
export default function AdminForumReportComment() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
console.log("[ID]", id);
|
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [listReport, setListReport] = useState<any[] | null>(null);
|
||||||
|
const [loadList, setLoadList] = useState(false);
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
||||||
|
const [selectedReport, setSelectedReport] = useState({
|
||||||
|
id: "",
|
||||||
|
username: "",
|
||||||
|
kategori: "",
|
||||||
|
keterangan: "",
|
||||||
|
deskripsi: "",
|
||||||
|
});
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
@@ -40,18 +53,28 @@ export default function AdminForumReportComment() {
|
|||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoadList(true);
|
||||||
const response = await apiAdminForumCommentById({
|
const response = await apiAdminForumCommentById({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
category: "get-one",
|
category: "get-one",
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES GET ONE COMMENT]", JSON.stringify(response, null, 2));
|
const responseReport = await apiAdminForumListReportCommentById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
}
|
}
|
||||||
|
if (responseReport.success) {
|
||||||
|
setListReport(responseReport.data);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
setData(null);
|
setData(null);
|
||||||
|
setListReport([]);
|
||||||
|
} finally {
|
||||||
|
setLoadList(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,34 +108,52 @@ export default function AdminForumReportComment() {
|
|||||||
|
|
||||||
<AdminComp_BoxTitle title="Daftar Report Komentar" />
|
<AdminComp_BoxTitle title="Daftar Report Komentar" />
|
||||||
|
|
||||||
<BaseBox>
|
<StackCustom>
|
||||||
<AdminTitleTable
|
<AdminTitleTable
|
||||||
title1="Aksi"
|
title1="Aksi"
|
||||||
title2="Username"
|
title2="Pelapor"
|
||||||
title3="Kategori Report"
|
title3="Kategori Report"
|
||||||
/>
|
/>
|
||||||
<Spacing />
|
|
||||||
<Divider />
|
<Divider />
|
||||||
{Array.from({ length: 5 }).map((_, index) => (
|
{loadList ? (
|
||||||
<AdminTableValue
|
<LoaderCustom />
|
||||||
key={index}
|
) : _.isEmpty(listReport) ? (
|
||||||
value1={
|
<TextCustom align="center" color="gray">
|
||||||
<ActionIcon
|
Tidak ada report
|
||||||
icon={<IconView size={ICON_SIZE_BUTTON} color="black" />}
|
</TextCustom>
|
||||||
onPress={() => {
|
) : (
|
||||||
setOpenDrawerAction(true);
|
listReport?.map((item: any, index: number) => (
|
||||||
}}
|
<AdminTableValue
|
||||||
/>
|
key={index}
|
||||||
}
|
value1={
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
<ActionIcon
|
||||||
value3={
|
icon={<IconView size={ICON_SIZE_BUTTON} color="black" />}
|
||||||
<TextCustom truncate={2} align="center">
|
onPress={() => {
|
||||||
SPAM
|
setOpenDrawerAction(true);
|
||||||
</TextCustom>
|
setSelectedReport({
|
||||||
}
|
id: item.id,
|
||||||
/>
|
username: item.User?.username,
|
||||||
))}
|
kategori: item.ForumMaster_KategoriReport?.title,
|
||||||
</BaseBox>
|
keterangan: item.ForumMaster_KategoriReport?.deskripsi,
|
||||||
|
deskripsi: item.deskripsi,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value2={
|
||||||
|
<TextCustom truncate={1}>
|
||||||
|
{item?.User?.username || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
value3={
|
||||||
|
<TextCustom truncate={2} align="center">
|
||||||
|
{item?.ForumMaster_KategoriReport?.title || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
<DrawerCustom
|
<DrawerCustom
|
||||||
@@ -136,7 +177,19 @@ export default function AdminForumReportComment() {
|
|||||||
message: "Apakah Anda yakin ingin menghapus komentar ini?",
|
message: "Apakah Anda yakin ingin menghapus komentar ini?",
|
||||||
textLeft: "Batal",
|
textLeft: "Batal",
|
||||||
textRight: "Hapus",
|
textRight: "Hapus",
|
||||||
onPressRight: () => {
|
onPressRight: async () => {
|
||||||
|
const deleteComment = await apiAdminForumDeactivateComment({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!deleteComment.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Komentar gagal dihapus",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setOpenDrawer(false);
|
setOpenDrawer(false);
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "success",
|
type: "success",
|
||||||
@@ -154,37 +207,39 @@ export default function AdminForumReportComment() {
|
|||||||
closeDrawer={() => setOpenDrawerAction(false)}
|
closeDrawer={() => setOpenDrawerAction(false)}
|
||||||
height={"auto"}
|
height={"auto"}
|
||||||
>
|
>
|
||||||
{listDataAction.map((item, i) => (
|
<StackCustom>
|
||||||
<GridDetail_4_8
|
<GridDetail_4_8
|
||||||
key={i}
|
label={<TextCustom bold>Pelapor</TextCustom>}
|
||||||
label={<TextCustom bold>{item.label}</TextCustom>}
|
value={<TextCustom>{selectedReport?.username || "-"}</TextCustom>}
|
||||||
value={<TextCustom>{item.value}</TextCustom>}
|
|
||||||
/>
|
/>
|
||||||
))}
|
|
||||||
|
{selectedReport?.kategori && (
|
||||||
|
<>
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Kategori Report</TextCustom>}
|
||||||
|
value={
|
||||||
|
<TextCustom>{selectedReport?.kategori || "-"}</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Keterangan</TextCustom>}
|
||||||
|
value={
|
||||||
|
<TextCustom>{selectedReport?.keterangan || "-"}</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{selectedReport?.deskripsi && (
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Deskripsi</TextCustom>}
|
||||||
|
value={
|
||||||
|
<TextCustom>{selectedReport?.deskripsi || "-"}</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</DrawerCustom>
|
</DrawerCustom>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
label: "Username",
|
|
||||||
value: "Username",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const listDataAction = [
|
|
||||||
{
|
|
||||||
label: "Username",
|
|
||||||
value: "Riyusa",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Kategori Report",
|
|
||||||
value: "SPAM",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Deskripsi",
|
|
||||||
value:
|
|
||||||
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis asperiores quidem deleniti architecto eaque et nostrum, ad consequuntur eveniet quisquam quae voluptatum ducimus! Dolorem nobis modi officia debitis, beatae mollitia.",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
DrawerCustom,
|
DrawerCustom,
|
||||||
|
LoaderCustom,
|
||||||
MenuDrawerDynamicGrid,
|
MenuDrawerDynamicGrid,
|
||||||
Spacing,
|
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
@@ -19,15 +20,64 @@ import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
|||||||
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { router } from "expo-router";
|
import {
|
||||||
import { useState } from "react";
|
apiAdminForumDeactivatePosting,
|
||||||
|
apiAdminForumListReportPostingById,
|
||||||
|
apiAdminForumPostingById,
|
||||||
|
} from "@/service/api-admin/api-admin-forum";
|
||||||
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminForumReportPosting() {
|
export default function AdminForumReportPosting() {
|
||||||
|
const { id } = useLocalSearchParams();
|
||||||
const [openDrawerPage, setOpenDrawerPage] = useState(false);
|
const [openDrawerPage, setOpenDrawerPage] = useState(false);
|
||||||
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
||||||
|
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [listReport, setListReport] = useState<any[] | null>(null);
|
||||||
|
const [loadListReport, setLoadListReport] = useState(false);
|
||||||
|
const [selectedReport, setSelectedReport] = useState({
|
||||||
|
id: "",
|
||||||
|
username: "",
|
||||||
|
kategori: "",
|
||||||
|
keterangan: "",
|
||||||
|
deskripsi: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadListReport(true);
|
||||||
|
const response = await apiAdminForumPostingById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
const responseReport = await apiAdminForumListReportPostingById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseReport.success) {
|
||||||
|
setListReport(responseReport.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadListReport(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper
|
||||||
@@ -45,50 +95,86 @@ export default function AdminForumReportPosting() {
|
|||||||
>
|
>
|
||||||
<BaseBox>
|
<BaseBox>
|
||||||
<StackCustom gap={"sm"}>
|
<StackCustom gap={"sm"}>
|
||||||
{listData.map((item, i) => (
|
<GridDetail_4_8
|
||||||
<GridDetail_4_8
|
label={<TextCustom bold>Username</TextCustom>}
|
||||||
key={i}
|
value={<TextCustom>{data?.Author?.username || "-"}</TextCustom>}
|
||||||
label={<TextCustom bold>{item.label}</TextCustom>}
|
/>
|
||||||
value={<TextCustom>{item.value}</TextCustom>}
|
|
||||||
/>
|
<GridDetail_4_8
|
||||||
))}
|
label={<TextCustom bold>Status</TextCustom>}
|
||||||
<TextCustom bold>Posting</TextCustom>
|
value={
|
||||||
<TextCustom>
|
data && data?.ForumMaster_StatusPosting?.status ? (
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit.
|
<BadgeCustom
|
||||||
Asperiores cupiditate nobis dignissimos explicabo quo unde dolorum
|
color={
|
||||||
numquam eos ab laborum fugiat illo nam velit quibusdam, maxime
|
data?.ForumMaster_StatusPosting?.status === "Open"
|
||||||
assumenda aut vero provident!
|
? MainColor.green
|
||||||
</TextCustom>
|
: MainColor.red
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{data?.ForumMaster_StatusPosting?.status === "Open"
|
||||||
|
? "Open"
|
||||||
|
: "Close"}
|
||||||
|
</BadgeCustom>
|
||||||
|
) : (
|
||||||
|
<TextCustom>{"-"}</TextCustom>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Postingan</TextCustom>}
|
||||||
|
value={<TextCustom>{data?.diskusi || "-"}</TextCustom>}
|
||||||
|
/>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
<AdminComp_BoxTitle title="Daftar Report Posting" />
|
<AdminComp_BoxTitle title="Daftar Report Posting" />
|
||||||
<BaseBox>
|
<StackCustom gap={"sm"}>
|
||||||
<AdminTitleTable
|
<AdminTitleTable
|
||||||
title1="Aksi"
|
title1="Aksi"
|
||||||
title2="Username"
|
title2="Pelapor"
|
||||||
title3="Kategori Report"
|
title3="Kategori Report"
|
||||||
/>
|
/>
|
||||||
<Spacing />
|
|
||||||
<Divider />
|
<Divider />
|
||||||
{Array.from({ length: 5 }).map((_, index) => (
|
{loadListReport ? (
|
||||||
<AdminTableValue
|
<LoaderCustom />
|
||||||
key={index}
|
) : _.isEmpty(listReport) ? (
|
||||||
value1={
|
<TextCustom align="center" color={"gray"}>
|
||||||
<ActionIcon
|
Belum ada report
|
||||||
icon={<IconView size={ICON_SIZE_BUTTON} color="black" />}
|
</TextCustom>
|
||||||
onPress={() => setOpenDrawerAction(true)}
|
) : (
|
||||||
/>
|
listReport?.map((item: any, index: number) => (
|
||||||
}
|
<AdminTableValue
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
key={index}
|
||||||
value3={
|
value1={
|
||||||
<TextCustom truncate={2} align="center">
|
<ActionIcon
|
||||||
SPAM
|
icon={<IconView size={ICON_SIZE_BUTTON} color="black" />}
|
||||||
</TextCustom>
|
onPress={() => {
|
||||||
}
|
setOpenDrawerAction(true);
|
||||||
/>
|
setSelectedReport({
|
||||||
))}
|
id: item?.id,
|
||||||
</BaseBox>
|
username: item?.User?.username,
|
||||||
|
kategori: item?.ForumMaster_KategoriReport?.title,
|
||||||
|
keterangan: item?.ForumMaster_KategoriReport?.deskripsi,
|
||||||
|
deskripsi: item?.deskripsi,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value2={
|
||||||
|
<TextCustom truncate={1}>
|
||||||
|
{item?.User?.username || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
value3={
|
||||||
|
<TextCustom truncate={2} align="center">
|
||||||
|
{item?.ForumMaster_KategoriReport?.title || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
<DrawerCustom
|
<DrawerCustom
|
||||||
@@ -112,13 +198,25 @@ export default function AdminForumReportPosting() {
|
|||||||
message: "Apakah Anda yakin ingin menghapus posting ini?",
|
message: "Apakah Anda yakin ingin menghapus posting ini?",
|
||||||
textLeft: "Batal",
|
textLeft: "Batal",
|
||||||
textRight: "Hapus",
|
textRight: "Hapus",
|
||||||
onPressRight: () => {
|
onPressRight: async () => {
|
||||||
|
const response = await apiAdminForumDeactivatePosting({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Posting gagal dihapus",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setOpenDrawerPage(false);
|
setOpenDrawerPage(false);
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "success",
|
type: "success",
|
||||||
text1: "Posting berhasil dihapus",
|
text1: "Posting berhasil dihapus",
|
||||||
});
|
});
|
||||||
router.back()
|
router.back();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
@@ -130,41 +228,39 @@ export default function AdminForumReportPosting() {
|
|||||||
closeDrawer={() => setOpenDrawerAction(false)}
|
closeDrawer={() => setOpenDrawerAction(false)}
|
||||||
height={"auto"}
|
height={"auto"}
|
||||||
>
|
>
|
||||||
{listDataAction.map((item, i) => (
|
<StackCustom>
|
||||||
<GridDetail_4_8
|
<GridDetail_4_8
|
||||||
key={i}
|
label={<TextCustom bold>Pelapor</TextCustom>}
|
||||||
label={<TextCustom bold>{item.label}</TextCustom>}
|
value={<TextCustom>{selectedReport?.username || "-"}</TextCustom>}
|
||||||
value={<TextCustom>{item.value}</TextCustom>}
|
|
||||||
/>
|
/>
|
||||||
))}
|
|
||||||
|
{selectedReport?.kategori && (
|
||||||
|
<>
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Kategori Report</TextCustom>}
|
||||||
|
value={
|
||||||
|
<TextCustom>{selectedReport?.kategori || "-"}</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Keterangan</TextCustom>}
|
||||||
|
value={
|
||||||
|
<TextCustom>{selectedReport?.keterangan || "-"}</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{selectedReport?.deskripsi && (
|
||||||
|
<GridDetail_4_8
|
||||||
|
label={<TextCustom bold>Deskripsi</TextCustom>}
|
||||||
|
value={
|
||||||
|
<TextCustom>{selectedReport?.deskripsi || "-"}</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</DrawerCustom>
|
</DrawerCustom>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
label: "Username",
|
|
||||||
value: "Username",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Status",
|
|
||||||
value: <BadgeCustom color={MainColor.green}>Open</BadgeCustom>,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const listDataAction = [
|
|
||||||
{
|
|
||||||
label: "Username",
|
|
||||||
value: "Firman Nusantara",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Kategori Report",
|
|
||||||
value: "SPAM",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Deskripsi",
|
|
||||||
value:
|
|
||||||
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis asperiores quidem deleniti architecto eaque et nostrum, ad consequuntur eveniet quisquam quae voluptatum ducimus! Dolorem nobis modi officia debitis, beatae mollitia.",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export default function AdminForum() {
|
|||||||
category: "dashboard",
|
category: "dashboard",
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES DASHBOARD]", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
}
|
}
|
||||||
@@ -39,12 +38,12 @@ export default function AdminForum() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Report Posting",
|
label: "Report Posting",
|
||||||
value: data?.report_posting || 0,
|
value: data?.reportPosting || 0,
|
||||||
icon: <IconReport size={25} color={MainColor.orange} />,
|
icon: <IconReport size={25} color={MainColor.orange} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Report Comment",
|
label: "Report Comment",
|
||||||
value: data?.report_comment || 0,
|
value: data?.reportComment || 0,
|
||||||
icon: <IconReport size={25} color={MainColor.red} />,
|
icon: <IconReport size={25} color={MainColor.red} />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BaseBox,
|
|
||||||
LoaderCustom,
|
LoaderCustom,
|
||||||
SearchInput,
|
SearchInput,
|
||||||
Spacing,
|
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
@@ -39,8 +37,7 @@ export default function AdminForumPosting() {
|
|||||||
category: "posting",
|
category: "posting",
|
||||||
search: search,
|
search: search,
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("[RES LIST POSTING]", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setList(response.data);
|
setList(response.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BaseBox,
|
LoaderCustom,
|
||||||
Divider,
|
|
||||||
SearchInput,
|
SearchInput,
|
||||||
Spacing,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
@@ -14,14 +14,48 @@ import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
|||||||
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { router } from "expo-router";
|
import { apiAdminForum } from "@/service/api-admin/api-admin-forum";
|
||||||
|
import { router, useFocusEffect } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import { Divider } from "react-native-paper";
|
||||||
|
|
||||||
export default function AdminForumReportComment() {
|
export default function AdminForumReportComment() {
|
||||||
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
|
const [loadList, setLoadList] = useState<boolean>(false);
|
||||||
|
const [search, setSearch] = useState<string>("");
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [search])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadList(true);
|
||||||
|
|
||||||
|
const response = await apiAdminForum({
|
||||||
|
category: "report_comment",
|
||||||
|
search: search,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setListData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadList(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const rightComponent = (
|
const rightComponent = (
|
||||||
<SearchInput
|
<SearchInput
|
||||||
containerStyle={{ width: "100%", marginBottom: 0 }}
|
containerStyle={{ width: "100%", marginBottom: 0 }}
|
||||||
placeholder="Cari Komentar"
|
placeholder="Cari Komentar"
|
||||||
|
value={search}
|
||||||
|
onChangeText={setSearch}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -29,36 +63,56 @@ export default function AdminForumReportComment() {
|
|||||||
<>
|
<>
|
||||||
<ViewWrapper headerComponent={<AdminTitlePage title="Forum" />}>
|
<ViewWrapper headerComponent={<AdminTitlePage title="Forum" />}>
|
||||||
<AdminComp_BoxTitle
|
<AdminComp_BoxTitle
|
||||||
title="Report Comment"
|
title="Report Komentar"
|
||||||
rightComponent={rightComponent}
|
rightComponent={rightComponent}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BaseBox>
|
<StackCustom gap={"sm"}>
|
||||||
<AdminTitleTable title1="Aksi" title2="Pelapor" title3="Jenis Laporan" />
|
<AdminTitleTable
|
||||||
<Spacing />
|
title1="Aksi"
|
||||||
|
title2="Pelapor"
|
||||||
|
title3="Jenis Laporan"
|
||||||
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
{loadList ? (
|
||||||
<AdminTableValue
|
<LoaderCustom />
|
||||||
key={index}
|
) : _.isEmpty(listData) ? (
|
||||||
value1={
|
<TextCustom align="center" color="gray">
|
||||||
<ActionIcon
|
Belum ada data
|
||||||
icon={
|
</TextCustom>
|
||||||
<IconView size={ICON_SIZE_BUTTON} color={MainColor.black} />
|
) : (
|
||||||
}
|
listData?.map((item: any, index: number) => (
|
||||||
onPress={() => {
|
<AdminTableValue
|
||||||
router.push(`/admin/forum/${index + 1}/list-report-comment`);
|
key={index}
|
||||||
}}
|
value1={
|
||||||
/>
|
<ActionIcon
|
||||||
}
|
icon={
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
<IconView
|
||||||
value3={
|
size={ICON_SIZE_BUTTON}
|
||||||
<TextCustom truncate={2} align="center">
|
color={MainColor.black}
|
||||||
SPAM
|
/>
|
||||||
</TextCustom>
|
}
|
||||||
}
|
onPress={() => {
|
||||||
/>
|
router.push(
|
||||||
))}
|
`/admin/forum/${item?.Forum_Komentar?.id}/list-report-comment`
|
||||||
</BaseBox>
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value2={
|
||||||
|
<TextCustom truncate={1}>
|
||||||
|
{item?.User?.username || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
value3={
|
||||||
|
<TextCustom truncate={2} align="center">
|
||||||
|
{item?.ForumMaster_KategoriReport?.title || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BaseBox,
|
|
||||||
Divider,
|
Divider,
|
||||||
|
LoaderCustom,
|
||||||
SearchInput,
|
SearchInput,
|
||||||
Spacing,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconView } from "@/components/_Icon/IconComponent";
|
import { IconView } from "@/components/_Icon/IconComponent";
|
||||||
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
@@ -15,17 +15,47 @@ import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
|||||||
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { router } from "expo-router";
|
import { apiAdminForum } from "@/service/api-admin/api-admin-forum";
|
||||||
import { useState } from "react";
|
import { router, useFocusEffect } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function AdminForumReportPosting() {
|
export default function AdminForumReportPosting() {
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
const [id, setId] = useState<any>();
|
const [loadList, setLoadList] = useState<boolean>(false);
|
||||||
|
const [search, setSearch] = useState<string>("");
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [search])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadList(true);
|
||||||
|
|
||||||
|
const response = await apiAdminForum({
|
||||||
|
category: "report_posting",
|
||||||
|
search: search,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setListData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadList(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const rightComponent = (
|
const rightComponent = (
|
||||||
<SearchInput
|
<SearchInput
|
||||||
containerStyle={{ width: "100%", marginBottom: 0 }}
|
containerStyle={{ width: "100%", marginBottom: 0 }}
|
||||||
placeholder="Cari"
|
placeholder="Cari Postingan"
|
||||||
|
value={search}
|
||||||
|
onChangeText={setSearch}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -37,36 +67,49 @@ export default function AdminForumReportPosting() {
|
|||||||
rightComponent={rightComponent}
|
rightComponent={rightComponent}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BaseBox>
|
<StackCustom gap={"sm"}>
|
||||||
<AdminTitleTable title1="Aksi" title2="Pelapor" title3="Postingan" />
|
<AdminTitleTable title1="Aksi" title2="Pelapor" title3="Postingan" />
|
||||||
<Spacing />
|
|
||||||
<Divider />
|
<Divider />
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
{loadList ? (
|
||||||
<AdminTableValue
|
<LoaderCustom />
|
||||||
key={index}
|
) : _.isEmpty(listData) ? (
|
||||||
value1={
|
<TextCustom align="center" color="gray">
|
||||||
<ActionIcon
|
Belum ada data
|
||||||
icon={
|
</TextCustom>
|
||||||
<IconView size={ICON_SIZE_BUTTON} color={MainColor.black} />
|
) : (
|
||||||
}
|
listData?.map((item: any, index: number) => (
|
||||||
onPress={() => {
|
<AdminTableValue
|
||||||
router.push(`/admin/forum/${id}/list-report-posting`);
|
key={index}
|
||||||
}}
|
value1={
|
||||||
/>
|
<ActionIcon
|
||||||
}
|
icon={
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
<IconView
|
||||||
value3={
|
size={ICON_SIZE_BUTTON}
|
||||||
<TextCustom truncate={2} align="center">
|
color={MainColor.black}
|
||||||
Lorem, ipsum dolor sit amet consectetur adipisicing elit.
|
/>
|
||||||
Omnis laborum doloremque eius velit voluptate corrupti vel,
|
}
|
||||||
provident quaerat tempore animi sed accusamus amet.
|
onPress={() => {
|
||||||
Temporibus, praesentium? Rem voluptatum nesciunt voluptas
|
router.push(
|
||||||
repellat.
|
`/admin/forum/${item?.Forum_Posting?.id}/list-report-posting`
|
||||||
</TextCustom>
|
);
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
}
|
||||||
</BaseBox>
|
value2={
|
||||||
|
<TextCustom truncate={1}>
|
||||||
|
{item?.User?.username || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
value3={
|
||||||
|
<TextCustom truncate={2} align="center">
|
||||||
|
{item?.Forum_Posting?.diskusi || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
@@ -14,14 +15,42 @@ import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
|||||||
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
||||||
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
||||||
|
import { dateTimeView } from "@/utils/dateTimeView";
|
||||||
|
import { Entypo } from "@expo/vector-icons";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
import { List } from "react-native-paper";
|
import { List } from "react-native-paper";
|
||||||
|
|
||||||
export default function AdminVotingDetail() {
|
export default function AdminVotingDetail() {
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
|
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminVotingById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("[DATA BY ID]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const colorBadge = () => {
|
const colorBadge = () => {
|
||||||
if (status === "publish") {
|
if (status === "publish") {
|
||||||
return MainColor.green;
|
return MainColor.green;
|
||||||
@@ -37,63 +66,53 @@ export default function AdminVotingDetail() {
|
|||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
label: "Username",
|
label: "Username",
|
||||||
value: "Bagas Banuna",
|
value: (data && data?.Author?.username) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Judul",
|
label: "Judul",
|
||||||
value: `Judul Proyek: ${id}Lorem ipsum dolor sit amet consectetur adipisicing elit.`,
|
value: (data && data?.title) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Status",
|
label: "Status",
|
||||||
value: (
|
value:
|
||||||
<BadgeCustom color={colorBadge()}>
|
data && data?.Voting_Status?.name ? (
|
||||||
{_.startCase(status as string)}
|
<BadgeCustom color={colorBadge()}>
|
||||||
</BadgeCustom>
|
{_.startCase(data?.Voting_Status?.name)}
|
||||||
),
|
</BadgeCustom>
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Mulai Voting",
|
label: "Mulai Voting",
|
||||||
value: dayjs().format("DD/MM/YYYY"),
|
value:
|
||||||
|
(data && data?.awalVote && dateTimeView({ date: data?.awalVote })) ||
|
||||||
|
"-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Voting Berakhir",
|
label: "Voting Berakhir",
|
||||||
value: dayjs().format("DD/MM/YYYY"),
|
value:
|
||||||
|
(data && data?.akhirVote && dateTimeView({ date: data?.akhirVote })) ||
|
||||||
|
"-",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: "Deskripsi",
|
label: "Deskripsi",
|
||||||
value: "Lorem ipsum dolor sit amet consectetur adipisicing elit.",
|
value: (data && data?.deskripsi) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Daftar Pilhan",
|
label: "Daftar Pilihan",
|
||||||
value: (
|
value:
|
||||||
<>
|
data && data?.Voting_DaftarNamaVote
|
||||||
<List.Item
|
? data?.Voting_DaftarNamaVote?.map((item: any, i: number) => (
|
||||||
title={<TextCustom>Pilihan 1</TextCustom>}
|
<List.Item
|
||||||
left={(props) => (
|
key={i}
|
||||||
<List.Icon {...props} icon="circle" color={MainColor.yellow} />
|
title={<TextCustom>{item?.value}</TextCustom>}
|
||||||
)}
|
left={(props) => (
|
||||||
/>
|
<Entypo name="chevron-right" color={MainColor.yellow} />
|
||||||
<List.Item
|
)}
|
||||||
title={<TextCustom>Pilihan 2</TextCustom>}
|
/>
|
||||||
left={(props) => (
|
))
|
||||||
<List.Icon {...props} icon="circle" color={MainColor.yellow} />
|
: "-",
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<List.Item
|
|
||||||
title={<TextCustom>Pilihan 3</TextCustom>}
|
|
||||||
left={(props) => (
|
|
||||||
<List.Icon {...props} icon="circle" color={MainColor.yellow} />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<List.Item
|
|
||||||
title={<TextCustom>Pilihan 4</TextCustom>}
|
|
||||||
left={(props) => (
|
|
||||||
<List.Icon {...props} icon="circle" color={MainColor.yellow} />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -121,17 +140,23 @@ export default function AdminVotingDetail() {
|
|||||||
</TextCustom>
|
</TextCustom>
|
||||||
<Spacing />
|
<Spacing />
|
||||||
<Grid>
|
<Grid>
|
||||||
|
{Array.from({ length: 4 }).map((_, index) => (
|
||||||
{Array.from({length: 4}).map((_, index) => (
|
<Grid.Col
|
||||||
<Grid.Col key={index} span={3} style={{ paddingRight: 3, paddingLeft: 3 }}>
|
key={index}
|
||||||
<StackCustom gap={"sm"}>
|
span={3}
|
||||||
<CircleContainer value={index % 3 * 3} style={{ alignSelf: "center" }} />
|
style={{ paddingRight: 3, paddingLeft: 3 }}
|
||||||
<TextCustom size="small" align="center">
|
>
|
||||||
Pilihan {index + 1}
|
<StackCustom gap={"sm"}>
|
||||||
</TextCustom>
|
<CircleContainer
|
||||||
</StackCustom>
|
value={(index % 3) * 3}
|
||||||
</Grid.Col>
|
style={{ alignSelf: "center" }}
|
||||||
))}
|
/>
|
||||||
|
<TextCustom size="small" align="center">
|
||||||
|
Pilihan {index + 1}
|
||||||
|
</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
</Grid.Col>
|
||||||
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,27 +1,66 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
SearchInput,
|
LoaderCustom,
|
||||||
Spacing,
|
SearchInput,
|
||||||
TextCustom,
|
Spacing,
|
||||||
ViewWrapper,
|
StackCustom,
|
||||||
|
TextCustom,
|
||||||
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
||||||
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
||||||
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
|
import { apiAdminVoting } from "@/service/api-admin/api-admin-voting";
|
||||||
import { Octicons } from "@expo/vector-icons";
|
import { Octicons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { useState, useCallback } from "react";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
|
|
||||||
export default function AdminVotingStatus() {
|
export default function AdminVotingStatus() {
|
||||||
const { status } = useLocalSearchParams();
|
const { status } = useLocalSearchParams();
|
||||||
|
console.log("[STATUS]", status);
|
||||||
|
|
||||||
|
const [list, setList] = useState<any | null>(null);
|
||||||
|
const [loadList, setLoadList] = useState(false);
|
||||||
|
const [search, setSearch] = useState<string>("");
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [status, search])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadList(true);
|
||||||
|
const response = await apiAdminVoting({
|
||||||
|
category: status as "publish" | "review" | "reject" as any,
|
||||||
|
search,
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log("[LIST BY STATUS]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setList(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadList(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const rightComponent = (
|
const rightComponent = (
|
||||||
<SearchInput
|
<SearchInput
|
||||||
containerStyle={{ width: "100%", marginBottom: 0 }}
|
containerStyle={{ width: "100%", marginBottom: 0 }}
|
||||||
placeholder="Cari"
|
placeholder="Cari"
|
||||||
|
value={search}
|
||||||
|
onChangeText={setSearch}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
@@ -32,18 +71,17 @@ export default function AdminVotingStatus() {
|
|||||||
rightComponent={rightComponent}
|
rightComponent={rightComponent}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BaseBox>
|
<StackCustom gap={"sm"}>
|
||||||
<AdminTitleTable
|
<AdminTitleTable
|
||||||
title1="Aksi"
|
title1="Aksi"
|
||||||
title2="Username"
|
title2="Username"
|
||||||
title3="Judul Voting"
|
title3="Judul Voting"
|
||||||
/>
|
/>
|
||||||
<Spacing />
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
{loadList ? <LoaderCustom/> : _.isEmpty(list) ? <TextCustom align="center" bold color="gray">Belum ada data</TextCustom> : list.map((item: any, i: number) => (
|
||||||
<AdminTableValue
|
<AdminTableValue
|
||||||
key={index}
|
key={i}
|
||||||
value1={
|
value1={
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
icon={
|
icon={
|
||||||
@@ -54,22 +92,19 @@ export default function AdminVotingStatus() {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
router.push(`/admin/voting/${index}/${status}`);
|
router.push(`/admin/voting/${item.id}/${status}`);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
value2={<TextCustom truncate={1}>{item?.Author?.username || "-"}</TextCustom>}
|
||||||
value3={
|
value3={
|
||||||
<TextCustom truncate={2}>
|
<TextCustom align="center" truncate={2}>
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit.
|
{item?.title || "-"}
|
||||||
Blanditiis asperiores quidem deleniti architecto eaque et
|
|
||||||
nostrum, ad consequuntur eveniet quisquam quae voluptatum
|
|
||||||
ducimus! Dolorem nobis modi officia debitis, beatae mollitia.
|
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</BaseBox>
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,8 +8,56 @@ import {
|
|||||||
import AdminComp_BoxDashboard from "@/components/_ShareComponent/Admin/BoxDashboard";
|
import AdminComp_BoxDashboard from "@/components/_ShareComponent/Admin/BoxDashboard";
|
||||||
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { apiAdminVoting } from "@/service/api-admin/api-admin-voting";
|
||||||
|
import { useFocusEffect } from "expo-router";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function AdminVoting() {
|
export default function AdminVoting() {
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminVoting({
|
||||||
|
category: "dashboard",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const listData = [
|
||||||
|
{
|
||||||
|
label: "Publish",
|
||||||
|
value: (data && data?.publish) || 0,
|
||||||
|
icon: <IconPublish size={25} color={MainColor.green} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Review",
|
||||||
|
value: (data && data?.review) || 0,
|
||||||
|
icon: <IconReview size={25} color={MainColor.orange} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Reject",
|
||||||
|
value: (data && data?.reject) || 0,
|
||||||
|
icon: <IconReject size={25} color={MainColor.red} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Riwayat",
|
||||||
|
value: (data && data?.history) || 0,
|
||||||
|
icon: <IconArchive size={25} color={MainColor.white_gray} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
@@ -24,26 +72,3 @@ export default function AdminVoting() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
label: "Publish",
|
|
||||||
value: 4,
|
|
||||||
icon: <IconPublish size={25} color={MainColor.green} />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Review",
|
|
||||||
value: 7,
|
|
||||||
icon: <IconReview size={25} color={MainColor.orange} />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Reject",
|
|
||||||
value: 5,
|
|
||||||
icon: <IconReject size={25} color={MainColor.red} />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Riwayat",
|
|
||||||
value: 5,
|
|
||||||
icon: <IconArchive size={25} color={MainColor.white_gray} />,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const adminListMenu: NavbarItem[] = [
|
|||||||
{ label: "Dashboard", link: "/admin/forum" },
|
{ label: "Dashboard", link: "/admin/forum" },
|
||||||
{ label: "Posting", link: "/admin/forum/posting" },
|
{ label: "Posting", link: "/admin/forum/posting" },
|
||||||
{ label: "Report Posting", link: "/admin/forum/report-posting" },
|
{ label: "Report Posting", link: "/admin/forum/report-posting" },
|
||||||
{ label: "Report Comment", link: "/admin/forum/report-comment" },
|
{ label: "Report Komentar", link: "/admin/forum/report-comment" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@ const superAdminListMenu: NavbarItem[] = [
|
|||||||
{ label: "Dashboard", link: "/admin/forum" },
|
{ label: "Dashboard", link: "/admin/forum" },
|
||||||
{ label: "Posting", link: "/admin/forum/posting" },
|
{ label: "Posting", link: "/admin/forum/posting" },
|
||||||
{ label: "Report Posting", link: "/admin/forum/report-posting" },
|
{ label: "Report Posting", link: "/admin/forum/report-posting" },
|
||||||
{ label: "Report Comment", link: "/admin/forum/report-comment" },
|
{ label: "Report Komentar", link: "/admin/forum/report-comment" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,3 +41,51 @@ export async function apiAdminForumCommentById({
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function apiAdminForumListReportCommentById({
|
||||||
|
id,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/forum/${id}/report-comment`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminForumDeactivateComment({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.put(`/mobile/admin/forum/${id}/comment`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminForumListReportPostingById({
|
||||||
|
id,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/forum/${id}/report-posting`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminForumDeactivatePosting({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.put(`/mobile/admin/forum/${id}`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
31
service/api-admin/api-admin-voting.ts
Normal file
31
service/api-admin/api-admin-voting.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { apiConfig } from "../api-config";
|
||||||
|
|
||||||
|
export async function apiAdminVoting({
|
||||||
|
category,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
category: "dashboard" | "history" | "publish" | "review" | "report";
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/voting?category=${category}&search=${search}`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminVotingById({
|
||||||
|
id,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/admin/voting/${id}`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user