{% load character_extras %}
{% load django_bootstrap5 %}
<div id="paths-and-capabilities">
    <h2>Voies & Capacités <span class="badge text-bg-{% if character.capability_points_remaining > 0 %}success{% elif character.capability_points_remaining == 0 %}secondary{% else %}danger{% endif %} rounded-pill">{{ character.capability_points_remaining }}</span></h2>
    {% if character|managed_by:user %}
        <form>
            {% csrf_token %}
            <div class="row">
                <div class="col">
                    {% bootstrap_form_errors add_path_form %}
                    <div class="input-group">
                        {{ add_path_form.character_path }}
                        {{ add_path_form.other_path }}
                        <button class="btn btn-primary"
                                hx-target="#paths-and-capabilities"
                                hx-swap="outerHTML"
                                hx-post="{% url "character:add_path" pk=character.pk %}">
                            Sélectionner
                        </button>
                    </div>
                </div>
            </div>
        </form>
    {% endif %}
    <div class="row mt-2 gy-3">
        {% for path, character_capabilities in character.get_capabilities_by_path.items %}
            {% include "character/snippets/character_details/path.html" %}
        {% endfor %}
    </div>
</div>
