PhoenixKitProjects.Web.Components.WorkflowStatusFields (PhoenixKitProjects v0.10.0)

Copy Markdown View Source

The shared "Workflow status" form section (V125), reused by every form that edits a project-like record: ProjectFormLive, TemplateFormLive, and AssignmentFormLive's sub-project mode. A sub-project and a template are both projects, so they get the same status-source picker a project has.

The component renders the section; the module's plain functions (available?/0, entity_options/0, preview_for/1, mode_string/1, apply_mode/3, selected_entity_uuid/1) are the shared logic so each LV's mount/validate/save stays a thin delegation. The "Generate default" button emits generate_default_statuses — each LV owns that handler (it knows which form to update).

Summary

Functions

Folds the translated-titles 3-way choice into the settings JSONB on attrs, preserving the record's other settings. "" removes the per-record override (inherit the global default).

True when the optional entities module backs the status feature.

Grouped status-source entity options for the <.select>.

The 3-way translated-titles control value ("true"/"false"/"") for a record.

The status rows the given entity (nil = shared default) would supply.

The status_entity_uuid currently in the form (nil = shared default).

Functions

apply_mode(attrs, params, record)

Folds the translated-titles 3-way choice into the settings JSONB on attrs, preserving the record's other settings. "" removes the per-record override (inherit the global default).

available?()

True when the optional entities module backs the status feature.

entity_options()

Grouped status-source entity options for the <.select>.

mode_string(record)

The 3-way translated-titles control value ("true"/"false"/"") for a record.

preview_for(uuid)

The status rows the given entity (nil = shared default) would supply.

selected_entity_uuid(field)

The status_entity_uuid currently in the form (nil = shared default).

workflow_status_fields(assigns)

Attributes

  • statuses_available (:boolean) - Defaults to false.
  • field (:any) (required) - the status_entity_uuid form field.
  • status_entities (:list) - Defaults to [].
  • status_preview (:list) - Defaults to [].
  • status_translation_mode (:string) - Defaults to "".
  • locked (:boolean) - true once the project has started — its statuses were cemented at start (started_at is the freeze boundary), so the source can no longer change. Defaults to false.