Build ProxyRegistrationScreen scaffold and form state
epic-coordinator-proxy-registration-core-task-006 — Create the ProxyRegistrationScreen StatefulWidget with form fields for activity type, date, start time, duration, and notes. Integrate MentorSingleSelectWidget (from foundation epic) for mentor selection. Implement FormState management via a dedicated ProxyRegistrationFormCubit that holds field values and tracks dirty/validation state.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 2 - 518 tasks
Can start after Tier 1 completes
Implementation Notes
Use `Cubit
Duration selector: use a `DropdownButtonFormField
Testing Requirements
Widget tests in `test/widget/proxy_registration_screen_test.dart`. Test cases: (1) all form fields render with correct defaults (30min, today), (2) submitting with empty required fields shows inline validation errors, (3) filling all required fields and submitting does not show errors, (4) cubit emits dirty state after first field interaction, (5) back navigation with dirty state shows discard dialog, (6) back navigation with clean state navigates without dialog. Use `BlocProvider` / `ProviderScope` to inject fake cubit. Also add cubit unit tests in `test/unit/proxy_registration_form_cubit_test.dart` covering state transitions for each field update and validation logic.
The 2-hour window duplicate detection logic requires querying existing proxy records with compound key matching (mentor + date + activity type within time range). If the query is too broad it produces false positives that frustrate coordinators; if too narrow it misses genuine duplicates that corrupt Bufdir data.
Mitigation & Contingency
Mitigation: Define the duplicate detection window as a configurable parameter from the start. Prototype the Supabase query with representative data covering edge cases (midnight boundaries, different activity types same day, same activity type different mentors) before finalising the implementation.
Contingency: If the detection produces excessive false positives in UAT, allow coordinators to explicitly acknowledge and bypass the duplicate warning with a reason field, preserving safety while reducing friction.
If the proxy registration form does not clearly distinguish between the acting coordinator and the attributed mentor, coordinators may submit records attributing activities to themselves, causing inaccurate Bufdir reporting and potential funding issues.
Mitigation & Contingency
Mitigation: Conduct UAT with at least one real coordinator via TestFlight before release. Use distinct visual treatment (different card colours, explicit 'Registering on behalf of:' label) and require the confirmation screen to show both identities prominently.
Contingency: Add a mandatory confirmation checkbox on the confirmation screen that explicitly names the attributed mentor, preventing accidental self-attribution from slipping through.
Coordinators with multi-chapter access must select an active chapter context before the mentor list is filtered correctly. If chapter scope resolution fails or is bypassed, cross-org proxy registrations could occur, violating data isolation between chapters.
Mitigation & Contingency
Mitigation: Reuse the existing active-chapter-state and hierarchy-service components established by the org hierarchy feature. Add a guard that blocks entry to the proxy flow if no chapter context is active, prompting chapter selection first.
Contingency: If the chapter resolution service is unavailable, default to the most restrictive scope (no mentors visible) and surface a clear error message rather than showing an unfiltered mentor list.