# Implementation Plan - Inertia.js + Vue 3 Frontend & Real-time Notifications

This plan outlines the transformation of the current API-only system into a full-stack Inertia.js application with a premium Vue 3 frontend and real-time broadcasting using Laravel Reverb.

## Proposed Changes

### 1. Backend Setup (Full-stack Integration)

#### [MODIFY] [composer.json](file:///d:/Laragon/www/absensi/composer.json)
- Add `inertiajs/inertia-laravel` and `laravel/reverb`.

#### [NEW] [HandleInertiaRequests.php](file:///d:/Laragon/www/absensi/app/Http/Middleware/HandleInertiaRequests.php)
- Share global data: authenticated user, roles, permissions, and unread notification count.

#### [NEW] [app.blade.php](file:///d:/Laragon/www/absensi/resources/views/app.blade.php)
- Create the root Inertia template with standard modern meta tags and CSS/JS entry points.

### 2. Frontend Infrastructure (Build System)

#### [MODIFY] [package.json](file:///d:/Laragon/www/absensi/package.json)
- Install `@inertiajs/vue3`, `vue`, `vite`, `laravel-vite-plugin`, `leaflet`, `lucide-vue-next` (for premium icons), and `laravel-echo` + `pusher-js`.

#### [MODIFY] [vite.config.js](file:///d:/Laragon/www/absensi/vite.config.js)
- Configure Vite to handle Vue components and Inertia aliasing.

### 3. Components & Pages (Vue 3)

#### [NEW] [Layouts](file:///d:/Laragon/www/absensi/resources/js/Layouts/)
- `AttendanceLayout.vue`: Clean, focused layout for employees.
- `OperationalLayout.vue`: Professional, sidebar-driven layout for HR/Managers with role-based navigation.

#### [NEW] [Components](file:///d:/Laragon/www/absensi/resources/js/Components/)
- `CameraCapture.vue`: Handles `getUserMedia` for photo capture with real-time preview.
- `GPSCapture.vue`: Integrates Leaflet.js for location visualization.
- `ScheduleCard.vue`: Displays current/upcoming shifts with clean typography.
- `NotificationToast.vue`: Real-time notification display using standard animation libraries.

#### [NEW] [Pages](file:///d:/Laragon/www/absensi/resources/js/Pages/)
- `Employee/Dashboard.vue`: Centralized employee interaction page.
- `Operational/Dashboard.vue`: High-level summary with cards and real-time activity tables.

### 4. Real-time Broadcasting (Laravel Reverb)

#### [NEW] [Events](file:///d:/Laragon/www/absensi/app/Events/)
- `AttendanceLogged.php`: Broadcasts when someone clocks in/out.
- `LeaveRequestStatusChanged.php`: Notifies employees of approval results.

#### [MODIFY] [channels.php](file:///d:/Laragon/www/absensi/routes/channels.php)
- Define private channels for site-based broadcasting and user-specific notifications.

## User Review Required

> [!IMPORTANT]
> **Pusher vs Reverb**: I proposed using **Laravel Reverb** as it is the new standard for Laravel 11/12 and allows for self-hosted real-time notifications without external costs. Do you have a specific preference for Pusher instead?

> [!WARNING]
> **Existing API**: Integrating Inertia involves changing some controller methods from `response()->json()` to `Inertia::render()`. I will create separate Web routes and controllers to avoid breaking the existing API if needed, or unify them. Please confirm if you want to **replace** the current API flow or **expand** alongside it.

## Verification Plan

### Automated/Manual Testing
- **Inertia**: Verify page transitions and shared props in the browser.
- **Camera/GPS**: Verify browser permissions and successful data capture.
- **Real-time**: Verify toast notifications appear in a second browser window when an action (like clock-in) occurs.
