# Court Booking System v2.0 - Tennis & Padel

Complete booking system for tennis and padel courts with instructor management, revenue reports, and multiple booking types for WordPress.

## 🎯 Key Features

### Advanced Booking Management
- **Flexible Time Slots**: Bookings starting from 30 minutes up to 3 hours
- **Three Booking Types**:
  - **Regular Match** (Red): 2-4 players (tennis or padel) with payment tracking
  - **Lesson / Technical Match** (Orange): 1-4 participants with instructor
  - **Tournament / Exhibition** (Blue): Event name visible on frontend
- **Configurable Courts**: Manage from 1 to 100 courts (tennis, padel, or mixed)
- **Customizable Hours**: Set opening and closing times
- **Digital Clock**: Real-time clock display (HH:MM) on both backend and frontend
- **Past & Future Bookings**: Create bookings for any date (no date restrictions)

### Instructor Management
- Complete instructor registry with:
  - First Name and Last Name
  - Contact info (Email and Phone)
  - Professional Certification/Level
  - Custom revenue percentage
  - Active/Inactive status

### Payment System
- **Individual Quotas**: Amount for each player
- **Multi-Currency**: Euro, Dollar, Pound Sterling, Swiss Franc
- **Payment Tracking**: Mark who paid and who hasn't
- **Automatic Calculation**: Total revenue calculated automatically

### Reports and Statistics
- **Revenue Reports**:
  - Filter by period and type
  - Daily revenue breakdown
  - Total summaries
- **Instructor Reports**:
  - Earnings per instructor
  - Number of lessons taught
  - Automatic percentage calculation

### Public Frontend
- **Visual Calendar**: Hourly grid with real-time availability
- **Digital Clock**: Real-time HH:MM display
- **Distinctive Colors**:
  - Green = Available
  - Red = Regular match
  - Orange = Lesson
  - Blue = Tournament (with name visible)
- **Responsive Design**: Optimized for mobile and tablet

## 📦 Installation

1. Upload the `padel-court-booking` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Database tables will be created automatically
4. **5 sample instructors** will be automatically added (you can modify or delete them later)

### Sample Instructors Included

Upon activation, the plugin creates 5 sample instructors:
- Marco Rodriguez (Level 3 Coach, 55%)
- Sofia Martinez (Master Trainer, 60%)
- Alessandro Colombo (Level 2 Coach, 50%)
- Emma Thompson (Level 1 Instructor, 45%)
- Carlos Sanchez (Professional Player & Coach, 65%)

**Note**: These are placeholder instructors. You should:
- Update them with your real staff information, or
- Delete them and add your own instructors

See `SAMPLE-INSTRUCTORS.md` for details.

## 🚀 Usage

### Backend (Administration)

#### Bookings
1. Go to **Padel Booking > Bookings**
2. Note the **digital clock** displaying current time
3. Select date (past, present, or future dates allowed)
4. Click "New Booking"
5. Fill in the fields

#### Creating Different Booking Types

**Regular Match**:
- Enter reference person
- Enter all 4 players (mandatory)
- Set amounts and payment status for each

**Lesson/Technical Match**:
- Select instructor
- Enter reference person
- Enter 1 to 4 participants
- Set amounts and payment status

**Tournament/Exhibition**:
- Enter tournament name
- No players or payments required
- Name will be visible on frontend

### Frontend (Visitors)

1. Create a WordPress page
2. Insert the shortcode: `[padel_booking]`
3. Publish the page

Visitors will see:
- **Digital clock** with current time
- Calendar with real-time availability
- Distinctive colors by type
- Tournament names when present

## 🕐 Digital Clock Feature

### Backend Clock
- Location: Next to date selector
- Format: 24-hour (HH:MM)
- Style: Gradient purple background
- Updates: Every second

### Frontend Clock
- Location: Header area
- Format: 24-hour (HH:MM)
- Style: Gradient purple background
- Updates: Every second
- Responsive: Adapts to mobile screens

## 📅 Date Flexibility

### No Restrictions
The system allows bookings for:
- **Past dates**: Record historical bookings
- **Current date**: Today's bookings
- **Future dates**: Book months in advance

### Use Cases
- Migrating from another system
- Recording past tournament results
- Historical data management
- Advance bookings for tournaments

## 🎨 Colors and Legend

| Color | Type | Frontend Display |
|-------|------|------------------|
| 🟢 Green | Available | "FREE" |
| 🔴 Red | Regular Match | "OCCUPIED" |
| 🟠 Orange | Lesson | "LESSON" |
| 🔵 Blue | Tournament | Tournament Name |

## ⚙️ Technical Requirements

- WordPress 5.0 or higher
- PHP 7.4 or higher
- MySQL 5.6 or higher

## 📊 Database Structure

The plugin creates 2 tables:

### wp_padel_bookings (31 fields)
Stores all booking information including:
- Date, court, time, duration
- Booking type
- Players (1-4) with individual amounts
- Instructor reference (for lessons)
- Tournament name (for tournaments)
- Payment status per player
- Total amount and currency

### wp_padel_instructors (9 fields)
Stores instructor information:
- Personal data
- Contact information
- Certification level
- Revenue percentage
- Active status

See `DATABASE-SCHEMA.md` for complete structure.

## 🆘 Support

For assistance, bug reports, or feature requests:
- Email: info@freecmsplugins.com
- Website: https://freecmsplugins.com

## 👨‍💻 Author

**Michele BRUNO**
- Website: https://freecmsplugins.com
- Specialization: Plugins and components for CMS

## 📄 License

GPL v2 or later

## 🔄 Changelog

### Version 2.0.0 (2024)
- ✨ Flexible 30-minute time slots
- ✨ Three booking types (Match, Lesson, Tournament)
- ✨ Flexible participant management (1-4 players)
- ✨ Multi-currency system
- ✨ Complete instructor registry
- ✨ Advanced revenue reports
- ✨ Instructor earnings reports
- ✨ Distinctive colors on frontend
- ✨ Tournament names publicly visible
- ✨ **Digital clock display (HH:MM) on backend and frontend**
- ✨ **Past and future booking support (no date restrictions)**
- 🎨 Completely redesigned interface
- 🐛 Numerous bugfixes and optimizations

### Version 1.0.0
- 🎉 Initial release
- Fixed 1.5-hour time slots
- Fixed 4 players
- Basic payment management

---

**Thank you for choosing Padel Court Booking System!**

*Visit [freecmsplugins.com](https://freecmsplugins.com) for more quality free plugins.*
