{% 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="row py-1 justify-content-center">
                    <div class="col col-1"></div>
                    <div class="col col-auto col-form-label text-end"><label>建物名称</label></div>
                    <div class="col container-fluid">{{ form.building_name }}</div>
                    <div class="col col-1"></div>
                </div>
                <div class="row py-1 justify-content-center">
                    <div class="col-auto">
                        <input type="submit" value="検索" class="btn btn-primary">
                    </div>
                    <div class="col-auto">
                        <input type="submit" value="クリア" v-on:click="clearConditions($event)" class="btn btn-secondary">
                    </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 %}
