# Walkthrough: RC-011 & RC-012 Couple Workspace

We have successfully completed Release Candidates **RC-011** (Couple Experience — Dashboard & Invitation Workspace) and **RC-012** (Guest Management Workspace) for the INVEETAIRE platform.

---

## RC-011: Couple Experience

### 1. Couple Dashboard Summary Page
- **Controller**: [CoupleDashboardController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/CoupleDashboardController.php) [NEW]
  - Collects wedding metadata, countdown days, checklist status (Basic Info, Venue details, Message template, Guest count), guest stats, and visible wishes.
- **View**: [dashboard.php](file:///c:/xampp/htdocs/inveetaire/app/views/invitation/dashboard.php) [NEW]
  - Displays hero block with names/date/countdown, setup progress tracker, quick action cards, stats grid, recent activity placeholder, and latest wishes list.
- **Route**: [couple.php](file:///c:/xampp/htdocs/inveetaire/routes/couple.php)
  - Remapped GET `/dashboard` from the config form to `CoupleDashboardController@index`.

### 2. Dedicated Invitation Workspace & Theme Design
- **Route**: [routes.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/routes.php)
  - Registered route `GET /invitation/design` pointing to `InvitationController@design`.
- **Controller Action**: Added `design()` in [InvitationController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/InvitationController.php) to load current theme detail.
- **View**: [design.php](file:///c:/xampp/htdocs/inveetaire/app/views/invitation/design.php) [NEW]
  - Showcases active theme (*Klasik Putih*), thumbnail, theme layout preview, premium theme catalog placeholders, and future upgrade messages.

### 3. Navigation Restructuring
- **File**: [couple.php](file:///c:/xampp/htdocs/inveetaire/app/views/layouts/couple.php)
  - Reorganized navigation menu into an expandable Accordion tree for *Invitation*:
    - **General**: `/app/couple/invitation/edit`
    - **Design**: `/app/couple/invitation/design`
    - **Message Template**: `/app/couple/messaging/template`
  - Replaced *Operation* with *Wedding Day (disabled)* placeholder.

### 4. Database Helper Extensions
- **File**: [InvitationModel.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/InvitationModel.php)
  - Added visible wishes counting and recent wishes collection methods.

---

## RC-012: Guest Management Workspace

### 1. Navigation Expandable Submenu
- **File**: [couple.php](file:///c:/xampp/htdocs/inveetaire/app/views/layouts/couple.php)
  - Restructured the sidebar's static *Guests* link into an expandable Accordion sub-tree containing:
    - **Guest List** (`/app/couple/guests`)
    - **Add Guest** (`/app/couple/guests/create`)
    - **Import Excel** (`/app/couple/guests/import`)

### 2. Database CRUD & Search Queries
- **File**: [GuestModel.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Guest/GuestModel.php)
  - Added `getGuests()` to fetch paginated guests matching filters (category, RSVP status, attendance status, and search query).
  - Added `getGuestsCount()` for pagination logic.
  - Added helper methods `getGuestById()`, `updateGuest()`, `deleteGuest()` (using soft deletes), and duplicate checking functions `guestExistsByPhone()` and `getDistinctGroups()`.

### 3. Controller Actions & Flow Registry
- **File**: [GuestController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Guest/GuestController.php)
  - Implemented page-actions for displaying lists, manual guest creation, record editing, soft deletion, excel uploading, and templated downloading.
  - Adapted parameter signatures to read route variables directly from `$request->param('id')` to maintain strict compatibility with the framework's Router structure.

### 4. Preview Validation & Excel Upload Parsing
- **File**: [GuestService.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Guest/GuestService.php)
  - Implemented `validateImportFile()` which parses uploads and validates required fields, phone formats, pax size, duplicate names, and duplicate phone numbers.
  - Compiles a row-by-row validation report preview.
  - Implemented `finalizeImport()` to insert approved rows to the database.

### 5. UI Views & Templates
- [list.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/list.php) [NEW]: Renders a responsive list table with metrics panels, filter controls, pagination, empty states, and deletion confirm modals.
- [create.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/create.php) [NEW]: Form to add guest details manually.
- [edit.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/edit.php) [NEW]: Safe edit view utilizing null-safe coalescing operators inside escape helpers to prevent PHP 8 exceptions.
- [import_preview.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/import_preview.php) [NEW]: Renders summary counts, validation details, and final import actions.
- [import.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/import.php) [MODIFY]: Restructured to point to preview validator and links template downloading.

---

## Visual Verification

### Guest List Workspace View
![Guest List Workspace](/C:/Users/FRIDAY/.gemini/antigravity-ide/brain/2818d634-5c83-402d-a431-621d539bcb9d/guest_list_workspace_1783929434973.png)

### Video Session Recording
![Guest Workspace Recording](/C:/Users/FRIDAY/.gemini/antigravity-ide/brain/2818d634-5c83-402d-a431-621d539bcb9d/rc012_guest_workspace_final_fix_1783929171187.webp)

---

## Verification Results

All tests completed successfully.
1. Path and helper test suites passed:
   ```
   ✅ PASS: base_path() - localhost subdirectory with public
   ✅ PASS: base_path & url - localhost subdirectory with public
   ✅ PASS: base_path & url - localhost root with public
   ✅ PASS: base_path & url - production root without public
   ✅ PASS: base_path & url - production subdirectory without public
   ✅ PASS: url() with external urls
   ✅ PASS: asset() helper
   ✅ PASS: route() helper
   ✅ PASS: GET / in subfolder returns Landing Page
   ✅ PASS: GET / in production root returns Landing Page
   ✅ PASS: GET /login redirects to /couple
   ✅ PASS: GET /couple loads login page successfully
   ✅ PASS: GET /unknown-path still returns 404
   ```
2. PHP Syntax checks on all edited/created files passed.
3. Full end-to-end browser walkthrough validated: guest list loaded, added guest manually, updated their name, confirmed deletion in modal, and tested excel upload routes.
