Skip to content

fix: accompanying opportunity creation — required field validation and submission bugs #698

@nadavosa

Description

@nadavosa

Problem

When an agent creates a new opportunity with type Accompanying, the accompanying details section has no required field validation. The schema marks all fields as optional, so the form can be submitted with empty critical fields, sending null values to the BE.

Affected file

src/components/Dashboard/Profile/sections/AccompanyingDetails/accompanyingDetailsSchema.ts

Bugs to fix

  1. No required validation on key fieldsappointmentAddress, appointmentPostcode, appointmentDate, appointmentTime, refugeeName are all .optional() in the schema. For accompanying type these should be required (or at minimum address + date).
  2. accompanyingDetailsSchema is shared between the creation form (NewOpportunity) and the profile edit section (AccompanyingDetails). The creation form should enforce stricter validation than the edit form (where partial saves are acceptable). Consider a separate schema or a stricter variant for creation.

Expected behaviour

When opportunity type is Accompanying and the agent clicks Create, form submission should be blocked until the required accompanying fields are filled in, with inline error messages shown.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions