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

    {% block head_title %}建物名称検索：{{ company.company_name | default_if_none:'' }}{% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'building/css/style.css' %}">
    {% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}建物名称検索{% endblock %}

    {% block contents %}
        <div id="search-conditions-form">
            <form action="" method="post" enctype="multipart/form-data">
                {% csrf_token %}
                <div class="form-group row">
                    <div class="col col-2 col-form-label"><label class="float-right">建物名称</label></div>
                    <div class="col-8">{{ form.building_name }}</div>
                    <div class="col-2"></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">
                        <input type="submit" value="クリア" v-on:click="clearConditions($event)" class="btn d-block mx-auto d-flex align-items-center btn-secondary">
                    </div>
                    <div class="col-2"></div>
                </div>
            </form>
        </div>

        {% if is_searched %}
        <div id="building-list">
        {% if buildings|length > 0 %}
            {% include 'building/includes/search_name_pagination.html' %}
            {% include 'building/includes/building_list.html' %}
            {% include 'building/includes/search_name_pagination.html' %}
        {% else %}
            <p class="no-buildings">該当する建物がありません。</p>
        {% endif %}
        </div>
        {% endif %}
    {% endblock %}

    {% block footer %}
        <script type="text/javascript" src="{% static 'building/js/search_name.js' %}"></script>
        <script type="text/javascript">
            var searchApp = createSearchNameVue(
                "{{ default_building_name | default_if_none:'' }}"
            );
        </script>
    {% endblock %}
