
{% partialdef publish-results %}
    <div class="exam-status-container d-flex align-items-center gap-2">
        <div class="me-2 small text-muted">Results</div>
        <div>
            {% if exam.publish_results %}
                <button
                    class="btn btn-sm btn-success published-icon"
                    hx-post="{% url exam.get_app_name|add:':exam_toggle_results_published' exam.pk %}"
                    hx-swap="outerHTML"
                    hx-target="closest .exam-status-container"
                    title="Click to unpublish results"
                    aria-label="Unpublish results"
                    hx-disabled-elt="this"

                >Published</button>
                <span class="exam-loading ms-2 d-none"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></span>
            {% else %}
                <button
                    class="btn btn-sm btn-secondary published-icon"
                    hx-post="{% url exam.get_app_name|add:':exam_toggle_results_published' exam.pk %}"
                    hx-swap="outerHTML"
                    hx-target="closest .exam-status-container"
                    title="Click to publish results"
                    aria-label="Publish results"
                    hx-disabled-elt="this"
                >Unpublished</button>
                <span class="exam-loading ms-2 d-none"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></span>
            {% endif %}
        </div>
    </div>
{% endpartialdef publish-results %}


{% partialdef exam-active %}
    <div class="exam-status-container d-flex align-items-center gap-2">
        <div class="me-2 small text-muted">Exam status:</div>
        <div>
            {% if exam.active %}
                <button
                    class="btn btn-sm btn-success active-icon"
                    hx-post="{% url exam.get_app_name|add:':exam_toggle_active' exam.pk %}"
                    hx-swap="outerHTML"
                    hx-target="closest .exam-status-container"
                    title="Click to deactivate this exam"
                    aria-label="Deactivate exam"
                    hx-disabled-elt="this"
                >Active</button>
                <span class="exam-loading ms-2 d-none"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></span>
            {% else %}
                <button
                    class="btn btn-sm btn-secondary active-icon"
                    hx-post="{% url exam.get_app_name|add:':exam_toggle_active' exam.pk %}"
                    hx-swap="outerHTML"
                    hx-target="closest .exam-status-container"
                    title="Click to activate this exam"
                    aria-label="Activate exam"
                    hx-disabled-elt="this"
                >Inactive</button>
                <span class="exam-loading ms-2 d-none"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></span>
            {% endif %}
        </div>
    </div>
{% endpartialdef exam-active %}

{% partialdef exam-archived %}
    <div class="exam-status-container d-flex align-items-center gap-2">
        <div>
            {% if exam.archive %}
                <button
                    class="btn btn-sm btn-warning archived-icon"
                    hx-post="{% url exam.get_app_name|add:':exam_toggle_archived' exam.pk %}"
                    hx-swap="outerHTML"
                    hx-target="closest .exam-status-container"
                    title="Click to unarchive this exam"
                    aria-label="Unarchive exam"
                ><i class="bi bi-archive"></i></button>
                <span class="exam-loading ms-2 d-none"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></span>
            {% else %}
                <button
                    class="btn btn-sm btn-secondary archived-icon"
                    hx-post="{% url exam.get_app_name|add:':exam_toggle_archived' exam.pk %}"
                    hx-swap="outerHTML"
                    hx-target="closest .exam-status-container"
                    title="Click to archive this exam"
                    aria-label="Archive exam"
                ><i class="bi bi-archive"></i></button>
                <span class="exam-loading ms-2 d-none"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></span>
            {% endif %}
        </div>
    </div>
{% endpartialdef %}