{# Partial: series cases list. Expects `series` and `can_edit` in context. Returns the <ul> that is inserted into #cases-list. #}
<ul class="list-group list-group-flush">
    {% for case in series.case.all %}
        <li id="case-link-{{ case.pk }}" class="list-group-item d-flex justify-content-between align-items-center case-item">
            <a href="{% url 'atlas:case_detail' pk=case.pk %}">{{case}}</a>
            {% if can_edit %}
                <button hx-post="{% url 'atlas:remove_series_from_case' series.pk case.pk %}"
                        hx-target="#cases-list"
                        hx-swap="innerHTML"
                        hx-confirm="Are you sure you want to remove this series from the case?"
                        class="btn btn-link btn-sm text-danger remove-button">Remove</button>
            {% endif %}
        </li>
    {% empty %}
        <li class="list-group-item">This series is not associated with any cases.</li>
    {% endfor %}
</ul>
