{% extends "pagination/pagination_base.html" %}
{% load custom_tags_and_filters %}
{% block before_pagination %}
    <div class="panel panel-default">
        <div class="panel-heading clearfix">
            <div class="row">
                <span class="col-xs-9">Search for tickets</span>
                <span class="col-xs-3 text-right" style="margin-bottom: -5px;margin-top: -5px">
                    {% url "osticket_create_ticket" as create_ticket_url %}
                    {% button type="save" submit=False url=create_ticket_url value="New ticket" icon="glyphicon-plus-sign" size="small" %}
                </span>
            </div>
        </div>
        <form class="form-horizontal" action="{% url 'osticket_tickets' %}" method="get">
            <div class="form-group" style="margin: 15px 0">
                <label for="created_email" class="col-md-2 control-label">Created by email</label>
                <div class="col-lg-4 col-md-5">
                    <input type="email"
                           autocomplete="on"
                           class="form-control"
                           id="created_email"
                           name="email"
                           required
                           value="{{ form.email.value }}">
                </div>
                <label for="ticket_status" class="col-md-2 control-label">Ticket status</label>
                <div class="col-lg-2 col-md-3">
                    <select class="form-control" id="ticket_status" name="is_open">
                        <option value="unknown" selected>All</option>
                        <option value="true" {% if form.is_open.value is True %}selected{% endif %}>Open</option>
                        <option value="false" {% if form.is_open.value is False %}selected{% endif %}>Closed</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12 text-center">{% button type="save" value="Search" icon="glyphicon-search" %}</div>
            </div>
        </form>
    </div>
{% endblock %}
{% block pagination_content %}
    {% include "NEMO_osticket/snippets/tickets_table.html" %}
{% endblock %}
{% block table_empty_content %}
    {% if search_done %}
        There are no tickets matching your search query, <a href="{{ create_ticket_url }}">click here</a> to create a new one
    {% else %}
        Click the "search" button to look for tickets or <a href="{{ create_ticket_url }}">Submit a new ticket</a>
    {% endif %}
{% endblock %}
