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">
<CardContent className="p-0">
<CardHeader className="border-none mb-2 pt-5">
{roleId == 10 || roleId == 11 ?
{roleId == 11 || roleId == 12 ?
<Button
onClick={handleDateClick}
className="dark:bg-background dark:text-foreground"

View File

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

View File

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

View File

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

View File

@ -1156,7 +1156,26 @@ export default function FormTaskDetail() {
</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="">
<Button
color="primary"
@ -1170,7 +1189,7 @@ export default function FormTaskDetail() {
<Button
className="btn btn-primary ml-3 mr-3"
style={
statusAcceptance || detail?.createdBy?.id == Number(userId)
statusAcceptance || detail?.createdBy?.id !== Number(userId)
? {
display: "none",
}
@ -1183,23 +1202,24 @@ export default function FormTaskDetail() {
</div>
<div
className="task-response w-100 px-3 "
style={
isSentResult || detail?.createdBy?.id == Number(userId)
? {}
: {
display: "none",
}
}
// style={
// Number(detail?.createdBy?.id) == Number(userId)
// ? {}
// : {
// display: "none",
// }
// }
>
<Button
color="primary"
variant={"default"}
onClick={() => setIsTableResult(!isTableResult)}
>
Hasil Upload
Hasil Upload {Number(userId)}
</Button>
</div>
</div>
</div>
{isTableResult && (
<table className="w-full border-collapse border border-gray-300">
<thead>
@ -1223,6 +1243,7 @@ export default function FormTaskDetail() {
</table>
)}
{showInput && (
<>
<div className="mt-4 border p-4 rounded bg-gray-50">
<Textarea
placeholder="Tulis tanggapan Anda di sini..."
@ -1239,7 +1260,6 @@ export default function FormTaskDetail() {
</Button>
</div>
</div>
)}
<div className="mt-6">
<h3 className="text-lg font-bold text-center">Tanggapan</h3>
{listData?.map((item: any) => (
@ -1401,6 +1421,8 @@ export default function FormTaskDetail() {
</div>
))}
</div>
</>
)}
<div className="flex justify-center mt-4">
{detail?.createdBy?.id == Number(userId) &&
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>
</form>
</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 React, { useEffect, useState } from "react";
import { Button } from "../ui/button";
import { Reveal } from "./Reveal";
import { useTranslations } from "next-intl";
import { usePathname } from "next/navigation";
import { useParams } from "next/navigation";
const ContentCategory = () => {
const ContentCategory = (props: { group?: string }) => {
const [categories, setCategories] = useState<any>();
const t = useTranslations("LandingPage");
const params = useParams();
const locale = params?.locale;
const poldaName = params?.polda_name;
const satkerName = params?.satker_name;
useEffect(() => {
initFetch();
}, []);
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);
setCategories(response?.data?.data?.content);
};

View File

@ -2403,6 +2403,152 @@ export function getMenuList(pathname: string, t: any): Group[] {
},
];
} 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 = [
{
groupLabel: t("apps"),
@ -2712,6 +2858,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
},
];
}
}
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=`);
}
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() {
return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`);
}
export async function getListContent(props: any) {
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=`
);
}