--- import { Authentication } from "../../scripts/pocketbase/Authentication"; import { Get } from "../../scripts/pocketbase/Get"; import { Toaster } from "react-hot-toast"; import EventRequestManagementTable from "./Officer_EventRequestManagement/EventRequestManagementTable"; import type { EventRequest } from "../../schemas/pocketbase"; // Get instances const get = Get.getInstance(); const auth = Authentication.getInstance(); // Extended EventRequest interface with additional properties needed for this component interface ExtendedEventRequest extends EventRequest { requested_user_expand?: { name: string; email: string; }; expand?: { requested_user?: { id: string; name: string; email: string; [key: string]: any; }; [key: string]: any; }; feedback?: string; [key: string]: any; // For other optional properties } // Initialize variables for all event requests let allEventRequests: ExtendedEventRequest[] = []; let error = null; try { // Don't check authentication here - let the client component handle it // The server-side check is causing issues when the token is valid client-side but not server-side console.log("Fetching event requests in Astro component..."); // Expand the requested_user field to get user details allEventRequests = await get .getAll("event_request", "", "-created", { expand: ["requested_user"], }) .catch((err) => { console.error("Error in get.getAll:", err); // Return empty array instead of throwing return []; }); console.log( `Fetched ${allEventRequests.length} event requests in Astro component` ); // Process the event requests to add the requested_user_expand property allEventRequests = allEventRequests.map((request) => { const requestWithExpand = { ...request }; // Add the requested_user_expand property if the expand data is available if ( request.expand && request.expand.requested_user && request.expand.requested_user.name && request.expand.requested_user.email ) { requestWithExpand.requested_user_expand = { name: request.expand.requested_user.name, email: request.expand.requested_user.email, }; } return requestWithExpand; }); } catch (err) { console.error("Error fetching event requests:", err); error = err; } ---

Event Request Management

Review and manage event requests submitted by officers. Update status, provide feedback, and coordinate with the team.

As an executive officer, you can:

  • View all submitted event requests
  • Update the status of requests (Pending, Completed, Declined)
  • Add comments or feedback for the requesting officer
  • Filter and sort requests by various criteria
{ error && (
{error}
) } { !error && (
) }