# Changelog

All notable changes to the Restaurant Manager Workbook.

## 7.0.0 — 2026-11-06

### Added

- **ZATCA Phase 2, vendor-ready.** Provider registry in Settings →
  E-invoicing (name, base URL, submission and status endpoints, auth type,
  credential label, supports-cancel flag). A common provider interface
  (`submit` / `retry` / `check status` / `cancel`) over Manual, Mock and
  HTTP adapters. Simplified UBL 2.1 XML generated offline from the frozen
  invoice snapshot, with an offline well-formedness and required-fields
  validator. Per-invoice status: Not submitted / Queued / Submitted /
  Accepted / Rejected / Failed / Cancelled. Only Accepted **with a
  submission reference** counts as cleared. New Controls check `zatcaReady`;
  Controls total is now **36**. Plain-language vendor interface in the
  Guide. The workbook still never sends anything itself — live submission
  needs a ZATCA-approved provider.
- **Payout import by invoice reference.** Import a payout statement (CSV)
  in Cash → Reconcile; lines are matched, unmatched or ambiguous by
  invoice reference only, never by amount. Importing posts nothing; posting
  a matched line settles through the existing paired legs, capped at the
  amount owed.
- **Shift / till sessions.** One open shift per till, opening float, mid-shift
  X-report, close runs the ordinary cash-up and records the variance.
- **Ramadan mode.** Optional toggle in Settings → Payroll. When on, Sales
  gains iftar pre-orders (confirmed orders hold their ingredients; invoicing
  one releases the hold) and a suhoor/iftar prep forecast. Ramadan 2027
  dates are expected, not official. The 6-hour Ramadan day and overtime cap
  stay date-driven and apply whether the toggle is on or off.
- **Nitaqat ratio.** From employee nationality and headcount, with a warning
  below the level (default 20%, editable). Bands are labelled estimates.
- **Zakat estimate.** Equity + long-term liabilities − fixed assets at 2.5%,
  from the workbook's own figures, labelled "Estimate only — not a filing."
- **Food safety.** Fridge/freezer temperature logs with out-of-range alerts,
  5-item opening and closing checklists, and a printable municipal
  inspection pack. All behind a toggle; nothing blocks sales or invoices.
- **Per-person PINs.** Owner-set 4–6 digit PINs (stored as salted SHA-256
  hashes). The audit log records the person, not just the role. A PIN is a
  convenience sign-in only — it never replaces the master password and never
  unlocks locked modules.
- **Thermal printing.** ESC/POS 32-column receipt text for invoices and
  Z-reports, offered as a downloadable `.txt` file or copy. The file must be
  sent to the printer manually.
- **Offline app (PWA).** Manifest, service worker and icons. The single file
  still works fully without them.
- **IndexedDB storage.** Autosave and snapshots now live in IndexedDB
  (database `restaurant-manager-v2`), with a lossless first-run copy from
  localStorage and a localStorage fallback with a short banner note when the
  fallback is actually in use. JSON export format unchanged.
- **Design pass.** One token style section, one 23-symbol inline SVG icon
  set, bundled fonts (no web-font download), page-header pattern, Dashboard
  and Controls attention summaries, sticky table headers, right-aligned
  numbers, dismissible demo banner, focus ring and reduced-motion support.

### Fixed

- **Blank PDF / share bug (all 7 document kinds).** The PDF renderer drew
  every document 10,000 px off-screen, so invoices, credit notes, payslips,
  Z-reports, purchase orders, kitchen tickets and batch labels all shared
  as blank PDFs. Fixed, with a blank-canvas self-check that now errors
  instead of sharing a blank file. Example: invoice INV-00001 went from 0%
  non-white / 14,080 bytes to 19.33% non-white / 238,222 bytes (demo data).
- **Silent-failure sweep.** The audit "Shared" entry is now logged only
  after a share succeeds; a blocked pop-up, a failed download and a blank
  render are now reported instead of claimed as done. The setup-wizard
  backup step now waits for the real export result before marking the backup
  done. Backup folder/file pickers now report a failed first write instead
  of claiming success. Print failures now surface instead of failing
  silently.
- **Produce-first sales check.** In Production mode the invoice check now
  credits cooked portions, so producing 5 and selling 5 no longer asks for
  raw material for 10. Only the shortfall is refused.
- **Multi-tab guard restored in IndexedDB mode.** A stale tab can no longer
  silently overwrite a newer tab's save.
- **Dashboard / Controls cost wording.** The two cost lines now honestly say
  the sold-cost line is frozen at invoice time while the theoretical cost
  uses today's average costs (they differ and that is expected).
- **Phone layout.** A long pop-up message no longer collapses to a near-circle
  on narrow screens.

### Notes and honest limits

- No live ZATCA submission (by design). Simplified UBL XML, not certified
  ZATCA XML. Live clearance needs a ZATCA-approved provider.
- GOSI phased rates need confirmation with GOSI before real payslips.
- Ramadan 2027 dates are expected, not official.
- No real-phone / iOS test yet — verified in Node and headless Chromium only.
- Nitaqat bands are estimates; zakat is an estimate; temperature ranges are
  common guidance to confirm locally.
- PINs are convenience sign-in, not security. Browser autosave/snapshots are
  not encrypted; only exports are.
- Demo data note: the sample business sells more of two pizza sizes than it
  produced, so selling those on the demo now correctly refuses until they are
  produced. The sample was left as-is on purpose.

Verified on this release: 1,512 Node assertions passed (0 failed), headless
browser suite 44/44, and the four demo figures unchanged (E001 October net
9,096.87; INV-00001 84.53; R001 13.32; E002 overtime 370 / 300).
