1
Driver-Management
Jonathan Miller edited this page 2026-06-27 19:44:27 +00:00

Driver Management

CRM Integration

Drivers are linked to MokoSuiteCRM contacts via the contact_id foreign key. This means:

  • No duplicate user tables -- driver profiles reference existing CRM records
  • Contact details (name, phone, email, address) are managed in CRM
  • Driver-specific fields (license, commission, rating) are in the taxi drivers table
  • Layer dependency: MokoSuiteTaxi (Layer 2) requires MokoSuiteCRM (Layer 1)

Driver Status

Status Description
active Approved and available for dispatch
inactive Account exists but not taking rides
suspended Administratively suspended
pending Awaiting approval (if auto_approve_drivers is off)

License Tracking

Each driver record stores:

  • license_number -- driving license ID
  • license_expiry -- expiry date for proactive alerts

Commission

  • commission_rate -- per-driver override (nullable)
  • Falls back to default_commission plugin parameter when null
  • Commission is a percentage of the total fare

Rating System

Ratings are bidirectional:

  • Rider rates driver after ride completion (1-5 stars)
  • Driver rates rider after ride completion (1-5 stars)

Stored in #__mokosuitetaxi_ratings with:

  • ride_id, rater_type (rider/driver), ratee_type (rider/driver)
  • rating (1-5), comment, tags (JSON array of feedback tags)

The driver rating column is an aggregate average, updated automatically when new ratings are submitted.

Shift Management

Driver shifts are tracked in #__mokosuitetaxi_shifts:

  • driver_id, start_time, end_time
  • start_latitude, start_longitude -- where the shift started
  • end_latitude, end_longitude -- where the shift ended
  • total_rides, total_earnings -- aggregated during the shift
  • status -- active, completed, cancelled

Automatic Stats

Driver records maintain running totals:

  • total_rides -- lifetime completed rides
  • total_earnings -- lifetime earnings
  • rating -- rolling average rating

These are updated by RideHelper::completeRide() after each completed ride.