# EP Golf Event Management System

A comprehensive PHP-based golf event management system for El Paraiso Golf Club.

The **`Plesk/`** directory on disk is **not part of this repository**; it is its own Git repo (Plesk deployment copy). See `Plesk/README.md` inside that folder after you clone or open it.

## Features

### Scorecard Generation
- **PDF Scorecard Generation**: Creates professional PDF scorecards for golf events
- **Multiple Formats**: Supports Individual, Pairs, and Scramble formats
- **Flight Management**: Automatic flight assignment and timing
- **Handicap Calculation**: Integrated handicap and shot allocation
- **Asterisk Display**: Configurable asterisk display for handicap holes

### Buggy Assignment Printing
- **A5 Landscape Layout**: Optimized for buggy assignment cards
- **Logo Integration**: El Paraiso Golf Club branding
- **Flight Grouping**: Automatic grouping by flights and tees
- **Time Calculation**: Accurate tee time calculations for various start formats

### Event Management
- **Participant Management**: Add, edit, and manage event participants
- **Flight Assignment**: Automatic and manual flight assignment
- **Waitlist Management**: Handle waitlist participants
- **Export Functionality**: Export participant lists and data

## File Structure

### Core Files
- `event-scorecard.php` - Main scorecard generation system
- `event-scorecard-setup.php` - Scorecard configuration interface
- `event-buggy-print.php` - Buggy assignment printing
- `event-dashboard.php` - Main event management dashboard

### Configuration
- `event-server.php` - Database connection and configuration
- `event-session-check.php` - Session management and authentication

### Assets
- `event-El-Paraiso-Golf-Logo.svg` - Club logo for printouts

## Database Schema

### Key Tables
- `Events` - Event information and configuration
- `EventUsers` - Participant data and flight assignments
- `InviteEventGroupsText` - Scorecard configuration
- `Users` - Member information
- `Guests` - Guest participant information

## Installation

1. Ensure PHP 7.4+ is installed
2. Install FPDF library for PDF generation
3. Configure database connection in `event-server.php`
4. Set up web server to serve the EP directory

## Usage

### Generating Scorecards
1. Navigate to event dashboard
2. Configure scorecard settings
3. Click "Print Scorecard" button
4. PDF will be generated and displayed

### Printing Buggy Assignments
1. From event dashboard, click "Print Buggy Assignments"
2. A5 landscape cards will be generated
3. Each card shows flight, tee, time, and participants

## Development

### Version Control
- Git repository for version control
- `.gitignore` configured to exclude temporary and sensitive files
- Regular commits for feature development

### Debugging
- Debug output available in HTML comments
- Error handling with user-friendly messages
- Database query logging for troubleshooting

## Recent Updates

### Latest Features
- ✅ Fixed time calculation for mixed tee starts
- ✅ Improved error handling with user-friendly messages
- ✅ Enhanced buggy print layout with larger text and logo
- ✅ Added waitlist handling in buggy assignments
- ✅ Integrated logo into all printouts

### Bug Fixes
- ✅ Corrected sequential timing for flights using same tee
- ✅ Fixed waitlist display in buggy assignments
- ✅ Resolved database field issues for Max Handicap settings

## Support

For technical support or feature requests, contact the development team.

## License

Internal use for El Paraiso Golf Club.
