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

    {% block head_title %}{{ target_user.full_name }} ユーザ詳細{% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'users/css/style.css' %}">
    {% endblock %}

    {% block page_top %}{% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}【ユーザ情報】 {{ target_user.full_name }}{% endblock %}

    {% block contents %}
        <div id="user-form">
        {% if back_url %}
            <form action="{% url 'users_user' target_user.idb64 %}?back_url={{ escaped_back_url }}" method="post" enctype="multipart/form-data">
        {% else %}
            <form action="{% url 'users_user' target_user.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-form-label"><label class="float-right">{{form.username.label}}</label></div>
                    <div class="col col-9">{{ form.username }}</div>
                </div>
                <div class="form-group row">
                    <div class="col-3 col-form-label"><label class="float-right">{{form.password.label}}</label></div>
                    <div class="col-7">{{ form.password }}</div>
                    <div class="col col-2 border-primary col-form-label">
                            <a href="{% url 'users_user_change_password' target_user.idb64 %}" class="btn btn-outline-primary">変更</a>
                    </div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label"><label class="float-right">{{form.last_name.label}}</label></div>
                    <div class="col col-9">{{ form.last_name }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label"><label class="float-right">{{form.first_name.label}}</label></div>
                    <div class="col col-9">{{ form.first_name }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label"><label class="float-right">{{form.email.label}}</label></div>
                    <div class="col col-9">{{ form.email }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label"><label class="float-right">有効化</label></div>
                    <div class="col col-3 col-form-label text-center">
                        {{ form.is_active }}<label class="form-check-label">{{form.is_active.label}}</label>
                    </div>
                    <div class="col col-3 col-form-label text-center">
                        {{ form.is_company_admin }}<label class="form-check-label">{{form.is_company_admin.label}}</label>
                    </div>
                    <div class="col col-3"></div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label"><label class="float-right">{{form.staff.label}}</label></div>
                    <div class="col col-9">{{ form.staff }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label"><label class="float-right">最終ログイン</label></div>
                    <div class="col col-9 col-form-label">{{ target_user.last_login }}</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 %}
