feat: update category in landing, update menu admin polda

This commit is contained in:
hanif salafi 2025-01-13 07:35:40 +07:00
parent 31e3b6f218
commit 9ea4d15611
8 changed files with 708 additions and 539 deletions

View File

@ -494,7 +494,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
<Card className="col-span-12 lg:col-span-4 2xl:col-span-3 pb-5"> <Card className="col-span-12 lg:col-span-4 2xl:col-span-3 pb-5">
<CardContent className="p-0"> <CardContent className="p-0">
<CardHeader className="border-none mb-2 pt-5"> <CardHeader className="border-none mb-2 pt-5">
{roleId == 10 || roleId == 11 ? {roleId == 11 || roleId == 12 ?
<Button <Button
onClick={handleDateClick} onClick={handleDateClick}
className="dark:bg-background dark:text-foreground" className="dark:bg-background dark:text-foreground"

View File

@ -13,7 +13,7 @@ const page = () => {
<WelcomePolda /> <WelcomePolda />
<NewContent group="polda" type="latest" /> <NewContent group="polda" type="latest" />
<NewContent group="polda" type="popular" /> <NewContent group="polda" type="popular" />
<ContentCategory /> <ContentCategory group="polda" />
</div> </div>
); );
}; };

View File

@ -13,7 +13,7 @@ const page = () => {
<WelcomeSatker /> <WelcomeSatker />
<NewContent group="satker" type="latest" /> <NewContent group="satker" type="latest" />
<NewContent group="satker" type="popular" /> <NewContent group="satker" type="popular" />
<ContentCategory /> <ContentCategory group="satker" />
</div> </div>
); );
}; };

View File

@ -22,7 +22,7 @@ const Home = ({ params: { locale } }: { params: { locale: string } }) => {
<NewContent group="mabes" type="latest" /> <NewContent group="mabes" type="latest" />
<NewContent group="mabes" type="popular" /> <NewContent group="mabes" type="popular" />
{/* <PopularContent /> */} {/* <PopularContent /> */}
<ContentCategory /> <ContentCategory group="mabes" />
<Coverage /> <Coverage />
<Division /> <Division />
<Footer /> <Footer />

View File

@ -1156,7 +1156,26 @@ export default function FormTaskDetail() {
</div> </div>
</div> </div>
</div> </div>
<div className="flex flex-row justify-end gap-3 my-3"> <div className="flex flex-row justify-between gap-3 my-3">
<div className="px-1">
{detail?.isDone !== true &&
(Number(userLevelNumber) !== 3 ||
Number(userLevelNumber) == 2) ? (
<Button
color="primary"
variant={"outline"}
type="button"
className="btn btn-outline-primary ml-3"
onClick={() => handleForward()}
>
Forward
</Button>
) : (
""
)
}
</div>
<div className="flex gap-2">
<div className=""> <div className="">
<Button <Button
color="primary" color="primary"
@ -1170,7 +1189,7 @@ export default function FormTaskDetail() {
<Button <Button
className="btn btn-primary ml-3 mr-3" className="btn btn-primary ml-3 mr-3"
style={ style={
statusAcceptance || detail?.createdBy?.id == Number(userId) statusAcceptance || detail?.createdBy?.id !== Number(userId)
? { ? {
display: "none", display: "none",
} }
@ -1183,23 +1202,24 @@ export default function FormTaskDetail() {
</div> </div>
<div <div
className="task-response w-100 px-3 " className="task-response w-100 px-3 "
style={ // style={
isSentResult || detail?.createdBy?.id == Number(userId) // Number(detail?.createdBy?.id) == Number(userId)
? {} // ? {}
: { // : {
display: "none", // display: "none",
} // }
} // }
> >
<Button <Button
color="primary" color="primary"
variant={"default"} variant={"default"}
onClick={() => setIsTableResult(!isTableResult)} onClick={() => setIsTableResult(!isTableResult)}
> >
Hasil Upload Hasil Upload {Number(userId)}
</Button> </Button>
</div> </div>
</div> </div>
</div>
{isTableResult && ( {isTableResult && (
<table className="w-full border-collapse border border-gray-300"> <table className="w-full border-collapse border border-gray-300">
<thead> <thead>
@ -1223,6 +1243,7 @@ export default function FormTaskDetail() {
</table> </table>
)} )}
{showInput && ( {showInput && (
<>
<div className="mt-4 border p-4 rounded bg-gray-50"> <div className="mt-4 border p-4 rounded bg-gray-50">
<Textarea <Textarea
placeholder="Tulis tanggapan Anda di sini..." placeholder="Tulis tanggapan Anda di sini..."
@ -1239,7 +1260,6 @@ export default function FormTaskDetail() {
</Button> </Button>
</div> </div>
</div> </div>
)}
<div className="mt-6"> <div className="mt-6">
<h3 className="text-lg font-bold text-center">Tanggapan</h3> <h3 className="text-lg font-bold text-center">Tanggapan</h3>
{listData?.map((item: any) => ( {listData?.map((item: any) => (
@ -1401,6 +1421,8 @@ export default function FormTaskDetail() {
</div> </div>
))} ))}
</div> </div>
</>
)}
<div className="flex justify-center mt-4"> <div className="flex justify-center mt-4">
{detail?.createdBy?.id == Number(userId) && {detail?.createdBy?.id == Number(userId) &&
detail?.isDone !== true ? ( detail?.isDone !== true ? (
@ -1427,21 +1449,6 @@ export default function FormTaskDetail() {
) : ( ) : (
"" ""
)} )}
{detail?.isDone !== true &&
(Number(userLevelNumber) !== 3 ||
Number(userLevelNumber) == 2) ? (
<Button
color="primary"
variant={"outline"}
type="button"
className="btn btn-outline-primary ml-3"
onClick={() => handleForward()}
>
Forward
</Button>
) : (
""
)}
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,20 +1,31 @@
import { getCategoryData } from "@/service/landing/landing"; import { getCategoryData, getPublicCategoryData } from "@/service/landing/landing";
import Link from "next/link"; import Link from "next/link";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { Reveal } from "./Reveal"; import { Reveal } from "./Reveal";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import { useParams } from "next/navigation";
const ContentCategory = () => { const ContentCategory = (props: { group?: string }) => {
const [categories, setCategories] = useState<any>(); const [categories, setCategories] = useState<any>();
const t = useTranslations("LandingPage"); const t = useTranslations("LandingPage");
const params = useParams();
const locale = params?.locale;
const poldaName = params?.polda_name;
const satkerName = params?.satker_name;
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
const response = await getCategoryData(); const response = await getPublicCategoryData(
props.group == "mabes" ? "" :
props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName :
props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-"+satkerName : "",
"",
locale == "en" ? true : false
);
console.log("category", response); console.log("category", response);
setCategories(response?.data?.data?.content); setCategories(response?.data?.data?.content);
}; };

View File

@ -2403,6 +2403,152 @@ export function getMenuList(pathname: string, t: any): Group[] {
}, },
]; ];
} else if (Number(roleId) === 2) { } else if (Number(roleId) === 2) {
if (Number(levelNumber) == 2) {
menusSelected = [
{
groupLabel: t("apps"),
id: "dashboard",
menus: [
{
id: "dashboard",
href: "/dashboard",
label: t("dashboard"),
active: pathname.includes("/dashboard"),
icon: "material-symbols:dashboard",
submenus: [
{
href: "/dashboard",
label: "Breakdown",
active: pathname === "/dashboard",
icon: "heroicons:arrow-trending-up",
children: [],
},
{
href: "/dashboard/executive",
label: "Executive",
active: pathname === "/dashboard/executive",
icon: "heroicons:arrow-trending-up",
children: [],
},
],
},
],
},
{
groupLabel: "",
id: "agenda-setting",
menus: [
{
id: "agenda-setting",
href: "/contributor/agenda-setting",
label: t("agenda-setting"),
active: pathname.includes("/agenda-setting"),
icon: "iconoir:journal-page",
submenus: [],
},
],
},
{
groupLabel: "",
id: "management-user",
menus: [
{
id: "management-user-menu",
href: "/admin/management-user",
label: "Management User",
active: pathname.includes("/management-user"),
icon: "clarity:users-solid",
submenus: [],
},
],
},
{
groupLabel: "",
id: "content-production",
menus: [
{
id: "content-production",
href: "/curator/content-production",
label: t("content-production"),
active: pathname.includes("/content-production"),
icon: "fluent:content-view-gallery-16-regular",
submenus: [],
},
],
},
{
groupLabel: "",
id: "pattern-relation",
menus: [
{
id: "pattern-relation",
href: "/curator/pattern-relation",
label: t("pattern-relation"),
active: pathname.includes("/pattern-relation"),
icon: "oui:app-index-pattern",
submenus: [],
},
],
},
{
groupLabel: "",
id: "performance-polda",
menus: [
{
id: "performance-polda",
href: "/admin/performance-polda",
label: t("performance-polda"),
active: pathname.includes("/admin/performance-polda"),
icon: "ant-design:signal-filled",
submenus: [],
},
],
},
{
groupLabel: "",
id: "communication",
menus: [
{
id: "communication",
href: "/shared/communication",
label: t("communication"),
active: pathname.includes("/communication"),
icon: "token:chat",
submenus: [],
},
],
},
{
groupLabel: "",
id: "settings",
menus: [
{
id: "settings",
href: "/admin/settings",
label: t("settings"),
active: pathname.includes("/settinng"),
icon: "material-symbols:settings",
submenus: [
{
href: "/admin/settings/category",
label: t("category"),
active: pathname === "/admin/settings/category",
icon: "heroicons:arrow-trending-up",
children: [],
},
{
href: "/admin/settings/tag",
label: "Tag",
active: pathname === "/admin/settings/tag",
icon: "heroicons:arrow-trending-up",
children: [],
}
],
},
],
},
];
} else {
menusSelected = [ menusSelected = [
{ {
groupLabel: t("apps"), groupLabel: t("apps"),
@ -2712,6 +2858,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
}, },
]; ];
} }
}
return menusSelected; return menusSelected;
} }

View File

@ -5,13 +5,17 @@ export async function getHeroData() {
return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`); return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`);
} }
export async function getPublicCategoryData(group: any = "", type: string = "", isInt: Boolean = false) {
return await httpGetInterceptor(`media/categories/list/publish?enablePage=0&group=${group}&type=${type}&isInt=${isInt}`);
}
export async function getCategoryData() { export async function getCategoryData() {
return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`); return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`);
} }
export async function getListContent(props: any) { export async function getListContent(props: any) {
return await httpGetInterceptor( return await httpGetInterceptor(
`media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&isInt=${props.isInt}&typeId=${props.contentTypeId}&title=${props.title}&group=${props.group}&group=${props.group}&categoryId=&fileFormats=&tags=&startDate=&endDate=&month=&year=` `media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&isInt=${props.isInt}&typeId=${props.contentTypeId}&title=${props.title}&group=${props.group}&categoryId=&fileFormats=&tags=&startDate=&endDate=&month=&year=`
); );
} }