# CanteenHub - Multi-User Collaborative Canteen & Food Ordering System A zero‑framework PHP application that uses **SQLite** as its default database. It replaces informal chat‑based lunch ordering threads with a structured web interface. --- ## Key Features 1. **User Authentication** – Login `/login` & Register `/register` with password hashing. Pre‑seeded demo accounts (password: `password`). 2. **Session Creation** – Any user can start a food session, paste menu items, and invite colleagues. 3. **Self‑Ordering** – Browse active sessions, select multiple items, set quantities and notes. 4. **Bill Calculation** – Host enters final prices, app computes each participant’s bill and generates copy‑ready markdown. --- ## How to Run (SQLite) ### Option 1: PHP Built‑in Server ```bash php -S localhost:8000 -t public ``` Visit `http://localhost:8000`. ### Option 2: Docker Compose ```bash docker compose up -d --build ``` Visit `http://localhost:8080`. ### Option 3: Apache Point the VirtualHost `DocumentRoot` to the `public/` directory (rewrites handled by `public/.htaccess`). --- ## Database Setup (SQLite) 1. Copy the example env file and set SQLite configuration: ```bash cp .env.example .env ``` Edit `.env`: ``` DB_CONNECTION=sqlite DB_DATABASE=storage/database.sqlite ``` 2. Create the SQLite file and run the schema initialization (executed automatically on first request): ```bash mkdir -p storage touch storage/database.sqlite php -r "require 'public/index.php'; App\\Core\\Database\\Database::initSchema();" ``` The `initSchema()` method creates all tables and seeds initial data if the database is empty. ### Resetting Data To start from a clean slate: ```bash rm storage/database.sqlite mkdir -p storage touch storage/database.sqlite php -r "require 'public/index.php'; App\\Core\\Database\\Database::initSchema();" ``` Or invoke the built‑in reset: ```bash php -r "require 'public/index.php'; App\\Core\\Database\\Database::initSchema();" ``` (Calling `initSchema()` drops existing tables and recreates them.) --- ## Troubleshooting - **Missing PDO SQLite extension** – Install via `sudo apt-get install php8.2-sqlite3`. - **File permission issues** – Ensure the web server user can read/write `storage/`. - **Database connection errors** – Verify `.env` settings and that `storage/database.sqlite` exists. --- ## License MIT License. See `LICENSE` for details. A zero-framework PHP application built to replace informal Mattermost/chat lunch ordering threads. Anyone on the team can log in, start a food session, join any colleague's session, and place their own orders with automatic bill calculation upon food arrival. --- ## Key Features 1. **User Authentication (Zero Framework)**: - Login (`/login`) & Register (`/register`) with secure password hashing (`password_hash()`). - Pre-seeded test accounts (Password: `password`): - `dea` (Dea - Coordinator) - `alex` (Alex Turner) - `sarah` (Sarah Jenkins) - `budi` (Budi Santoso) - `michael` (Michael Chen) - 1-click Quick Demo Account switcher on login page. 2. **Session Creation by Anyone**: - Any team member can click **"➕ Start a Food Session"** to coordinate canteen lunch, boba/coffee runs, or snack orders. - Hosts paste today's menu choices directly from chat (no prices needed upfront). 3. **Self-Ordering from Any Session**: - Logged-in colleagues browse all active sessions on the dashboard. - **Multi-Select Interactive Menu**: Click multiple items, adjust quantities (`+` / `-`), and add specific notes (*"no spicy"*, *"extra egg"*). - The app automatically assigns the order to the authenticated coworker. 4. **Grouped Canteen Placement & Bill Settlement**: - 1-Click **"Copy Canteen Text"** aggregates quantities into a formatted WhatsApp/chat message. - When food arrives with the receipt, the host enters the final prices per item. - The app automatically computes every coworker's personal bill! - 1-Click **"Copy Mattermost Breakdown"** generates a ready-to-paste markdown table tagging `@coworker` with their exact individual bill and payment status (`Unpaid` / `Paid`). --- ## How to Run ### Option 1: PHP Built-in Server (`php -S`) ```bash php -S localhost:8000 -t public ``` Visit: `http://localhost:8000` --- ### Option 2: Docker Compose ```bash docker compose up -d --build ``` Visit: `http://localhost:8080` To stop: ```bash docker compose down ``` --- ### Option 3: Apache Point your Apache VirtualHost `DocumentRoot` to `public/` directory (rewrites handled by [`public/.htaccess`](file:///home/supanadit/Workspaces/Scalar/PHP/order-system/public/.htaccess)).