{% extends 'vacancy_mgr/base.html' %}
{% load static %}
{% load humanize %}

    {% block head_title %}{% if all_users %}全{% endif %}ユーザ一覧{% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'users/css/style.css' %}">
    {% endblock %}

    {% block page_top %}{% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}【{% if all_users %}全{% endif %}ユーザ一覧】{% endblock %}

    {% block contents %}
        <div  id="user-list-header">
            <div class="row">
                <div id="link-add-user" class="col col-6 text-left">
                    <a href="{% url 'users_create_user' %}">ユーザ追加</a>
                </div>
                <div id="link-change-list" class="col col-6 text-right">
                {% if all_users %}
                    <a href="{% url 'users_user_list' %}">ユーザ一覧</a>
                {% else %}
                    <a href="{% url 'users_all_user_list' %}">全ユーザ一覧</a>
                {% endif %}
                </div>
            </div>
        </div>
        <div id="user-list">
        {% if users %}
            <div class="row">
                <div class="col col-3 text-center">ユーザ名</div>
                <div class="col col-3 text-center">氏名</div>
                <div class="col col-1 text-center">管理者</div>
                <div class="col col-1 text-center">有効</div>
                <div class="col col-4 text-center">スタッフ</div>
            </div>
            {% for item in users %}
            <div class="row">
                <div class="col col-3"><a href="{% url 'users_user' item.idb64 %}" target="_blank">{{ item.username }}</a></div>
                <div class="col col-3">{{ item.full_name }}</div>
                <div class="col col-1 text-center">{% if item.is_company_admin %}〇{% else %}－{% endif %}</div>
                <div class="col col-1 text-center">{% if item.is_active %}〇{% else %}×{% endif %}</div>
                <div class="col col-4">
                {% if item.staff_id %}
                    <a href="{% url 'company_staff' item.staff.idb64 %}" target="_blank">
                        {{ item.staff }} ({{ item.staff.department }})
                    </a>
                {% endif %}
                </div>
            </div>
            {% endfor %}
        {% else %}
            <div class="row">
                <div class="col col-12 text-center">該当するユーザはありません。</div>
            </div>
        {% endif %}
        </div>
    {% endblock %}

    {% block footer %}{% endblock %}

    {% block page_bottom %}{% endblock %}
