Compare commits
4 Commits
api-admin/
...
api-admin/
| Author | SHA1 | Date | |
|---|---|---|---|
| 4da55a5a8a | |||
| faf0f36e53 | |||
| 57285e5697 | |||
| 1fd9694ebf |
@@ -11,6 +11,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconEdit } from "@/components/_Icon";
|
import { IconEdit } from "@/components/_Icon";
|
||||||
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
||||||
|
import ReportBox from "@/components/Box/ReportBox";
|
||||||
import Job_BoxDetailSection from "@/screens/Job/BoxDetailSection";
|
import Job_BoxDetailSection from "@/screens/Job/BoxDetailSection";
|
||||||
import Job_ButtonStatusSection from "@/screens/Job/ButtonStatusSection";
|
import Job_ButtonStatusSection from "@/screens/Job/ButtonStatusSection";
|
||||||
import { apiJobGetOne } from "@/service/api-client/api-job";
|
import { apiJobGetOne } from "@/service/api-client/api-job";
|
||||||
@@ -70,7 +71,13 @@ export default function JobDetailStatus() {
|
|||||||
<LoaderCustom />
|
<LoaderCustom />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<StackCustom>
|
<StackCustom gap={"xs"}>
|
||||||
|
{data &&
|
||||||
|
data?.catatan &&
|
||||||
|
(status === "draft" || status === "rejected") && (
|
||||||
|
<ReportBox text={data?.catatan} />
|
||||||
|
)}
|
||||||
|
|
||||||
<Job_BoxDetailSection data={data} />
|
<Job_BoxDetailSection data={data} />
|
||||||
<Job_ButtonStatusSection
|
<Job_ButtonStatusSection
|
||||||
id={id as string}
|
id={id as string}
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ import {
|
|||||||
LoaderCustom,
|
LoaderCustom,
|
||||||
MenuDrawerDynamicGrid,
|
MenuDrawerDynamicGrid,
|
||||||
Spacing,
|
Spacing,
|
||||||
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconArchive, IconContribution, IconEdit } from "@/components/_Icon";
|
import { IconArchive, IconContribution, IconEdit } from "@/components/_Icon";
|
||||||
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
||||||
|
import ReportBox from "@/components/Box/ReportBox";
|
||||||
import Voting_BoxDetailHasilVotingSection from "@/screens/Voting/BoxDetailHasilVotingSection";
|
import Voting_BoxDetailHasilVotingSection from "@/screens/Voting/BoxDetailHasilVotingSection";
|
||||||
import { Voting_BoxDetailSection } from "@/screens/Voting/BoxDetailSection";
|
import { Voting_BoxDetailSection } from "@/screens/Voting/BoxDetailSection";
|
||||||
import Voting_ButtonStatusSection from "@/screens/Voting/ButtonStatusSection";
|
import Voting_ButtonStatusSection from "@/screens/Voting/ButtonStatusSection";
|
||||||
@@ -49,6 +51,8 @@ export default function VotingDetailStatus() {
|
|||||||
setLoadingGetData(true);
|
setLoadingGetData(true);
|
||||||
const response = await apiVotingGetOne({ id: id as string });
|
const response = await apiVotingGetOne({ id: id as string });
|
||||||
|
|
||||||
|
console.log("[DATA BY ID]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
}
|
}
|
||||||
@@ -127,6 +131,13 @@ export default function VotingDetailStatus() {
|
|||||||
</BaseBox>
|
</BaseBox>
|
||||||
)}
|
)}
|
||||||
<Spacing height={0} />
|
<Spacing height={0} />
|
||||||
|
|
||||||
|
{data &&
|
||||||
|
data?.catatan &&
|
||||||
|
(status === "draft" || status === "rejected") && (
|
||||||
|
<ReportBox text={data?.catatan} />
|
||||||
|
)}
|
||||||
|
|
||||||
<Voting_BoxDetailSection data={data as any} />
|
<Voting_BoxDetailSection data={data as any} />
|
||||||
{status === "publish" ? (
|
{status === "publish" ? (
|
||||||
<Voting_BoxDetailHasilVotingSection
|
<Voting_BoxDetailHasilVotingSection
|
||||||
|
|||||||
@@ -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>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButt
|
|||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import funUpdateStatus from "@/screens/Admin/Job/funUpdateStatus";
|
import funUpdateStatusJob from "@/screens/Admin/Job/funUpdateStatus";
|
||||||
import { apiAdminJobGetById } from "@/service/api-admin/api-admin-job";
|
import { apiAdminJobGetById } from "@/service/api-admin/api-admin-job";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -88,7 +88,7 @@ export default function AdminJobDetailStatus() {
|
|||||||
changeStatus: "publish" | "review" | "reject";
|
changeStatus: "publish" | "review" | "reject";
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
const response = await funUpdateStatus({
|
const response = await funUpdateStatusJob({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
import funUpdateStatus from "@/screens/Admin/Job/funUpdateStatus";
|
import funUpdateStatusJob from "@/screens/Admin/Job/funUpdateStatus";
|
||||||
import { apiAdminJobGetById } from "@/service/api-admin/api-admin-job";
|
import { apiAdminJobGetById } from "@/service/api-admin/api-admin-job";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
@@ -45,7 +45,7 @@ export default function AdminJobRejectInput() {
|
|||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const response = await funUpdateStatus({
|
const response = await funUpdateStatusJob({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
data: data,
|
data: data,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
@@ -13,90 +14,153 @@ import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButt
|
|||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
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 ReportBox from "@/components/Box/ReportBox";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import funUpdateStatusVoting from "@/screens/Admin/Voting/funUpdateStatus";
|
||||||
|
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
||||||
|
import { colorBadge } from "@/utils/colorBadge";
|
||||||
|
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";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminVotingDetail() {
|
export default function AdminVotingDetail() {
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const colorBadge = () => {
|
console.log("[status]", status);
|
||||||
if (status === "publish") {
|
|
||||||
return MainColor.green;
|
useFocusEffect(
|
||||||
} else if (status === "review") {
|
useCallback(() => {
|
||||||
return MainColor.orange;
|
onLoadData();
|
||||||
} else if (status === "reject") {
|
}, [id])
|
||||||
return MainColor.red;
|
);
|
||||||
} else {
|
|
||||||
return MainColor.placeholder;
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminVotingById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
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({ status: status as string })}>
|
||||||
</BadgeCustom>
|
{status === "history" ? "Riwayat" : _.startCase(status as string)}
|
||||||
),
|
</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} />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const handleUpdate = async ({
|
||||||
|
changeStatus,
|
||||||
|
}: {
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
const dateNow = new Date();
|
||||||
|
// const dateNowHour = dateNow.getHours();
|
||||||
|
// const awalVoteHour = dayjs(data?.awalVote).hour();
|
||||||
|
|
||||||
|
const isBefore = dayjs(dateNow).diff(dayjs(data?.awalVote), "hours") < 0;
|
||||||
|
console.log("[IS BEFORE]", isBefore);
|
||||||
|
|
||||||
|
if (!isBefore) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Tanggal & waktu telah lewat",
|
||||||
|
text2: "Silahkan report dan ubah tanggal & waktu voting",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Berhasil mempublikasikan data",
|
||||||
|
});
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
const response = await funUpdateStatusVoting({
|
||||||
|
id: id as string,
|
||||||
|
changeStatus,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Gagal mempublikasikan data",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Berhasil mempublikasikan data",
|
||||||
|
});
|
||||||
|
|
||||||
|
router.back();
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper
|
||||||
@@ -114,46 +178,59 @@ export default function AdminVotingDetail() {
|
|||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
{status === "publish" && (
|
{status === "publish" ||
|
||||||
<BaseBox>
|
(status === "history" && (
|
||||||
<TextCustom bold align="center">
|
<BaseBox>
|
||||||
Hasil Voting
|
<TextCustom bold align="center">
|
||||||
</TextCustom>
|
Hasil Voting
|
||||||
<Spacing />
|
</TextCustom>
|
||||||
<Grid>
|
<Spacing />
|
||||||
|
<Grid>
|
||||||
{Array.from({length: 4}).map((_, index) => (
|
{data?.Voting_DaftarNamaVote?.map(
|
||||||
<Grid.Col key={index} span={3} style={{ paddingRight: 3, paddingLeft: 3 }}>
|
(item: any, index: number) => (
|
||||||
<StackCustom gap={"sm"}>
|
<Grid.Col
|
||||||
<CircleContainer value={index % 3 * 3} style={{ alignSelf: "center" }} />
|
key={index}
|
||||||
<TextCustom size="small" align="center">
|
span={12 / data?.Voting_DaftarNamaVote?.length}
|
||||||
Pilihan {index + 1}
|
style={{ paddingRight: 3, paddingLeft: 3 }}
|
||||||
</TextCustom>
|
>
|
||||||
</StackCustom>
|
<StackCustom gap={"sm"}>
|
||||||
</Grid.Col>
|
<CircleContainer
|
||||||
))}
|
value={item?.jumlah}
|
||||||
</Grid>
|
style={{ alignSelf: "center" }}
|
||||||
</BaseBox>
|
/>
|
||||||
)}
|
<TextCustom size="small" align="center">
|
||||||
|
{item?.value}
|
||||||
|
</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
</Grid.Col>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</Grid>
|
||||||
|
</BaseBox>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{data &&
|
||||||
|
data?.catatan &&
|
||||||
|
(status === "review" || status === "reject") && (
|
||||||
|
<ReportBox text={data?.catatan} />
|
||||||
|
)}
|
||||||
|
|
||||||
{status === "review" && (
|
{status === "review" && (
|
||||||
<AdminButtonReview
|
<AdminButtonReview
|
||||||
|
isLoading={isLoading}
|
||||||
onPublish={() => {
|
onPublish={() => {
|
||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
title: "Publish",
|
title: "Publish",
|
||||||
message: "Apakah anda yakin ingin mempublikasikan data ini?",
|
message: "Apakah anda yakin ingin mempublikasikan data ini?",
|
||||||
textLeft: "Cancel",
|
textLeft: "Cancel",
|
||||||
textRight: "Publish",
|
textRight: "Publish",
|
||||||
onPressLeft: () => {
|
|
||||||
router.back();
|
|
||||||
},
|
|
||||||
onPressRight: () => {
|
onPressRight: () => {
|
||||||
router.back();
|
handleUpdate({ changeStatus: "publish" });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onReject={() => {
|
onReject={() => {
|
||||||
router.push(`/admin/voting/${id}/reject-input`);
|
router.push(`/admin/voting/${id}/${status}/reject-input`);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -162,7 +239,7 @@ export default function AdminVotingDetail() {
|
|||||||
<AdminButtonReject
|
<AdminButtonReject
|
||||||
title="Tambah Catatan"
|
title="Tambah Catatan"
|
||||||
onReject={() => {
|
onReject={() => {
|
||||||
router.push(`/admin/voting/${id}/reject-input`);
|
router.push(`/admin/voting/${id}/${status}/reject-input`);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
113
app/(application)/admin/voting/[id]/[status]/reject-input.tsx
Normal file
113
app/(application)/admin/voting/[id]/[status]/reject-input.tsx
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
|
import {
|
||||||
|
AlertDefaultSystem,
|
||||||
|
BoxButtonOnFooter,
|
||||||
|
TextAreaCustom,
|
||||||
|
ViewWrapper,
|
||||||
|
} from "@/components";
|
||||||
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
|
import funUpdateStatusVoting from "@/screens/Admin/Voting/funUpdateStatus";
|
||||||
|
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
||||||
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
|
export default function AdminVotingRejectInput() {
|
||||||
|
const { id, status } = useLocalSearchParams();
|
||||||
|
const [data, setData] = useState("");
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminVotingById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data.catatan);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleUpdate = async ({
|
||||||
|
changeStatus,
|
||||||
|
}: {
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
const response = await funUpdateStatusVoting({
|
||||||
|
id: id as string,
|
||||||
|
changeStatus,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Report gagal",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Report berhasil",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (status === "review") {
|
||||||
|
router.replace(`/admin/voting/reject/status`);
|
||||||
|
} else if (status === "reject") {
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const buttonSubmit = (
|
||||||
|
<BoxButtonOnFooter>
|
||||||
|
<AdminButtonReject
|
||||||
|
title="Reject"
|
||||||
|
isLoading={isLoading}
|
||||||
|
onReject={() =>
|
||||||
|
AlertDefaultSystem({
|
||||||
|
title: "Reject",
|
||||||
|
message: "Apakah anda yakin ingin menolak data ini?",
|
||||||
|
textLeft: "Batal",
|
||||||
|
textRight: "Ya",
|
||||||
|
onPressRight: () => handleUpdate({ changeStatus: "reject" }),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</BoxButtonOnFooter>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ViewWrapper
|
||||||
|
footerComponent={buttonSubmit}
|
||||||
|
headerComponent={<AdminBackButtonAntTitle title="Penolakan Voting" />}
|
||||||
|
>
|
||||||
|
<TextAreaCustom
|
||||||
|
value={data}
|
||||||
|
onChangeText={setData}
|
||||||
|
placeholder="Masukan alasan"
|
||||||
|
required
|
||||||
|
showCount
|
||||||
|
maxLength={1000}
|
||||||
|
/>
|
||||||
|
</ViewWrapper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import {
|
|
||||||
AlertDefaultSystem,
|
|
||||||
BoxButtonOnFooter,
|
|
||||||
TextAreaCustom,
|
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
|
||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
|
||||||
import { useState } from "react";
|
|
||||||
|
|
||||||
export default function AdminVotingRejectInput() {
|
|
||||||
const { id } = useLocalSearchParams();
|
|
||||||
const [value, setValue] = useState(id as string);
|
|
||||||
const buttonSubmit = (
|
|
||||||
<BoxButtonOnFooter>
|
|
||||||
<AdminButtonReject
|
|
||||||
title="Reject"
|
|
||||||
onReject={() =>
|
|
||||||
AlertDefaultSystem({
|
|
||||||
title: "Reject",
|
|
||||||
message: "Apakah anda yakin ingin menolak data ini?",
|
|
||||||
textLeft: "Batal",
|
|
||||||
textRight: "Ya",
|
|
||||||
onPressLeft: () => {
|
|
||||||
router.back();
|
|
||||||
},
|
|
||||||
onPressRight: () => {
|
|
||||||
console.log("value:", value);
|
|
||||||
router.replace(`/admin/voting/reject/status`);
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</BoxButtonOnFooter>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<ViewWrapper
|
|
||||||
footerComponent={buttonSubmit}
|
|
||||||
headerComponent={<AdminBackButtonAntTitle title="Penolakan Voting" />}
|
|
||||||
>
|
|
||||||
<TextAreaCustom
|
|
||||||
value={value}
|
|
||||||
onChangeText={setValue}
|
|
||||||
placeholder="Masukan alasan"
|
|
||||||
required
|
|
||||||
showCount
|
|
||||||
maxLength={1000}
|
|
||||||
/>
|
|
||||||
</ViewWrapper>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,27 +1,60 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BaseBox,
|
LoaderCustom,
|
||||||
SearchInput,
|
SearchInput,
|
||||||
Spacing,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
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 { useCallback, useState } 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();
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
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,44 +65,52 @@ 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 ? (
|
||||||
<AdminTableValue
|
<LoaderCustom />
|
||||||
key={index}
|
) : _.isEmpty(list) ? (
|
||||||
value1={
|
<TextCustom align="center" bold color="gray">
|
||||||
<ActionIcon
|
Belum ada data
|
||||||
icon={
|
</TextCustom>
|
||||||
<Octicons
|
) : (
|
||||||
name="eye"
|
list.map((item: any, i: number) => (
|
||||||
size={ICON_SIZE_BUTTON}
|
<AdminTableValue
|
||||||
color="black"
|
key={i}
|
||||||
/>
|
value1={
|
||||||
}
|
<ActionIcon
|
||||||
onPress={() => {
|
icon={
|
||||||
router.push(`/admin/voting/${index}/${status}`);
|
<Octicons
|
||||||
}}
|
name="eye"
|
||||||
/>
|
size={ICON_SIZE_BUTTON}
|
||||||
}
|
color="black"
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
/>
|
||||||
value3={
|
}
|
||||||
<TextCustom truncate={2}>
|
onPress={() => {
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit.
|
router.push(`/admin/voting/${item.id}/${status}`);
|
||||||
Blanditiis asperiores quidem deleniti architecto eaque et
|
}}
|
||||||
nostrum, ad consequuntur eveniet quisquam quae voluptatum
|
/>
|
||||||
ducimus! Dolorem nobis modi officia debitis, beatae mollitia.
|
}
|
||||||
</TextCustom>
|
value2={
|
||||||
}
|
<TextCustom truncate={1}>
|
||||||
/>
|
{item?.Author?.username || "-"}
|
||||||
))}
|
</TextCustom>
|
||||||
</BaseBox>
|
}
|
||||||
|
value3={
|
||||||
|
<TextCustom align="center" truncate={2}>
|
||||||
|
{item?.title || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
104
app/(application)/admin/voting/history.tsx
Normal file
104
app/(application)/admin/voting/history.tsx
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
LoaderCustom,
|
||||||
|
SearchInput,
|
||||||
|
StackCustom,
|
||||||
|
TextCustom,
|
||||||
|
ViewWrapper
|
||||||
|
} from "@/components";
|
||||||
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
|
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
||||||
|
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
||||||
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
|
import { apiAdminVoting } from "@/service/api-admin/api-admin-voting";
|
||||||
|
import { Octicons } from "@expo/vector-icons";
|
||||||
|
import { router, useFocusEffect } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import { Divider } from "react-native-paper";
|
||||||
|
|
||||||
|
export default function AdminVotingHistory() {
|
||||||
|
const [list, setList] = useState<any | null>(null);
|
||||||
|
const [loadList, setLoadList] = useState(false);
|
||||||
|
const [search, setSearch] = useState<string>("");
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [ search])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadList(true);
|
||||||
|
const response = await apiAdminVoting({
|
||||||
|
category: "history",
|
||||||
|
search,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setList(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadList(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const rightComponent = (
|
||||||
|
<SearchInput
|
||||||
|
containerStyle={{ width: "100%", marginBottom: 0 }}
|
||||||
|
placeholder="Cari"
|
||||||
|
value={search}
|
||||||
|
onChangeText={setSearch}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ViewWrapper headerComponent={<AdminTitlePage title="Voting" />}>
|
||||||
|
<AdminComp_BoxTitle
|
||||||
|
title="Riwayat"
|
||||||
|
rightComponent={rightComponent}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<StackCustom gap={"sm"}>
|
||||||
|
<AdminTitleTable
|
||||||
|
title1="Aksi"
|
||||||
|
title2="Username"
|
||||||
|
title3="Judul Voting"
|
||||||
|
/>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
{loadList ? <LoaderCustom/> : _.isEmpty(list) ? <TextCustom align="center" bold color="gray">Belum ada data</TextCustom> : list.map((item: any, i: number) => (
|
||||||
|
<AdminTableValue
|
||||||
|
key={i}
|
||||||
|
value1={
|
||||||
|
<ActionIcon
|
||||||
|
icon={
|
||||||
|
<Octicons
|
||||||
|
name="eye"
|
||||||
|
size={ICON_SIZE_BUTTON}
|
||||||
|
color="black"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onPress={() => {
|
||||||
|
router.push(`/admin/voting/${item.id}/history`);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value2={<TextCustom truncate={1}>{item?.Author?.username || "-"}</TextCustom>}
|
||||||
|
value3={
|
||||||
|
<TextCustom align="center" truncate={2}>
|
||||||
|
{item?.title || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</StackCustom>
|
||||||
|
</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} />,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
3
bun.lock
3
bun.lock
@@ -17,7 +17,6 @@
|
|||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"expo": "^54.0.0",
|
"expo": "^54.0.0",
|
||||||
"expo-blur": "~15.0.7",
|
|
||||||
"expo-camera": "~17.0.7",
|
"expo-camera": "~17.0.7",
|
||||||
"expo-clipboard": "~8.0.7",
|
"expo-clipboard": "~8.0.7",
|
||||||
"expo-constants": "~18.0.8",
|
"expo-constants": "~18.0.8",
|
||||||
@@ -1153,8 +1152,6 @@
|
|||||||
|
|
||||||
"expo-asset": ["expo-asset@12.0.8", "", { "dependencies": { "@expo/image-utils": "^0.8.7", "expo-constants": "~18.0.8" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-jj2U8zw9+7orST2rlQGULYiqPoECOuUyffs2NguGrq84bYbkM041T7TOMXH2raPVJnM9lEAP54ezI6XL+GVYqw=="],
|
"expo-asset": ["expo-asset@12.0.8", "", { "dependencies": { "@expo/image-utils": "^0.8.7", "expo-constants": "~18.0.8" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-jj2U8zw9+7orST2rlQGULYiqPoECOuUyffs2NguGrq84bYbkM041T7TOMXH2raPVJnM9lEAP54ezI6XL+GVYqw=="],
|
||||||
|
|
||||||
"expo-blur": ["expo-blur@15.0.7", "", { "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-SugQQbQd+zRPy8z2G5qDD4NqhcD7srBF7fN7O7yq6q7ZFK59VWvpDxtMoUkmSfdxgqONsrBN/rLdk00USADrMg=="],
|
|
||||||
|
|
||||||
"expo-camera": ["expo-camera@17.0.7", "", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*", "react-native-web": "*" }, "optionalPeers": ["react-native-web"] }, "sha512-jdZfijfFjlVAuuIkDheA41YKpigPjqsN0juRvgyr7Lcyz+fvwZ3/RP50/n/hvuozH657wHxPfiyVVFa00z8TcQ=="],
|
"expo-camera": ["expo-camera@17.0.7", "", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*", "react-native-web": "*" }, "optionalPeers": ["react-native-web"] }, "sha512-jdZfijfFjlVAuuIkDheA41YKpigPjqsN0juRvgyr7Lcyz+fvwZ3/RP50/n/hvuozH657wHxPfiyVVFa00z8TcQ=="],
|
||||||
|
|
||||||
"expo-clipboard": ["expo-clipboard@8.0.7", "", { "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-zvlfFV+wB2QQrQnHWlo0EKHAkdi2tycLtE+EXFUWTPZYkgu1XcH+aiKfd4ul7Z0SDF+1IuwoiW9AA9eO35aj3Q=="],
|
"expo-clipboard": ["expo-clipboard@8.0.7", "", { "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-zvlfFV+wB2QQrQnHWlo0EKHAkdi2tycLtE+EXFUWTPZYkgu1XcH+aiKfd4ul7Z0SDF+1IuwoiW9AA9eO35aj3Q=="],
|
||||||
|
|||||||
16
components/Box/ReportBox.tsx
Normal file
16
components/Box/ReportBox.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import StackCustom from "../Stack/StackCustom";
|
||||||
|
import TextCustom from "../Text/TextCustom";
|
||||||
|
import BaseBox from "./BaseBox";
|
||||||
|
|
||||||
|
export default function ReportBox({ text }: { text: string }) {
|
||||||
|
return (
|
||||||
|
<BaseBox>
|
||||||
|
<StackCustom gap={"sm"}>
|
||||||
|
<TextCustom bold>
|
||||||
|
Catatan penolakan
|
||||||
|
</TextCustom>
|
||||||
|
<TextCustom>{text}</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
</BaseBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,27 +1,39 @@
|
|||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { StyleProp, StyleSheet, TextInput, View, ViewStyle } from "react-native";
|
import {
|
||||||
|
StyleProp,
|
||||||
|
StyleSheet,
|
||||||
|
View,
|
||||||
|
ViewStyle
|
||||||
|
} from "react-native";
|
||||||
|
import TextCustom from "../Text/TextCustom";
|
||||||
|
|
||||||
interface CircularInputProps {
|
interface CircularInputProps {
|
||||||
value?: string | number
|
value?: string | number;
|
||||||
onChange?: (value: string | number) => void;
|
onChange?: (value: string | number) => void;
|
||||||
icon?: React.ReactNode;
|
icon?: React.ReactNode;
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CircularInput: React.FC<CircularInputProps> = ({ value, onChange, icon, style }) => {
|
const CircularInput: React.FC<CircularInputProps> = ({
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
icon,
|
||||||
|
style,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.circleContainer, style]}>
|
<View style={[styles.circleContainer, style]}>
|
||||||
{icon ? (
|
{icon ? (
|
||||||
icon
|
icon
|
||||||
) : (
|
) : (
|
||||||
<TextInput
|
<TextCustom
|
||||||
value={String(value)}
|
// text={String(value)}
|
||||||
onChangeText={onChange}
|
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
keyboardType="numeric"
|
// keyboardType="numeric"
|
||||||
maxLength={2} // Batasan maksimal karakter
|
// maxLength={2} // Batasan maksimal karakter
|
||||||
/>
|
>
|
||||||
|
{value}
|
||||||
|
</TextCustom>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -39,7 +51,7 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
color: MainColor.yellow, // Warna kuning
|
color: MainColor.yellow, // Warna kuning
|
||||||
fontSize: 24,
|
fontSize: 18,
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
padding: 0,
|
padding: 0,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ interface TextCustomProps {
|
|||||||
bold?: boolean;
|
bold?: boolean;
|
||||||
semiBold?: boolean;
|
semiBold?: boolean;
|
||||||
size?: "default" | "large" | "small" | "xlarge" | number
|
size?: "default" | "large" | "small" | "xlarge" | number
|
||||||
color?: "default" | "yellow" | "red" | "gray" | "green" | "black"
|
color?: "default" | "yellow" | "red" | "gray" | "green" | "black" | "orange"
|
||||||
align?: TextAlign; // Prop untuk alignment
|
align?: TextAlign; // Prop untuk alignment
|
||||||
truncate?: boolean | number;
|
truncate?: boolean | number;
|
||||||
onPress?: () => void;
|
onPress?: () => void;
|
||||||
@@ -62,6 +62,7 @@ const TextCustom: React.FC<TextCustomProps> = ({
|
|||||||
else if (color === "gray") selectedStyles.push(styles.gray);
|
else if (color === "gray") selectedStyles.push(styles.gray);
|
||||||
else if (color === "green") selectedStyles.push(styles.green);
|
else if (color === "green") selectedStyles.push(styles.green);
|
||||||
else if (color === "black") selectedStyles.push(styles.black);
|
else if (color === "black") selectedStyles.push(styles.black);
|
||||||
|
else if (color === "orange") selectedStyles.push(styles.orange);
|
||||||
|
|
||||||
// Alignment
|
// Alignment
|
||||||
if (align) {
|
if (align) {
|
||||||
@@ -140,4 +141,7 @@ export const styles = StyleSheet.create({
|
|||||||
black: {
|
black: {
|
||||||
color: MainColor.black,
|
color: MainColor.black,
|
||||||
},
|
},
|
||||||
|
orange: {
|
||||||
|
color: MainColor.orange,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default function AdminButtonReject({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
iconLeft={<IconReject />}
|
iconLeft={<IconReject size={16} />}
|
||||||
backgroundColor={MainColor.red}
|
backgroundColor={MainColor.red}
|
||||||
textColor="white"
|
textColor="white"
|
||||||
onPress={onReject}
|
onPress={onReject}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import Grid from "@/components/Grid/GridCustom";
|
|||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
|
||||||
export default function AdminButtonReview({
|
export default function AdminButtonReview({
|
||||||
|
isLoading,
|
||||||
onPublish,
|
onPublish,
|
||||||
onReject,
|
onReject,
|
||||||
}: {
|
}: {
|
||||||
|
isLoading?: boolean;
|
||||||
onPublish: () => void;
|
onPublish: () => void;
|
||||||
onReject: () => void;
|
onReject: () => void;
|
||||||
}) {
|
}) {
|
||||||
@@ -15,6 +17,7 @@ export default function AdminButtonReview({
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={6} style={{ paddingRight: 10 }}>
|
<Grid.Col span={6} style={{ paddingRight: 10 }}>
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
|
isLoading={isLoading}
|
||||||
iconLeft={<IconPublish />}
|
iconLeft={<IconPublish />}
|
||||||
backgroundColor={MainColor.green}
|
backgroundColor={MainColor.green}
|
||||||
textColor="white"
|
textColor="white"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
StyleProp,
|
StyleProp,
|
||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { SafeAreaView } from "react-native-safe-area-context";
|
import { NativeSafeAreaViewProps, SafeAreaView } from "react-native-safe-area-context";
|
||||||
|
|
||||||
interface ViewWrapperProps {
|
interface ViewWrapperProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -21,6 +21,7 @@ interface ViewWrapperProps {
|
|||||||
footerComponent?: React.ReactNode;
|
footerComponent?: React.ReactNode;
|
||||||
floatingButton?: React.ReactNode;
|
floatingButton?: React.ReactNode;
|
||||||
hideFooter?: boolean;
|
hideFooter?: boolean;
|
||||||
|
edgesFooter?: NativeSafeAreaViewProps["edges"];
|
||||||
style?: StyleProp<ViewStyle>;
|
style?: StyleProp<ViewStyle>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ const ViewWrapper = ({
|
|||||||
footerComponent,
|
footerComponent,
|
||||||
floatingButton,
|
floatingButton,
|
||||||
hideFooter = false,
|
hideFooter = false,
|
||||||
|
edgesFooter =[],
|
||||||
style,
|
style,
|
||||||
}: ViewWrapperProps) => {
|
}: ViewWrapperProps) => {
|
||||||
const assetBackground = require("../../assets/images/main-background.png");
|
const assetBackground = require("../../assets/images/main-background.png");
|
||||||
@@ -77,7 +79,7 @@ const ViewWrapper = ({
|
|||||||
|
|
||||||
{footerComponent ? (
|
{footerComponent ? (
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
edges={["bottom"]}
|
edges={Platform.OS === "ios" ? edgesFooter : ["bottom"]}
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: MainColor.darkblue,
|
backgroundColor: MainColor.darkblue,
|
||||||
height: OS_HEIGHT
|
height: OS_HEIGHT
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export {
|
|||||||
|
|
||||||
// OS Height
|
// OS Height
|
||||||
const OS_ANDROID_HEIGHT = 115
|
const OS_ANDROID_HEIGHT = 115
|
||||||
const OS_IOS_HEIGHT = 65
|
const OS_IOS_HEIGHT = 70
|
||||||
const OS_HEIGHT = Platform.OS === "ios" ? OS_IOS_HEIGHT : OS_ANDROID_HEIGHT
|
const OS_HEIGHT = Platform.OS === "ios" ? OS_IOS_HEIGHT : OS_ANDROID_HEIGHT
|
||||||
|
|
||||||
// Text Size
|
// Text Size
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"expo": "^54.0.0",
|
"expo": "^54.0.0",
|
||||||
"expo-blur": "~15.0.7",
|
|
||||||
"expo-camera": "~17.0.7",
|
"expo-camera": "~17.0.7",
|
||||||
"expo-clipboard": "~8.0.7",
|
"expo-clipboard": "~8.0.7",
|
||||||
"expo-constants": "~18.0.8",
|
"expo-constants": "~18.0.8",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { apiAdminJobUpdate } from "@/service/api-admin/api-admin-job";
|
import { apiAdminJobUpdate } from "@/service/api-admin/api-admin-job";
|
||||||
|
|
||||||
const funUpdateStatus = async ({
|
const funUpdateStatusJob = async ({
|
||||||
id,
|
id,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
data,
|
data,
|
||||||
@@ -23,4 +23,4 @@ const funUpdateStatus = async ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default funUpdateStatus;
|
export default funUpdateStatusJob;
|
||||||
|
|||||||
26
screens/Admin/Voting/funUpdateStatus.ts
Normal file
26
screens/Admin/Voting/funUpdateStatus.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { apiAdminVotingUpdateStatus } from "@/service/api-admin/api-admin-voting";
|
||||||
|
|
||||||
|
const funUpdateStatusVoting = async ({
|
||||||
|
id,
|
||||||
|
changeStatus,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
data?: string;
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminVotingUpdateStatus({
|
||||||
|
id: id,
|
||||||
|
status: changeStatus as any,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
return response;
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default funUpdateStatusVoting;
|
||||||
@@ -49,7 +49,7 @@ const adminListMenu: NavbarItem[] = [
|
|||||||
{ label: "Publish", link: "/admin/voting/publish/status" },
|
{ label: "Publish", link: "/admin/voting/publish/status" },
|
||||||
{ label: "Review", link: "/admin/voting/review/status" },
|
{ label: "Review", link: "/admin/voting/review/status" },
|
||||||
{ label: "Reject", link: "/admin/voting/reject/status" },
|
{ label: "Reject", link: "/admin/voting/reject/status" },
|
||||||
{ label: "Riwayat", link: "/admin/voting/riwayat/status" },
|
{ label: "Riwayat", link: "/admin/voting/history" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -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" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -142,7 +142,7 @@ const superAdminListMenu: NavbarItem[] = [
|
|||||||
{ label: "Publish", link: "/admin/voting/publish/status" },
|
{ label: "Publish", link: "/admin/voting/publish/status" },
|
||||||
{ label: "Review", link: "/admin/voting/review/status" },
|
{ label: "Review", link: "/admin/voting/review/status" },
|
||||||
{ label: "Reject", link: "/admin/voting/reject/status" },
|
{ label: "Reject", link: "/admin/voting/reject/status" },
|
||||||
{ label: "Riwayat", link: "/admin/voting/riwayat/status" },
|
{ label: "Riwayat", link: "/admin/voting/history" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
49
service/api-admin/api-admin-voting.ts
Normal file
49
service/api-admin/api-admin-voting.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminVotingUpdateStatus({
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
status,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
data?: string;
|
||||||
|
status: "publish" | "review" | "reject";
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.put(
|
||||||
|
`/mobile/admin/voting/${id}?status=${status}`,
|
||||||
|
{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -195,7 +195,14 @@ export const GStyles = StyleSheet.create({
|
|||||||
bottomBar: {
|
bottomBar: {
|
||||||
backgroundColor: MainColor.darkblue,
|
backgroundColor: MainColor.darkblue,
|
||||||
borderTopColor: AccentColor.blue,
|
borderTopColor: AccentColor.blue,
|
||||||
borderTopWidth: 1,
|
// borderTopWidth: 0.5,
|
||||||
|
height: "100%",
|
||||||
|
justifyContent: "center",
|
||||||
|
shadowColor: AccentColor.blue,
|
||||||
|
shadowOffset: { width: 0, height: -5},
|
||||||
|
shadowOpacity: 0.4,
|
||||||
|
shadowRadius: 40,
|
||||||
|
elevation: 8, // untuk Android
|
||||||
},
|
},
|
||||||
bottomBarContainer: {
|
bottomBarContainer: {
|
||||||
paddingHorizontal: 15,
|
paddingHorizontal: 15,
|
||||||
|
|||||||
14
utils/colorBadge.ts
Normal file
14
utils/colorBadge.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
|
||||||
|
export const colorBadge = ({ status }: { status: string }) => {
|
||||||
|
const statusLowerCase = status.toLowerCase();
|
||||||
|
if (statusLowerCase === "publish") {
|
||||||
|
return MainColor.green;
|
||||||
|
} else if (statusLowerCase === "review") {
|
||||||
|
return MainColor.orange;
|
||||||
|
} else if (statusLowerCase === "reject") {
|
||||||
|
return MainColor.red;
|
||||||
|
} else {
|
||||||
|
return MainColor.placeholder;
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user