{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
{% load widget_tweaks %}

{% block title %}Venue | {{ object.name }}{% endblock %}

{% block content %}
    <div class="row">
        {% if not request.is_ajax %}
            <div class="col-sm-12">
                <h1>Venue | {{ object.name }}</h1>
            </div>

            <div class="col-sm-12 text-right">
                <div class="btn-group btn-page">
                    <a href="{% url 'venue_update' object.pk %}" class="btn btn-default"><span
                        class="glyphicon glyphicon-pencil"></span> Edit</a>
                </div>
            </div>
        {% endif %}
        <div class="col-sm-12">
            <div class="panel panel-info">
                <div class="panel-heading">Venue Details</div>
                <div class="panel-body">
                    <dl class="dl-horizontal">
                        <dt>Name</dt>
                        <dd>{{ object.name }}</dd>

                        <dt>Phone</dt>
                        <dd><a href="tel:{{ object.phone }}">{{ object.phone }}</a></dd>

                        <dt>Email</dt>
                        <dd><a href="mailto:{{ object.email }}"><span class="overflow-ellipsis">{{ object.email }}</span></a></dd>

                        <dt>Address</dt>
                        <dd>{{ object.address|linebreaksbr }}</dd>

                        <dt>Notes</dt>
                        <dd>{{ object.notes|linebreaksbr }}</dd>

                        <dt>Three Phase Available</dt>
                        <dd>{{ object.three_phase_available|yesno|capfirst }}</dd>
                    </dl>                        
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading">Associated Events</div>
                <div class="panel-body">
                    {% with object.latest_events as events %}
                        {% include 'RIGS/event_table.html' %}
                    {% endwith %}
                </div>
            </div>
        </div>
    </div>

    {% if not request.is_ajax %}
        <div class="row">
            <div class="col-sm-12 text-right">
                <div class="btn-group btn-page">
                    <a href="{% url 'venue_update' object.pk %}" class="btn btn-default"><span
                        class="glyphicon glyphicon-pencil"></span> Edit</a>
                </div>
                <div>
                    <a href="{% url 'venue_history' object.pk %}" title="View Revision History">
                        Last edited {{ object.last_edited_at }} by {{ object.last_edited_by.name }}
                    </a>
                </div>
            </div>
        </div>
    {% endif %}

{% endblock %}


{% if request.is_ajax %}
    {% block footer %}
        <div class="row">
            <div class="col-sm-12 text-right">
                <div class="btn-group btn-page">
                    <a href="{% url 'venue_detail' object.pk %}" class="btn btn-default"><span
                        class="glyphicon glyphicon-eye-open"></span> Open Page</a>
                    <a href="{% url 'venue_update' object.pk %}" class="btn btn-default"><span
                        class="glyphicon glyphicon-pencil"></span> Edit</a>
                </div>
                <div>
                    <a href="{% url 'venue_history' object.pk %}" title="View Revision History">
                        Last edited {{ object.last_edited_at }} by {{ object.last_edited_by.name }}
                    </a>
                </div>
            </div>
        </div>
    {% endblock %}
{% endif %}