diff --git a/.planning/phases/04/PLAN.md b/.planning/phases/04/PLAN.md new file mode 100644 index 0000000..a9e4509 --- /dev/null +++ b/.planning/phases/04/PLAN.md @@ -0,0 +1,242 @@ +# Phase 4 Plan: Form Rendering + +## Goal +Create shortcode `[umzugsliste]` that renders the complete moving list form matching legacy structure with 7 room sections, customer info fields, and montage options. + +## Context +- Legacy form in `/Users/vmiller/Local Sites/siegel-liste/app/public/liste/liste.php` +- Furniture data already extracted in `includes/class-furniture-data.php` +- Settings system complete with receiver email and captcha config +- Form must match legacy structure exactly for office staff familiarity +- Will use Foundation CSS classes from legacy (migrate to theme styles later) + +## Implementation Plan + +### 1. Create Shortcode Handler Class +**File**: `includes/class-shortcode.php` + +Create a new class `Umzugsliste_Shortcode` that: +- Registers `[umzugsliste]` shortcode +- Returns rendered form HTML +- Enqueues necessary CSS/JS +- Follows singleton pattern like other plugin classes + +**Key Methods**: +- `register()` - Hook into WordPress shortcode system +- `render_form()` - Main rendering method +- `enqueue_assets()` - Load CSS/JS for form + +### 2. Create Form Renderer Class +**File**: `includes/class-form-renderer.php` + +Create `Umzugsliste_Form_Renderer` class with methods to generate form sections: +- `render_date_selector()` - Moving date selection (day/month/year dropdowns) +- `render_customer_info()` - Beladeadresse and Entladeadresse fields +- `render_room_section( $room_key )` - Generic room furniture table +- `render_additional_work()` - Montage, Schrank, Elektriker, etc. +- `render_sonstiges()` - Free text section +- `render_submit_button()` - Submit button and required field notice + +**Data Flow**: +- Get furniture items from `Umzugsliste_Furniture_Data::get_furniture_items()` +- Use room labels from `Umzugsliste_Furniture_Data::get_rooms()` +- Generate field names matching legacy format (e.g., `Wohnzimmer[vSofa, Couch, je Sitz]`) + +### 3. Form Structure (Matching Legacy) + +**Header Section**: +- Siegel logo and company info +- Privacy policy notice +- Moving date selector (3 dropdowns) + +**Customer Info Section** (2 columns): +- **Beladeadresse** (left): + - Name* (text) + - Straße* (text) + - PLZ/Ort* (text) + - Geschoss (text) + - Lift (radio: nein/ja) + - Telefon* (text) + - Telefax (text) + - Mobil (text) + +- **Entladeadresse** (right): + - Name* (text) + - Straße* (text) + - PLZ/Ort* (text) + - Geschoss (text) + - Lift (radio: nein/ja) + - Telefon (text) + - Telefax (text) + - Mobil (text) + +- E-Mail* (in Beladeadresse section but labeled in Entladeadresse) + +**Room Sections** (7 total): +1. Wohnzimmer +2. Schlafzimmer +3. Arbeitszimmer +4. Bad +5. Küche/Esszimmer +6. Kinderzimmer +7. Keller/Speicher/Garage + +Each room section contains: +- Table with columns: Anzahl, Bezeichnung, qbm, Montage? +- Rows for each furniture item with: + - Quantity input field (text, size 2, maxlength 3) + - Item name (label) + - CBM value display (from data) + - Hidden CBM input field + - Montage radio buttons (Ja/Nein, default Nein) + +**Field Naming Convention** (critical for email generation): +- Quantity: `{Room}[v{ItemName}]` (e.g., `Wohnzimmer[vSofa, Couch, je Sitz]`) +- CBM: `{Room}[q{ItemName}]` (hidden field) +- Montage: `{Room}[m{ItemName}]` (radio) + +**Submit Section**: +- Required fields notice +- Submit button + +### 4. Create Date Selector Helpers +**File**: `includes/class-date-helpers.php` + +Port legacy date functions: +- `render_day_select( $selected )` - Day dropdown (1-31) +- `render_month_select( $selected )` - Month dropdown (German names) +- `render_year_select( $selected )` - Year dropdown (current + 2 years) + +Default to today's date. + +### 5. Assets Setup + +**CSS**: +- Copy relevant Foundation grid CSS from legacy +- Copy custom.css styles +- Create `assets/css/form.css` for form-specific styles +- Inline critical CSS or enqueue properly + +**JavaScript** (for Phase 5): +- Create placeholder `assets/js/form.js` +- Will contain volume calculation logic in Phase 5 +- For now, just enqueue empty file + +### 6. Integration with Main Plugin +**File**: `umzugsliste.php` + +Update main plugin file to: +- Require shortcode class +- Require form renderer class +- Require date helpers class +- Initialize shortcode handler + +### 7. HTML Structure Notes + +**Form Tag**: +```html +