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

    {% block head_title %}スタッフ情報 {{staff.full_name}}{% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'company/css/style.css' %}">
    {% endblock %}

    {% block page_top %}{% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}【スタッフ情報】 {{ staff.full_name }}{% endblock %}

    {% block contents %}
        <div id="data-form">
        {% if back_url %}
            <form action="{% url 'company_staff' staff.idb64 %}?back_url={{ escaped_back_url }}" method="post" enctype="multipart/form-data">
        {% else %}
            <form action="{% url 'company_staff' staff.idb64 %}" method="post" enctype="multipart/form-data">
        {% endif %}
                {% csrf_token %}
                {% if form.errors %}
                    {% for field in form %}
                        {% for error in field.errors %}
                            <p>*&nbsp;{{ field.label }} : {{ error }}</p>
                        {% endfor %}
                     {% endfor %}
                {% endif %}
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">スタッフID</label></div>
                    <div class="col col-9 col-md-10 col-form-label">{{ staff.id }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.last_name.label}}</label></div>
                    <div class="col col-3 col-md-4">{{ form.last_name }}</div>
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.first_name.label}}</label></div>
                    <div class="col col-3 col-md-4">{{ form.first_name }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.post_name.label}}</label></div>
                    <div class="col col-3 col-md-4">{{ form.post_name }}</div>
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.vacancy_name.label}}</label></div>
                    <div class="col col-3 col-md-4">{{ form.vacancy_name }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{ form.priority.label }}</label></div>
                    <div class="col col-3 col-md-3">{{ form.priority }}</div>
                    <div class="col col-6 col-md-7"></div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.department.label}}</label></div>
                    <div class="col col-9 col-md-10">{{ form.department }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.tel1.label}}</label></div>
                    <div class="col col-3 col-md-4">{{ form.tel1 }}</div>
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.tel2.label}}</label></div>
                    <div class="col col-3 col-md-4">{{ form.tel2 }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">{{form.mail.label}}</label></div>
                    <div class="col col-9 col-md-10">{{ form.mail }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">スタッフ属性</label></div>
                    <div class="col col-3 col-md-2 col-form-label text-center">{{ form.is_pm_staff }}<label class="form-check-label">{{form.is_pm_staff.label}}</label></div>
                    <div class="col col-3 col-md-2 col-form-label text-center">{{ form.is_publish_vacancy }}<label class="form-check-label">{{form.is_publish_vacancy.label}}</label></div>
                    <div class="col col-3 col-md-6"></div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">停止 / 削除</label></div>
                    <div class="col col-3 col-md-2 col-form-label text-center">{{ form.is_stopped }}<label class="form-check-label">{{form.is_stopped.label}}</label></div>
                    <div class="col col-3 col-md-2 col-form-label text-center">{{ form.is_deleted }}<label class="form-check-label">{{form.is_deleted.label}}</label></div>
                    <div class="col col-3 col-md-6"></div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">登録日時</label></div>
                    <div class="col col-9 col-md-4 col-form-label">{{ staff.created_at }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-md-2 col-form-label"><label class="float-right">関連ユーザ</label></div>
                    <div class="col col-9 col-md-4 col-form-label">
                    {% for staff_user in staff.users.all %}
                        <span class="staff_user"><a href="{% url 'users_user' staff_user.idb64 %}" target="_blank" rel="noopener noreferrer">{{ staff_user.full_name }}</a></span>
                    {% endfor %}
                    </div>
                </div>
                <div class="form-group row">
                    <div class="col-2"></div>
                    <div class="col-4">
                        <input type="submit" value="保存" class="btn d-block mx-auto d-flex align-items-center btn-primary">
                    </div>
                    <div class="col-4">
                    {% if back_url %}
                        <a href="{{ back_url }}" class="btn btn-secondary">戻る</a>
                    {% else %}
                        <input type="button" value="閉じる" onclick="window.close();" class="btn d-block mx-auto d-flex align-items-center btn-secondary">
                    {% endif %}
                    </div>
                    <div class="col-2"></div>
                </div>
            </form>
        </div>
    {% endblock %}

    {% block footer %}{% endblock %}

    {% block page_bottom %}{% endblock %}
