=== Bookance ===
Contributors: dotance
Tags: booking, appointments, scheduling, calendar, reservations
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.14.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Appointment booking that works natively in Gutenberg, Elementor, Beaver Builder, Breakdance and Oxygen. Zero double bookings, reminders that send.

== Description ==

Bookance is an appointment booking system built around three things the popular booking plugins get wrong.

**1. It works in your page builder, natively.**
The same booking form is a real Gutenberg block, a real Elementor widget (with its own category and style controls), a real Beaver Builder module and a real Breakdance / Oxygen 6 element — plus a shortcode for everything else. No iframes, no "paste this shortcode" workaround. Four layouts: step by step, single page, calendar first, or a button that opens a popup.

**2. Zero double bookings, guaranteed.**
Every reservation is committed inside a database transaction with a per-staff lock and a unique slot key. Two people can click "Confirm" at the same second; exactly one gets the slot and the other is offered the next free times. Chosen times are held for the visitor while they fill in their details.

**3. Reminders that actually send.**
Emails and reminders run through a bundled background scheduler (Action Scheduler) instead of WP-Cron alone, with retries and a log that shows every message, when it went out, and the real error when it did not. No paid "cloud cron" add-on.

= Everything in the free plugin =

* Unlimited services, staff, appointments and customers — weekly hours, breaks and date overrides per staff member
* Step-by-step booking form: service → staff → date & time → details → confirmation, with keyboard-accessible calendar, RTL support and theme-matching design tokens (`--bkc-*`)
* Timezone done right: in-person services show venue time, online services show the visitor's time; daylight saving handled automatically
* Buffers before/after, minimum notice, booking window, slot step, group capacity
* Customer self-service link to reschedule or cancel; "Add to calendar" for Google, Outlook and .ics
* Google Calendar push: every booking lands in your own Google Calendar (connect with your own Google Cloud client — no third-party middleman)
* Email notifications with merge tags for confirmation, reschedule, cancellation, reminders and admin alerts — with a send log, resend and test-send
* Locations with their own timezone and address; staff belong to a location and a form can be placed for one branch only
* Admin screens: dashboard, calendar (day/week/month with drag-to-reschedule), appointments (filters, manual booking, status changes), customers, services, staff & hours, locations, notifications, design, tools, settings
* Importers for Bookly and Amelia, plus CSV import for everything else
* Privacy: WordPress personal-data export and erasure support, optional automatic anonymisation of inactive customers, clean uninstall option
* WP-CLI commands for status, seeding, availability, booking, notifications and imports

= Coming in Bookance Pro =

Online payments (Stripe, PayPal), deposits and coupons, two-way Google/Outlook calendar sync, SMS and WhatsApp reminders, packages, waitlists, round-robin staff assignment, webhooks and white-label. Pro is a separate plugin; nothing in this free plugin is locked.

= Developers =

The public REST API lives under `bookance/v1`. Every builder integration is a thin adapter over one PHP renderer, so adding another builder is one class. Compiled JavaScript ships with its readable source in `assets/js/src`. Action Scheduler is bundled unmodified under `libraries/action-scheduler` (GPL, the same library WooCommerce ships).

== Installation ==

1. Install and activate Bookance from Plugins → Add New (or upload the ZIP).
2. Go to Bookance → Services and add a service; then Bookance → Staff & Hours and add yourself with working hours.
3. Put the booking form on a page: the "Booking Form" block, the Elementor widget under the "Bookance" category, the Beaver Builder module, the Breakdance / Oxygen element, or the `[bookance]` shortcode.
4. Pick that page under Bookance → Settings so emails link to it.

== Frequently Asked Questions ==

= Does it work with my theme? =

Yes. The form inherits your theme's font and text colour and exposes CSS variables (`--bkc-accent`, `--bkc-radius`, …) for fine-tuning. Elementor users get colour and radius controls in the widget's Style tab.

= Does it send reminders if my site has little traffic? =

Bookance uses Action Scheduler for background work. On a very quiet site you should point a real cron job at `wp-cron.php` (the Notifications screen warns you when tasks are stalling).

= Can I take payments? =

Not in the free plugin yet. Bookings are confirmed with payment on arrival. Stripe and PayPal are part of Bookance Pro.

= How do I move from Bookly or Amelia? =

Keep the old plugin installed (it can be deactivated), open Bookance → Tools and run the importer. Dry-run first; re-running is safe because imported rows are remembered.

= Which shortcode attributes exist? =

`[bookance service="2" staff="any" location="0" layout="wizard" show_price="1"]` — `staff` accepts a staff ID or `any`; `location` limits the form to one location's staff; `layout` is `wizard`, `single`, `calendar-first` or `button` (add `button_label="Book a table"` for the button).

== Screenshots ==

1. The booking form on the front end (date and time step).
2. Confirmation screen with the manage link and add-to-calendar links.
3. Appointments admin screen with filters and quick actions.
4. Staff & Hours editor with weekly hours and date overrides.
5. Notifications: templates, test send and the delivery log.
6. The Booking Form block in the editor and the Elementor widget.

== External services ==

By default the plugin does not send data to any third-party service. Emails are sent through WordPress' own `wp_mail()`. The "Add to calendar" links (calendar.google.com, outlook.live.com) only open in the visitor's browser when clicked.

**Google Calendar (optional, off until you connect it).** Under Bookance → Settings you can connect your own Google account through an OAuth client that you create in your own Google Cloud project. Once connected, the plugin calls the Google Calendar API (`www.googleapis.com/calendar/v3`, tokens from `oauth2.googleapis.com`) from your server to create, update and delete events for bookings: the service name, staff name, start and end time, booking number, the customer's name, email, phone and notes, and the manage-booking link are sent. If "Invite the customer" is on, the customer's email address is added as an event attendee and Google emails them an invitation. Tokens are stored only in your site's database. Google's terms: https://policies.google.com/terms — privacy policy: https://policies.google.com/privacy — Calendar API terms: https://developers.google.com/terms

== Changelog ==

= 0.14.0 =
* Breakdance and Oxygen 6: a native "Booking Form" element (Bookance category) with service, staff, location, layout, button label and price controls, server-side rendered so the real form shows inside the builder. The setup wizard now recognises Breakdance/Oxygen.

= 0.13.0 =
* Locations: a Bookance → Locations screen (name, address, phone, timezone), staff assigned to a location, the location's timezone used for staff without one of their own, location filters on Appointments and Calendar, `{location}` / `{location_address}` merge tags, the venue shown in the booking summary, and a Location control on the block, Elementor widget, Beaver module and shortcode (`location="2"`) so a form can be placed for one branch only.

= 0.12.0 =
* Four booking-form layouts, in every builder and the shortcode: Step by step (wizard), Single page (one scrolling card with "Change" rows), Calendar first (Calendly-style: calendar up front, service and staff as dropdowns) and Button (a button that opens the form in an accessible popup, custom label).

= 0.11.0 =
* Calendar view: day / week / month, staff filter, colour per service, drag an appointment to reschedule (validated by the booking engine), click an empty slot to add an appointment, click an event for details and status actions.

= 0.10.0 =
* Phase 8: Google Calendar push (1-way) with your own OAuth client — connect in Settings, choose a calendar, optionally invite the customer; events created, updated and removed on booking, reschedule and cancel via background jobs; `wp bookance google`.

= 0.9.0 =
* Design pass: refreshed booking-form design (progress indicator, card, calendar, slots, buttons, motion) and a new Bookance → Design screen with presets (Minimal, Rounded, Bold, Soft), colours, radius, font, button style, shadow, dark card, width, custom CSS and a live preview of the real form.

= 0.8.0 =
* Phase 3b: onboarding wizard — opens once after activation; timezone/currency/alerts, first service, you & hours, auto-created "Book online" page; re-run from the dashboard.

= 0.7.0 =
* Phase 6: importers (Bookly, Amelia, CSV) with dry run + idempotent re-runs, Tools screen, GDPR personal-data exporter and eraser (anonymise), privacy-policy text, retention setting with daily anonymisation, `wp bookance import`.
* WordPress.org prep: readme, translators comments, minimum WordPress 6.4.

= 0.6.0 =
* Phase 5: page-builder adapters — Gutenberg block (bookance/form), Elementor widget (Bookance category, accent/radius style controls), Beaver Builder module; "Add to calendar" links (Google, Outlook, .ics) on the booking confirmation.

= 0.5.0 =
* Phase 4: notifications — email templates with merge tags (confirmed, moved, cancelled, reminder, admin new/cancelled), reminders and retries via Action Scheduler (bundled), notification log with resend, .ics attachment + Google/Outlook links, Notifications admin screen, `wp bookance notify`.

= 0.4.0 =
* Phase 3a: admin UI — Dashboard, Appointments (filters, close, manual booking), Customers, Services, Staff & Hours (weekly hours, date overrides), Settings; authenticated admin REST; `manage_bookance` capability.

= 0.3.0 =
* Phase 2: REST API `bookance/v1` (catalog, availability, holds, bookings create/get/cancel/reschedule), customer find-or-create, `[bookance]` shortcode + renderer, Preact booking widget (wizard layout, manage mode, holds, alternatives on slot_taken, dark mode, RTL, keyboard calendar).

= 0.2.0 =
* Phase 1: booking engine — Period/Schedule/Availability (slot generation with buffers, capacity, min notice, DST-safe), atomic reservation with per-staff lock + unique slot_key, holds, reschedule/cancel, `wp bookance` CLI (status, seed, slots, reserve, hold, cancel, reschedule, reset).

= 0.1.1 =
* Fix: meta table was not created (index prefix longer than column). Caught by first real-site activation.

= 0.1.0 =
* Phase 0: bootstrap, autoloader, database schema (12 tables), versioned migrator, timezone engine, admin status screen, uninstall.
