<div class="self-review-actions mb-3 js-self-review-panel" data-refresh-key="{{ panel_key|default:'default' }}">
    <div class="btn-group btn-group-sm mb-2" role="group" aria-label="Self review actions">
        <a class="btn btn-primary" href="{% url 'atlas:add_self_review' cid_user_exam.id case.id %}">
            <i class="bi bi-card-checklist"></i> Add Self Review
        </a>
        <button type="button"
                class="btn btn-outline-info"
                onclick="openSelfReviewPopup('{% url 'atlas:add_self_review' cid_user_exam.id case.id %}')">
            Popup
        </button>
        <button type="button"
                class="btn btn-outline-secondary"
                onclick="openSelfReviewSidebar('{% url 'atlas:add_self_review' cid_user_exam.id case.id %}')">
            Sidebar
        </button>
    </div>

    {% if self_review %}
        <h4>Self Feedback</h4>
        <div class="list-group">
            {% for review in self_review %}
                <div class="list-group-item">
                    <div class="d-flex justify-content-between align-items-start mb-2">
                        <div class="small text-muted">
                            Updated: {{ review.review_update_date|date:"Y-m-d H:i" }}
                        </div>
                        <div class="d-flex flex-wrap gap-1" role="group" aria-label="Self review actions">
                            <a class="btn btn-outline-primary btn-sm"
                               href="{% url 'atlas:self_review_detail' cid_user_exam.id case.id review.id %}">
                                View
                            </a>
                            <button type="button" class="btn btn-outline-info btn-sm"
                                    onclick="openSelfReviewPopup('{% url 'atlas:self_review_detail' cid_user_exam.id case.id review.id %}')">
                                View popup
                            </button>
                            <button type="button" class="btn btn-outline-secondary btn-sm"
                                    onclick="openSelfReviewSidebar('{% url 'atlas:self_review_detail' cid_user_exam.id case.id review.id %}')">
                                View sidebar
                            </button>
                            <a class="btn btn-outline-warning btn-sm"
                               href="{% url 'atlas:self_review_update' cid_user_exam.id case.id review.id %}">
                                Edit
                            </a>
                            <button type="button" class="btn btn-outline-warning btn-sm"
                                    onclick="openSelfReviewPopup('{% url 'atlas:self_review_update' cid_user_exam.id case.id review.id %}')">
                                Edit popup
                            </button>
                            <button type="button" class="btn btn-outline-warning btn-sm"
                                    onclick="openSelfReviewSidebar('{% url 'atlas:self_review_update' cid_user_exam.id case.id review.id %}')">
                                Edit sidebar
                            </button>
                        </div>
                    </div>

                    <div class="small mb-1">
                        <strong>Findings:</strong>
                        <span class="badge bg-info-subtle text-info-emphasis">{{ review.findings|default:"-" }}/5</span>
                    </div>
                    <div class="small mb-2">
                        <strong>Interpretation:</strong>
                        <span class="badge bg-warning-subtle text-warning-emphasis">{{ review.interpretation|default:"-" }}/5</span>
                    </div>
                    {% if review.comments %}
                        <div class="small text-body-secondary">{{ review.comments|linebreaksbr }}</div>
                    {% else %}
                        <div class="small text-muted">No comments added.</div>
                    {% endif %}
                </div>
            {% endfor %}
        </div>
    {% endif %}
</div>