=== Plattivo – Restaurant Ordering, QR Menu & Kitchen Display for WooCommerce ===
Contributors: logicweft
Tags: restaurant, food ordering, online ordering, kitchen display, qr menu
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 8.1
Requires Plugins: woocommerce
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Online ordering, a kitchen display and order management for restaurants on WooCommerce. No commission, no per-order fees, on your own site.

== Description ==

Plattivo turns a WooCommerce store into a restaurant: customers order from a fast, phone-first menu, and your staff run the orders, the kitchen and the day from an app that works on any phone or tablet.

Your products, prices, taxes, payment gateways and emails stay in WooCommerce. Plattivo adds what a restaurant needs on top of them.

= For your customers =

* **A menu built for phones.** Categories, photos, veg/non-veg marks, allergens and badges. Choices and add-ons ("Size", "Extra cheese") with included selections, percentage prices and choices that appear only after another, combos, items offered only at set times (a breakfast or lunch menu), and notes for the kitchen.
* **Pickup, delivery and dine-in.** Delivery zones by postcode with fees and minimums, opening hours and closures, and ordering ahead for a later time.
* **WooCommerce checkout.** Works with the Checkout block and the classic checkout, and with your WooCommerce payment gateways (cash on delivery included).
* **Order tracking.** A tracking page shows each step, from confirmed to ready to on the way, and a one-tap reorder brings back the last order.
* **Emails.** WooCommerce's order emails gain the order type, time, table or address and a tracking link. Plattivo adds three emails of its own: "Ready for pickup", "On the way" and "Order not accepted", each managed under WooCommerce → Settings → Emails.

= For your staff: the Plattivo app =

Open `yoursite.com/restaurant-app/` on a phone or tablet and add it to the home screen. Staff sign in with their WordPress account and see only what their role allows.

* **Today:** sales, orders and the live state of the kitchen at a glance, with an Action Center for late orders, printing problems and days left open.
* **Orders board:** accept or reject new orders with a reason, follow them to ready and hand them over or dispatch them, and change the ready time. A chime announces each new order.
* **Kitchen display:** tickets for one or several stations on a tablet, with an elapsed timer coloured against each station's target time, notes in red, Start, Ready, Recall and Reprint. A paused station's tickets go to its fallback station. It works through short Wi-Fi drops, keeps the screen awake and runs full screen.
* **Counter orders (POS):** takeaway orders, and phone orders for pickup or delivery, from a touch menu with favourites, categories and search. Take cash with the change worked out, card on your own terminal, or a QR payment.
* **Cash drawer:** open it with a float, record cash in and out with a reason, and close it with a count and a printable drawer report.
* **Menu on/off ("86"):** switch an item, a choice or a whole category off when it runs out, for an hour or until tomorrow, and the menu updates for customers.
* **Busy and pause:** add waiting time when the kitchen is busy, or pause delivery, pickup or all online orders.
* **Printing:** kitchen tickets, receipts and packing slips from the app's own browser printing or as PDF files. Failed prints are retried and listed until someone prints or handles them, so no ticket is lost.
* **Close the day:** a closing summary with sales by type and payment method, cancellations, refunds, kitchen times and top items, and a printable closing report. Unfinished orders can be carried to the next day.

= Made for restaurants =

* Tables by area with seats, each with a printable QR code.
* Restaurant roles: owner, manager, cashier, waiter, kitchen and driver, each with its own permissions.
* A setup wizard and a demo restaurant to try everything in minutes.
* Translation-ready, with right-to-left support.
* Compatible with WooCommerce's High-Performance Order Storage (HPOS).

= Plattivo Pro =

Plattivo Pro, planned for the WooCommerce Marketplace, will be a separate plugin. Nothing in this plugin is locked or limited, and everything described above stays free.

== Installation ==

1. Install and activate WooCommerce.
2. Install Plattivo from Plugins → Add New, or upload the zip, and activate it.
3. Go to **Restaurant → Setup** and follow the steps: your restaurant, tax, the ways you serve, hours, menu and checkout. "Load the demo restaurant" fills in a sample menu to try first.
4. Add the **Restaurant ordering** block (or the `[plattivo_ordering]` shortcode) to a page. The setup wizard can create an "Order Online" page for you.
5. Open `yoursite.com/restaurant-app/` on your staff phones and tablets. Users with a restaurant role, or administrators, can sign in.

== Frequently Asked Questions ==

= Does Plattivo take a commission or charge per order? =

No. Payments go through your own WooCommerce payment gateways, and Plattivo charges nothing per order.

= Do I need special hardware? =

No. The staff app runs in the browser of any recent phone, tablet or computer. For printed kitchen tickets, the app prints through the device's normal print dialog, or makes PDF files.

= Can tickets print without the print dialog? =

Browsers always show a print dialog unless the device is set up for silent printing: for example, Chrome started with `--kiosk-printing`, or an Android print service with a default printer. With that in place, turn on "Print automatically" under More → Printing on that device.

= What happens if a printer is offline? =

The kitchen display never depends on printing. Failed prints are retried, then listed under More → Printing (and in the Action Center), where staff can retry, print on another device or mark them handled.

= Which checkout does it use? =

Both. Plattivo works with the WooCommerce Checkout block and with the classic checkout shortcode, and it detects which payment gateways can be used inside the ordering page.

= Does it work with High-Performance Order Storage? =

Yes. Plattivo supports both HPOS and the older post storage.

= Is my data deleted when I delete the plugin? =

Not by default: a reinstall finds the menu settings, stations, printers and history where they were. To remove everything, turn on "Delete all Plattivo data when the plugin is deleted" under Restaurant → Setup before deleting the plugin. Orders always stay in WooCommerce.

= Does it work on multisite? =

Yes. Activate it on each site that is a restaurant; each one keeps its own menu, orders and staff. Network activation is not supported and is refused with a message.

== Screenshots ==

1. The ordering page on your restaurant's website: a photo menu at full width, with the order beside it.
2. On a phone: categories, dishes with photos and dietary marks, and the cart bar.
3. Choosing a size and extras for a dish, with the price as you go.
4. The order: delivery checked against your zones, with the fee, the time and the total.
5. Order tracking: each step, updated on its own, and linked in the emails.
6. The staff app: new orders chime and wait on the board, by type and state.
7. The kitchen display: dishes, choices and notes in large type, with a timer.
8. Today: the day's sales and orders, and what needs your attention.
9. Turning dishes and choices off when they run out, until a time you pick.
10. Closing the day: unfinished orders, the day's totals and the cash.
11. Restaurant → Appearance: brand colour, fonts, buttons and the photo-grid menu, with a live preview.
12. Restaurant → Setup: a guided setup, and a demo restaurant in one click.

== External services ==

Plattivo does not send data to any outside service by default: it makes no requests to third-party servers, and its scripts, styles, fonts and icons are bundled with the plugin. "Use my location" uses the browser's own location, and the point goes only to your site.

**Map tiles (off by default).** When a restaurant turns on "Show maps" in Plattivo → Settings → Delivery, the delivery address sheet and the Delivery zones screen show a map. The visitor's browser then loads map images from the tile server set in "Map tiles URL", by default OpenStreetMap (https://tile.openstreetmap.org). Each image request sends the visitor's IP address and the map area being shown. See the OpenStreetMap Foundation's tile usage policy (https://operations.osmfoundation.org/policies/tiles/) and privacy policy (https://osmfoundation.org/wiki/Privacy_Policy). If you set another tile server, its terms apply.

Two kinds of links in the staff app open an outside service, only when a staff member taps them:

* **WhatsApp (wa.me)**, provided by WhatsApp LLC. "WhatsApp" on an order opens a chat with the customer's phone number. On devices without a share sheet, "Send receipt" on the counter screen opens a chat with the customer's phone number and a ready-made message with the order number and its tracking link. The phone number and message reach WhatsApp only when the staff member taps the link and sends the message. [Terms of service](https://www.whatsapp.com/legal/terms-of-service), [privacy policy](https://www.whatsapp.com/legal/privacy-policy).
* **Google Maps**, provided by Google LLC. "Open in maps" on a delivery order opens Google Maps searching for the delivery address. The address reaches Google only when the staff member taps the link. [Terms of service](https://policies.google.com/terms), [Google Maps terms](https://maps.google.com/help/terms_maps/), [privacy policy](https://policies.google.com/privacy).

== Source code ==

The JavaScript and CSS in `assets/` are compiled. Their human-readable source ships with the plugin in `apps/`: the staff app (`apps/operator`), the ordering page (`apps/customer`), the WordPress admin screens (`apps/admin`) and the shared components (`apps/ui`), written in TypeScript and React.

To rebuild `assets/` from that source, use Node.js 22.12 or newer in the plugin folder:

`npm install && npm run build`

The build uses Vite, TypeScript, React, Tailwind CSS and vite-plugin-pwa, as listed in the `package.json` files. The PHP code is not compiled.

== Third-party libraries ==

PHP, in `vendor-prefixed/` with prefixed namespaces so they cannot clash with another plugin's copy:

* dompdf 3.1 (LGPL-2.1-or-later), used to make PDF tickets, receipts and reports, with php-font-lib (LGPL-2.1-or-later), php-svg-lib (LGPL-3.0-or-later), masterminds/html5 (MIT) and sabberworm/php-css-parser (MIT). dompdf includes the DejaVu fonts ([Bitstream Vera and DejaVu licence](https://dejavu-fonts.github.io/License.html)).

JavaScript, compiled into `assets/` (source in `apps/`):

* Leaflet 1.9.4 (BSD-2-Clause), for the optional delivery maps; it loads only when maps are shown.
* React, React Router, TanStack Query, Zustand, dnd-kit, Workbox and qrcode-generator (MIT), lucide-react (ISC), Dexie (Apache-2.0) and @wordpress/i18n (GPL-2.0-or-later).

Fonts and images:

* Inter and Manrope variable fonts (SIL Open Font License 1.1), bundled; their licences are in `licenses/`.
* The staff app's icons were made for Plattivo and are GPLv2 or later, like the plugin.

== Changelog ==

= 1.1.0 =
* New: Restaurant → Appearance → Menu layout. "Photo grid" shows dishes as cards with a large photo, as many columns as fit; "List" (the default) is unchanged.
* The ordering block set to Full width now runs edge to edge without its frame and lines up with your theme's header and wide blocks.
* Requires WordPress 7.0 and WooCommerce 11.0, the oldest versions it is tested on; tested up to WooCommerce 11.2.
* Delivery checkout on WooCommerce 11: the delivery zone and minimum order are checked against the address being ordered to, not the customer's previous one.
* Page caches, LiteSpeed Cache included, no longer cache the staff app or the order-tracking page.
* Multisite: activate Plattivo on each site; network activation is refused with an explanation.
* The staff app opens faster: screens other than the Orders board load when first opened.
* Printers on a device check for new jobs with a quick "nothing changed" reply, and opening the day's cash summary loads its orders in one query.
* Order numbers above 999 print without a thousands separator.
* Public endpoints: rate limits count reliably under load and treat an IPv6 /64 as one visitor; every text the API accepts has a length limit.
* If two copies of Plattivo are active, one stands aside with a notice, and deleting one never removes the data while the other is active.

= 1.0.4 =
* Admin forms read each field on its own with a sanitizer for its type, and every admin action checks the user's capability.
* The plugin no longer carries the one-time rename from its development name.
* Names the plugin stores in the browser, and the checkout nonce, use the `plattivo` prefix.
* The setup reminder shows only on the Dashboard, Plugins, WooCommerce and Restaurant screens.
* Font licences ship in `licenses/`; third-party development scripts are left out of the plugin.
* Works reliably on MariaDB 11.6 and later: when two requests change the same order at once, staff actions no longer lose changes or save them only in part, and the app shows "someone else changed this" instead of an error.

= 1.0.3 =
* Sites upgrading from the plugin's earlier "Restaurant OS" names have their roles and capabilities renamed through the WordPress roles API.

= 1.0.2 =
* `wp plattivo seed` no longer switches to an administrator: run it with WP-CLI's `--user` flag as a user who can manage Plattivo settings.

= 1.0.1 =
* Every feature in this plugin is now available to everyone: availability schedules, included selections and percentage prices for choices, conditional choices, several kitchen stations on one screen with target-time colours, fallback stations and whole-category "86".
* The staff app's styles and scripts, the receipt styles and the menu colours are loaded through WordPress.
* Choices posted with an item are sanitized field by field, and stored markup is escaped where it is printed.

= 1.0.0 =
* First public release: online ordering (pickup, delivery, dine-in), delivery zones, hours and closures, order tracking, the staff app (Today, orders board, kitchen display, menu availability, printing, day close), restaurant roles, customer emails, the setup wizard and the demo restaurant.

== Upgrade Notice ==

= 1.1.0 =
A photo-grid menu layout and a full-width ordering page. Requires WordPress 7.0 and WooCommerce 11.0.

= 1.0.4 =
Review fixes (input handling, capability checks, prefixes) and reliable saving on MariaDB 11.6 and later.

= 1.0.3 =
Roles are renamed through the WordPress roles API.

= 1.0.2 =
The demo seeding command now needs WP-CLI's --user flag.

= 1.0.1 =
Every feature is available to everyone, and assets load through WordPress.

= 1.0.0 =
First public release.
