feat:task,content,agenda setting,Spit

This commit is contained in:
Anang Yusman 2025-02-05 17:05:24 +08:00
commit 39dd1e71bf
5 changed files with 45 additions and 11 deletions

View File

@ -415,6 +415,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
mabes: "bg-yellow-500",
polda: "bg-blue-400",
polres: "bg-slate-400",
satker: "bg-orange-500",
international: "bg-green-400",
};
return colors[type];
@ -635,7 +636,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
if (selectedCategory?.length === categories?.length) {
setSelectedCategory([]);
} else {
setSelectedCategory(categories.map((c) => c.value));
setSelectedCategory(categories?.map((c) => c.value));
}
}}
/>

View File

@ -125,7 +125,6 @@ export const categories = [
{
label: "Polda",
value: "polda",
className:
"data-[state=checked]:bg-blue-400 data-[state=checked]:ring-blue-400",
},

View File

@ -396,7 +396,7 @@ const EventModal = ({
setStartDate(event?.event?.start);
setEndDate(event?.event?.end);
const eventCalendar = event?.event?.extendedProps?.calendar;
setAgendaType(eventCalendar || categories[0].value);
setAgendaType(eventCalendar || categories?.length > 0 && categories[0].value);
}
setValue("title", event?.event?.title || "");
setValue("description", event?.event?.description || "");

View File

@ -1,17 +1,49 @@
"use client"
import { getEvents, getCategories } from "./utils";
import { calendarEvents, Category } from "./data";
import CalendarView from "./calender-view";
import { getCookiesDecrypt } from "@/lib/utils";
import { useEffect, useState } from "react";
import { CalendarCategory } from "./data";
const CalenderPage = () => {
const [categories, setCategories] = useState<CalendarCategory[]>([]);
const userLevelNumber = Number(getCookiesDecrypt("ulne")) || 0;
const userLevelId = Number(getCookiesDecrypt("ulie")) || 0;
const userParentLevelId = Number(getCookiesDecrypt("uplie")) || 0;
useEffect(() => {
initData();
async function initData() {
const events = await getEvents();
const categories = await getCategories();
let valueShowed : string[] = [];
if (userLevelNumber == 1) {
valueShowed = ['mabes', 'polda', 'polres', 'satker', 'international'];
} else if (userLevelNumber == 2 && userLevelId != 761) {
valueShowed = ['polda', 'polres'];
} else if ((userLevelNumber == 2 && userLevelId == 761) || (userLevelNumber == 3 && userParentLevelId == 761)) {
valueShowed = ['satker'];
} else if (userLevelNumber == 3 && userParentLevelId != 761) {
valueShowed = ['polres'];
}
const formattedCategories = categories.filter((category: Category) => valueShowed.includes(category.value))
.map((category: Category) => ({
...category,
activeClass: "",
}));
console.log(formattedCategories);
setCategories(formattedCategories);
}
}, []);
const CalenderPage = async () => {
const events = await getEvents();
const categories = await getCategories();
const formattedCategories = categories.map((category: Category) => ({
...category,
activeClass: "",
}));
return (
<div>
<CalendarView categories={formattedCategories} />
{categories && <CalendarView categories={categories} />}
</div>
);
};

View File

@ -177,6 +177,7 @@ interface UploadResult {
fileType: { name: string };
uploadStatus: { name: string };
creatorName: string;
creatorGroup: string;
}
interface FileUploaded {
@ -395,6 +396,7 @@ export default function FormTaskDetail() {
}
}
initState();
// fetchFilteredData();
}, [id, refresh]);
const handleUrlChange = (index: number, newUrl: string) => {