# 🎯 Time Slot Blocking Feature - Demo

Complete guide to blocking full days or specific hours when fully booked or vehicle unavailable

### 🔑 Admin Login Credentials

Use these credentials to access the admin panel:

Email: `admin@ashtransfer.com`

Password: `Global2026@`

🔐 Admin Login 📅 Blocked Dates Page 📊 Admin Dashboard

## ✨ Key Features

- ✅ Full Day Blocking: Block entire day when car unavailable
- ✅ Time Slot Blocking: Block specific hours (e.g., 09:00-13:00)
- ✅ Multiple Reasons: Car breakdown, maintenance, holiday, emergency, etc.
- ✅ Overlap Detection: Prevents double-booking time slots
- ✅ Bulk Blocking: Block multiple consecutive days at once
- ✅ Easy Management: View, edit, and remove blocks from admin panel

## 📖 How to Use

### Block a Full Day:

1. Go to Blocked Dates page
2. Select "Full Day (All day unavailable)"
3. Choose date to block
4. Select reason (e.g., "Car breakdown")
5. Click "Block This Date"

### Block Specific Hours:

1. Go to Blocked Dates page
2. Select "Specific Time Slot"
3. Choose date
4. Enter Start Time (e.g., 09:00)
5. Enter End Time (e.g., 13:00)
6. Select reason
7. Click "Block This Date"

## 💼 Real-World Scenarios

### 🔧 Scenario 1: Car Breakdown

Problem: "Car breaks down at 2pm. Need to cancel all afternoon bookings."

✅ Solution: Block today's date with time slot 14:00 - 23:59, Reason: "Car breakdown". Customers can't book afternoon slots, morning slots remain available.

### 🛠️ Scenario 2: Scheduled Maintenance

Problem: "Car service scheduled for 3 hours tomorrow morning."

✅ Solution: Block tomorrow with time slot 09:00 - 12:00, Reason: "Car maintenance". Morning unavailable, afternoon bookings still open.

### 🏖️ Scenario 3: Holiday Week

Problem: "Taking vacation for 7 days next month."

✅ Solution: Click "Block Multiple Dates", enter start date (e.g., 2026-03-01) and end date (2026-03-07), Reason: "Holiday". Entire week blocked in one action.

### ⚡ Scenario 4: Fully Booked Peak Hours

Problem: "Valentine's Day evening slots already filled."

✅ Solution: Block February 14 with time slot 18:00 - 23:00, Reason: "Fully booked". Evening slots blocked, daytime still bookable.

## 🎛️ Admin Panel Features

- 📊 Statistics Dashboard: View total blocked dates, same-day booking status, minimum advance hours
- 📋 Blocked Dates List: See all blocks with date, time, reason, and status
- 🗓️ Calendar View: Visual representation of blocked dates
- ⚙️ Booking Configuration: Control same-day bookings and advance notice requirements
- 🗑️ Easy Removal: Remove blocks when car becomes available again

## 🎨 Reason Options

- ✅ Fully booked: All slots taken for the day/time
- 🔧 Car breakdown / Maintenance: Vehicle requires servicing
- 🏖️ Holiday / Staff unavailable: On vacation or off duty
- 🚨 Personal emergency: Unexpected urgent situation
- 🌧️ Bad weather conditions: Unsafe driving conditions
- 📝 Custom reason: Enter your own specific reason

## ⚙️ Technical Implementation

### Database Schema:

    blocked_dates
    ├── id (PRIMARY KEY)
    ├── blocked_date (DATE)
    ├── reason (TEXT)
    ├── start_time (TEXT, nullable) -- HH:MM format
    ├── end_time (TEXT, nullable)   -- HH:MM format
    ├── created_by (INTEGER)
    └── created_at (TIMESTAMP)

    Note: NULL start_time/end_time = Full day block
          Non-NULL values = Specific time slot

### API Endpoints:

- GET /api/blocked-dates - List all blocks
- GET /api/blocked-dates/check/:date?time=HH:MM - Check availability
- POST /api/blocked-dates - Create new block
- DELETE /api/blocked-dates/:id - Remove block
- GET /api/blocked-dates/config - Get booking config
- PUT /api/blocked-dates/config/:key - Update config

## 🚀 Quick Start Guide

1. Login: Use admin credentials above to access admin panel
2. Navigate: Click "Blocked Dates" in the navigation menu
3. Choose Type: Select full day or time slot blocking
4. Set Details: Pick date, time (if applicable), and reason
5. Confirm: Click "Block This Date" to save
6. Verify: See the block appear in the list below

Ready to get started?

🎯 Open Blocked Dates Manager