---
phase: 04-post-launch-fixes
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - _rejestracja/template/partial/Index/Index.tpl
  - _rejestracja/Admin/template/partial/Calc/Reg.tpl
  - _rejestracja/Admin/template/partial/Calc/RegEdit.tpl
autonomous: true
delegation: off
---

<objective>
## Goal
Remove the obsolete FAX field from the public registration form and admin views, and hide the "single room surcharge" and "accompanying person" checkboxes when "one day without accommodation" participation option is selected.

## Purpose
Two small UX fixes requested by the client post-launch: FAX is obsolete and clutters the form; the room/person surcharges are irrelevant for one-day-no-lodging participation so they should be hidden to avoid confusion.

## Output
- FAX field removed from public form template and admin participant display templates
- JS `showSelectDate()` updated to hide/show `#conference_1` surcharge block based on participation option
</objective>

<context>
## Project Context
@.paul/PROJECT.md
@.paul/ROADMAP.md
@.paul/STATE.md

## Source Files
@_rejestracja/template/partial/Index/Index.tpl
@_rejestracja/Admin/template/partial/Calc/Reg.tpl
@_rejestracja/Admin/template/partial/Calc/RegEdit.tpl
</context>

<acceptance_criteria>

## AC-1: FAX field removed from public form
```gherkin
Given the public registration form at /_rejestracja/
When a user views the form
Then there is no "Fax" label or input field visible
```

## AC-2: FAX removed from admin views
```gherkin
Given the admin participant list (Reg.tpl) and edit view (RegEdit.tpl)
When an admin views participant details
Then there is no "Fax:" line in the participant contact data
```

## AC-3: Surcharge fields hidden for one-day-no-lodging
```gherkin
Given the public registration form
When the user selects "udział jeden dzień bez noclegu" (conference_fee_1, value=5)
Then the #conference_1 block (containing "dopłata do pokoju 1-osobowego" and "udział osoby towarzyszącej") is hidden and its checkboxes are unchecked
```

## AC-4: Surcharge fields shown for full conference
```gherkin
Given the public registration form
When the user selects the full conference option (conference_fee, value=1)
Then the #conference_1 block is visible
```

</acceptance_criteria>

<tasks>

<task type="auto">
  <name>Task 1: Remove FAX field from public form and admin views</name>
  <files>
    _rejestracja/template/partial/Index/Index.tpl,
    _rejestracja/Admin/template/partial/Calc/Reg.tpl,
    _rejestracja/Admin/template/partial/Calc/RegEdit.tpl
  </files>
  <action>
    In `_rejestracja/template/partial/Index/Index.tpl`:
    - Remove the entire `<div class="entry">` block containing the "Fax" label and `{formField name="fax" ...}` (currently lines 45–48).

    In `_rejestracja/Admin/template/partial/Calc/Reg.tpl`:
    - Remove the line `Fax: {$obj->getFax()}</br>` from the participant contact cell (currently line 49).

    In `_rejestracja/Admin/template/partial/Calc/RegEdit.tpl`:
    - Remove the line `Fax: {$objParticipant->getFax()|default:$registrationMissing}</br>` from the edit view (currently line 36).

    Do NOT modify the PHP model, controller, or database schema — the `fax` column stays in DB for existing records.
  </action>
  <verify>
    Visually inspect the public form — no "Fax" row present.
    Grep: `grep -n "fax\|Fax" _rejestracja/template/partial/Index/Index.tpl _rejestracja/Admin/template/partial/Calc/Reg.tpl _rejestracja/Admin/template/partial/Calc/RegEdit.tpl`
    Expected: no matches in the three template files.
  </verify>
  <done>AC-1 and AC-2 satisfied: FAX absent from public form and both admin templates.</done>
</task>

<task type="auto">
  <name>Task 2: Hide surcharge checkboxes when one-day-no-lodging is selected</name>
  <files>_rejestracja/template/partial/Index/Index.tpl</files>
  <action>
    In the `showSelectDate()` JavaScript function (inside the `{literal}...{/literal}` block in Index.tpl), update the logic as follows:

    Current behaviour:
    - Full conference radio (`conference_fee`, onclick): calls `$('#conference_1').show()` explicitly in its `onclick` attribute.
    - One-day-no-lodging radio (`conference_fee_1`, onclick): only calls `calculatePrice()`.
    - `showSelectDate()` does not touch `#conference_1`.

    Required change — inside `showSelectDate()`, add visibility toggling for `#conference_1`:
    1. At the start of `showSelectDate()`, after the existing hide/reset lines, add: `$('#conference_1').hide();` (default to hidden when option changes).
    2. In the `if (selectedId === 'conference_fee')` branch (full conference — note: there is no such branch yet, add it): show `#conference_1`.
       Actually the full conference radio id is `conference_fee` (the radio with `checked="true"` and value=1). Add the branch:
       ```
       if (selectedId === 'conference_fee') {
           $('#conference_1').show();
       }
       ```
    3. In the `if (selectedId === 'conference_fee_1')` branch (one day no lodging): already handled by the default hide above, but also uncheck both checkboxes:
       ```
       if (selectedId === 'conference_fee_1') {
           $('#participation_option').val('one_day_no_lodging');
           $('#one-day-no-lodging-days').css('display', 'flex');
           $('#price_plus_room').prop('checked', false);
           $('#price_plus_person').prop('checked', false);
       }
       ```

    Also remove the inline `onclick="$('#conference_1').show(); $('#conference_2').hide(); calculatePrice();"` from the full conference radio input and replace it with just `onclick="showSelectDate(); calculatePrice();"` — or simply add `showSelectDate()` logic to handle it, keeping existing calculatePrice() calls.

    Simpler approach to minimise risk: Keep the inline onclick on the full conference radio as-is (`$('#conference_1').show(); ...`) and only modify `showSelectDate()` to:
    - After the three existing hide/reset lines (lines ~218-222), add: `$('#conference_1').hide();`
    - In the `if (selectedId === 'conference_fee_1')` block, add unchecking of the two checkboxes:
      ```js
      $('#price_plus_room').prop('checked', false);
      $('#price_plus_person').prop('checked', false);
      ```
    This way, when `showSelectDate()` fires on `conference_fee_1` change, `#conference_1` is hidden and checkboxes are cleared. When the full conference radio fires its inline onclick, it explicitly calls `$('#conference_1').show()` before `calculatePrice()` — unchanged behaviour.

    Avoid: touching calculatePrice() logic or any server-side code.
  </action>
  <verify>
    Manual test flow:
    1. Load the registration form.
    2. Select "udział jeden dzień bez noclegu" — confirm #conference_1 block disappears and both checkboxes are unchecked.
    3. Re-select full conference — confirm #conference_1 block reappears.
    4. Verify price calculation still works correctly for both options.
  </verify>
  <done>AC-3 and AC-4 satisfied: surcharge block hidden on one-day-no-lodging, visible on full conference.</done>
</task>

</tasks>

<boundaries>

## DO NOT CHANGE
- `_rejestracja/controller/IndexController.php` — FAX is still saved from POST (will just be empty); no controller changes needed.
- `_rejestracja/core/model/MfParticipant.class.php` — DB model unchanged.
- Any database schema or migration files.
- Pricing calculation logic (`calculatePrice()` function body).
- Any other form fields or admin templates not listed above.

## SCOPE LIMITS
- Do not remove FAX from the DB column or PHP model.
- Do not change the admin edit form inputs for FAX (RegEdit.tpl input field, if any) — only remove the display line; if there's an editable FAX input in RegEdit.tpl, remove that display label only, not the save logic.
- Do not redesign or refactor the showSelectDate() function beyond the targeted change.

</boundaries>

<verification>
Before declaring plan complete:
- [ ] `grep -n "Fax\|fax" _rejestracja/template/partial/Index/Index.tpl` returns no results (or only comments/model)
- [ ] `grep -n "Fax" _rejestracja/Admin/template/partial/Calc/Reg.tpl` returns no results
- [ ] `grep -n "Fax" _rejestracja/Admin/template/partial/Calc/RegEdit.tpl` returns no results
- [ ] Public form loads without PHP errors
- [ ] Selecting one-day-no-lodging hides #conference_1 surcharges
- [ ] Selecting full conference shows #conference_1 surcharges
- [ ] Price calculation works correctly for all options
</verification>

<success_criteria>
- All tasks completed
- FAX field absent from public form and both admin templates
- Surcharge block toggles correctly with participation option selection
- No regressions in pricing, form submission, or admin display
</success_criteria>

<output>
After completion, create `.paul/phases/04-post-launch-fixes/04-01-SUMMARY.md`
</output>
