{% from "fragments/_chips.html" import chip, needs_review_chip %}
{# The speaker's profile fields (#159, #246, #383): aggregate provenance chip,
3-column grid (ROLE / ORGANIZATION / LINKS), inline edit per field. Saves
submit per-field via htmx; clearing is done by blanking the input and saving.
Included by profile.html and ALSO rendered out-of-band (profile_oob=true) by
the research-decision response, so an accepted claim shows up here without a
reload. Archived speakers render read-only (no forms). #}
Profile
{% if profile.values()|list %}
{% set has_accepted = profile.values()|selectattr("provenance", "eq", "enrichment")|list %}
{{ chip("completed" if has_accepted else "unknown") }}
{% if has_accepted %}Filled in by web research{% else %}Entered by hand{% endif %} — edit anything
{% endif %}
{% if profile_error %}
{{ profile_error }}
{% endif %}
hideshow
{% for field in profile_fields %}
{% set row = profile.get(field) %}
{% set col_label = {"bio": "ROLE", "affiliation": "ORGANIZATION", "link": "LINKS"} %}
{{ col_label.get(field, field|upper) }}
{% if archived or not shell.can_write %}
{% if row %}
{% if field == "link" and (row.value.startswith("https://") or row.value.startswith("http://")) %}
{{ row.value }}
{% else %}{{ row.value }}{% endif %}
{% else %}
not set
{% endif %}
{% else %}
{% endif %}