{% extends "base.html" %} {% block title %}{{ bill.bill_type|upper }} {{ bill.bill_number }} — Concord{% endblock %} {% block content %} {# Long sections (cosponsors, votes, actions, subjects, titles) start as a preview of the first N items and expand the remainder on click. The preview/expand structure is shared via show_more_list (below); each call supplies the per-item markup as its {% call(item) %} body. #} {%- macro cosponsor_li(c) -%}
  • {% if c.sponsorship_withdrawn_date %} {% if c.display_name %} {{ c.display_name }} {% else %} {{ c.bioguide_id }} {% endif %} (withdrawn {{ c.sponsorship_withdrawn_date }}) {% else %} {% if c.display_name %} {{ c.display_name }} {% else %} {{ c.bioguide_id }} (not indexed) {% endif %} {% if c.is_original_cosponsor %} · original {% elif c.sponsorship_date %} · joined {{ c.sponsorship_date }} {% endif %} {% endif %}
  • {%- endmacro -%} {%- macro title_li(t) -%}
  • {{ t.title_type }}{% if t.chamber %} · {{ t.chamber }}{% endif %}
    {{ t.title_text }}
  • {%- endmacro -%} {%- macro empty_state(label) -%}
    {{ label }}
    {%- endmacro -%} {%- macro show_more(label) -%} {{ label }} {%- endmacro -%} {# Render ``items`` as a preview of the first ``preview`` entries, with the remainder behind a
    . ``caller(item)`` renders one entry, so the preview and the expanded remainder render identically. #} {%- macro show_more_list(items, preview, noun, wrapper_class="space-y-1", tag="ul") -%} <{{ tag }} class="{{ wrapper_class }}"> {% for item in items[:preview] %}{{ caller(item) }}{% endfor %} {% if items|length > preview %}
    {{ show_more("Show all %d %s"|format(items|length, noun)) }} <{{ tag }} class="{{ wrapper_class }} mt-1"> {% for item in items[preview:] %}{{ caller(item) }}{% endfor %}
    {% endif %} {%- endmacro -%} {# Compute the most recent fetched_at across tier-1 + tier-2 sections. #} {%- set tier2_stamps = [bill.cosponsors_fetched_at, bill.actions_fetched_at, bill.subjects_fetched_at, bill.titles_fetched_at, bill.summaries_fetched_at] -%} {%- set updated_at = bill.fetched_at -%} {%- for stamp in tier2_stamps -%} {%- if stamp and stamp > updated_at -%}{%- set updated_at = stamp -%}{%- endif -%} {%- endfor -%} {%- set any_missing = (bill.cosponsors_fetched_at is none or bill.actions_fetched_at is none or bill.subjects_fetched_at is none or bill.titles_fetched_at is none or bill.summaries_fetched_at is none) -%}
    {{ bill.bill_type|upper }} {{ bill.bill_number }} · {{ bill.congress|ordinal }} Congress

    {{ bill.title }}

    {# -- Data completeness --------------------------------------------- #} {% if enrichment_enabled and enrichment_state %}
    {% include "bills/" + enrichment_state + ".html" %}
    {% elif any_missing %} {# No on-demand enrichment available here, but sections are empty: explain why rather than leaving silent dashed boxes below. #}
    Some sections below haven't been fetched from Congress.gov yet. {% include "bills/_why_enrichment.html" %}
    {% endif %} {# -- Brief (synthesized summary — the headline glance) ------------- #} {% if brief_enabled %} {% include "bills/_brief.html" %} {% endif %} {# -- Latest action (current status) ------------------------------- #} {% if bill.latest_action_date or bill.latest_action_text %}

    Latest action

    {% if bill.latest_action_date %} {{ bill.latest_action_date }} — {% endif %} {{ bill.latest_action_text or "—" }}

    {% endif %} {# -- Summaries (what the bill does) ------------------------------- #}

    Summaries

    {% if bill.summaries_fetched_at is none %} {{ empty_state("Summaries not yet fetched.") }} {% elif summaries %} {% set latest_index = summaries|length - 1 %}
    {% for s in summaries %}
    {{ s.action_desc or s.version_code }} {% if s.action_date %}· {{ s.action_date }}{% endif %}
    {{ s.summary_text|safe }}
    {% endfor %}

    Fetched {{ bill.summaries_fetched_at|humanize_age }}.

    {% else %}

    No summaries published.

    Fetched {{ bill.summaries_fetched_at|humanize_age }}.

    {% endif %}
    {# -- Sponsor ------------------------------------------------------- #}

    Sponsor

    {% if bill.sponsor_bioguide_id %} {% if bill.sponsor_display_name %} {{ bill.sponsor_display_name }} {% else %} Bioguide {{ bill.sponsor_bioguide_id }} (not indexed) {% endif %} {% else %} No sponsor recorded. {% endif %}
    {# -- Cosponsors ---------------------------------------------------- #}

    Cosponsors

    {% if bill.cosponsors_fetched_at is none %} {{ empty_state("Cosponsors not yet fetched.") }} {% elif cosponsors %} {% call(c) show_more_list(cosponsors, 8, "cosponsors") %}{{ cosponsor_li(c) }}{% endcall %}

    Fetched {{ bill.cosponsors_fetched_at|humanize_age }}.

    {% else %}

    No cosponsors recorded.

    Fetched {{ bill.cosponsors_fetched_at|humanize_age }}.

    {% endif %}
    {# -- Vote history -------------------------------------------------- #}

    Vote history

    {% if vote_history %} {% call(v) show_more_list(vote_history, 5, "votes", "space-y-2") %}{% include "_vote_row.html" %}{% endcall %} {% else %}

    No votes recorded for this bill yet.

    {% endif %}
    {# -- Action history ----------------------------------------------- #}

    Action history

    {% if bill.actions_fetched_at is none %} {{ empty_state("Action history not yet fetched.") }} {% elif actions %} {% call(action) show_more_list(actions, 8, "actions", "") %}{% include "bills/_action_row.html" %}{% endcall %}

    Fetched {{ bill.actions_fetched_at|humanize_age }}.

    {% else %}

    No actions recorded.

    Fetched {{ bill.actions_fetched_at|humanize_age }}.

    {% endif %}
    {# -- Subjects ----------------------------------------------------- #}

    Subjects

    {% if bill.subjects_fetched_at is none %} {{ empty_state("Subjects not yet fetched.") }} {% elif subjects %} {% call(s) show_more_list(subjects, 18, "subjects", "flex flex-wrap gap-1", "div") -%} {{ s }} {%- endcall %}

    Fetched {{ bill.subjects_fetched_at|humanize_age }}.

    {% else %}

    No subjects assigned.

    Fetched {{ bill.subjects_fetched_at|humanize_age }}.

    {% endif %}
    {# -- Titles ------------------------------------------------------- #}

    Titles

    {% if bill.titles_fetched_at is none %} {{ empty_state("Titles not yet fetched.") }} {% elif titles %} {% call(t) show_more_list(titles, 4, "titles", "space-y-2") %}{{ title_li(t) }}{% endcall %}

    Fetched {{ bill.titles_fetched_at|humanize_age }}.

    {% else %}

    No titles recorded.

    Fetched {{ bill.titles_fetched_at|humanize_age }}.

    {% endif %}
    {% endblock %}