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

    {% block head_title %}建物パノラマ {{ data.panorama_type.name }} {{ data.building.building_name }} {% endblock %}
    {% block head %}
        <link rel="stylesheet" href="{% static 'property/css/style.css' %}">
        <link rel="stylesheet" href="{% static 'property/css/style_ids.css' %}">
    {% endblock %}

    {% block page_top %}{% endblock %}

    {% block header %}{% endblock %}

    {% block h1_title %}【建物パノラマ】{{ data.building.building_name }}{% endblock %}

    {% block contents %}
        <div id="data-form">
        {% if back_url %}
            <form action="{% url 'property_edit_building_panorama'  data.building.oid data.id %}?back_url={{ escaped_back_url }}" method="post" enctype="multipart/form-data">
        {% else %}
            <form action="{% url 'property_edit_building_panorama'  data.building.oid data.id %}" 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-2"></div>
                    <div class="col col-8 text-center">
                        <iframe width="600px" height="400px" allowfullscreen style="border-style:none;" src="/static/panorama/pannellum.htm#panorama=/viewer/public_media/buildings/{{ data.building.file_oid }}/panoramas/{{ data.file_name }}&autoLoad=true"></iframe>
                    </div>
                    <div class="col col-2"></div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 text-right"><label>ファイル名:</label></div>
                    <div class="col col-9 form-inline">{{ data.file_name }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label text-right"><label>種別:</label></div>
                    <div class="col col-9 form-inline">{{ form.panorama_type }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label text-right"><label>優先順:</label></div>
                    <div class="col col-9 form-inline">{{ form.priority }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label text-right"><label>コメント:</label></div>
                    <div class="col col-9 form-inline">{{ form.comment }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label text-right"><label>備考:</label></div>
                    <div class="col col-9 form-inline">{{ form.note }}</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label text-right"><label>空室情報:</label></div>
                    <div class="col col-1"></div>
                    <div class="col col-8 form-inline">{{ form.is_publish_vacancy }} 公開</div>
                </div>
                <div class="form-group row">
                    <div class="col col-3 col-form-label text-right"><label>WEB:</label></div>
                    <div class="col col-1"></div>
                    <div class="col col-8 form-inline">{{ form.is_publish_web }} 公開</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 %}
                        <a href="{% url 'property_building' data.building.oid %}?page=pictures_page#panorama-anchor" class="btn btn-secondary">戻る</a>
                    {% endif %}
                    </div>
                    <div class="col-2"></div>
                </div>
            </form>
        </div>
    {% endblock %}

    {% block footer %}{% endblock %}

    {% block page_bottom %}{% endblock %}
