Added category input component

This commit is contained in:
Alexis
2024-06-10 18:58:08 +02:00
parent e9ec2cb3ae
commit 17b9937c6a
11 changed files with 178 additions and 11 deletions

View File

@@ -1,7 +1,8 @@
import type { RPGDate } from '@/models/Date'
import type { CalendarEvent } from '@/models/CalendarEvent'
import type { RPGDate } from '@/models/Date'
import { defineStore } from 'pinia'
import { ref, watch, type Ref } from 'vue'
import type { Category } from '~/models/Category'
import { useCalendar } from './CalendarStore'
export const useCalendarEvents = defineStore('calendar-events', () => {
@@ -14,6 +15,12 @@ export const useCalendarEvents = defineStore('calendar-events', () => {
baseEvents.value = data
}
const categories = ref<Category[]>([])
function setCategories(data: Category[]) {
categories.value = data
}
// Order base events by dates
const allEvents = computed(() => baseEvents.value.sort((a, b) => {
return compareDates(a.startDate, b.startDate, 'desc')
@@ -269,6 +276,8 @@ export const useCalendarEvents = defineStore('calendar-events', () => {
return {
allEvents,
setEvents,
categories,
setCategories,
currentEvents,
getRelativeEventFromDate,
getRelativeEventFromEvent,