=== ProAppointments Scheduler ===

Contributors: ProAppointments
Tags: appointments, booking, scheduler, calendar, staff, services
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.6.22
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A complete Appointment & Booking System with professional frontend UI, staff scheduling, and a fully featured admin dashboard – designed for IT and computer service businesses.

== Description ==

ProAppointments Scheduler lets you offer a modern, reliable booking experience for your clients while keeping day‑to‑day scheduling simple for your team.

=== Key Features ===

* **Professional frontend booking form**
	* Multi-step wizard: Service → Staff → Date & Time → Details → Confirm.
	* Clean, responsive card-style form for desktop, tablet, and mobile.
	* Service selection with duration/price meta and optional staff selection.
	* Modern calendar with disabled past dates and unavailable days.
	* Dynamic time slots generated from service duration and staff availability.
	* Time dropdown automatically hides past times for the current day.
	* Remote‑service notice: if a service name indicates remote/online support, the form shows a professional message explaining that RustDesk/AnyDesk (or similar) remote access will be required.

* **Reports, integrations & growth features**
	* Dashboard KPIs, upcoming appointments, trend charts, and a dedicated Reports page.
	* Google Calendar sync, recurring appointments, and WooCommerce order creation (Licensed; WooCommerce only when installed).
	* WPML-ready admin texts via `wpml-config.xml`.

* **Staff management & availability**
	* Create staff records with name, email, phone, and bio.
	* Per‑staff weekly schedule (days + shift times).
	* Assign services to staff (specialties) so only relevant staff appear for each service.
	* The booking engine honours staff schedule, service duration, and existing bookings to prevent overlaps.
	* “Any staff” option for clients; admin can assign later.

* **Services tailored for IT / computer businesses**
	* Add your own services (name, description, duration, price, active flag).
	* One‑click **“Restore default IT services”** button to seed a full catalog of common IT services (remote support, on‑site visits, consultations, WordPress support, security review, and more).

* **Appointment management for admins**
	* **Manage Appointments** screen (WP_List_Table based) with:
		* Filters by date range, staff member, and status.
		* Pagination and total count.
		* Bulk actions: CSV export and delete.
	* **Inline status actions** in the list:
		* Action links under the Status column: **Mark Pending**, **Confirm**, **Close** (Completed), **Cancel**.
		* Status changes also trigger email notifications when enabled.

* **Dashboard, Kanban, and calendar views**
	* **Dashboard**:
		* KPI cards: Total Appointments, New Bookings, Revenue, Customers.
		* Upcoming appointments table with status badges.
		* Line chart (30-day overview) and top-services doughnut chart.
		* Status snapshot, quick links, and embedded Kanban board preview (Licensed).
	* **Reports**: Dedicated analytics page with the same KPI/chart insights.
	* **Kanban board**:
		* Drag‑and‑drop appointments between Pending / Confirmed / Completed / Cancelled.
		* Filter by staff.
	* **Calendar view**:
		* Monthly calendar highlighting days with appointments.
		* Click a day to see appointments and time details.

* **Email notifications (HTML)**
	* Customer emails:
		* Confirmation, pending‑assignment, cancellation, and reminder messages.
		* Fully configurable HTML subject and body with placeholders:
			`{customer_name}`, `{customer_email}`, `{appointment_date}`, `{start_time}`, `{end_time}`, `{appointment_status}`, `{service_name}`, `{staff_name}`.
	* Staff emails:
		* New appointment notification and reminder emails.
		* Separate on/off switches for new bookings and reminders.
		* Independent HTML templates per email type.
	* Admin/manager emails:
		* Notification when a booking is made with “Any” staff, prompting assignment.
	* Background reminder cron:
		* Sends reminders a configurable number of hours before the appointment.
		* Optimised query that only scans the relevant date window.
	* Built‑in test email tool to validate templates and delivery.

* **Security**
	* All public write operations (booking) are protected with nonces.
	* Optional **Google reCAPTCHA** v3 integration on the booking form.
	* Strict capability checks for admin REST routes (`proappt_manage_*` caps or `manage_options`).
	* Extensive use of `sanitize_*`, `wp_kses_post`, and escaping functions in both admin and frontend templates.

* **Frontend style customizer**
	* Live‑preview style panel in the admin.
	* Controls for:
		* Primary color, button style, form background and border, input styling.
		* Calendar styles (including soft rounded colourful themes).
		* Weekday label case and size.
	* Color pickers with HEX copy buttons and preset themes.
	* “Reset styles” button to restore default look.

* **Shortcode, block, and widget**
	* Shortcode: `[proappt_booking]`.
* Shortcode: `[proappt_staff_portal]`.
* Shortcode: `[proappt_staff_login_link]` for direct popup login links/buttons.
	* Shortcode attribute `show_staff="0"` to hide the staff dropdown.
	* Gutenberg block: **“ProAppointments Booking”**.
	* Widget: **“ProAppointments Booking”** for classic widget areas.

* **Technical details**
	* Uses dedicated database tables for services, staff, appointments, staff schedules, and staff–service assignments.
	* All schema changes applied via `dbDelta` with versioning (`PROAPPT_DB_VERSION`).
	* REST API based frontend and admin screens for snappy UX.
	* Translation‑ready (`.pot` file included).
	* Namespaced options and capabilities using the `proappt_` prefix.

== Installation ==

1. Upload the `proappointments-scheduler` folder to `/wp-content/plugins/`, or install the ZIP via **Plugins → Add New → Upload Plugin**.
2. Activate **ProAppointments Scheduler** through the **Plugins** screen.
3. After activation, the plugin will:
	* Create necessary database tables.
	* Add ProAppointments capabilities to the Administrator role.
	* Seed default visual settings.
	* (Optionally) seed default IT services if no services exist yet.
4. Go to **ProAppointments** in the admin menu to configure services, staff, notifications, and styles.

== Configuration & Usage ==

=== 1. Configure services ===

1. Navigate to **ProAppointments → Services**.
2. Either:
	* Click **“Restore default IT services”** to populate a full set of computer‑related services; or
	* Use **“Add / Edit Service”** to define your own:
		* **Name** – how the service appears to clients.
		* **Description** – internal or client‑visible description.
		* **Duration (minutes)** – used to calculate time slots.
		* **Price** – optional; shown in admin views.
		* **Active** – whether the service can be booked.
3. Save your services. You can edit or delete them at any time.

Tip: For services that require remote access, include words like “Remote”, “Online”, or “Phone” in the service name so the booking form can automatically show the remote‑access note to clients.

=== 2. Configure staff & availability ===

1. Go to **ProAppointments → Staff**.
2. For each staff member:
	* Fill in **Name**, **Email**, **Phone**, and optional **Bio**.
	* Mark **Active** to make them bookable.
	* Under **Availability (shift times)**:
		* Add one or more shifts per day (e.g. Monday 09:00–13:00, 14:00–17:00).
		* Only days with defined shifts are considered available; other days are treated as off‑days.
	* Under **Services (specialty)**:
		* Check which services this staff member can deliver.
		* If you leave all unchecked for all staff, the plugin treats every staff as able to deliver every service (backwards‑compatible behaviour).
3. Save the staff member.

The booking engine uses this data to:

* Limit available days and times for each staff member.
* Prevent overlapping appointments (per‑staff).
* Merge availability when the client chooses “Any” staff.

=== 3. Configure notifications ===

1. Open **ProAppointments → Email / Notifications**.
2. Under **When to send notifications**, choose when customers should receive emails:
	* On new booking.
	* When status is set to Confirmed.
	* When an appointment is Cancelled.
	* Whether to send a reminder, and how many hours before.
3. Configure **Admin / Manager notification email** for “Any staff” bookings.
4. In **Customer email template (HTML)**, customise subject and body using placeholders.
5. In **Staff notification emails (HTML)**:
	* Enable or disable:
		* Email on new appointment assignment.
		* Reminder emails to staff before the appointment.
	* Customise the HTML templates for both new and reminder emails.
6. Use the **Test email** section to verify that email delivery and templates are working.

=== 4. Configure security (reCAPTCHA) ===

1. In **ProAppointments → Settings**, enter your **Google reCAPTCHA v3** site key and secret key.
2. When enabled, the booking form will request and verify a reCAPTCHA token before creating appointments.

=== 5. Configure frontend style ===

1. Go to **ProAppointments → Frontend Style**.
2. Adjust colours, typography, spacing, and calendar styles and see them update in the live preview.
3. Click **Save styles** to persist your configuration.
4. Use **Reset styles** to restore the default visual theme if needed.

=== 6. Add the booking form to your site ===

* **Shortcode (classic editor or page builders)**:
	* Basic: `[proappt_booking]`
	* Hide staff selector: `[proappt_booking show_staff="0"]`
* Staff portal page: `[proappt_staff_portal]`
* Direct staff login trigger link/button:
  * `[proappt_staff_login_link portal_url="https://example.com/staff-portal/"]`
  * Optional label/class:
    `[proappt_staff_login_link portal_url="https://example.com/staff-portal/" label="Team Login" class="my-login-link"]`
* **Block editor**:
	1. Edit a page and click **Add block**.
	2. Search for **“ProAppointments Booking”**.
	3. Insert and configure options (such as showing staff).
* **Widget (classic widgets screen)**:
	1. Go to **Appearance → Widgets**.
	2. Add the **“ProAppointments Booking”** widget to a sidebar or footer.

=== 7. Manage appointments ===

* Use **ProAppointments → Appointments** to:
	* View all bookings with filters.
	* Change status quickly via the Status column action links.
	* Export selected appointments to CSV.
	* Bulk‑delete selected appointments.
* Use the **Kanban** page for drag‑and‑drop status changes and visual workflow.
* Use the **Calendar** page to see which days are busy and inspect per‑day details.

== Frequently Asked Questions ==

= How do I show the booking form? =

Use the shortcode `[proappt_booking]` on a page or post, add the **“ProAppointments Booking”** block in the block editor, or use the **“ProAppointments Booking”** widget in a widget area.

= Can I hide the staff selector? =

Yes. Use the shortcode with `show_staff="0"`: `[proappt_booking show_staff="0"]`. In the block, toggle the “Show staff” option in the block settings sidebar.

= How are time slots generated? =

Slots are built from:

* The selected service duration.
* The selected staff member’s configured shift for that day (or merged availability when “Any staff” is chosen).
* Existing bookings for that staff member or unassigned bookings (to prevent overlaps).

On days where a staff member has no shifts configured, those days are treated as unavailable and no time slots are offered.

= Does the plugin support remote IT support sessions? =

Yes. For services whose names contain “remote”, “online”, or “phone”, the booking form automatically shows a professional note explaining that the client must have a remote‑access tool (such as RustDesk or AnyDesk) ready before the session.

== Help & Support ==

If you need help, start with this quick checklist:

1. Ensure at least one service is marked **Active** in **ProAppointments → Services**.
2. Ensure staff has schedule shifts and (optionally) service specialties in **ProAppointments → Staff**.
3. If using caching/CDN/minification, clear all caches after updates.
4. Re-test in an incognito/private window after clearing cache.

=== Troubleshooting ===

= Frontend does not show services/staff/slots =

Recent versions include a REST + AJAX fallback strategy, so the booking form can still load data when REST is blocked.

Check:

* Browser DevTools Network tab for:
	* `wp-json/proappt/v1/services`, and/or
	* `wp-admin/admin-ajax.php?action=proappt_public_services`
* Response should be JSON with a `services` array.
* Services must be active (`is_active = 1` in plugin UI).

= Kanban shows “An error occurred” =

The Kanban board now validates appointment IDs and uses a fallback admin AJAX endpoint when REST read requests fail.

Check:

* You are logged in with permission to manage appointments.
* Browser DevTools for failed requests to:
	* `wp-json/proappt/v1/admin/appointments`
	* `wp-admin/admin-ajax.php?action=proappt_admin_appointments`
* If `WP_DEBUG` is enabled, additional Kanban diagnostics are shown in the console.

= Site Health warns: “The REST API did not process the context query parameter correctly.” =

The plugin no longer uses a broad REST authentication override that could affect Site Health checks.  
If this warning persists, it is usually environmental (server/proxy/caching/plugin conflict). Test with:

* all caches disabled temporarily,
* default theme + minimal plugin stack,
* direct access to `wp-json/wp/v2/types/post?context=edit` while logged in.

= Notification templates are hard to edit =

Notification bodies now use WordPress editors with both **Visual** and **Text** tabs:

* Visual tab for non-technical admins.
* Text tab for advanced HTML editing.

Placeholders remain supported in both modes.

== Changelog ==

= 1.6.22 =
* Added admin Date, time & timezone settings (default India / Asia/Kolkata, dd/mm/yyyy, 12-hour AM/PM).
* Booking form, staff portal, admin calendar/Kanban/invoices, and email placeholders now display dates and times using those settings.

= 1.6.21 =
* Staff portal status column now paints styles via inline styles from the admin setting (bypasses cached CSS that kept tiled checkmark icons).
* Renamed status control classes and neutralized legacy `.proappt-status-select` background-image rules.

= 1.6.20 =
* Status column styles now apply from the staff portal markup (not only JS) and never tile icons on the select control; hard-refresh cache busting for portal CSS/JS.
* Settings preview updates live when changing status column style.
* Payment reminder email body uses Visual/Text editor (readable formatting + full HTML), same pattern as notification templates.

= 1.6.19 =
* Fixed staff portal status icons tiling over text (unreadable Completed pills) by using background-color instead of the background shorthand.
* Added admin setting to choose Appointment list status column style: Color pill, Icon pill, Soft badge, Outline, Left bar, or Plain (default: Color pill).

= 1.6.18 =
* Increased staff portal status-pill icon size to 14px for better readability on high-density displays.

= 1.6.17 =
* Replaced emoji status labels in staff portal appointment-list dropdown with tiny inline SVG icons for consistent rendering across operating systems and browsers.

= 1.6.16 =
* Improved staff portal appointment-list status visibility with colored status-pill dropdowns and status icons, plus better column/select sizing to avoid clipped labels.

= 1.6.15 =
* Improved Kanban reset UX: confirmation appears only when current values differ from recommended and only once per page load.

= 1.6.14 =
* Added “Reset to recommended” buttons beside both staff portal Kanban settings (items per column and column scroll height) to quickly apply 3 and 420px defaults.

= 1.6.13 =
* Added admin setting for staff portal Kanban column scroll height (px), so max visible card-stack height can be tuned without code edits.

= 1.6.12 =
* Staff portal Kanban UI: added per-column “Showing X of Y” text and vertical scrollbar for card lists so dashboard height stays controlled as appointments increase.

= 1.6.11 =
* Staff portal Kanban UX: added admin setting to cap cards per status column (default 3, range 1-20), sorted by current/upcoming first, preventing very tall columns as records grow.



= 1.6.10 =
* Added admin-only booking request sequence debug logs (`?proappt_debug=1`) for staff/availability/slots request lifecycle tracing in browser console.

= 1.6.9 =
* Calendar/month switching hardening: request sequencing + in-flight aborts prevent stale staff/availability/slots responses from older clicks overwriting current selections.

= 1.6.8 =
* Runtime UX hardening: after first public REST failure, frontend booking switches to AJAX-only mode for the rest of the session (services, staff, availability map, slots, submit) to avoid repeated step-by-step console errors.
* Staff edge case improvement: “No staff configured” guidance now appears consistently in fallback responses too.

= 1.6.7 =
* Replaced remaining `hidden` toggles in admin/staff portal JavaScript with boolean `prop('hidden', ...)` for cleaner jQuery Migrate compatibility.
* Updated Help → Troubleshooting with REST 403/500 and cache/stale-settings checks for booking forms.

= 1.6.6 =
* Hotfix: resolved a PHP fatal causing 500 on public booking REST GET endpoints by safely detecting route from `rest_route`/request URI in REST auth allowlist logic.

= 1.6.5 =
* Fixed frontend 403 errors on public REST booking endpoints by whitelisting ProAppointments public GET routes through REST authentication filters; fallback AJAX remains in place.
* Replaced deprecated jQuery `removeAttr('hidden')` with boolean `prop('hidden', ...)` in booking wizard UI.

= 1.6.4 =
* Frontend booking display settings (max services, show duration/price) now apply via form-embedded config; rocker save + click reliability fixed.

= 1.6.3 =
* Fixed frontend booking settings: max services applies to customers without WP login; duration/price toggles now honor YES/NO correctly.

= 1.6.2 =
* Professional default HTML payment reminder email (subject + body) with invoice summary and placeholders; auto-seeded when settings were blank.

= 1.6.1 =
* Currency selector (default ₹) syncs admin + frontend; toggles for showing duration/price; compact inline service rows; clearer multi-service total-time availability messaging.

= 1.6.0 =
* Redesigned admin dashboard (KPIs, upcoming table, trend + top-services charts) and multi-step responsive frontend booking wizard.
* Added Reports & Analytics, Integrations (Google Calendar Sync, WooCommerce orders when WC is active), and recurring appointments (Licensed).
* WPML config + improved mobile/tablet layout; existing booking, staff, invoices, Kanban, and notifications preserved.

= 1.5.20 =
* Expanded Help & Support docs: default settings tables, worked shortcode/service examples, placeholders, statuses, and deeper troubleshooting.

= 1.5.19 =
* Redesigned plugin information header; license server details no longer shown in admin UI.
* New **Help & Support** documentation page (guides, shortcodes, license, troubleshooting, contact).

= 1.5.18 =
* Dual license servers with failover: computerbazar.in → license.alfaintelli.com; busy message when both unreachable.

= 1.5.17 =
* Free Version limits without a valid license (3 services, 1 staff, 50 appointments/month); Invoices, Kanban, reminders, multi-service, participants, and Frontend Style require a license.
* Licensed sites unlock full features with no record limits.
* Settings and License pages show plugin information header and Free Version / Licensed badge.

= 1.5.16 =
* **Critical fix**: rename license update client to `ProAppt_License_Updater` so it does not fatally collide when another plugin already declares `WP_License_Updater`.

= 1.5.15 =
* New **License** admin page (ProAppointments → License): activate/validate/deactivate `proappt_license_key` against computerbazar.in; REST + AJAX handlers; clears update cache after status changes.
* Settings page includes a link to License & updates.

= 1.5.14 =
* WordPress **7.0** compatibility: `Tested up to: 7.0`; booking block **apiVersion 3**; license update client for computerbazar.in.
* Security: appointments bulk export/delete require capability + list-table nonce; admin Kanban AJAX and staff portal AJAX verify nonces.
* Settings REST save sanitizes each option; default service seeding uses plain English (no early `__()` on activate); reminders cron scheduled on activation/upgrade only.

= 1.5.13 =
* Fix WordPress notice: translation domain loaded too early — text domain now loads on **init**; booking widget is no longer constructed at bootstrap (avoids `__()` before init on every request).
* Harden hook loader against **null priorities** (PHP 8.5 / `WP_Hook` deprecation) and fix cron unscheduling on deactivate.

= 1.5.12 =
* Staff portal **Add / Edit appointment**: **Services** are a full-width top section with a multi-column checkbox grid; **Schedule, staff & client** (and save actions) sit in a second section underneath.

= 1.5.11 =
* Staff portal **session on refresh**: fixed expiry check mixing **UTC** stored values with **local** “now”, which could clear a valid session on every full page load; expiry now uses **`UTC_TIMESTAMP()`** in SQL.
* Staff session **cookie domain** falls back to host-only when `COOKIE_DOMAIN` does not match the current hostname.
* Staff portal shortcode sends **no-cache headers**; session **bootstrap** runs on **document ready**.

= 1.5.10 =
* Staff portal: after **refresh** or **hard refresh**, a quick **session check** restores the dashboard when the cookie is valid but the page HTML was cached as logged out; AJAX uses **withCredentials**.
* Staff portal **Add / Edit appointment**: **two-column layout** (wide **services** grid on the left, appointment details on the right from 900px); denser service checkbox columns to fill the panel.
* Admin: staff inactivity timeout input **min="0"** so disabling the timer matches the description.

= 1.5.9 =
* Staff portal: session cookie path defaults to site root so staff remain logged in after **refresh** or **hard refresh**; logout still clears the session. Filter `proappt_staff_session_cookie_path` for custom paths.
* Staff portal: **0** in session timeout (minutes) correctly disables the inactivity auto-logout timer.

= 1.5.8 =
* Staff portal **Add / Edit appointment**: full-width **multi-column services** grid; two-column field layout below on larger screens.
* **Total** and optional **manual price override** in the section header; booking `price` included on create/update.
* REST: staff appointment **update** accepts `price`.

= 1.5.7 =
* Admin appointment modal: **Manual price override** field under the live service total; leave empty to use that total, or enter a custom booking price.

= 1.5.6 =
* Admin appointment modal: two-column layout on desktop, single column on smaller screens.
* Live **Total** (from selected service prices) shown in the modal header; booking price syncs when services change.

= 1.5.5 =
* Guest booking default: **one** service per appointment when not signed into WordPress; filter `proappt_max_guest_booking_services` may raise the cap to **two** (values above 2 are clamped).
* New helper `proappt_get_max_guest_booking_services()`; REST and booking script use it.
* Guest-facing copy and API errors use correct singular/plural for “service(s)” when the limit is 1.

= 1.5.4 =
* Public booking: guests (not signed into WordPress) may select at most two services; signed-in users have no limit on the same form.
* REST enforcement on public booking endpoints so the limit cannot be bypassed.
* Filter `proappt_max_guest_booking_services` (default 2) to change the guest cap.

= 1.5.3 =
* Multiple services per appointment: public booking form uses checkboxes; duration and price combine all selected services.
* Database column `service_ids_json` (DB version 11); REST and public AJAX accept `service_ids` (array or comma-separated).
* Invoices from multi-service appointments include one line item per service.
* Admin appointment modal and staff portal quick add/edit support multiple services.

= 1.5.2 =
* Invoice partial payments: record multiple payments per invoice with method, date, and reference.
* Balance due shown on invoice detail and in admin/staff invoice lists.
* Payment reminder email to client (configurable subject/body in plugin settings).
* New table `proappt_invoice_payments` (DB version 10); REST endpoints for add/delete payment and send reminder.

= 1.5.1 =
* Full invoice editing for admin and staff portal.
* Admin: "Edit" link in invoices list opens full edit modal (client info, items, discount, tax, notes, status).
* Staff portal: "Edit" button opens edit modal for their own invoices with full field editing.
* New REST endpoint: `POST staff/invoices/{id}` for staff invoice updates.
* Shared `update_invoice_from_params()` ensures consistent update logic.

= 1.5.0 =
* Redesigned manual invoice creation form for both staff portal and admin.
* Client dropdown with all existing clients — select to auto-fill info and load completed appointments.
* "+ New Client" option for invoicing clients without prior appointments.
* Multi-select completed appointments with "Import Selected" button.
* Service autocomplete datalist on description fields.
* Larger input fields, professional fieldset layout, responsive design.

= 1.4.2 =
* Fixed "Unsupported staff portal request" error when staff create invoices from the frontend portal.
* Fixed Invoices tab not switching in the staff portal.
* Replaced Appointment ID input with a dropdown of completed appointments filtered by client name for manual invoice creation (admin and staff).
* Fixed AJAX proxy parameter handling for invoice endpoints.

= 1.4.1 =
* **Manual invoice creation**: "Create Invoice" button on admin Invoices page and staff portal Invoices tab.
* Import appointment details into invoices by appointment ID.
* Add unlimited custom line items with description, date, time, quantity, and unit price.
* Flat or percentage discount support with live auto-calculation.
* Invoice views now display discount breakdowns.

= 1.4.0 =
* **New feature: Invoicing system** — Professional A4-printable invoices auto-generated on appointment completion.
* Smart pricing: quantity calculated from appointment duration ÷ service base duration (e.g. 1hr appointment / 30min service = 2 units).
* Same-day appointments for the same client are grouped into one invoice with separate line items.
* Invoice management admin page with list, view, print, status updates, and delete.
* Configurable invoice settings: company info, logo, tax rate, currency symbol, prefix, payment terms.
* Staff portal invoice creation from inline updates, Kanban drops, and the add/edit form.
* All "Customer" labels renamed to "Client" across admin, staff portal, emails, and exports.
* New database tables: `proappt_invoices` and `proappt_invoice_items` (DB version 8).

= 1.3.2 =
* Fixed cancelled appointment availability — cancelled appointments now correctly free their time slots for new bookings.
* Fixed multi-day appointment overlap detection — appointments spanning multiple days now block all spanned dates, not just the start date.
* Fixed booked-slot map key collision that could allow double-booking when two appointments start at the same time.
* Added no-cache headers to slot/availability REST and AJAX responses to prevent stale availability data from server-side caching.
* Added client-side cache busting for slot and availability map requests.

= 1.3.1 =
* Professional admin calendar redesign: full-width grid, dark toolbar, today highlight, per-status colored badges, rich day detail panel with time/service/customer/status, 6-row grid fill, responsive mobile layout.

= 1.3.0 =
* Staff calendar redesign: colored per-status appointment count badges (pending/confirmed/completed/cancelled) replace the generic total number.
* Fixed staff session logout on browser refresh — staff sessions now persist correctly.
* Added configurable inactivity auto-logout timer (default 5 minutes, admin-configurable).
* Calendar tooltips now include appointment status for quick scanning.

= 1.2.82 =
* CRITICAL: Fixed customer postpone/transfer action wiping entire appointment record (data loss on leave notification links).
* Fixed staff portal save button always resetting to "Add Appointment" during edits.
* Fixed inline note update using wrong key (`notes` → `staff_notes`).
* Fixed booking form submit handler double-firing on timeout/abort failures.
* Fixed stale XHR references in AJAX fallback error handlers.
* Fixed AJAX staff fallback missing `res.data.staff` response shape.
* Fixed hardcoded English button text breaking i18n after booking submission.
* Fixed potential TypeError crash when customer form fields are missing from DOM.
* Hardened `escapeHtml` with `>` and `'` entity escaping (XSS prevention).
* Added server-side end_date validation to admin appointment save endpoint.
* reCAPTCHA v2 null widget guard for graceful degradation.
* Admin list table, CSV/ICS exports, and Kanban cards now show multi-day date ranges.

= 1.2.81 =
* Added full reCAPTCHA v2 checkbox support to the frontend booking form (visible widget, getResponse, reset after booking).
* Fixed reCAPTCHA API loading for v2 using explicit render mode.

= 1.2.80 =
* Server-side reCAPTCHA now gracefully degrades when keys are misconfigured — bookings are allowed through instead of being blocked.
* Empty tokens are verified with Google to detect whether the issue is a configuration error or a bypass attempt.

= 1.2.79 =
* Fixed silent booking form failure when reCAPTCHA site key is invalid — form now submits gracefully with a clear error.
* Added try-catch around grecaptcha.execute() to handle synchronous errors from Google's reCAPTCHA library.

= 1.2.78 =
* Fixed conflict detection race condition — save now properly waits for conflict check before proceeding.
* Improved conflict panel with clear overlap explanation and visual styling.
* Added "End Date" field for multi-day appointments (site visits, extended services) — staff portal and admin backend.
* New `end_date` column added to appointments table (DB version 7, auto-migrated via dbDelta).

= 1.2.77 =
* Fixed frontend booking form submission by adding AJAX fallback for hosts that block REST POST requests.
* Added "Add New" appointment button to the admin Manage Appointments page.
* Admin appointment modal now supports both create and edit modes with dynamic titles and button labels.

= 1.2.76 =
* Added weekday label-length fallback chain for frontend staff portal calendar to ensure 1/2/3 letter setting applies consistently.

= 1.2.75 =
* Fixed weekday label length setting reliability on booking calendar by adding fallback resolution from localized config, form data attribute, and CSS variable.

= 1.2.74 =
* Updated frontend booking calendar legend so “Phone only” uses a phone icon badge (matching the calendar day indicator).

= 1.2.73 =
* Reduced phone-only badge size in calendars on mobile and switched to a non-emoji phone symbol for consistent rendering.

= 1.2.72 =
* Replaced off-day text badge with icon badge and tooltip (`Not available / leave`) in frontend booking and staff portal calendars.
* Kept phone-only icon badge behavior for visual consistency across leave statuses.

= 1.2.71 =
* Replaced phone-only day badge text with a phone icon in frontend booking and staff portal calendars.
* Added hover tooltip on phone icon badge to explain “Phone consultation only”.

= 1.2.70 =
* Fixed weekday label length setting propagation in frontend booking script localization so 1/2/3 letter selection is consistently applied across booking render paths.

= 1.2.69 =
* Added calendar weekday label length setting in Frontend Style Customizer (1-letter / 2-letter / 3-letter).
* Applied selected weekday label length to both frontend booking and frontend staff portal calendars.

= 1.2.68 =
* Added ultra-compact one-letter weekday headers on very small mobile screens for both frontend booking and staff portal calendars.
* Larger screens continue using standard 3-letter weekday headers.

= 1.2.67 =
* Fixed mobile calendar overflow in frontend booking by constraining day columns to equal-width tracks and preventing badge text from expanding the grid beyond viewport width.
* Applied matching responsive containment and compact spacing improvements to staff portal calendar on mobile devices.

= 1.2.66 =
* Frontend staff dashboard: added mobile calendar collapse toggle so Kanban stays primary on smaller screens.
* Appointment Calendar section now defaults collapsed on mobile and can be expanded/collapsed by staff.

= 1.2.27 =
* Added explicit “Phone consult service” option in service settings and used it in leave-time booking rules.
* Leave-impact handling now also covers appointments where unavailable staff is a participant, not only primary assigned staff.

= 1.2.26 =
* Added staff leave management (Holiday/Off/Sick/Other) with date ranges and optional “phone consult allowed”.
* Booking and slot availability now block regular appointments when staff are on leave.
* Added leave-impact customer action flow for existing appointments: email links to postpone or transfer to another available staff (same service) when possible.

= 1.2.25 =
* Frontend Style Customizer: added Auto-contrast button text toggle to keep button labels readable against selected primary color.
* Auto-contrast setting now persists and is applied to frontend CSS variable generation.

= 1.2.24 =
* Frontend Style Customizer: added Color harmony scheme selector (Monochromatic, Complementary, Analogous, Triadic, Achromatic) with Apply Scheme action.
* Scheme apply now auto-generates palette colors and key frontend UI colors for faster design setup.
* Added saved option support for selected color scheme in admin options handling.

= 1.2.23 =
* Frontend Style Customizer settings (fonts, sizes, colors) now apply consistently to booking form and staff portal across direct shortcode/widget render paths.
* Staff portal primary button styling now respects configured customizer colors while preserving readable contrast.

= 1.2.22 =
* Staff portal: fixed low-contrast primary buttons so “Add Appointment” and row “Update” remain clearly visible across theme color schemes.

= 1.2.21 =
* Staff portal: added “Participant Staff” tooltip explaining multi-select on desktop/mobile.
* Staff portal: fixed Customer Email field styling/height to match other controls.
* Staff portal: improved Status field sizing and aligned appointment list action buttons.

= 1.2.20 =
* Conflict preview panel now shows which existing appointment(s) overlap for each staff member (time/service/customer).

= 1.2.19 =
* Staff portal now shows a live conflict preview panel before saving appointments (checks overlaps for primary + participant staff).
* Save is blocked when conflicts are detected to prevent double-booking.

= 1.2.18 =
* Added multi-staff participant support for appointments (primary staff + additional participant staff).
* Staff portal appointment form can now assign participant staff and prevent overlaps for every assigned participant.
* Team coordination improved with participant-aware listing and filtering in the staff portal dashboard.

= 1.2.17 =
* Fixed staff portal active-tab text contrast so labels remain readable across theme color mixes.
* Staff portal now supports creating, editing, and deleting appointments directly from frontend.
* Added Mine/Team scope and staff filters to review/coordinate other staff appointments and avoid conflicts.

= 1.2.16 =
* Added General Settings toggle to enable/disable email OTP requirement for staff login (enabled by default).
* Staff auth now respects the toggle: direct login when disabled, OTP challenge+verification when enabled.

= 1.2.15 =
* Staff login now uses two-step verification: password check + email OTP before staff session is issued.
* Added OTP security controls (expiry, max attempts, throttle) and updated staff login popup to handle OTP entry.
* Staff profile now includes editable email and enforces a valid email as mandatory for profile updates and OTP delivery.

= 1.2.14 =
* Staff portal toolbar welcome line shows the staff member’s display name from their profile (updates after load and after saving profile).

= 1.2.13 =
* Staff portal: redesigned authenticated view with Dashboard / Export / My profile tabs and morphology-style panels.
* Profile: searchable services list with scroll area; clearer sections for account, shifts, and services.
* Global status messages placed under tabs; KPI grid includes cancelled totals; logout uses secondary tactile-style button.

= 1.2.12 =
* Staff portal: load Google reCAPTCHA before staff portal JS (proper dependency order) so v3 initializes reliably on the frontend.
* Staff portal: CSS to prevent themes from hiding the reCAPTCHA v3 badge; added visible v3 legal disclosure text on the portal intro.
* Booking enqueue: apply the same v2/v3 script URL logic and depend on Google’s script before `booking.js` when reCAPTCHA is enabled.

= 1.2.11 =
* Added reCAPTCHA type setting (`v3` or `v2 Checkbox`) in General Settings.
* Updated staff login frontend to support selected reCAPTCHA type correctly.
* Added v2 checkbox rendering/token flow for staff login when reCAPTCHA type is set to v2.

= 1.2.10 =
* Added admin-side "Test reCAPTCHA Connection" button in General Settings.
* Added admin REST endpoint to validate saved reCAPTCHA keys connectivity and secret validity.
* Added actionable test result messages to help diagnose key/secret/domain mismatch issues quickly.

= 1.2.9 =
* Added explicit frontend detection for invalid Google reCAPTCHA site key errors during staff login.
* Prevented misleading login requests when reCAPTCHA key is invalid/not loaded; popup now shows actionable key/domain message.
* Updated admin settings help text to clarify reCAPTCHA v3 key requirement for token-based login flow.

= 1.2.8 =
* Fixed staff session lookup bug after login where session validation compared against password hash instead of session token hash.
* Resolved post-login "Could not load appointments" issue for valid staff credentials.

= 1.2.7 =
* Improved reCAPTCHA server-side validation diagnostics for staff login and booking endpoints.
* Added explicit handling for expired/duplicate tokens and invalid key/secret cases.
* Added clearer error messages for likely key/domain mismatch issues in Google reCAPTCHA settings.

= 1.2.6 =
* Fixed stuck "Logging in..." state by adding reCAPTCHA fail-safe fallback in staff login flow.
* Added login request timeout handling so UI recovers cleanly instead of hanging.
* Improved login error messaging for timeout/network edge cases.

= 1.2.5 =
* Fixed staff login popup overlap issue by improving modal container layout for sticky-header themes.
* Moved login error feedback inside popup so failed login reasons are visible immediately.
* Improved login action UX with disabled/loading state and Enter key submission.
* Improved modal reliability by moving popup root to `body` at runtime (prevents theme container clipping/stacking issues).

= 1.2.4 =
* Fixed `[proappt_staff_login_link]` visibility by enqueuing frontend button styles when shortcode is used alone.
* Added `proappt-staff-login-trigger` class for direct modal trigger compatibility on portal pages.
* Improved same-page login trigger behavior so link click opens popup when portal shortcode is present.

= 1.2.1 =
* Added "Test Staff Login" action in Staff admin list for quick auth configuration checks.
* Added admin REST auth-check endpoint for staff login validation (username configured, staff/login active).

= 1.2.3 =
* Added new shortcode `[proappt_staff_login_link]` to create direct login trigger links/buttons.
* Supports `portal_url`, `label`, and optional `class` attributes.
* Login links auto-open popup on portal page using `?staff-login=1#staff-login`.

= 1.2.2 =
* Fixed staff login popup layering so it stays above theme header/menu overlays.
* Fixed/strengthened login button and form field visibility in popup to follow theme colors safely.
* Added direct menu-triggered popup login support via `#staff-login` or `?staff-login=1`.

= 1.2.0 =
* Replaced staff portal authentication dependency on WordPress users with plugin-owned staff auth storage.
* Added dedicated staff auth table and session flow for staff login/logout.
* Added popup staff login modal in frontend portal.
* Added Google reCAPTCHA validation on staff login using existing plugin reCAPTCHA settings.
* Added staff username/password fields in Staff admin form (plugin auth credentials).
* Removed frontend staff login requirement for WordPress user accounts.

= 1.1.2 =
* Added status color legend for staff calendar (pending, confirmed, completed, cancelled).
* Added status-based calendar day indicators for quick visual prioritization.
* Added export date-range controls (Export From / Export To) for CSV and ICS actions.

= 1.1.1 =
* Added frontend staff calendar view in staff portal with monthly navigation and day-wise appointment list.
* Added staff portal export tools for CSV and ICS downloads.
* Improved staff portal notes binding to use internal staff notes field consistently.

= 1.1.0 =
* Added secure staff self-service profile APIs in frontend portal: update bio, phone, shifts, services, and password.
* Added staff portal KPI cards and profile management UI.
* Added internal `staff_notes` support for staff-side appointment notes (separate from customer notes).
* Added booking rate-limiting to reduce abuse on public booking endpoint.
* Added staff action audit logging and admin staff-save audit entries.
* Added optional email fallback setting for staff login mapping (disabled by default).
* Added admin staff fields to create/link WordPress user credentials directly from staff profile section.
* Added staff bio tooltip/help text when customer selects a staff member during booking.

= 1.0.2 =
* Added frontend staff portal shortcode: `[proappt_staff_portal]` for staff login and self-service appointment management.
* Added staff-only frontend actions to view assigned appointments, update appointment status, and update notes.
* Added secure staff portal REST endpoints with strict ownership checks so staff can edit only their own appointments.
* Added staff account mapping improvements: linked WordPress user support in Staff admin form and list.
* Added frontend portal assets and settings guidance for using the new staff portal shortcode.

= 1.0.1 =
* Frontend data-loading hardening with REST-to-AJAX fallbacks for services, staff, and slots.
* Kanban drag-drop reliability fixes, including protection against invalid appointment IDs.
* Kanban admin AJAX fallback and debug logging support when `WP_DEBUG` is enabled.
* Admin form UX improvements: inline field validation and non-blocking toast notifications.
* Frontend booking form UX improvements: field-level validation, accessible error states, and clearer guidance.
* Notification templates upgraded to Visual + Code editor experience using WordPress editors.
* Improved compatibility with WordPress Site Health REST checks.

= 1.0.0 =
* Initial public release.
* Frontend booking form with calendar and dynamic time slots.
* Admin dashboard, services, staff, appointments, calendar, and Kanban views.
* Staff schedules and service specialties.
* HTML email notifications for customers, staff, and admin; reminder cron.
* Frontend style customizer with multiple calendar styles.
* Google reCAPTCHA integration.
* Default IT service catalog and “Restore default IT services” tool.
* Booking shortcode, Gutenberg block, and widget.
