{% extends 'base.html' %}
{% load static %}
{% block content %}
{% include 'profile/header.html' %}
{% include 'profile/drawer.html' %}

<br />
<br />
<br />
<br />

<div class="container mt-4">
    <h2 class="mb-4 text-center">لیست اعضای شورا</h2> 
    {% include 'profile/message.html' %}
    
    <a href="{% url 'council_members_create' %}" class="btn btn-success mb-3 animate__animated animate__bounce animate__repeat-2">افزودن عضو جدید</a>
 
    <div class="table-responsive animate__animated animate__delay-0.1s animate__fadeIn">
        <table class="table table-bordered bg-light text-center">
            <thead class="bg-light-dark text-dark">
                <tr>
                    <th>ردیف</th>
                    <th>عکس</th>
                    <th>فرد</th>
                    <th>رسته</th>
                    <th>عملیات</th>
                </tr>
            </thead>
            <tbody>
                {% for member in members %}
                <tr>
                    <td class="text-center align-middle">{{ forloop.counter }}</td>
                    <td class="text-center align-middle">{% if member.person.person_private_info.pic %}
                        <img src="{{ member.person.person_private_info.pic.url }}" alt="تصویر " width="60" height="60" class="rounded-circle" />
                    {% else %}
                    <img src="{% static 'media\users\default_profile.png' %}" alt="بدون تصویر" width="60" height="60" class="rounded-circle"/>
                    {% endif %} </td>
                    <td class="text-center align-middle">{{ member }}</td>
                    <td class="text-center align-middle">
                        {% if member.person_cultural %}
                            {{ member.person_cultural.raste_categories }}
                        {% else %}
                            هیچ رسته‌ای تعیین نشده
                        {% endif %}
                    </td>
                                        <td class="text-center align-middle">
                        <div class="text-center d-flex justify-content-center">
                           
                            <a href="{% url 'update2' member.pk %}" class="text-warning mx-1" title="ویرایش">
                                <i class="fas fa-edit"></i>
                            </a>
                           
                        </div>
                    </td>
                </tr>
                {% empty %}
                <tr>
                    <td colspan="4" class="text-center">هیچ عضوی یافت نشد.</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>

{% endblock %}
