# 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.

---

## RC-013: Wedding Event Management Foundation

### 1. Multiple Events Seeding & Legacy Event Soft-deletion
- **Model**: [OperationModel.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Operation/OperationModel.php)
  - `ensurePilotEventsExist(int $workspaceId)`: Ensures `Holy Matrimony` (sort 1), `Tea Pai` (sort 2), and `Reception` (sort 3) events exist in the database, while soft-deleting the legacy default single `Wedding Ceremony` event to prevent UI clutter.
  - `migrateExistingGuestsEvents(int $workspaceId)`: Automatically maps any unassigned guests to all active ceremonies for complete backward compatibility.

### 2. Guest Event Access Mapping
- **Model**: [GuestModel.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Guest/GuestModel.php)
  - `saveGuestEvents()`: Synchronizes selected checkbox event access configurations in the `guest_events` pivot table.
- **Views**: [create.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/create.php) and [edit.php](file:///c:/xampp/htdocs/inveetaire/app/views/guest/edit.php)
  - Added "Event Access" checkboxes to let couples explicitly specify ceremonies for guest invitations.

### 3. Invitation Visibility Filtering
- **Model**: [PublicInvitationModel.php](file:///c:/xampp/htdocs/inveetaire/app/modules/PublicInvitation/PublicInvitationModel.php)
  - Cleaned up default database fallback queries to ensure only explicitly invited ceremonies are rendered on the public invitation agenda page.

### 4. Wedding Day Event Sidebar Navigation
- **Views**: [couple.php](file:///c:/xampp/htdocs/inveetaire/app/views/layouts/couple.php) and [crew.php](file:///c:/xampp/htdocs/inveetaire/app/views/layouts/crew.php)
  - Replaced the disabled placeholder with a dynamic Alpine.js dropdown listing active ceremonies (Holy Matrimony, Tea Pai, Reception) pointing to their corresponding operational check-in terminals.

### 5. Check-In & Override Terminal
- **Controller**: [OperationController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Operation/OperationController.php)
  - `showScanner()`: Resolves terminal views, calculates live attendance stats, and handles text search queries.
  - `checkin()`: Validates invitation access. If not invited, requires an operator-selected reason (VIP, Family Request, Organizer Approval, Extra Pax, Other) and optional notes to register a manual override.
  - `reject()`: Logs entry rejection `checkin.rejected` in audit logs.
- **Views**:
  - [scanner.php](file:///c:/xampp/htdocs/inveetaire/app/views/operation/scanner.php): Dual QR token / text search lookup layout.
  - [guest.php](file:///c:/xampp/htdocs/inveetaire/app/views/operation/guest.php): Guest profile summary, warning banners, rejection forms, and manual override forms.

### 6. Event-Aware Dashboards
- **Controller**: [CoupleDashboardController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/CoupleDashboardController.php)
  - Computes Expected, Arrived, and Pending metrics per ceremony.
- **View**: [dashboard.php](file:///c:/xampp/htdocs/inveetaire/app/views/invitation/dashboard.php)
  - Renders visual progress bars and attendance stats cards for each individual event.

---

## Verification Results

All tests completed successfully.
1. Path and router suites passed (`test_dev_patch_001.php` and `test_dev_patch_002.php`).
2. Project-wide PHP syntax check passed: 0 errors.
3. Automated database integration test `test_rc013_logic.php` passed:
   - Seeding and legacy default cleanup logic validated.
   - Guest creation with selective event access validated.
   - Standard check-in validation validated.
   - Entry warning, rejection, and manual override audit trail logging validated.

---

## RC-014: Guest Engagement Center

### 1. Unified Sidebar Navigation
- **View**: [couple.php](file:///c:/xampp/htdocs/inveetaire/app/views/layouts/couple.php)
  - Integrated the "Guest Engagement" navigation group containing links to RSVP Center, Guest Wishes, and WhatsApp Queue.

### 2. RSVP Center Workspace
- **Controller**: [EngagementController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Engagement/EngagementController.php)
  - `showRsvpCenter()`: Computes expected, confirmed, declined, and pending RSVPs by reusing existing guest counters.
- **View**: [rsvp_center.php](file:///c:/xampp/htdocs/inveetaire/app/views/engagement/rsvp_center.php)
  - Designed responsive data grids and search/category filters with rounded cards utilizing White, Lavender, and Periwinkle color aesthetics.

### 3. wishes Center Moderation
- **Model**: [InvitationModel.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/InvitationModel.php)
  - Added `getWishesFiltered()` and `getWishesCountFiltered()` to support text search and chronological sorting.
- **View**: [wishes.php](file:///c:/xampp/htdocs/inveetaire/app/views/engagement/wishes.php)
  - Created a timeline of congratulations wishes showing guest initials, dates, and blessing messages.

### 4. WhatsApp queue Management
- **Controller**: [EngagementController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Engagement/EngagementController.php)
  - `showWhatsAppQueue()`: Compiles custom wording messages and pre-filled WhatsApp link URLs.
  - `markSent()`: Marks guest as sent to clear the pending queue list.
  - `resetQueue()`: Resets all delivery statuses to start sending again.
- **View**: [whatsapp_queue.php](file:///c:/xampp/htdocs/inveetaire/app/views/engagement/whatsapp_queue.php)
  - Added preview modal modals, message copying, and premium mock disabled broadcast panels.

### 5. Guest Journey Timeline Component
- **View**: [_timeline.php](file:///c:/xampp/htdocs/inveetaire/app/views/engagement/_timeline.php)
  - Visualized vertical progress timeline (Invitation -> RSVP -> Wish -> Check-In) matching guest statuses.
- **View Integration**: [guest.php](file:///c:/xampp/htdocs/inveetaire/app/views/operation/guest.php)
  - Embedded timeline panel on the check-in profile lookup screen.

### 6. Dashboard Updates
- **Controller**: [CoupleDashboardController.php](file:///c:/xampp/htdocs/inveetaire/app/modules/Invitation/CoupleDashboardController.php)
  - Fetches the last 5 RSVP entries and last 5 check-ins.
- **View**: [dashboard.php](file:///c:/xampp/htdocs/inveetaire/app/views/invitation/dashboard.php)
  - Injected Recent RSVPs and Recent Check-ins activity panels, and a "View All Wishes" link under the Latest wishes widget.

---

## RC-014 Verification Results
1. Project-wide PHP syntax check passed: 0 errors.
2. Automated database integration test `test_rc014_logic.php` passed:
   - RSVP center count queries validated.
   - Wishes search, limit, and oldest/newest sorting validated.
   - WhatsApp queue generation, sent mark updates, and queue resets validated.
   - Dashboard recent RSVPs and check-ins feeds validated.

---

## RC-015: Product Polish & Production Readiness

### 1. Standardized Empty States
- **Views**:
  - `app/views/invitation/dashboard.php`: Styled wishes list, recent RSVPs feed, and recent check-ins empty placeholders to use `.empty-state-elegant`.
  - `app/views/guest/list.php`: Standardized empty list state prompting manually adding or uploading spreadsheets.
  - `app/views/engagement/rsvp_center.php`: Custom empty RSVP state directing to WhatsApp delivery queue.
  - `app/views/engagement/wishes.php`: Custom empty wishes state.
  - `app/views/engagement/whatsapp_queue.php`: Custom empty queue placeholder when all messages are sent.
  - `app/views/operation/scanner.php`: Styled empty lookup results and waiting prompts.

### 2. Loading Shimmer Skeletons
- **Views**:
  - Added client-side shimmery visual states utilizing Alpine.js (`tableLoading`, `rsvpLoading`, `wishesLoading`, `queueLoading`).
  - Automatically activates pulse row `.skeleton-table-row` and pulse card `.skeleton-card` widgets when forms/filters are submitted or pagination links are clicked.

### 3. Unified Layout Alerts
- **Component**: [flash.php](file:///c:/xampp/htdocs/inveetaire/app/views/components/flash.php)
  - Mapped all ephemeral session alerts to design system alert classes (`.alert-success`, `.alert-danger` for errors, `.alert-warning`, `.alert-info`).

### 4. Standardized Confirmation Dialogs
- **Views**:
  - Unified guest delete modal (in `list.php`), queue reset modal (in `whatsapp_queue.php`), entry reject and override modal (in `guest.php`), and logout modal (in layout `couple.php` and `crew.php`).
  - All dialogs share rounded borders, backdrop click configurable dismissals, Escape key handlers, and standardized button actions.

### 5. Form & Table Polishes
- **Views**: Standardized input fields, validation labels using `.form-error` wrapper, mobile-responsive overflow scrolling wrappers on tables, and uppercase sticky headers.

### 6. Consistent Custom HTTP Error Pages
- **Views**: Created branded error views with dark luxury gold palettes and dynamic base path links:
  - [403.php](file:///c:/xampp/htdocs/inveetaire/app/views/errors/403.php) — Access Forbidden.
  - [404.php](file:///c:/xampp/htdocs/inveetaire/app/views/errors/404.php) — Resource Not Found.
  - [500.php](file:///c:/xampp/htdocs/inveetaire/app/views/errors/500.php) — Internal Server Error.
  - [expired.php](file:///c:/xampp/htdocs/inveetaire/app/views/errors/expired.php) — Session Timeout.
  - [workspace_not_found.php](file:///c:/xampp/htdocs/inveetaire/app/views/errors/workspace_not_found.php) — Workspace Missing.
  - [invitation_not_found.php](file:///c:/xampp/htdocs/inveetaire/app/views/errors/invitation_not_found.php) — Invitation Missing.

---

## RC-015 Verification Results
1. Project-wide PHP syntax check passed: 0 errors.
2. Bootstrap execution & model query assertions check passed.



