# Migration Plan: CodeIgniter 3 to Laravel with AdminLTE Pro

## Goal Description
The objective is to clone the legacy CodeIgniter 3 Helpdesk application (`supportclicngo4`) into a new Laravel 11 project (`support-system`). The new system must retain 100% of the old database structure and logic, while modernizing the UI for both Admin and Client panels using AdminLTE Pro.

## User Review Required
> [!IMPORTANT]
> - Do you already have the **AdminLTE Pro** template assets (CSS, JS, images) placed in your `public/` directory, or should we install an AdminLTE package via Composer/NPM?
> - For the database, do you want us to create proper Laravel Migrations based on [old-database-codeigniter.sql](file:///d:/xampp8/htdocs/support-system/old-database-codeigniter.sql) to generate the schema, or do you want to just import the SQL file directly and only create Eloquent Models? Creating Migrations is the standard Laravel way.
> - The old system uses tables prefixed with `clic23_`. Do you want to keep this prefix in Laravel, or remove the prefix in the actual table names?

## Proposed Changes

### 1. Database & Models
- Parse [old-database-codeigniter.sql](file:///d:/xampp8/htdocs/support-system/old-database-codeigniter.sql) to identify all tables: `users`, `tickets`, `categories`, `custom_fields`, `ticket_replies`, etc.
- Create Laravel Migrations for each table to replicate the exact structure.
- Create Laravel Eloquent Models for each table.
- Define 100% of the relationships in Laravel (e.g., `Ticket->hasMany(TicketReply)`, `Ticket->belongsTo(User)`), based on CodeIgniter's logic.

### 2. Logic Translation (Controllers & Services)
- Translate [application/controllers/Tickets.php](file:///d:/xampp8/htdocs/support-system/supportclicngo4/application/controllers/Tickets.php), [Admin.php](file:///d:/xampp8/htdocs/support-system/supportclicngo4/application/controllers/Admin.php), [Client.php](file:///d:/xampp8/htdocs/support-system/supportclicngo4/application/controllers/Client.php) into Laravel Controllers:
  - `Admin\TicketController`
  - `Admin\UserController`
  - `Client\TicketController`
- Translate form validations from CodeIgniter to Laravel Form Requests (`StoreTicketRequest`, etc.).
- Convert standard SQL queries from CodeIgniter Models into Eloquent/Query Builder.

### 3. Admin Panel UI
- Setup layout: `resources/views/admin/layout/app.blade.php` using AdminLTE Pro.
- Create Views:
  - Dashboard
  - Ticket List (DataTables)
  - Ticket Details / Reply Interface
  - Settings & Users Management

### 4. Client Panel UI
- Setup layout: `resources/views/client/layout/app.blade.php` using AdminLTE Pro.
- Create Views:
  - Client Dashboard
  - My Tickets (List)
  - Create Ticket Form
  - Ticket Details / Reply

## Verification Plan

### Automated Tests
- N/A for this initial migration phase, unless requested. We will rely on manual testing to ensure it matches CodeIgniter.

### Manual Verification
1. Compare the database schema in phpMyAdmin between the old DB and the new Laravel DB to ensure a 100% match.
2. Login as Admin in the new system and verify that all menus and modules (Tickets, Users, Settings) load correctly with the AdminLTE Pro design.
3. Login as Client in the new system and test creating a ticket, replying to it, and checking the status.
4. Manually verify that custom fields and categories work exactly as they did in CodeIgniter.
