{% extends "base.html" %}

{% block content %}

<div class="action">
  <button onClick="refresh(this)" type="button" value="Refresh" title="new iteration">↻</button>
  <span class="info" style="display: none;">
    <span class="operations">↝ new display of random records from the dataset;</span>
  </span>
  <button id="notes-operations" onclick="hideShowInfo()">?</button>
  <a href="{{ url_for('main.index') }}" class="arrow-back h1 text-left" title="back to index"> ⇽ </a>
</div>

<div class="compare mt-5">

  {% for result in results %}
    <div class="mt-5 text-center skewY">

    {% if result['title'] is defined %}
    <h1 class="h1 mt-4 mb-2">
      Title:
      {{ result['title'] }}
    </h1>
    {% endif %}

    {% if result['year'] is defined %}
    <p class="mb-2">
      Year:
      {{ result['year'] }}
    </p>
    {% endif %}

    {% if result['country'] is defined %}
    <p class="mb-2">
      Country:
      {{ result['country'].name }}
      {{ result['country'].flag }}
    </p>
    {% endif %}

    {% if result['original_title'] is defined %}
    <p class="mb-2">
      Original language title:
      {{ result['original_title'] }}
    </p>
    {% endif %}

    {% if result['abstract'] is defined %}
    <p class="mb-2">
      Abstract:
      {{ result['abstract'] }}
    </p>
    {% endif %}

    {% if result['original_abstract'] is defined %}
    <p class="mb-2">
      Original language abstract:
      {{ result['original_abstract'] }}
    </p>
    {% endif %}

    <p class="mb-2">
      European Patent Office PDF:
      <a href="{{ url_for('search.id_search', id=result['id'], core='all') }}">
        {{ result['application_id'] }}
      </a>
    </p>

    {% if result['image'] is defined %}
    <div class="col text-center">
      <img class="img-fluid" src="data:image/jpg;base64,{{ result['image'] }}" alt="Drawing accompanying patent for {{ result['title'] }}" />
    </div>
    {% endif %}

    </div>
  {% endfor %}

</div>

{% endblock %}
