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

    {% block head_title %}建物エリア{% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'search/css/style.css' %}">
    {% endblock %}

    {% block page_top %}{% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}【建物エリア検索】{% endblock %}

    {% block contents %}
        <div id="search-conditions-form">
            <form action="" method="post" enctype="multipart/form-data" v-on:submit="submit($event)">
                {% csrf_token %}
                <div class="form-group row">
                    <div class="col col-2 col-form-label"><label class="float-right">エリア</label></div>
                    <div class="col-10 form-inline">
                        {{ form.pref }}
                        &nbsp;
                        {{ form.city }}
                        &nbsp;
                        {{ form.area }}
                        &nbsp;
                        <input type="submit" value="検索" class="btn d-block d-flex align-items-center btn-primary">
                        &nbsp;
                        <input type="submit" value="クリア" v-on:click="clearConditions($event)" class="btn d-block d-flex align-items-center btn-secondary">
                    </div>
                </div>
            </form>
        </div>

        {% if is_searched %}
        {% if buildings %}<div class="total-count">全 {{ buildings|length }} 件</div>{% endif %}
        {% include 'search/includes/building_list.html' %}
        {% else %}
         <div class="search-message">
            <p>市区町村または地域を選択して、検索を実行してください。</p>
         </div>
        {% endif %}

    {% endblock %}

    {% block footer %}{% endblock %}

    {% block page_bottom %}
        <script type="text/javascript" src="{% static 'search/js/search_area.js' %}"></script>
        <script type="text/javascript">
            var searchApp = createSearchAreaVue(
                "{{ api_key }}",
                "{{ default_pref_id | default_if_none:'' }}"
            );
        </script>
    {% endblock %}
