{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
{% load widget_tweaks %}
{% load paginator from filters %}
{% load url_replace from filters %}
{% load orderby from filters %}

{% block title %}Venues{% endblock %}

{% block content %}
    <div class="col-sm-10 col-sm-offset-1">
        <div class="row">
            <div class="col-sm-10">
                <h3>Venues</h3>
            </div>
            <div class="col-sm-2">
                <a href="{% url 'venue_create' %}" class="btn btn-default pull-right">New <span
                        class="glyphicon glyphicon-plus"></span></a>
            </div>
            <div class="col-sm-3 col-sm-offset-9">
                <form class="form form-horizontal col-sm-12">
                    <div class="form-group">
                        <input type="search" name="q" placeholder="Search" value="{{ request.GET.q }}"
                               class="form-control"/>
                    </div>
                </form>
            </div>
            <div class="text-right col-sm-12">{% paginator %}</div>
        </div>
        
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                <tr>
                    <td></td>
                    <td>Name<a href="?{% orderby request 'orderBy' 'name' %}"><span class="caret"></span></a></td>
                    <td>Email</td>
                    <td>Phone</td>
                    <td>Notes</td>
                    <td></td>
                </tr>
                </thead>
                <tbody>
                {% for object in object_list %}
                    <tr>
                        <td>{{ object.pk }}</td>
                        <td>{{ object.name }}</td>
                        <td>{{ object.email }}</td>
                        <td><a href="tel:{{ object.phone }}">{{ object.phone }}</a></td>
                        <td>{{ object.notes|yesno|capfirst }}</td>
                        <td>
                            <a href="{% url 'venue_detail' object.pk %}" class="btn btn-default modal-href">
                                <span class="glyphicon glyphicon-eye-open"></span>
                            </a>
                            <a href="{% url 'venue_update' object.pk %}" class="btn btn-default"><span
                                    class="glyphicon glyphicon-pencil"></span></a>
                        </td>
                    </tr>
                {% empty %}
                    <tr>
                        <td></td>
                        <td colspan="5">No venues found</td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
        <div class="align-right">{% paginator %}</div>
    </div>
{% endblock %}