=== BookPilot AI ===
Contributors: brainstudioz
Tags: booking, appointments, scheduling, staff, woocommerce
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A comprehensive booking management system for WordPress. Manage services, staff, appointments, payments, and notifications from one dashboard.

== Description ==

BookPilot AI lets you accept and manage appointments directly from your WordPress site. Build a fully branded booking experience — no third-party redirect required.

**Key features:**

* **Services & staff** — Create unlimited services with custom pricing, duration, and capacity. Assign staff members with individual schedules and time-off.
* **Three booking views** — Embed the booking widget in Grid, List, or Calendar layout via the included Elementor widget.
* **Payments** — Accept Cash/Pay on Arrival, PayPal Standard, or Stripe. Optionally route everything through **WooCommerce** for unified order management.
* **Coupons** — Create percentage or fixed-amount discount codes with expiry dates and usage limits.
* **Notifications manager** — A dedicated **Notifications** screen to create unlimited custom email notifications. Choose action-based triggers (approved, pending, rejected, cancelled, details changed, rescheduled) or scheduled reminders/follow-ups (X minutes before/after the appointment), filter by service and appointment status, send to multiple recipients (client, staff, admins, custom address), and write the message with a full **rich text editor** and dynamic placeholders.
* **Staff widget** — Show your team in a Grid or List with five layout presets (Card, Overlay, Minimal, Classic, Compact), columns, ordering, pagination, AJAX category filter chips, and a built-in **"Book Now"** popup that opens the booking flow pre-filtered to that staff member's services.
* **Works in any page builder** — Use the `[bpai_staff]` shortcode in Gutenberg, WPBakery, Divi, Beaver Builder, or the Classic editor — not just Elementor.
* **iCal export** — Let customers add their appointment to any calendar app.
* **Elementor widgets** — Style every aspect of the booking and staff widgets (colours, typography, card layout, button, calendar) with Elementor's visual controls. No coding required.

== Installation ==

1. Upload the `bookpilot-ai` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **BookPilot AI → Settings** to configure your services, staff, and payment options.
4. Add the **BookPilot AI** Elementor widget to any page, or use the `[bpai_booking_form]` shortcode.

== Frequently Asked Questions ==

= Does this plugin work without Elementor? =

Yes. Use the `[bpai_booking_form]` shortcode for the booking form and the `[bpai_staff]` shortcode for the staff listing on any page or post. Both work in Gutenberg, WPBakery, Divi, Beaver Builder, and the Classic editor.

= How do I add a custom notification? =

Go to **BookPilot AI → Notifications** and click **Add Notification**. On the editor page, give it a name, pick an action-based trigger or a scheduled time (before/after the appointment), choose the recipients (client, staff, administrators or a custom email), optionally limit it to specific services, then write the subject and message using the rich text editor. Click any placeholder chip (such as `{customer_name}` or `{service_name}`) to insert it. Scheduled reminders and follow-ups rely on WordPress cron running.

= How do I show my staff and let visitors book a specific person? =

Add the **BookPilot AI — Staff** Elementor widget or the `[bpai_staff]` shortcode to a page. Set the **Book Action** to "Open booking form" and the "Book Now" button will open a popup listing only that staff member's services; choosing one starts the booking flow with that staff member locked in.

= Can I use WooCommerce for payment? =

Yes. Go to **Settings → Payments** and enable *Use WooCommerce for checkout & order management*. Bookings will flow through the WooCommerce cart and checkout, and booking status will sync automatically with the WooCommerce order status.

= Is Stripe or PayPal required? =

No. Cash / Pay on Arrival is enabled by default. Stripe and PayPal are optional.

= Where is booking data stored? =

All bookings, services, staff, and schedules are stored in your own WordPress database. No booking data is sent to external servers by this plugin.

= Does the plugin add any "powered by" links? =

No. The plugin does not add any front-end branding or links without your permission.

== External Services ==

This plugin optionally connects to the following third-party services:

= Stripe (optional) =

If you enable Stripe payments in Settings → Payments, the plugin loads the Stripe.js library from `https://js.stripe.com/v3/` on any page that contains the booking form. This is required by Stripe for PCI DSS compliance; bundling Stripe.js locally is prohibited by Stripe's terms.

When a customer submits a booking with Stripe as the payment method, their card details are sent directly from the browser to Stripe's servers to create a Payment Intent. **No card data passes through your WordPress server.** The plugin sends the Payment Intent amount and currency to Stripe's API (`https://api.stripe.com/v1/payment_intents`) using your configured secret key.

* [Stripe Terms of Service](https://stripe.com/legal/ssa)
* [Stripe Privacy Policy](https://stripe.com/privacy)

= PayPal (optional) =

If you enable PayPal payments, customers are redirected to PayPal's hosted checkout page to complete payment. No payment data is processed on your server.

* [PayPal User Agreement](https://www.paypal.com/us/legalhub/useragreement-full)
* [PayPal Privacy Statement](https://www.paypal.com/us/legalhub/privacy-full)

== Source Code ==

The full, human-readable source code for this plugin (including all build assets and JavaScript source) is publicly available at: https://github.com/derwaish05/bookpilot-ai

The admin calendar view uses FullCalendar v5.11.5 (MIT licence). Source: https://github.com/fullcalendar/fullcalendar
The reports view uses Chart.js v4.5.1 (MIT licence). Source: https://github.com/chartjs/Chart.js
The booking date picker uses Flatpickr v4.6.13 (MIT licence). Source: https://github.com/flatpickr/flatpickr

== Screenshots ==

1. Dashboard — at-a-glance booking stats and upcoming appointments.
2. Booking widget — Grid view with Elementor style controls.
3. Booking widget — Calendar view.
4. Booking modal — 5-step flow (staff → date/time → customer info → payment → confirmation).
5. Admin bookings list — sortable, filterable, with inline status update.
6. Reports — bookings and revenue by service and staff.
7. Settings — payments, notifications, and WooCommerce integration.

== Changelog ==

= 1.1.3 =
* Final Plugin Check cleanup: removed the dot-file from the build, moved inline phpcs annotations onto the flagged lines, and annotated the admin dashboard's prepared stat queries. No functional changes.

= 1.1.2 =
* Plugin Check fixes: escaped all flagged output, added missing "translators:" comments, sanitised/justified remaining input handling, bumped "Tested up to", trimmed the upgrade notice, and removed development-only files from the distributed build. No functional changes.

= 1.1.1 =
* Compliance & polish: added missing i18n translators comments and minor readme/header housekeeping ahead of WordPress.org submission. No functional changes.

= 1.1.0 =
**New**
* **Notifications manager** — New **BookPilot AI → Notifications** screen to create and manage unlimited custom email notifications, replacing the three fixed templates in Settings. Each notification has its own dedicated add/edit page.
* Action-based triggers: Approved, Pending, Rejected, Cancelled, Details changed, Rescheduled.
* Scheduled notifications: send a configurable number of minutes/hours **before** or **after** the appointment (e.g. a 24-hour reminder or a follow-up), driven by the hourly cron with per-booking de-duplication.
* Per-notification targeting: filter by **service** and by **appointment status**, and an optional **"Send only this notification"** to suppress the default for the chosen services.
* Multiple recipients per notification: **Client, Staff, Administrators, and/or a Custom email address**.
* **Rich text (TinyMCE) editor** for the message body, plus one-click dynamic placeholders ({customer_name}, {service_name}, {staff_name}, {date}, {time}, {price}, {booking_id}, and more).
* Enable/disable toggle and **Send test** for every notification.
* **Staff widget** (Elementor) — Display staff in Grid or List with five layout presets (Card Grid, Grid Overlay, Minimal, Classic, Compact), column count, photo shape, ordering (name, date added, random, manual display order), posts-per-page, AJAX pagination, and AJAX category filter chips.
* Staff "Book Now" can now open a popup of **only that staff member's services** and run the full booking flow with the staff member locked in.
* New **`[bpai_staff]` shortcode** so the staff listing works in Gutenberg, WPBakery, Divi, Beaver Builder, and the Classic editor (not only Elementor).
* New **Display Order** field on the staff add/edit screen for manual ordering.

**Changed**
* The admin menu was reorganised (Dashboard, Calendar, Appointments, Staff Members, Services, Customers, Notifications, …) and "Bookings" is now labelled "Appointments".
* The booking modal markup was centralised into a single shared renderer used by the booking widget, the staff widget, and the shortcode.
* Brand accent colour updated from #3498db to #3858e9 across the plugin.

**Developer**
* New database tables `{prefix}_bpai_notifications` and `{prefix}_bpai_notification_log`; new `display_order`, and notification `recipients`, `services`, `appointment_status`, and `send_only` columns. All created/upgraded automatically on update.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.3 =
Final Plugin Check cleanup. Safe drop-in update.

= 1.1.2 =
Plugin Check compliance fixes (output escaping, i18n comments, build cleanup). Safe drop-in update.

= 1.1.1 =
Minor compliance and translation-readiness fixes. Safe drop-in update over 1.1.0.

= 1.1.0 =
Adds a custom Notifications manager, a configurable Staff widget with a "book this staff" popup, and a [bpai_staff] shortcode. New tables are created automatically. Back up before updating.

= 1.0.0 =
Initial release. No upgrade required.
