Skip to content

Form status badge #41

@robinmolen

Description

@robinmolen

The current FormStatusBadge has a status property which dictates the content and styling of the badge. We need to add some logic that sets the correct status based on the form configuration. For this status calculation we need the form fields: active, activateOn, deactivateOn, maintenanceMode.

Depending on when the form status badge should be update, the status should be dictated using the Formik state or the form details present in the route loader. If we want instant status updated (without having to 'save' the form), we should use the Formik state, otherwise we can use the route loader data. (Decision should be made by designer)

Discussed with Lidwien: the form status should reflect the current form configuration; changing one of the previously mentioned fields immediately impacts the form status (without having to save the form in between). So we should use the Formik state to determine the form status.

The form status is determined using this logic:

Form field values Form status
maintenanceMode is true maintenance
active is true and deactivateOn is empty active
active is true and deactivateOn is a date in the future active
active is true and deactivateOn is a date in the past inactive
active is false and activateOn is empty inactive
active is false and activateOn is a date in the future scheduled
active is false and activateOn is a date in the past active
active is false and activateOn is a date in the past and deactivateOn is in the future active
active is false and activateOn is a date in the past and deactivateOn is in the past inactive

We have a couple options:

  • We add the logic to the FormStatusBadge component itself. The component accesses the Formik state or (if possible) the route loader data, and calculates the status.
  • We add a util function getFormState which takes the form configuration data as parameters. This might be easier if we need to use the route loader data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions