# Buggy Field Implementation Summary

## Overview
Added a "Buggy" field to track member buggy preferences (Walking, Own Buggy, Shared Buggy) for specific event types.

## Database Changes Required

**IMPORTANT:** Run the SQL migration file before using this feature:

```sql
-- Add buggy field to Users table
ALTER TABLE Users ADD COLUMN buggy VARCHAR(20) DEFAULT NULL;

-- Add buggy field to EventUsers table for event-specific values
ALTER TABLE EventUsers ADD COLUMN buggy VARCHAR(20) DEFAULT NULL;
```

Or run the provided SQL file:
```bash
mysql -u [username] -p el_paraiso < add_buggy_field.sql
```

## Features Implemented

### 1. User Profile (Default Buggy Setting)
- **Create User Form** (`event-user-management.php`): Added buggy dropdown with options:
  - (Blank - default)
  - Walking
  - Own Buggy
  - Shared Buggy

- **Edit User Form** (`event-user-edit.php`): Added buggy dropdown to update user's default buggy preference

### 2. Event Participants Display
- **Buggy Column Display**: The buggy column appears automatically for these event types:
  - Friday Roll Up / RollUp events
  - Scramble events
  - Tuesday Boys events

- **Behavior**:
  - Shows user's default buggy value from Users table if EventUsers.buggy is not set
  - Admin can edit buggy value per event (stored in EventUsers.buggy)
  - Non-admin users see read-only buggy value
  - Changes are saved via AJAX (no page refresh needed)

### 3. Technical Implementation

**Files Modified:**
1. `event-table.php`: Added buggy column display and AJAX handling
2. `event-user-update.php`: Added AJAX handler for buggy field updates
3. `event-user-management.php`: Added buggy field to create user form
4. `event-user-edit.php`: Added buggy field to edit user form

**Key Features:**
- Event-specific buggy values override user defaults
- Automatic column display based on event type
- AJAX updates for seamless editing
- Proper column span calculations for table layout

## Usage

1. **Set User Default**: When creating or editing a user, select their default buggy preference
2. **View in Events**: For Friday Roll Up, Scramble, or Tuesday Boys events, the buggy column will automatically appear
3. **Edit Per Event**: Admins can change the buggy value for specific events, which overrides the user's default for that event only

## Notes

- The buggy field is optional (can be blank)
- Event-specific buggy values take precedence over user defaults
- The field only appears for the specified event types
- All changes are saved immediately via AJAX

