{% extends "base.html" %}
{% block content %}
<div class="panel">
  <div class="panel-head">
    <div>
      <p class="eyebrow">Docs context</p>
      <h2>Search and relationships</h2>
    </div>
    <form method="get" action="/docs" class="inline-form">
      <input name="q" value="{{ query }}" placeholder="Search documents and entities">
      <button type="submit">Search</button>
    </form>
  </div>
  <div class="chart" data-plot='{{ plot | tojson }}'></div>
</div>

<div class="card-grid two">
  <section class="card">
    <h3>Documents</h3>
    <div class="table-wrap">
      <table>
        <thead><tr><th>Title</th><th>Type</th><th>Version</th></tr></thead>
        <tbody>
          {% for document in documents %}
          <tr><td>{{ document.title }}</td><td>{{ document.doc_type }}</td><td>{{ document.version }}</td></tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </section>
  <section class="card">
    <h3>Communities</h3>
    <div class="stack">
      {% for community in communities %}
      <article class="mini-card">
        <strong>{{ community.label }}</strong>
        <p>{{ community.summary }}</p>
      </article>
      {% endfor %}
    </div>
  </section>
</div>

{% if results %}
<section class="card">
  <h3>Search results</h3>
  <div class="stack">
    {% for result in results %}
    <article class="mini-card">
      <strong>{{ result.title }}</strong>
      <p>{{ result.snippet }}</p>
      <span class="muted">Score {{ result.score }}</span>
    </article>
    {% endfor %}
  </div>
</section>
{% endif %}
{% endblock %}