diff --git a/api/src/services/calendarService.ts b/api/src/services/calendarService.ts index c88f671..7aa2cee 100644 --- a/api/src/services/calendarService.ts +++ b/api/src/services/calendarService.ts @@ -123,15 +123,9 @@ export async function setAttendanceStatus(memberID: number, eventID: number, sta } export async function getEventAttendance(eventID: number): Promise { - const sql = ` - SELECT - s.member_id, - s.status, - m.name AS member_name - FROM calendar_events_signups s - LEFT JOIN members m ON s.member_id = m.id - WHERE s.event_id = ? - `; - return await pool.query(sql, [eventID]); + const sql = "CALL `sp_GetCalendarEventSignups`(?)" + const res = await pool.query(sql, [eventID]); + console.log(res[0]); + return res[0]; } \ No newline at end of file diff --git a/shared/types/calendar.ts b/shared/types/calendar.ts index 526068f..5a62a8b 100644 --- a/shared/types/calendar.ts +++ b/shared/types/calendar.ts @@ -26,6 +26,7 @@ export interface CalendarSignup { eventID: number; status: CalendarAttendance; member_name?: string; + member_unit?: string; } export interface CalendarEventShort { diff --git a/ui/src/components/Navigation/Navbar.vue b/ui/src/components/Navigation/Navbar.vue index 72c5bd4..c56d592 100644 --- a/ui/src/components/Navigation/Navbar.vue +++ b/ui/src/components/Navigation/Navbar.vue @@ -156,6 +156,12 @@ function blurAfter() { Join + + + + Calendar + + diff --git a/ui/src/components/calendar/ViewCalendarEvent.vue b/ui/src/components/calendar/ViewCalendarEvent.vue index 39be30d..c99e0dc 100644 --- a/ui/src/components/calendar/ViewCalendarEvent.vue +++ b/ui/src/components/calendar/ViewCalendarEvent.vue @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/ui/src/pages/Calendar.vue b/ui/src/pages/Calendar.vue index 2f4c76e..df9868b 100644 --- a/ui/src/pages/Calendar.vue +++ b/ui/src/pages/Calendar.vue @@ -3,15 +3,14 @@ import { ref, watch, nextTick, computed, onMounted } from 'vue' import FullCalendar from '@fullcalendar/vue3' import dayGridPlugin from '@fullcalendar/daygrid' import interactionPlugin from '@fullcalendar/interaction' -import { X, Clock, MapPin, User, ListTodo, ChevronLeft, ChevronRight, Plus } from 'lucide-vue-next' +import { ChevronLeft, ChevronRight, Plus } from 'lucide-vue-next' import CreateCalendarEvent from '@/components/calendar/CreateCalendarEvent.vue' -import { getCalendarEvent, getMonthCalendarEvents } from '@/api/calendar' -import { CalendarEvent, CalendarEventShort } from '@shared/types/calendar' -import { Calendar } from '@fullcalendar/core' +import { CalendarEvent } from '@shared/types/calendar' import ViewCalendarEvent from '@/components/calendar/ViewCalendarEvent.vue' import { useRouter, useRoute } from 'vue-router' import { useCalendarEvents } from '@/composables/useCalendarEvents' import { useCalendarNavigation } from '@/composables/useCalendarNavigation' +import { useUserStore } from '@/stores/user' const monthLabels = [ 'January', 'February', 'March', 'April', 'May', 'June', @@ -24,13 +23,14 @@ function api() { const router = useRouter(); const route = useRoute(); +const userStore = useUserStore(); function buildFullDate(month: number, year: number): Date { return new Date(year, month, 1); //default to first of month } const { selectedMonth, selectedYear, years, goPrev, goNext, goToday, onDatesSet, goToSelectedDate } = useCalendarNavigation(api) -const { events, loadEvents} = useCalendarEvents(selectedMonth, selectedYear); +const { events, loadEvents } = useCalendarEvents(selectedMonth, selectedYear); const panelOpen = ref(false) const activeEvent = ref(null) @@ -48,6 +48,7 @@ const dialogRef = ref(null) // NEW: handle day/time slot clicks to start creating an event function onDateClick(arg: { dateStr: string }) { + if (!userStore.isLoggedIn) return; dialogRef.value?.openDialog(arg.dateStr); // For now, just open the panel with a draft payload. // activeEvent.value = { @@ -202,7 +203,7 @@ onMounted(() => { @click="goToday"> Today -