diff --git a/components.d.ts b/components.d.ts index 25df4f0..ff26d3f 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,11 +8,17 @@ export {} declare module 'vue' { export interface GlobalComponents { BButton: typeof import('bootstrap-vue-next')['BButton'] + BButtonGroup: typeof import('bootstrap-vue-next')['BButtonGroup'] BCard: typeof import('bootstrap-vue-next')['BCard'] + BCardBody: typeof import('bootstrap-vue-next')['BCardBody'] + BCardBordy: typeof import('bootstrap-vue-next')['BCardBordy'] + BCardFooter: typeof import('bootstrap-vue-next')['BCardFooter'] BCardText: typeof import('bootstrap-vue-next')['BCardText'] BCol: typeof import('bootstrap-vue-next')['BCol'] BContainer: typeof import('bootstrap-vue-next')['BContainer'] BFormInput: typeof import('bootstrap-vue-next')['BFormInput'] + BFormInvalidFeedback: typeof import('bootstrap-vue-next')['BFormInvalidFeedback'] + BFormTextarea: typeof import('bootstrap-vue-next')['BFormTextarea'] BNav: typeof import('bootstrap-vue-next')['BNav'] BRow: typeof import('bootstrap-vue-next')['BRow'] EventModal: typeof import('./src/components/EventModal.vue')['default'] diff --git a/src/components/EventModal.vue b/src/components/EventModal.vue index f8e462e..49dc286 100644 --- a/src/components/EventModal.vue +++ b/src/components/EventModal.vue @@ -1,24 +1,79 @@ - - Header and footers using props. - Close + + + + + Title: + + Enter at least 3 letters + + + Start: + + + + Until: + + + + + + + + + + + + + Close + Add + + + diff --git a/src/interfaces/eventTypes.ts b/src/interfaces/eventTypes.ts new file mode 100644 index 0000000..528c379 --- /dev/null +++ b/src/interfaces/eventTypes.ts @@ -0,0 +1,7 @@ +export interface CustomEvent { + id?: string | number + title: string + startDataTime: string | Date + endDataTime: string | Date + contentText?: string +} \ No newline at end of file diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index db969cb..b50bc12 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -1,3 +1,4 @@ import type * as FullCalendar from './builtInTypes' +import type { CustomEvent } from './eventTypes' -export type {FullCalendar} \ No newline at end of file +export type { FullCalendar, CustomEvent } \ No newline at end of file diff --git a/src/stores/calendar.ts b/src/stores/calendar.ts index 96223bb..1d1d509 100644 --- a/src/stores/calendar.ts +++ b/src/stores/calendar.ts @@ -1,22 +1,39 @@ import { ref, computed } from 'vue' -import { createPinia } from 'pinia' -import { defineStore } from 'pinia' +import { createPinia, defineStore } from 'pinia' +import type { CustomEvent } from '@/interfaces' export const pinia = createPinia() export const useCalendarStore = defineStore('calendar', () => { const calendarApi = ref() const modal = ref(false) + const addedEvents = ref([]) const getCalendarApi = computed(() => calendarApi.value) + const getAddedEvents = computed(() => addedEvents.value) const setCalendarApi = (value: any) => { calendarApi.value = value } - const setModal = () => { modal.value = !modal.value } + const setAddedEvents = (value: CustomEvent | string | number , type: string) => { + const id = addedEvents.value.length + const newEvent = { ...value as CustomEvent, id } + + switch (type) { + case 'add': + addedEvents.value.push(newEvent as CustomEvent) + break + case 'delete': + delete addedEvents.value[value as any] + break + default: + break + } + addedEvents.value.push() + } - return { calendarApi, modal, getCalendarApi, setCalendarApi, setModal } + return { calendarApi, modal, addedEvents, getCalendarApi, getAddedEvents, setCalendarApi, setModal, setAddedEvents } }) \ No newline at end of file