feat(pos): wire POS v2 to live data (board, orders, payments)
CI/CD / CI · API (dotnet build + test) (push) Successful in 43s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 32s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m5s
CI/CD / CI · Admin Web (tsc) (push) Successful in 37s
CI/CD / CI · Website (tsc) (push) Successful in 45s
CI/CD / CI · Koja (tsc) (push) Successful in 49s
CI/CD / Deploy · all services (push) Successful in 2m42s

POS v2 is now a real, working point of sale at /[locale]/pos2 (was a static
mock). It reuses the existing data layer so it shares the React Query cache and
offline pipeline with the classic POS:

- Table board ← fetchCafeTableBoard (Free/Busy/Reserved/Cleaning, live totals,
  guest-QR badge); polls every 15s. Open a free table to start an order; open a
  busy table to hydrate its existing order (GET order → cart hydrateFromOrder).
- Order screen ← real branch/café menu + categories, bound to useCartStore
  (add/qty/remove). Send via submitOrderToApi (online + offline outbox) then
  re-hydrate; "ارسال (n)" shows the pending (unsynced) line count.
- Pay sheet ← POST /orders/{id}/payments. Cash (numpad + change), Card, and a
  Split helper (records the full amount; split is cashier guidance for now).
- Online/offline badge, loading/empty states, toasts, busy overlay, and a
  "نسخه کلاسیک" link back to /pos.

The static design mock stays at /[locale]/pos2-preview (dev-only, 404 in prod).
tsc --noEmit clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-04 00:16:37 +03:30
parent 8a8eaf37e0
commit 75a0a1c834
5 changed files with 1192 additions and 65 deletions
@@ -1,7 +1,9 @@
import { Pos2Prototype } from "@/components/pos2/pos2-prototype";
import { Pos2Screen } from "@/components/pos2/pos2-screen";
/** POS v2 — clickable static prototype (mock data, no backend). Open at /<locale>/pos2
* on a tablet/phone to judge the redesigned layout before we decompose + wire it. */
export default function Pos2PrototypePage() {
return <Pos2Prototype />;
/** POS v2 — redesigned point of sale, wired to live data (menu, tables, orders,
* payments) via the shared cart store + offline-capable submit pipeline.
* Auth-guarded by the (fullscreen) layout. The static design mock lives at
* /[locale]/pos2-preview. */
export default function Pos2Page() {
return <Pos2Screen />;
}
@@ -0,0 +1,13 @@
import { notFound } from "next/navigation";
import { Pos2Prototype } from "@/components/pos2/pos2-prototype";
/**
* Local, no-login preview of the POS v2 prototype.
* Dev-only — returns 404 in production. Open at /<locale>/pos2-preview
* (e.g. http://localhost:3000/fa/pos2-preview) to judge the redesign with
* zero auth and zero backend. The real, auth-guarded route is /<locale>/pos2.
*/
export default function Pos2PreviewPage() {
if (process.env.NODE_ENV === "production") notFound();
return <Pos2Prototype />;
}