{% extends "base.html" %}


{% block content %}

    <div class="row">
        {% for item in search_results %}
            <div class="col s12 m6 l6">
            <div class="card small">
            <div class="card-content" style="overflow-y: auto;">
                <div class="section">
                    <h4 style="display:inline; margin-left: 1.5rem;">Search: {{ item.model|title }}</h4>
                    <div class="divider"></div>
                </div>

                <h6><b>Searched for: </b>{{ item.search_text }}</h6>
                <ul class="collection">
                    {% for result in item.results %}
                        <li class="collection-item">
                            <a style="float: left; margin-right: 1rem" {% if result.get_absolute_url %}href="{{ result.get_absolute_url }}" class="tooltipped" data-tooltip="View {{ item.model|title }} item"{% endif %}><i class="material-icons">web_asset</i></a>{{ result }}
                        </li>
                    {% empty %}
                        <li class="collection-item">No items found</li>
                    {% endfor %}
                </ul>
            </div>
            </div>
            </div>

        {% empty %}
            <div class="col s5">
            <div class="card">
            <div class="card-content">
                <div class="section" style="display:inline; margin: 0 0 0 0.2rem; padding-top: 0;">
                    {% if previous_page %}
                        <a style="float: left;" href="{{ previous_page }}" class="tooltipped" data-tooltip="Previous Page"><i class="material-icons">keyboard_backspace</i></a>
                    {% endif %}
                    <h4 style="display:inline; margin-left: 1.5rem;">Search Error</h4>
                    <div class="divider"></div>
                </div>

                <h5>No search performed!</h5>
            </div>
            </div>
            </div>
        {% endfor %}
    </div>

{% endblock %}
