This commit is contained in:
2026-04-24 23:37:57 +02:00
parent ff05330778
commit ed2f89567c
15 changed files with 1263 additions and 41 deletions

View File

@@ -2,9 +2,9 @@
## Milestone v0.1: XXXV Konferencja Registration Update
Status: Complete
Status: In progress
Progress: 2 of 2 phases complete (100%)
Progress: 2 of 3 phases complete (67%)
### Phase 1: Registration Form Update
Status: Complete
@@ -23,3 +23,11 @@ Goal: Move new and related registration phrases into the editable dictionary so
Planned:
- `02-01`: Complete - seeded dictionary phrases and updated registration templates to use translations.
### Phase 3: Registration Form Settings
Status: Applying
Goal: Add an administrator "Ustawienia formularza" page for editable registration participation days and all prices used by the public form, mail/summary output, and server-side price calculation.
Planned:
- `03-01`: Applied, awaiting unify - created settings helper, admin page, deployment seed, and connected public form pricing/day options to editable settings.

View File

@@ -1,29 +1,29 @@
## Current Position
Milestone: v0.1 XXXV Konferencja Registration Update
Phase: 2 of 2 (Registration Dictionary Phrases) - Complete
Plan: 02-01 complete
Status: UNIFY complete, loop closed
Last activity: 2026-04-24 21:25:19 +02:00 - Created `.paul/phases/02-registration-dictionary-phrases/02-01-SUMMARY.md`
Phase: 3 of 3 (Registration Form Settings) - Planning
Plan: 03-01 applied, awaiting unify
Status: APPLY complete, ready for UNIFY
Last activity: 2026-04-24 23:09:13 +02:00 - Added in-plan KSeF helper note under NIP field
Progress:
- Milestone: [##########] 100%
- Phase 2: [##########] 100%
- Milestone: [#######---] 67%
- Phase 3: [----------] 0%
## Loop Position
Current loop state:
```text
PLAN --> APPLY --> UNIFY
* * * [Loop complete - milestone complete]
* * o [Apply complete, awaiting unify]
```
## Session Continuity
Last session: 2026-04-24 21:25:19 +02:00
Stopped at: Plan 02-01 unified
Next action: Apply dictionary seed on target server, then deploy/test as needed
Resume file: `.paul/phases/02-registration-dictionary-phrases/02-01-SUMMARY.md`
Last session: 2026-04-24 23:09:13 +02:00
Stopped at: Plan 03-01 applied
Next action: Run $paul-unify `.paul/phases/03-registration-form-settings/03-01-PLAN.md`
Resume file: `.paul/phases/03-registration-form-settings/03-01-APPLY.md`
## Accumulated Context
@@ -32,9 +32,11 @@ Resume file: `.paul/phases/02-registration-dictionary-phrases/02-01-SUMMARY.md`
|----------|-------|--------|
| 2026-04-24: Use stable `registration_*` dictionary keys for registration-specific phrases | Phase 2 | Admin can edit visible registration wording without template changes. |
| 2026-04-24: Preserve form values, persistence, pricing logic, and payment status values during dictionary refactor | Phase 2 | Registration behavior remains aligned with Phase 1. |
| 2026-04-24: Plan form settings around `wp_setup` for new scalar/list settings and `mf_parameters` for existing price rows | Phase 3 | Avoids schema changes while exposing current calculation values in one admin screen. |
### Blockers/Concerns
- Production must run `_rejestracja/sql/apply-2026-04-24-registration-dictionary-phrases.php?run=20260424` or apply the SQL file before dictionary entries are visible/editable.
- Phase 3 will require applying `_rejestracja/sql/apply-2026-04-24-registration-form-settings.php?run=20260424` or the matching SQL seed after implementation.
### Deferred Issues
- None.

View File

@@ -0,0 +1,51 @@
# APPLY Results: 03-01
Date: 2026-04-24 23:04:32 +02:00
## Completed Tasks
### Task 1: Add Shared Registration Settings Helper
Status: pass
Notes:
- Added `_rejestracja/core/class/RegistrationFormSettings.class.php` to centralize participation day lists, VAT multiplier, one-day prices, and existing `mf_parameters` price rows.
- Added `_rejestracja/sql/2026-04-24-registration-form-settings.sql` with idempotent `wp_setup` inserts.
- Added `_rejestracja/sql/apply-2026-04-24-registration-form-settings.php` as a guarded browser/CLI seed runner.
- New list/scalar settings use `wp_setup`; existing calculator prices remain in `mf_parameters`.
### Task 2: Build Admin Form Settings Page
Status: pass
Notes:
- Added `_rejestracja/Admin/controller/FormSettingsController.php`.
- Added `_rejestracja/Admin/template/partial/FormSettings/Index.tpl`.
- Added the `Ustawienia formularza` admin menu link to Dictionary, Setup, and the new controller.
- The admin form can edit participation days, one-day prices, VAT multiplier, and relevant `mf_parameters` price rows.
### Task 3: Use Settings in Public Form and Submit Pricing
Status: pass
Notes:
- Updated `_rejestracja/controller/IndexController.php` to load registration settings, pass them to Smarty/JavaScript, calculate VAT from the configured multiplier, and save one-day participant prices from settings.
- Updated `_rejestracja/template/partial/Index/Index.tpl` to render configured `participation_days` lists and use configured one-day prices in `calculatePrice`.
- Added a small KSeF ID helper note under the public NIP field as an in-plan follow-up.
- Preserved public field names and stored values for existing registration flow compatibility.
## Verification
- `php -l _rejestracja/core/class/RegistrationFormSettings.class.php`: pass
- `php -l _rejestracja/Admin/controller/FormSettingsController.php`: pass
- `php -l _rejestracja/controller/IndexController.php`: pass
- `php -l _rejestracja/sql/apply-2026-04-24-registration-form-settings.php`: pass
- Hardcoded day/one-day price scan: pass; matches remain only in helper defaults and deployment seed files.
- Admin menu scan: pass; Dictionary, Setup, and FormSettings include `Ustawienia formularza`.
- NIP field helper note: pass; rendered under the existing NIP input without changing form field names.
## Deviations
- No schema changes were introduced; the plan's no-schema approach was followed.
- Unrelated working tree entries were present and left untouched: `_rejestracja/Static/image/Admin/Thumbs.db` and `.vscode/ftp-kr.sync.cache.json`.
## Next Step
Run `$paul-unify .paul/phases/03-registration-form-settings/03-01-PLAN.md` to reconcile the plan and close the loop.

View File

@@ -0,0 +1,179 @@
---
phase: 03-registration-form-settings
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- _rejestracja/core/class/RegistrationFormSettings.class.php
- _rejestracja/Admin/controller/FormSettingsController.php
- _rejestracja/Admin/template/partial/FormSettings/Index.tpl
- _rejestracja/Admin/controller/DictionaryController.php
- _rejestracja/Admin/controller/SetupController.php
- _rejestracja/controller/IndexController.php
- _rejestracja/template/partial/Index/Index.tpl
- _rejestracja/sql/2026-04-24-registration-form-settings.sql
- _rejestracja/sql/apply-2026-04-24-registration-form-settings.php
autonomous: true
delegation: off
---
<objective>
## Goal
Add an administrator "Ustawienia formularza" page next to "Slowniki" and "Zmienne serwisu", and make registration day options plus every price used by the registration price calculation editable from that page.
## Purpose
The registration form currently mixes editable `mf_parameters` prices with hardcoded one-day prices and hardcoded `participation_days` labels in the Smarty/JavaScript template. The client needs those operational values changeable at any time without editing source code.
## Output
- New admin controller and template for form settings.
- Shared settings helper for reading defaults from `wp_setup` and `mf_parameters`.
- Public registration form and submit flow using the shared settings for day labels and pricing.
- SQL and PHP migration runner to seed default settings on production.
</objective>
<context>
## Project Context
@.paul/PROJECT.md
@.paul/ROADMAP.md
@.paul/STATE.md
## Prior Work
@.paul/phases/01-registration-form-update/01-01-SUMMARY.md
@.paul/phases/02-registration-dictionary-phrases/02-01-SUMMARY.md
## Source Files
@_rejestracja/controller/IndexController.php
@_rejestracja/template/partial/Index/Index.tpl
@_rejestracja/Admin/controller/SetupController.php
@_rejestracja/Admin/controller/DictionaryController.php
@_rejestracja/Admin/template/partial/Setup/Index.tpl
@_rejestracja/Admin/controller/CalcController.php
@_rejestracja/Admin/template/partial/Calc/Add.tpl
@_rejestracja/Admin/template/partial/Calc/Edit.tpl
@_rejestracja/core/_model/SetupDAL.class.php
@_rejestracja/core/_model/MfParameters.class.php
@_rejestracja/core/_model/MfParametersDAL.class.php
</context>
<acceptance_criteria>
## AC-1: Admin Menu Entry
```gherkin
Given an administrator is on the Dictionary or Setup admin area
When the admin side menu renders
Then the menu includes "Ustawienia formularza" linking to /_rejestracja/Admin/FormSettings/Index next to "Slowniki" and "Zmienne serwisu"
```
## AC-2: Editable Participation Days
```gherkin
Given an administrator opens "Ustawienia formularza"
When they edit the one-day with lodging and one-day without lodging day labels
Then the public registration form renders those labels as participation_days radio options and submitted registrations store the selected configured label
```
## AC-3: Editable Calculation Prices
```gherkin
Given an administrator opens "Ustawienia formularza"
When they edit full conference prices, single-room/accompanying-person/English-conference surcharges, one-day prices, or VAT multiplier
Then calculatePrice on the public form and the server-side saved participant price use the edited values consistently
```
## AC-4: Deployment Seed
```gherkin
Given production has not yet created the new form settings variables
When the deployment SQL or PHP runner is applied
Then default settings are inserted without overwriting existing values and the form still shows the current three November day options and current prices
```
</acceptance_criteria>
<tasks>
<task type="auto">
<name>Task 1: Add Shared Registration Settings Helper</name>
<files>_rejestracja/core/class/RegistrationFormSettings.class.php, _rejestracja/sql/2026-04-24-registration-form-settings.sql, _rejestracja/sql/apply-2026-04-24-registration-form-settings.php</files>
<action>
Create a `RegistrationFormSettings` helper that centralizes editable values:
- Read/write day labels from `wp_setup` variables using a clear prefix such as `registration_form_days_lodging` and `registration_form_days_no_lodging`; store list values as newline-separated text to keep the existing `wp_setup` table unchanged.
- Read/write the VAT multiplier from `wp_setup` as `registration_form_vat_multiplier`, defaulting to `1.23`.
- Read/write one-day net prices from `wp_setup` as `registration_form_one_day_price_prom` and `registration_form_one_day_price_normal`, defaulting to `1300` and `1600`.
- Read/write existing full conference and surcharge prices through `mf_parameters` rows, preserving IDs currently used by the form: `1` full conference, `2` single-room surcharge, `3` accompanying person/driver, `4` English conference, `5` legacy one-day.
- Return a normalized settings array for templates containing `days_lodging`, `days_no_lodging`, `prices`, and `vat_multiplier`.
- Provide save methods that normalize commas to dots for numbers, trim list entries, and leave unrelated `wp_setup` variables untouched.
Add SQL and PHP runner files that seed the new `wp_setup` variables only when missing. Do not change database schema.
</action>
<verify>Run `php -l _rejestracja/core/class/RegistrationFormSettings.class.php` and `php -l _rejestracja/sql/apply-2026-04-24-registration-form-settings.php`.</verify>
<done>AC-2, AC-3, and AC-4 have a shared source of truth and deployment defaults.</done>
</task>
<task type="auto">
<name>Task 2: Build Admin Form Settings Page</name>
<files>_rejestracja/Admin/controller/FormSettingsController.php, _rejestracja/Admin/template/partial/FormSettings/Index.tpl, _rejestracja/Admin/controller/DictionaryController.php, _rejestracja/Admin/controller/SetupController.php</files>
<action>
Add `FormSettingsController` with `IndexAction` and a `preDispatch` matching the existing admin controller style.
- On GET, load settings through `RegistrationFormSettings` and assign them to Smarty.
- On POST, validate required numeric fields with the existing `Validator` style where practical, save through the helper, and show an admin info/error message without redirect loops.
- Template should group fields into participation days, main prices, surcharge prices, one-day prices, and VAT multiplier.
- Update the local admin menu arrays in `DictionaryController`, `SetupController`, and the new controller to include `Ustawienia formularza` => `FormSettings`/`Index`.
- Keep existing Dictionary and Setup behavior unchanged.
</action>
<verify>Run `php -l _rejestracja/Admin/controller/FormSettingsController.php` and inspect the generated route URL from the same `Router::GenerateUrl('dictpig', ...)` pattern used by Dictionary/Setup.</verify>
<done>AC-1, AC-2, and AC-3 are satisfied from the administrator side.</done>
</task>
<task type="auto">
<name>Task 3: Use Settings in Public Form and Submit Pricing</name>
<files>_rejestracja/controller/IndexController.php, _rejestracja/template/partial/Index/Index.tpl</files>
<action>
Replace hardcoded form settings with data from `RegistrationFormSettings`.
- In `IndexController::IndexAction`, load settings once and assign JSON-safe arrays for `days_lodging`, `days_no_lodging`, `prices`, and `vat_multiplier`.
- Replace hardcoded day radio labels in `Index.tpl` with Smarty loops over configured day arrays, keeping `name="participation_days"` and existing option visibility behavior.
- Replace hardcoded JS one-day prices `1300/1600` and gross values `1599/1968` with the configured net prices and VAT multiplier; gross should be computed from net * VAT multiplier.
- Update server-side `$resultPrice` calculation so conference fee `5` uses configured one-day promotional/normal price instead of relying on `mf_parameters` ID 5 when the selected `participation_option` is `one_day_lodging` or `one_day_no_lodging`.
- Keep existing `mf_parameters` behavior for full conference and surcharges so saved registrations/admin summaries continue to resolve existing parameter rows.
- Preserve legacy fallback for missing POST values and for old session/display data.
</action>
<verify>Run `php -l _rejestracja/controller/IndexController.php`, then manually inspect the rendered Smarty syntax for valid `{foreach}` blocks and JavaScript object output.</verify>
<done>AC-2 and AC-3 are satisfied from the public form through persisted participant price.</done>
</task>
</tasks>
<boundaries>
## DO NOT CHANGE
- Existing `mf_participant` schema and participant status/payment semantics.
- Existing dictionary phrase keys created in Phase 2.
- Existing public form field names: `participation_days`, `participation_option`, `one_day_lodging`, `conference_fee`, and surcharge checkbox names.
- Existing Dictionary and Setup edit flows beyond adding the new menu link.
## SCOPE LIMITS
- Do not redesign the admin UI; follow the current table/dropdown container style.
- Do not replace the legacy `mf_parameters` calculator module; expose the relevant rows in the new settings page and keep compatibility.
- Do not add new third-party dependencies.
- Do not alter compiled Smarty cache files under `temp/compile`.
</boundaries>
<verification>
Before declaring plan complete:
- [ ] `php -l _rejestracja/core/class/RegistrationFormSettings.class.php`
- [ ] `php -l _rejestracja/Admin/controller/FormSettingsController.php`
- [ ] `php -l _rejestracja/controller/IndexController.php`
- [ ] `php -l _rejestracja/sql/apply-2026-04-24-registration-form-settings.php`
- [ ] Confirm no hardcoded `3 listopada`, `4 listopada`, `5 listopada`, `3/4 listopada`, `4/5 listopada`, `1300`, `1600`, `1599`, or `1968` remain in active registration form pricing code except as migration/default seed values.
- [ ] Confirm the admin menu in Dictionary, Setup, and FormSettings includes the new "Ustawienia formularza" entry.
</verification>
<success_criteria>
- Administrators can open `/_rejestracja/Admin/FormSettings/Index`.
- The new page edits configured day options and all prices used by the current public registration calculation.
- Public JS price preview and server-side saved price use the same configured values.
- Deployment seed is idempotent and does not overwrite production edits.
- All verification checks pass.
</success_criteria>
<output>
After completion, create `.paul/phases/03-registration-form-settings/03-01-SUMMARY.md`
</output>