# Event Summary Functionality

## Overview

The Event Summary page provides trainers with detailed information about their events, including ticket sales, attendee data, and revenue tracking. This page is designed to be a central hub for monitoring event performance and managing attendees.

## Access & Navigation

- **Access Path**: The Event Summary page can be accessed from the Trainer Dashboard by clicking the "Summary" link next to any event in the events table.
- **URL Structure**: `/event-summary/?event_id={id}` where `{id}` is the event post ID.
- **Authentication**: Only logged-in users with appropriate permissions (event creators or administrators) can access this page.

## Page Components

### 1. Header & Navigation

The header section contains:
- The event title with "Summary" suffix
- Navigation links to:
  - Dashboard
  - Edit Event (if user has permission)
  - View Public Page (opens in new tab)
  - Email Attendees (Phase 2 feature, currently a placeholder)

### 2. Event Overview

This section provides basic event information including:
- Date & Time (start and end)
- Event Status (Published, Draft, etc.)
- Cost
- Venue information (if available)
- Organizer details (if available)

### 3. Event Statistics

A visual representation of key metrics:
- Total Tickets Sold
- Total Revenue
- Ticket Type Distribution (with count and revenue for each type)

Statistics are displayed in card format for easy scanning, with the same visual style as the dashboard stats.

### 4. Ticket Sales & Attendees

A comprehensive table showing all attendee information:
- Attendee name
- Email address
- Ticket type
- Price paid
- Order ID
- Check-in status

This table provides a complete overview of all registrations and can be used for attendee management.

### 5. Event Description

The full event description is displayed for reference.

## Technical Implementation

### Files & Classes

- **Template**: `templates/template-event-summary.php`
- **Data Handler**: `includes/community/class-event-summary-data.php`
- **Shortcode**: `[hvac_event_summary]` (registered in main plugin class)
- **Styling**: Inline CSS in the template (consistent with dashboard styling)

### Data Flow

1. The `render_event_summary()` method in the main plugin class:
   - Retrieves the event ID from the URL parameter
   - Verifies user permissions
   - Includes the event summary template

2. The template:
   - Initializes the `HVAC_Event_Summary_Data` class with the event ID
   - Retrieves event details, venue info, organizer info, and transaction data
   - Calculates statistics from the transaction data
   - Renders the UI with the retrieved data

3. The `HVAC_Event_Summary_Data` class:
   - Provides methods to retrieve all necessary event data
   - Integrates with The Events Calendar API for event details
   - Integrates with Event Tickets for transaction data

## Testing

The Event Summary page is verified by E2E tests in `tests/e2e/event-summary.spec.ts`. The tests cover:
- Page accessibility from the dashboard
- Display of event overview information
- Display of event statistics
- Display of ticket sales and attendees data
- Display of event description
- Proper navigation links
- Authentication requirements

## Future Enhancements (Planned)

- **Phase 2**: Integration with the Email Attendees feature
- **Phase 2**: CSV export of attendee data
- **Phase 3**: Enhanced visualization of event statistics
- **Phase 3**: Integration with certificate generation