=== AlbertoIT Transfer Booking Manager ===
Contributors: albertosoliman
Tags: booking, excursions, airport transfer, transport, fleet management
Requires at least: 5.8
Requires PHP: 7.4
Tested up to: 7.1
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A self-hosted transfer and excursion booking manager with independent catalogues, request forms, pricing, and customer records.

== Description ==

AlbertoIT Transfer Booking Manager manages transfer bookings and excursion requests in WordPress, designed by AlbertoIT.de. It stores records in the site's database and does not require an account, license server, or external SaaS API. Email is sent with WordPress wp_mail() using the site's configured mail transport. Transfers and excursions use separate catalogues and booking records.

Features:

* Vehicle records with type, passenger capacity, luggage limit, availability, base fare, and fallback per-kilometre pricing.
* Route records with origin, destination, distance, duration, currency, inclusive rates per vehicle type, and optional visa/SIM fees.
* Optional route fares by passenger groups (1–3, 4–8, and 9–16 passengers), plus one-way and round-trip request fields.
* Public excursion catalogue and tour detail pages with location, duration, tour type, group size, languages, inclusions, exclusions, and a per-person request form.
* Scheduled excursion departures with per-date seat limits; pending and confirmed requests reserve seats, and the catalogue can be filtered by location, activity, and duration.
* Excursion requests are stored separately from transfer bookings and can be reviewed and status-managed in the admin area.
* Editable ISO currencies, each with a separate code, name, and symbol field. Currency codes and symbols are shown together; prices are never converted automatically.
* Dynamic fare preview with configurable weekend and night surcharges.
* Booking records in a dedicated MySQL table and customer records in a separate table.
* Passenger capacity validation, a configurable time lock for vehicles, flight-number validation for airport pickup, and pending/confirmed/completed/cancelled statuses.
* Admin booking calendar, date and flight-number filters, customer list, and tools to add customers and pending bookings without sending email.
* Confirmation email with Meet & Greet instructions when an eligible booking is confirmed.
* Optional customer reminders for confirmed transfers and excursions, sent once at a configurable lead time (default 24 hours).
* Booking detail lookup protected by the booking ID plus the customer's email address or WhatsApp number, with copy and WhatsApp hand-off controls.
* Extension hooks: th_before_price_calculation and th_after_booking_created.
* WordPress personal-data exporter/eraser support and a privacy-policy helper for the booking data.
* English source strings, bundled Arabic translations, a gettext `.pot` template, and right-to-left styles for Arabic.

Flight numbers are saved for staff to monitor. Automatic flight tracking is not included because this plugin deliberately makes no calls to external services.

== Installation ==

1. Upload the `albertoit-transfer-booking-manager` folder to `/wp-content/plugins/` or upload the ZIP from Plugins > Add New > Upload Plugin.
2. Activate **AlbertoIT Transfer Booking Manager**.
3. Open AIT Transfer > Vehicles and add published vehicles. Set the type, passenger capacity, luggage limit and availability.
4. Open AIT Transfer > Routes and add published routes. Configure the currency and either vehicle fares or optional passenger-group fares. Mark airport pickup routes so the flight-number field becomes mandatory.
5. Configure currencies, default currency, business WhatsApp number, vehicle lock period, optional surcharges and booking reminders under AIT Transfer > Settings. Enter each currency's code, name, and symbol in its own row. Prices are entered separately per route; changing currencies does not convert existing prices.
6. Add `[ait-t-booking-form]` to a public WordPress page. Add `[ait-t-booking-details]` to a separate public page for customers to look up a transfer booking; they will need its numeric booking ID and the matching email or WhatsApp number.
7. Add excursions under AIT Transfer > Excursions. Use the main editor for the overview and itinerary, the excerpt for the catalogue summary, and the details box for per-person price, tour facts, and optional scheduled dates with seat capacities. When departures are configured, the form accepts only dates with seats available. Add `[ait-t-excursions]` to a page to show the filterable public catalogue; each published excursion gets its own detail page and request form. Use `[ait-t-excursion-booking-form id="123"]` to place a request form for a specific excursion on another page, replacing `123` with its post ID.

The plugin uses the `albertoit-transfer-booking-manager` gettext text domain. Set the WordPress site language to Arabic (`ar` or `ar_EG`) to use the bundled Arabic translation and RTL styling. Other languages can be translated with standard WordPress gettext translation tools using the included `.pot` template.

== Frequently Asked Questions ==

= Does the plugin require license activation or contact an external service? =

No. All included features are available without a license key, activation server, subscription, or payment. Booking and customer data stays in the site's WordPress database. The WhatsApp link opens WhatsApp only after a customer clicks it, with a booking summary prefilled; the customer chooses whether to send that message. Email uses the site's normal wp_mail() configuration.

= What happens to stored data if I delete the plugin? =

Deleting the plugin does not remove its booking records, customer records, route or vehicle posts, or settings from the site database. Use the WordPress personal data erasure tools to anonymize customer information before deleting the plugin if needed.

= How are fares calculated? =

If a matching passenger-group fare is set for the route, it is used; round trips are twice that fare. Otherwise a positive fare for the selected vehicle type is used, or the route base fare, vehicle base fare, and route distance multiplied by the vehicle's per-kilometre rate are added. Optional visa fees are multiplied by passenger count; SIM fees are per booking. Configured weekend and night percentages are added, then the `th_before_price_calculation` filter may adjust the total. Excursion prices are per person. The server recalculates prices when a request is submitted. Neither service collects payment online.

= Does a booking immediately reserve a vehicle? =

Pending and confirmed bookings both block the same vehicle within the configured time window. Cancelled and completed bookings do not block it. A booking is only confirmed by an administrator.

= How does excursion capacity work? =

For excursions with scheduled departures, pending and confirmed requests count toward the seat limit. Cancelled and completed requests release seats. If no departures are configured, the form continues to accept a preferred date without a seat limit.

== Hooks ==

`th_before_price_calculation` receives the current total and a context array containing route, vehicle, date, time, passenger count, extras and price components. Return the adjusted numeric total.

`th_after_booking_created` fires after the booking transaction is committed. It receives the booking ID and the inserted booking data array.

== Requirements ==

* WordPress 5.8 or newer
* PHP 7.4 or newer
* MySQL 5.6 or newer (or a compatible MariaDB release)

== Changelog ==

= 1.2.0 =
* Add scheduled excursion dates with per-departure capacity enforcement and live remaining-seat choices.
* Add catalogue filters for location, activity type, and duration.
* Add configurable, once-only email reminders for confirmed transfer and excursion bookings.

= 1.1.0 =
* Remove the Demo Content feature and its admin actions.
* Add a public excursion catalogue, tour details, per-person request pricing, and a separate excursion request inbox.
* Add passenger-group transfer fares, round-trip dates, and hotel, nationality, and notes fields.
* Include transfer and excursion request details in WordPress personal-data export and erasure.
* Refresh public booking forms and excursion cards with responsive styling and a locally bundled Tajawal font for Arabic.

= 1.0.3 =
* Add editable currency codes, names and symbols throughout fare displays.
* Remove upgrade promotion; all plugin features work without license activation.

= 1.0.4 =
* Replace duplicated currency settings with editable currency rows and add/remove controls.
* Add admin forms for creating customers and pending bookings without sending email.
* Improve currency row indexing and transactionally check vehicle availability when adding a booking.
* Update Arabic/translation templates and skip confirmation email when a customer has no email address.

= 1.0.2 =
* Fix administrator capability mapping for vehicle and route post types.

= 1.0.1 =
* Add plugin action links and support information to settings.

= 1.0.0 =
* Initial release: self-hosted routes, vehicles, pricing, customers, bookings, admin calendar, and frontend shortcodes.
