=== Libre Bite ===
Contributors: simon61, freemius
Donate link: https://github.com/simurech/libre-bite
Tags: woocommerce, restaurant, pos, ordering, food-delivery
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.2.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Stress-free orders, happy guests, full tables — the WooCommerce plugin built for restaurants, take-aways, and cafés.

== Description ==

**More orders, less stress — Libre Bite turns WooCommerce into your restaurant's operational backbone.** No commission fees, no SaaS lock-in: your guests order online or at the table via QR code, pay with card, cash, or Twint, and your kitchen sees every order live on the board — all inside WordPress.

**Start for free. Upgrade only when you need more.**

---

= Free to Start =

All core features are available completely free of charge — no credit card, no trial period, no hidden limits.

A Pro subscription is only required for advanced features such as multi-location management, table ordering, optimised checkout, tipping, and pickup reminders. Pro plans are priced to be affordable — significantly cheaper than dedicated restaurant SaaS platforms.

**7-day free Pro trial — no payment required.**

---

= Built on WordPress & WooCommerce =

Libre Bite is a WordPress plugin. It extends WooCommerce — the proven e-commerce foundation used by millions of sites worldwide.

* **No new platform to learn** — manage everything inside your existing WordPress dashboard.
* **Your products stay WooCommerce products** — set them up once and they appear in the POS, checkout, and online shop automatically.
* **Use any WooCommerce-compatible payment gateway** — cash, card, Twint, Stripe, PayPal, or any other gateway you already have. Libre Bite charges **no transaction fees**.
* **Offline payments supported** — "Pay at pickup", "Pay at table", or any custom payment method via standard WooCommerce.

---

= For Whom Is Libre Bite? =

Libre Bite is built for **small and micro gastronomy businesses** — operations that want serious software without enterprise-level costs or delivery platform commissions.

* **Restaurants** — Take dine-in and take-away orders, keep the kitchen informed, delight guests with smooth service.
* **Take-Away & Fast Food** — Serve walk-ins fast with an integrated counter POS, accept card and Twint payments, no third-party fees.
* **Cafés & Bars** — Handle product extras, tips, and order flow without juggling multiple tools.
* **Multi-location businesses** — Run all branches from one WordPress installation, each with its own order board and POS (Pro).

---

= Modular by Design =

Only activate the features your business actually needs. Unused modules stay hidden — no cluttered menus, no unnecessary complexity.

---

= Core Features (Free) =

**Live Kanban Order Board (KDS)**
A real-time kitchen display that visualizes every incoming WooCommerce order as a card. Drag & drop cards between columns (New → Preparing → Ready → Completed) to update order statuses instantly — without reloading the page.

**Integrated Point of Sale (POS)**
A clear POS interface for walk-in customers. Add products to the order, accept payments — all without leaving WordPress.

**Location Management**
Create and manage branches, each with its own address, opening hours, and order routing. Works immediately for single-location businesses.

**Swiss 5-Cent Rounding**
Built-in support for the Swiss rounding rule (5-cent rounding). Indispensable for restaurants and retail in Switzerland.

**Pickup/Delivery Time Slots**
Customers choose a time slot for pickup or delivery directly during checkout. Relieve peak hours and better manage kitchen capacity.

**Product Add-ons & Extras**
Add configurable options to any WooCommerce product — sizes, sauces, toppings, preparation notes — with optional price markups.

**Modular Feature Control**
Only enable what your business really needs. Each module can be independently toggled on or off in the admin area.

**WooCommerce HPOS Compatible**
Fully tested with WooCommerce High-Performance Order Storage (HPOS). Safe for modern, high-traffic setups.

---

= Pro Features (Subscription required) =

**Table Ordering (QR Code)**
Generate a QR code for each table. Guests scan it and order directly — no address or pickup time fields required. Orders appear in the dashboard with the table name.

**Multi-Location Management**
Manage an unlimited number of branches. Each location gets its own Kanban board, POS configuration, and separate order flow — managed centrally via one WordPress installation.

**Optimized Checkout Flow**
A conversion-focused checkout process for gastronomy businesses — fewer steps, cleaner layout, mobile-first.

**Advanced Tipping System**
Customers can select percentage tip suggestions (e.g., 5%, 10%, 15%) or enter a custom amount. Tip amounts are saved per order and displayed in the dashboard.

**Automatic Pickup Reminders**
Automatic email reminders to customers X minutes before the scheduled pickup time. Fewer no-shows, better pickup experience.

**Nutritional Info & Allergen Labeling**
EU-compliant nutritional values and allergen declarations for every product. Displayed clearly on the product page and during checkout.

**Advanced Sound Notifications**
A browser signal tone when a new order arrives on the Kanban board. Configurable individually per location.

---

= Why Libre Bite? =

Delivery platforms take up to 30% commission. Dedicated restaurant SaaS tools charge monthly fees on top of that. Libre Bite is different: own your ordering system, pay no commissions, and keep every franc.

* **Commission-free ordering** — guests order directly on your website, no platform cut
* **No transaction fees** — ever
* **Twint, card, cash** — accept any payment WooCommerce supports
* **Swiss 5-cent rounding built in** — essential for CHF cash payments
* **QR code ordering at the table** — guests scan, choose, and pay in seconds (Pro)
* **Modular** — activate only what your business needs, nothing else
* **Your data stays yours** — in your own WordPress installation
* **Affordable Pro plans** — designed for small businesses, not enterprise budgets
* **7-day free Pro trial** — no payment required

---

= Works on Any Device =

Libre Bite works on any device — no app installation required. Use it with a mouse and keyboard on a desktop or laptop, or with touch input on a tablet. The Kanban order board, POS interface, and reservation dashboard are optimised for touch-first operation, making them well-suited for use on a tablet mounted at the counter or kitchen pass.

---

= How to Run Libre Bite =

**Option 1 — Extend your existing website**
Install Libre Bite directly into your existing WordPress/WooCommerce site. Any theme is compatible — no design changes required.

**Option 2 — Standalone installation (subdomain)**
Run Libre Bite as a dedicated installation on a subdomain, such as `order.myrestaurant.com` — completely independent from your main website, purpose-built for your gastronomy operation.

**Option 3 — Managed hosting by Libre Bite**
Libre Bite handles the complete setup: installation, configuration, hosting, and ongoing maintenance — from A to Z. Available as a paid service. Contact via GitHub.

---

= External Services =

This plugin uses **Freemius**, a third-party platform for managing licenses, subscriptions, and plugin updates for the Pro version.

During plugin activation, you can opt-in to data sharing with Freemius. Basic information about your website (WordPress version, PHP version, active plugins) is transmitted to Freemius to enable license validation and usage analysis. **Opt-in is completely optional.** All free core features work without opt-in.

* Freemius Privacy Policy: https://freemius.com/privacy/
* Freemius Terms of Service: https://freemius.com/terms/

No data is sent to Freemius if you skip or decline the opt-in during activation.

The Table Management feature (Pro) uses the **goQR.me API** (https://goqr.me/api/) to generate QR codes for table ordering links. The QR code URL is transmitted to generate the corresponding image. No personal or order data is sent.

* goQR.me API: https://goqr.me/api/
* goQR.me Privacy Policy: https://goqr.me/privacy-policy/

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/libre-bite` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Make sure **WooCommerce** is installed and active — Libre Bite requires WooCommerce.
4. Navigate to **Libre Bite** in the admin menu to configure locations, enable modules, and set up the POS and Kanban board.

== Frequently Asked Questions ==

= Is WooCommerce mandatory? =

Yes. Libre Bite is a WooCommerce extension. WooCommerce must be installed and active for Libre Bite to work. WooCommerce 8.0 or later is recommended.

= Which payment methods are supported? =

Libre Bite uses WooCommerce's standard payment system. Any WooCommerce-compatible payment gateway works — including Stripe, PayPal, Twint, cash on pickup, card at counter, and more. Libre Bite charges **no transaction fees**. You pay only for your payment gateway (if any) and the optional Pro subscription.

= Can customers pay in cash or at the counter? =

Yes. WooCommerce includes offline payment methods such as "Cash on Delivery" or "Pay in Person". You can rename and configure these freely — for example "Pay at pickup" or "Pay at the counter".

= Is the plugin compatible with WooCommerce HPOS? =

Yes. Libre Bite is fully compatible with WooCommerce High-Performance Order Storage (HPOS). It has been tested with both legacy post-based storage and the new Custom Order Tables.

= Can I manage multiple restaurant locations? =

Multi-location management is included in the Pro version. The free version supports a single location with full configuration of address, opening hours, and order routing.

= What is Swiss 5-Cent Rounding? =

In Switzerland, cash payments are rounded to the nearest 5 cents as 1- and 2-cent coins are no longer in circulation. Libre Bite automatically applies this rounding rule at checkout — useful for Swiss restaurants, cafés, and take-away businesses.

= Does the POS system work offline? =

The integrated POS system requires an active WordPress/WooCommerce session and an internet connection. It is a browser-based interface that currently does not support offline mode.

= Does Libre Bite share my data with third parties? =

Libre Bite uses Freemius for license management and delivery of Pro features. Data is only transmitted to Freemius if you explicitly opt-in during activation. No order, customer, or product data is transmitted — only basic website environment information (PHP version, WP version, plugin list). For more details, see the Freemius Privacy Policy: https://freemius.com/privacy/

= What are the minimum requirements? =

* WordPress 6.0 or higher
* WooCommerce 8.0 or higher
* PHP 7.4 or higher (PHP 8.1+ recommended)
* A modern browser for Kanban board and POS interface

= Is Libre Bite available in multiple languages? =

The plugin uses standard WordPress i18n functions and can be translated via .pot files or community translations on translate.wordpress.org. The default language is English.

== Screenshots ==

1. **Kanban Order Board** — Real-time order management for kitchen staff. Drag & drop cards to update status.
2. **POS Interface** — Integrated Point of Sale for walk-in customers and counter orders.
3. **Location Settings** — Configure branch address, opening hours, and order routing.
4. **Checkout Time Slots** — Customers choose their pickup time slot directly during checkout.
5. **Product Add-ons** — Configurable extras and options for each menu item.
6. **Module Settings** — Toggle individual features on or off depending on business needs.

== Changelog ==

= 1.2.8 =
* Maintenance: Updated Freemius SDK to version 2.13.1.

= 1.2.7 =
* Fix: HPOS compatibility – order meta now stored via HPOS API ($order->update_meta_data / $order->get_meta) instead of post meta functions.
* Fix: Capability checks now use plugin-specific capabilities (lbite_use_pos, lbite_view_dashboard) instead of generic edit_posts.
* Fix: Locations menu is now always visible – at least one location is required for POS and order overview.
* Fix: Free plan is now limited to 1 published location; attempting to publish a second one keeps it as draft and shows an upgrade notice.
* Fix: Removed orphaned onboarding assets and broken "Restart Setup" button in Help page.
* Fix: All hardcoded German strings in dashboard.js and pos.js replaced with localizable strings via wp_localize_script.
* New: Added de_CH_informal (informal Swiss German) and de_DE_formal (formal German) translation variants.

= 1.2.6 =
* Improvement: Alle Plugin-Strings auf Englisch umgestellt (WordPress i18n-Standard).
* New: Schweizerdeutsche Übersetzung (de_CH) wird direkt mit dem Plugin ausgeliefert.

= 1.2.5 =
* Fix: Zeitzonenfehler in Kanban-Sortierung und Auto-Statuswechsel behoben — strtotime() durch lbite_local_time_to_timestamp() ersetzt (class-order-dashboard.php, Zeilen 192–193 und 531).
* Fix: Anzeigefehler «Zuletzt geändert» in Order-Meta-Box korrigiert — strtotime() auf current_time('mysql')-Strings durch lbite_local_time_to_timestamp() ersetzt.
* Fix: Heutige Bestellungen im Dashboard-Widget zählten bei abweichender Server/WordPress-Timezone falsch — strtotime('today') durch timezone-bewusstes Mitternacht-Timestamp ersetzt.
* Fix: DateTime::createFromFormat() in checkout-location-time.php ohne Timezone-Parameter — auf DateTimeImmutable::createFromFormat() mit wp_timezone() umgestellt.
* Improvement: Produkt-Optionen im Warenkorb werden nun als ein gruppierter Eintrag «Optionen» angezeigt statt als separate «Option»-Zeilen pro Auswahl.

= 1.2.4 =
* Fix: Zeitzonenfehler bei Checkout-Bestätigung, Kanban-Board und E-Mails behoben — lokale Zeit-Strings werden nun korrekt mit lbite_local_time_to_timestamp() in Unix-Timestamps umgewandelt statt mit strtotime() (Doppelkonvertierung).
* Fix: Zeitzonenfehler bei POS-Bestellungen behoben (gleiche Ursache wie oben).
* Fix: Uhrzeit-Auswahlfelder im Checkout: Text wurde auf iOS/Safari unten abgeschnitten — line-height und height: auto ergänzt.

= 1.2.3 =
* Improvement: Capability-Dokumentation in class-roles.php erweitert — alle lbite_-Capabilities mit Inline-Kommentaren zur Funktion versehen.
* Improvement: phpcs:ignore-Kommentare um explizite Begründungen ergänzt (class-tables.php, class-reservations.php, class-checkout.php, class-onboarding.php, settings-tabbed.php).

= 1.2.2 =
* Fix: @fs_premium_only-Header um Tischmodul und zugehörige Assets erweitert — /includes/modules/tables/, /templates/admin/table-plan.php, admin-tables.js, admin-table-plan.js, reservation-board.js, admin-tables.css, admin-table-plan.css, admin-reservation-board.css werden nun korrekt aus der von Freemius generierten Free Version entfernt.

= 1.2.1 =
* Fix: Freemius-Deployment-Strategie korrigiert — Premium-Code korrekt mit @fs_premium_only-Header und is__premium_only()-Guards markiert, sodass die von Freemius generierte Free Version keinerlei Premium-Code enthält.
* Fix: Inline <style>- und <script>-Tags in class-admin.php in bestehende enqueued Stylesheet- und Script-Dateien ausgelagert.
* Fix: sanitize_admin_settings() implementiert — alle Felder werden nun mit den passenden WordPress-Sanitize-Funktionen bereinigt.
* Fix: add_tip_fee() prüft nun explizit den WooCommerce-Nonce (woocommerce-process_checkout bzw. update-order-review) und extrahiert nur die benötigten $_POST-Felder statt den ganzen Array zu kopieren.

= 1.2.0 =
* Feature: Reservierungs-Dashboard — neue Tagesansicht (Libre Bite → Reservierungsübersicht) mit Standort-Dropdown, Datums-Navigation, Status-Badge und Tisch-Zuweisung direkt auf der Karte.
* Improvement: Aktualisierungsintervall für Reservierungsübersicht in den Einstellungen konfigurierbar (Standard: 60 Sekunden).
* Improvement: Benachrichtigungs-Badge im Backend-Menü zeigt jetzt auf die neue Reservierungsübersicht.
* Improvement: Gerätkompatibilität und Betriebsmodelle in der Plugin-Beschreibung dokumentiert.

= 1.1.9 =
* Improvement: Plugin-Beschreibung auf Nutzen statt Features ausgerichtet (Kurzbeschreibung, Description, Why Libre Bite).
* Improvement: SEO-Keywords für Schweizer Gastronomie eingebaut (Twint, QR-Code-Bestellung, 5-Rappen-Rundung, provisionsfrei).
* Improvement: Tags auf WP.org optimiert.

= 1.1.8 =
* Feature: Benachrichtigungs-Badge für ausstehende Reservierungen im Backend-Menü ergänzt.

= 1.1.7 =
* Feature: Benachrichtigungs-Counter im Backend-Menü zeigt Anzahl eingehender Bestellungen an.
* Feature: Drucken-Schaltfläche auf der Bestellbestätigung zum Ausdrucken oder als PDF speichern.
* Verbesserung: «Bestellübersicht aktivieren» in die Karte «Bestellsystem» verschoben.
* Verbesserung: «Hilfe & Support» im Dashboard-Schnellzugriff ergänzt.

= 1.1.6 =
* Fix: PHP-Warning "Undefined property: WC_Order_Item_Fee::$total_tax" auf der Bestellbestätigungsseite behoben.
* Fix: Zahlungsart wird auf der Bestellbestätigungsseite nun als eigene Box angezeigt (nicht mehr als unformatierter Text).
* Fix: Vorbestellungen zeigen im Kanban-Board jetzt Datum und Uhrzeit an (nicht mehr nur die Uhrzeit).
* Fix: Bestellungen im Kanban-Board werden nach Dringlichkeit sortiert (Sofort: Erstellungszeit, Vorbestellung: Abholzeit).
* Fix: «Reservierungen» erscheint im Backend-Menü neu unter «Tischplan» statt ganz oben.
* Fix: Reservierungsformular zeigt keine Tischauswahl mehr – Tischzuweisung erfolgt durch das Personal im Backend.
* Fix: Sofort-Bestellungen werden blockiert, wenn der gewählte Standort aktuell geschlossen ist.
* Fix: Status-Badge auf der Standort-Übersicht zeigt nun den korrekten Öffnungsstatus (robuster Zeitvergleich).
* Fix: Nährwerttabelle auf der Produktdetailseite hat nun horizontales Innenabstand.
* Improvement: «Produkt-Optionen» ist neu unter WooCommerce → Produkte eingetragen.
* Improvement: Hilfe-Bereich um Tab und Inhalt für «Reservierungen» erweitert.

= 1.1.5 =
* Performance: POS product data cached for 1 hour via transient, invalidated on product and location save.
* Performance: Location colors cached via transient (lbite_location_colors), invalidated on location save.
* Performance: Admin settings JS now loaded only on the settings page (not on all Libre Bite admin pages).
* Improvement: Default dashboard refresh interval increased from 30s to 45s for new installations.

= 1.1.4 =
* Feature: Visual floor plan — drag-and-drop canvas per location with shape/size controls and live table status (free, occupied, preparing, ready).
* Feature: Table reservations — frontend form via shortcode [lbite_reservation_form], email notifications, and admin management view.
* Feature: POS table selector shows live occupancy status (free/occupied) for each table.
* Improvement: Floor plan link moved under Tables in admin menu.
* Improvement: Order board popup links to Order Board instead of individual orders.
* Improvement: Help section updated with floor plan documentation.
* Fix: Tables without saved order meta are now correctly shown in the floor plan.

= 1.1.3 =
* Feature: Location colors — color-coded highlight for location dropdowns in POS and Order Board.
* Feature: POS blocks product area when no location is selected.
* Feature: Seats per table — configurable seat count per table (preparation for reservations).
* Feature: Bulk table creation — create multiple tables at once with prefix and numbering.
* Feature: Location filter in table list.
* Improvement: Help section updated with full table management documentation and location color info.

= 1.1.2 =
* Improvement: Consolidated settings tabs – Checkout and Checkout Fields merged, Dashboard renamed to Order Board, Features tab shown first.
* Improvement: Simplified user roles to two-tier system (administrator + staff), removed legacy role cleanup on migration.
* Improvement: Rewrote help documentation to be feature-focused for new users.
* Fix: Optimized checkout CSS layout overrides for theme compatibility (Astra and others).
* Fix: Outdated legacy roles (OOS) removed from Roles & Menus screen.

= 1.1.1 =
* Improvement: Prefix all variables in template files with lbite_ for WordPress.org compliance.
* Improvement: Consistently use lbite_ prefix for passed-in and internal template variables.

= 1.1.0 =
* Feature: Table Management module – create tables, assign to locations, generate QR codes for ordering.
* Feature: Order at Table – QR code URL stores table + location in session, checkout adapts automatically.
* Feature: Table filter in Kanban board and table name display in order cards.
* Feature: Clean uninstall – new uninstall.php removes all plugin data when enabled in settings.
* Security: XSS hardening in dashboard.js and pos.js (template strings replaced with jQuery DOM APIs).
* Security: wp_unslash() added to all superglobal access in tables module and admin AJAX.
* Security: current_user_can() check added to table meta save callback.
* Security: Capability for table AJAX endpoint changed from edit_posts to lbite_use_pos.
* Improvement: Template variables prefixed with lbite_ in all frontend templates (XSS namespace protection).
* Improvement: Performance limits added to all unlimited post queries.
* Improvement: Inline styles and scripts in tables module extracted to external CSS/JS files.
* Improvement: readme.txt fully translated to English, external services disclosed.
* Improvement: Order board and POS styles extracted to dedicated CSS files.

= 1.0.9 =
* Feature: Onboarding page after initial installation – select features, no redirect to older instances.
* Feature: POS Payment Confirmation – Overlay with order summary and payment method (Cash/Card/Twint/Other) before order creation.
* Fix: HPOS incompatibility resolved – Order meta now uses WooCommerce HPOS API instead of get_post_meta/update_post_meta.
* Fix: XSS in support settings resolved (.html() → .text() for preview field).
* Fix: XSS in dashboard loading overlay resolved (message parameter escaped).

= 1.0.8 =
* Security: POS order now uses server-side product price instead of client price (prevents manipulation).
* Performance: Replaced wc_get_orders() unlimited limit (limit => -1) with sensible caps (Dashboard 50, Kanban 200, Cron 100).
* Performance: Pagination in ajax_load_more_completed() switched to true DB pagination (instead of loading all orders and slicing).
* Code: Removed redundant cron job registration from module constructors (cron setup only in activation hook).

= 1.0.7 =
* Security: Added XSS escaping in dashboard.js (item.meta, error message when cancelling).
* Security: Added XSS escaping in pos.js (variationName in product modal).
* Fix: Corrected wrong capability name in class-product-options.php (manage_lbite_options → lbite_manage_options). Product options are now saved correctly.
* Fix: Fixed typo in feature key in class-checkout.php (enable_tip → enable_tips). Tip JS is now loaded correctly for Pro users.
* Fix: Status labels in class-order-dashboard.php made translatable via WordPress i18n (WordPress.org compliance).

= 1.0.6 =
* Fix: Premium override only available in Pro version (WordPress.org compliance).
* Fix: Nutritional info, allergens, and sound notifications correctly marked as Pro features.
* Fix: Feature list in readme.txt adapted to Free/Pro assignment.
* Fix: Plugin description translated to English (WordPress.org guideline).
* Fix: Output escaping added to admin notices.
* Bump: Version to 1.0.6.

= 1.0.5 =
* Fix: Replaced Heredoc/Nowdoc syntax with external JS files (WPCS compliance).

= 1.0.4 =
* Fix: Changed function prefix from lb_ to lbite_ (WordPress.org naming convention).
* Fix: Moved inline CSS/JS from templates to separate enqueue files.
* Fix: Added nonce checks in checkout and product options.
* Fix: Added Freemius parameter is_org_compliant.
* Fix: Updated SortableJS to version 1.15.7.
* Fix: Corrected contributors field in readme.txt.

= 1.0.3 =
* Fix: Resolved all WordPress.org Plugin Check errors and warnings.
* Fix: Corrected direct file access protection in main plugin file.
* Fix: Fixed output escaping in wp_die() calls.
* Fix: Replaced strip_tags() with wp_strip_all_tags().
* Fix: Added PHPCS ignore comments for legitimate uses.
* Fix: Reduced tags in readme.txt to maximum 5.

= 1.0.2 =
* Fix: Resolved WordPress.org Plugin Check errors (Tested up to tag, text domain loading).
* Fix: Removed Domain Path header.

= 1.0.1 =
* Improved: Freemius integration for better WordPress.org compliance.
* Fixed: Uninstallation process adapted for feedback tracking.
* Security: Improved security checks and escaping.

= 1.0.0-beta =
* First beta version.
* Added: Location management module.
* Added: Point of Sale (POS).
* Added: Kanban order board.
* Added: Tipping system and scheduled order time slots.
* Added: Freemius integration for Pro features.

== Upgrade Notice ==

= 1.0.7 =
Security and bugfix release: XSS fixes in JS, correct capability checking for product options, fix for tip feature key. Update recommended.

= 1.0.6 =
Maintenance release with WordPress.org compliance fixes. No breaking changes.
