# DAL SEEN — Demo flow.

Practical, scripted demos for the people you'll be putting in front of the
system. Read top-to-bottom for any single demo; never try to run them all in
one session.

Every demo assumes a fresh seed:

```bash
cd backend
php artisan migrate:fresh --seed     # ~9s, builds 13 tenants + 28 invoices + DAL SEEN's books
php artisan serve --port=8800        # leave running
# new terminal:
cd app && npm run dev                # → http://localhost:5173
```

Database file: `backend/database/database.sqlite`. Wipe + re-seed any time.

---

## Demo accounts (all `password=password123`)

### Platform staff (DAL SEEN employees)
Sign in via the **"DAL SEEN platform staff? Sign in here →"** toggle on the
login page.

| Email | Role | Lands in |
|---|---|---|
| `admin@acme.test` | Super Admin | Full platform cockpit |
| `finance.manager@dalseen.sa` | Finance Manager | Billing + Collections + Subscriptions + DAL SEEN's books |
| `finance@dalseen.sa` | Finance Employee | Billing + Collections (read+work, no plan changes) |
| `support@dalseen.sa` | Support Agent | Tickets + CRM (no billing) |
| `ops@dalseen.sa` | Operations | Signups + Onboarding + Health + Releases (no billing) |

### Tenant users (login uses workspace toggle, `company_slug` per row)

| Email | Slug | Role | Notes |
|---|---|---|---|
| `owner@acme.test` | `acme` | Business Owner | Full module access (demo tenant — bypass everything) |
| `manager@acme.test` | `acme` | Manager | Most modules; cannot delete users |
| `accountant@acme.test` | `acme` | Accountant | Accounting only |
| `staff@acme.test` | `acme` | Staff | Limited POS/Dine |
| `cashier@acme.test` | `acme` | Cashier | Forced into `/retail/pos` kiosk on login |

ACME is the canonical demo tenant — flagged as `is_demo` so suspension and
plan-limit blocks never fire on it.

PIN for step-up actions (void sale, refund, period close): **`1234`**.

---

## DEMO 1 — Platform demo (15 min)

**Audience:** investors, prospective customers, anyone who wants to see "what does DAL SEEN's internal cockpit look like".

**Sign in as:** `admin@acme.test` (Super Admin) via platform toggle.

### Script

1. **Tenants page** (`/platform/tenants`)
   Open the list. Point out: `12 demo tenants across 4 templates (retail / restaurant / services / e-commerce)`. Click a row → drawer opens with three tabs: Overview / Commerce / Subscription / Team.

2. **Subscription tab** (inside the drawer)
   Show the `current` plan, billing cycle, period, status badge, three usage-vs-limit bars (branches/users/devices), enabled modules, and the **history** below — every plan change is recorded with reason + actor.

3. **Plans page** (`/platform/plans`)
   Click **"+ New plan"** → show the editor with sections (identity, limits, modules, premium features, marketing features, add-ons, visibility). Don't actually save.

4. **CRM** (`/platform/crm`)
   Drag a tenant card across stages (Lead → Qualified → Proposal → Closed). Show CSM tasks, notes, NPS. (CRM is one of the most polished surfaces.)

5. **System Health** (`/platform/health`)
   Live SLO board with 13 services. Click a service → drawer with restart / page on-call / silence actions.

6. **Audit log** (`/platform/audit`)
   Filter by severity=high. Point out that EVERY sensitive action (suspension, plan change, refund, write-off, journal post, impersonation) is recorded with actor + IP.

7. **Internal Staff** (`/platform/staff`)
   Show the 5 internal roles (only Super Admin can manage). Click "+ New staff member" → role dropdown shows 5 roles with bilingual labels. Don't save.

**One-liner takeaway:** DAL SEEN is operated end-to-end from a single internal cockpit — not from a database client.

---

## DEMO 2 — Merchant demo (15 min)

**Audience:** retail / restaurant prospects evaluating DAL SEEN as their POS + back-office.

**Sign in as:** `owner@acme.test` (workspace=`acme`).

### Script

1. **Dashboard**
   Land on the tenant home. Show the **Subscription / Plan & Usage** card (top of Owner page if available) — branches/users/devices vs limits, enabled modules with green checks, the plan tier.

2. **POS sale flow**
   - Open `/retail/pos` (full-screen kiosk).
   - Open shift with 500 SAR opening cash.
   - Add a product (Arabic coffee 1kg, 110 SAR), tender as cash 126.50 (15% VAT).
   - Print receipt.

3. **Back to dashboard → Inventory**
   Open `/inventory/movements`. Point out the just-sold line is now an out-movement.

4. **Accounting → Trial Balance**
   Open `/accounting/reports/trial-balance`. Pre-sale: 3,545 SAR. Post-sale: 3,741.50 SAR. **Always balanced** — every POS sale auto-posts (DR Cash 126.50 / CR Sales 110 / CR VAT 16.50 + DR COGS X / CR Inventory X).

5. **Drill into the GL**
   Click an account row → GL drill-down shows every line with running balance.

6. **Dine demo (optional)**
   Open `/dine/orders` if your prospect runs F&B. Place an order, send to KDS, mark paid → recipe ingredients deplete from inventory + COGS posts split by food/beverage.

**One-liner takeaway:** Every operational event (POS sale, inventory movement, payment, payroll) auto-posts to the books. The accountant never re-keys anything.

---

## DEMO 3 — Finance demo (10 min)

**Audience:** DAL SEEN's own finance team or finance prospects asking "show me how you'd actually run collections on us".

**Sign in as:** `finance.manager@dalseen.sa` (Finance Manager) via platform toggle.

### Script

1. **Billing page** (`/platform/billing`)
   Show the 5 KPI tiles (MRR, Paid 30d, Outstanding, Overdue, Open invoices, Collection rate) + the **5-bucket aging strip** (current / 1–30 / 31–60 / 61–90 / 90+). 9 open invoices, 9,623.20 SAR outstanding.

2. **Click an issued invoice → drawer**
   Three tabs: Summary / Payments / Collections.
   - **Summary**: subtotal, VAT, total, paid/outstanding, period dates, subscription snapshot.
   - **Payments**: ledger of every recorded payment (method, reference number, date, who recorded it).
   - **Collections**: status dropdown (not_started → contacted → promised → escalated → paid → written_off), assignee dropdown (sourced from /platform/staff), follow-up + promise-to-pay dates, append-only notes feed.

3. **Live workflow**
   - Set status to **Contacted**.
   - Add a note: "Reached AP team Monday."
   - Set follow-up to next Friday.
   - Sign out and sign in as `finance@dalseen.sa` (Finance Employee). Show that you can update status and add notes but **cannot reassign or write off** (the dropdown options shrink + the buttons go away).

4. **Record a partial payment** (Finance Employee)
   On any issued invoice → Payments tab → "+ Record payment" → enter 200 SAR, bank_transfer, reference TXN-DEMO. Invoice flips to "issued" with paid_amount=200, outstanding decreases by 200.

5. **DAL SEEN's own books** (`/platform/books` — sign in back as Finance Manager)
   - **Summary tile**: Subscription revenue 27,492 SAR / Outstanding AR 9,623.20 / VAT payable 4,123.80 / Cash in bank 21,992.60.
   - **Trial Balance tab**: balanced to the halala.
   - **P&L tab**: Income (4100 SaaS subscription revenue 27,492) - Expense (0) = Net profit 27,492.
   - **Journals tab**: filter by `source=platform_invoice` to see every invoice issuance posting.
   - **GL drill** on `1110 Tenant receivables`: 46 lines (27 issues + 19 payments) with running balance ending at 9,623.20 — matches the dashboard outstanding KPI exactly.

**One-liner takeaway:** Every tenant invoice and payment posts to DAL SEEN's books **automatically and idempotently**. Finance never touches journal entries; they manage the workflow and the books update themselves.

---

## DEMO 4 — Support demo (5 min)

**Audience:** internal support / CSM hires.

**Sign in as:** `support@dalseen.sa` (Support Agent) via platform toggle.

### Script

1. **Sidebar shows only what Support can see**
   Tenants (read-only), CRM (read+write), Onboarding (read), Signups (read), Support Desk (full), Audit Log (read). **No** Billing, **no** Plans, **no** Releases, **no** Internal Staff, **no** DAL SEEN's books.

2. **Open a tenant** (`/platform/tenants` → click row)
   Show the drawer. The "Impersonate" button is **greyed out** (only Super Admin can impersonate). Use the **"Message"** button to send a message — that's all support can do tenant-side.

3. **Support Desk** (`/platform/support`)
   - List tickets by priority, channel, age, SLA.
   - Open one → assign to yourself → reply → resolve.

4. **CRM Pipeline** (`/platform/crm`)
   Drag a tenant card across stages. Add a CSM note. Create a follow-up task with a due date. Show NPS scores.

5. **Try to break a permission gate (good for Q&A)**
   Try to open `/platform/billing` directly via URL. Sidebar doesn't even render the link, but typing the URL gets a clear "Forbidden" page. Same for `/platform/staff`, `/platform/books`, `/platform/releases`.

**One-liner takeaway:** Roles are real — Support sees what they need to do their job, nothing else. Nobody can accidentally suspend a customer or refund an invoice from the wrong account.

---

## After any demo

Reset the database between demos so each presenter starts from the same state:

```bash
cd backend && php artisan migrate:fresh --seed
```

(Takes ~9 seconds. Wipes everything and reseeds 13 tenants, 28 invoices, the
DAL SEEN platform company with its 9-account SaaS chart, 27 invoice-issue
journals, 19 payment journals, demo collection workflow state, etc.)

If you want to demo overdue enforcement specifically, force-overdue an
invoice and run the sweep:

```bash
php artisan billing:sweep-overdue
```
