{% extends "base.html" %}

{% block title %}Search Results{% endblock %}

{% block content %}

    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'main_page' %}">Home</a></li>
            <li class="breadcrumb-item active" aria-current="page">Search</li>
        </ol>
    </nav>

    <div class="container-fluid">
        <div class="row">
            <div class="col">
                <div class="card my-2">
                    <h3 class="card-header">
                        Searched for
                    </h3>
                    <dvi class="card-body">
                        <table class="table">
                            <tr>
                                <th>Key</th>
                                <th>{{ searched_key }}</th>
                            </tr>
                            <tr>
                                <th>Value</th>
                                <th>{{ searched_value }}</th>
                            </tr>
                        </table>
                    </dvi>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col">
                {% for project in results %}

                    {% if project %}
                        <div class="card my-2">
                            <h3 class="card-header">
                                Results for Project: <b>{{ project.name }}</b>
                            </h3>
                            <div class="card-body">
                                <table class="table table-striped table-bordered">
                                    <tr>
                                        <th>Name</th>
                                        <th>Sha256</th>
                                    </tr>
                                    {% for item in project.res %}
                                        <tr>
                                            <td><a href="{% url 'file-view' project.name item.1 %}">{{ item.0 }}</a></td>
                                            <td class="mono">{{ item.1 }}</td>
                                        </tr>
                                    {% endfor %}
                                </table>
                            </div>
                        </div>
                    {% endif %}

                {% empty %}
                    No Projects
                {% endfor %}

            </div>
        </div>
    </div>

{% endblock %}
