# Salon Management System – Phase 1 Setup

## Requirements

- PHP 8.2+
- Composer
- MySQL 8+
- Node.js & npm (for Vite/Tailwind)

## Installation

1. **Configure environment**

   Copy `.env.example` to `.env` if needed, then set:

   ```env
   APP_NAME="Salon Manager"
   DB_CONNECTION=mysql
   DB_HOST=127.0.0.1
   DB_PORT=3306
   DB_DATABASE=salon
   DB_USERNAME=root
   DB_PASSWORD=
   ```

2. **Create database**

   ```sql
   CREATE DATABASE salon CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
   ```

3. **Install dependencies**

   ```bash
   composer install
   npm install
   ```

4. **Generate key and run migrations**

   ```bash
   php artisan key:generate
   php artisan migrate
   ```

5. **Seed roles, permissions, and demo data**

   ```bash
   php artisan db:seed
   ```

6. **Build frontend assets**

   ```bash
   npm run build
   ```

7. **Run the application**

   ```bash
   php artisan serve
   ```

   Open: http://localhost:8000

## Demo credentials

| Role        | Email           | Password  |
|------------|------------------|-----------|
| Super Admin | admin@salon.com | password  |

After login you can use the sidebar to access Dashboard, Branches, Customers, Staff, Services, Appointments, and Walk-In Queue (according to permissions).

## Phase 1 modules

- **Authentication** – Login, logout, forgot/reset password, profile, change password (Laravel Breeze)
- **Roles & permissions** – Spatie Permission; RBAC with seeded roles and permissions
- **Branch management** – CRUD, search/filter, active/inactive
- **Customer management** – CRUD, customer code, filters, profile
- **Staff management** – CRUD, employee code, branch, service mapping
- **Service categories & services** – CRUD, duration, price, staff-service mapping
- **Appointments** – Create/edit, services + staff assignment, check-in, complete, cancel, no-show
- **Walk-in queue** – Add walk-in, list by status, convert to appointment
- **Dashboard** – Role/branch-aware widgets (today’s appointments, completed, walk-ins waiting, etc.)

## Default roles and permissions

- **Super Admin** – All permissions  
- **Owner** – All except “manage roles”  
- **Branch Manager** – Customers, staff, services, appointments, walk-ins, dashboard, assign staff, reschedule/cancel, check-in/out  
- **Receptionist** – Customers, appointments, walk-ins, dashboard, assign/reschedule/cancel, check-in/out  
- **Stylist / Beautician / Therapist** – View dashboard, check-in/out  
- **Cashier** – Dashboard, manage customers, check-out  

## Architecture

- **Business logic** in service classes (`App\Services\*`)
- **Validation** via Form Requests where applicable
- **Authorization** via policies and Spatie permissions
- **Enums** for statuses in `App\Enums\*`
- **API-ready** structure for future mobile/API phase

## After setup

1. Log in with `admin@salon.com` / `password`.
2. Open **Branches** to view or add branches.
3. Use **Customers**, **Staff**, **Services**, **Appointments**, and **Walk-In Queue** as needed.
4. Use **Calendar** under Appointments for a day view (when implemented in the UI).
