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

    {% block head_title %}{% if all_departments %}全{% endif %}部署一覧{% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'company/css/style.css' %}">
    {% endblock %}

    {% block page_top %}{% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}【{% if all_departments %}全{% endif %}部署一覧】{% endblock %}

    {% block contents %}
        <div  id="data-list-header">
            <div class="row">
                <div id="link-add-item" class="col col-6 text-left">
                    <a href="{% url 'company_create_department' %}">部署追加</a>
                </div>
                <div id="link-change-list" class="col col-6 text-right">
                {% if all_departments %}
                    <a href="{% url 'company_department_list' %}">部署一覧</a>
                {% else %}
                    <a href="{% url 'company_all_department_list' %}">全部署一覧</a>
                {% endif %}
                </div>
            </div>
        </div>
        <div id="data-list">
        {% if departments %}
            <div class="row">
                <div class="col col-6 text-center">部署名</div>
                <div class="col col-2 text-center">表示順</div>
                <div class="col col-2 text-center">情報公開</div>
                <div class="col col-1 text-center">停止</div>
                <div class="col col-1 text-center">削除</div>
            </div>
            {% for item in departments %}
            <div class="row">
                <div class="col col-6"><a href="{% url 'company_department' item.idb64 %}" target="_blank" rel="noopener noreferrer">{{ item.department_name }}</a></div>
                <div class="col col-2 text-center">{{ item.priority }}</div>
                <div class="col col-2 text-center">{% if item.is_publish_vacancy %}○{% else %}－{% endif %}</div>
                <div class="col col-1 text-center">{% if item.is_stopped %}×{% else %}－{% endif %}</div>
                <div class="col col-1 text-center">{% if item.is_deleted %}×{% else %}－{% 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 %}
