163 lines
4.2 KiB
TypeScript
163 lines
4.2 KiB
TypeScript
import { getAgendaSettingsList } from "@/service/agenda-setting/agenda-setting";
|
|
import { faker } from "@faker-js/faker";
|
|
import dayjs from "dayjs";
|
|
|
|
const date = new Date();
|
|
const prevDay = new Date().getDate() - 1;
|
|
const nextDay = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
|
|
const INITIAL_YEAR = dayjs().format("YYYY");
|
|
const INITIAL_MONTH = dayjs().format("M");
|
|
|
|
// prettier-ignore
|
|
const nextMonth = date.getMonth() === 11 ? new Date(date.getFullYear() + 1, 0, 1) : new Date(date.getFullYear(), date.getMonth() + 1, 1)
|
|
// prettier-ignore
|
|
const prevMonth = date.getMonth() === 11 ? new Date(date.getFullYear() - 1, 0, 1) : new Date(date.getFullYear(), date.getMonth() - 1, 1)
|
|
|
|
export const getCalendarEvents = async () => {
|
|
const res = await getAgendaSettingsList(INITIAL_YEAR, INITIAL_MONTH, "");
|
|
if (res.error) {
|
|
return false;
|
|
}
|
|
console.log("ress", res.data.data);
|
|
return res?.data?.data;
|
|
};
|
|
|
|
export const calendarEvents = [
|
|
{
|
|
id: faker.string.uuid(),
|
|
title: "aaaAll Day Event",
|
|
start: date,
|
|
end: nextDay,
|
|
allDay: false,
|
|
//className: "warning",
|
|
extendedProps: {
|
|
calendar: "polda",
|
|
},
|
|
},
|
|
{
|
|
id: faker.string.uuid(),
|
|
title: "Meeting With Client",
|
|
start: new Date(date.getFullYear(), date.getMonth() + 1, -11),
|
|
end: new Date(date.getFullYear(), date.getMonth() + 1, -10),
|
|
allDay: true,
|
|
//className: "success",
|
|
extendedProps: {
|
|
calendar: "national",
|
|
},
|
|
},
|
|
{
|
|
id: faker.string.uuid(),
|
|
title: "Lunch",
|
|
allDay: true,
|
|
start: new Date(date.getFullYear(), date.getMonth() + 1, -9),
|
|
end: new Date(date.getFullYear(), date.getMonth() + 1, -7),
|
|
// className: "info",
|
|
extendedProps: {
|
|
calendar: "polres",
|
|
},
|
|
},
|
|
{
|
|
id: faker.string.uuid(),
|
|
title: "Birthday Party",
|
|
start: new Date(date.getFullYear(), date.getMonth() + 1, -11),
|
|
end: new Date(date.getFullYear(), date.getMonth() + 1, -10),
|
|
allDay: true,
|
|
//className: "primary",
|
|
extendedProps: {
|
|
calendar: "polres",
|
|
},
|
|
},
|
|
{
|
|
id: faker.string.uuid(),
|
|
title: "Birthday Party",
|
|
start: new Date(date.getFullYear(), date.getMonth() + 1, -13),
|
|
end: new Date(date.getFullYear(), date.getMonth() + 1, -12),
|
|
allDay: true,
|
|
// className: "danger",
|
|
extendedProps: {
|
|
calendar: "polda",
|
|
},
|
|
},
|
|
{
|
|
id: faker.string.uuid(),
|
|
title: "Monthly Meeting",
|
|
start: nextMonth,
|
|
end: nextMonth,
|
|
allDay: true,
|
|
//className: "primary",
|
|
extendedProps: {
|
|
calendar: "international",
|
|
},
|
|
},
|
|
];
|
|
|
|
export const calendarCategories = [
|
|
{
|
|
label: "Nasional",
|
|
value: "national",
|
|
activeClass: "ring-primary-500 bg-primary-500",
|
|
className: "group-hover:border-blue-500",
|
|
},
|
|
{
|
|
label: "Polda",
|
|
value: "polda",
|
|
activeClass: "ring-success-500 bg-success-500",
|
|
className: " group-hover:border-green-500",
|
|
},
|
|
{
|
|
label: "Polres",
|
|
value: "polres",
|
|
activeClass: "ring-danger-500 bg-danger-500",
|
|
className: " group-hover:border-red-500",
|
|
},
|
|
{
|
|
label: "Satker",
|
|
value: "satker",
|
|
activeClass: "ring-yellow-500 bg-yellow-500",
|
|
className: " group-hover:border-red-500",
|
|
},
|
|
{
|
|
label: "Internasional",
|
|
value: "international",
|
|
activeClass: "ring-info-500 bg-info-500",
|
|
className: " group-hover:border-cyan-500",
|
|
},
|
|
];
|
|
|
|
export const categories = [
|
|
{
|
|
label: "Nasional",
|
|
value: "national",
|
|
className:
|
|
"data-[state=checked]:bg-primary data-[state=checked]:ring-primary",
|
|
},
|
|
{
|
|
label: "Polda",
|
|
value: "polda",
|
|
|
|
className:
|
|
"data-[state=checked]:bg-success data-[state=checked]:ring-success",
|
|
},
|
|
{
|
|
label: "Polres",
|
|
value: "polres",
|
|
className:
|
|
"data-[state=checked]:bg-destructive data-[state=checked]:ring-destructive ",
|
|
},
|
|
{
|
|
label: "Satker",
|
|
value: "satker",
|
|
className:
|
|
"data-[state=checked]:bg-warning data-[state=checked]:ring-warning ",
|
|
},
|
|
{
|
|
label: "Internasional",
|
|
value: "international",
|
|
className: "data-[state=checked]:bg-info data-[state=checked]:ring-info ",
|
|
},
|
|
];
|
|
|
|
export type CalendarEvent = (typeof calendarEvents)[number];
|
|
export type CalendarCategory = (typeof calendarCategories)[number];
|
|
export type Category = (typeof categories)[number];
|