# KYN POS Phase 3 — Operational Slice

## Purpose

Phase 3 creates the first usable POS workflow:

```text
Staff PIN login
→ table dashboard
→ open check
→ add simple menu item
→ view open check and totals
```

Payments, modifiers, voids, discounts, kitchen firing, and daily close are intentionally not activated yet. Those come after open checks and check lines are stable.

## New rule locked in

Credentials and local config stay outside shared code. The package includes `inc/config.local.example.php`, but your real `inc/config.local.php` is ignored by Git and should never be uploaded or shared.

## Installer requirement

Phase 3 includes:

```text
/install/install.php
/public/install.php
```

The installer:

- checks local config exists,
- connects to MySQL/MariaDB using private credentials,
- creates the configured database if missing,
- runs migration files with `CREATE TABLE IF NOT EXISTS`,
- runs seed files,
- creates demo staff with hashed PINs,
- creates demo location, tables, categories, and menu items,
- verifies required tables exist.

## Browser install

1. Copy `inc/config.local.example.php` to `inc/config.local.php`.
2. Fill in database credentials.
3. Temporarily set:

```php
'install' => [
    'enabled' => true,
    'demo_pin' => '123456',
],
```

4. Open:

```text
/public/install.php
```

5. After success, immediately set:

```php
'install' => [
    'enabled' => false,
]
```

## CLI install

From the project root:

```bash
php install/install.php
```

## Demo login

The installer creates:

```text
Demo Owner
Demo Server
PIN: 123456
```

Change or remove the demo users before any real deployment.

## Designer-safe files

Designers should primarily work in:

```text
/templates
/public/assets/css
/public/assets/js
```

Business logic remains in:

```text
/inc
/functions
/modules
/install
/sql
```

## Phase 3 acceptance checklist

- [ ] `inc/config.local.php` exists and is not committed.
- [ ] `/public/install.php` works only when `install.enabled = true`.
- [ ] Installer creates/checks DB and tables.
- [ ] Demo staff can log in using PIN.
- [ ] Tables page shows demo tables.
- [ ] Available table can open a check.
- [ ] Open check page displays check header and totals.
- [ ] Menu item can be added to the check.
- [ ] Check subtotal and total update after item add.
- [ ] Templates contain only display logic.
- [ ] Business logic stays in functions/modules.
