diff --git a/src/components/dashboard/Officer_EventManagement.astro b/src/components/dashboard/Officer_EventManagement.astro new file mode 100644 index 0000000..3a94302 --- /dev/null +++ b/src/components/dashboard/Officer_EventManagement.astro @@ -0,0 +1,404 @@ +--- +import { Icon } from "astro-icon/components"; +import { Get } from "../pocketbase/Get"; +import { Authentication } from "../pocketbase/Authentication"; + +// Get instances +const get = Get.getInstance(); +const auth = Authentication.getInstance(); + +// Interface for Event type +interface Event { + id: string; + event_name: string; + event_description: string; + start_date: string; + location: string; + event_code: string; +} + +interface ListResponse { + page: number; + perPage: number; + totalItems: number; + totalPages: number; + items: T[]; +} + +// Initialize variables +let eventResponse: ListResponse = { + page: 1, + perPage: 5, + totalItems: 0, + totalPages: 0, + items: [], +}; +let upcomingEvents: Event[] = []; + +// Fetch events +try { + if (auth.isAuthenticated()) { + eventResponse = await get.getList("events", 1, 5, "", "-start_date"); + upcomingEvents = eventResponse.items; + } +} catch (error) { + console.error("Failed to fetch events:", error); +} + +const totalEvents = eventResponse.totalItems; +const totalPages = eventResponse.totalPages; +const currentPage = eventResponse.page; + +// Add type declaration for window +declare global { + interface Window { + [key: string]: any; + openEditModal: (event: Event) => void; + } +} +--- + + + + + + + + + + diff --git a/src/config/dashboard.yaml b/src/config/dashboard.yaml index ddce352..e3ff924 100644 --- a/src/config/dashboard.yaml +++ b/src/config/dashboard.yaml @@ -1,4 +1,5 @@ -officerRoles: - - "IEEE Officer" - - "IEEE Executive" - - "IEEE Administrator" +officer: + roles: + - "IEEE Officer" + - "IEEE Executive" + - "IEEE Administrator" diff --git a/src/pages/dashboard.astro b/src/pages/dashboard.astro index 157ae0c..0dbd550 100644 --- a/src/pages/dashboard.astro +++ b/src/pages/dashboard.astro @@ -5,7 +5,7 @@ import ProfileSection from "../components/dashboard/ProfileSection.astro"; import EventsSection from "../components/dashboard/EventsSection.astro"; import ReimbursementSection from "../components/dashboard/ReimbursementSection.astro"; import SettingsSection from "../components/dashboard/SettingsSection.astro"; - +import Officer_EventManagement from "../components/dashboard/Officer_EventManagement.astro"; const title = "Dashboard"; --- @@ -61,6 +61,7 @@ const title = "Dashboard";