{% load static %}
{% load i18n %}
{% load l10n %}
{% load mastodon %}
{% load thumb %}
<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ site_name }} - {% trans 'Merge' %}</title>
    {% include "common_libs.html" %}
    {% if url %}<meta http-equiv="refresh" content="3;url={{ url }}">{% endif %}
  </head>
  <body>
    {% include "_header.html" %}
    <main class="container">
      <h2>
        {% if mode == "merge" %}
          {% if new_item %}
            {% trans 'Are you sure to merge?' %}
          {% else %}
            {% trans 'Are you sure to cancel merge?' %}
          {% endif %}
        {% elif mode == "link" %}
          {% trans 'Are you sure to link?' %}
        {% endif %}
      </h2>
      <div>
        <article class="item-card {% if mode == 'merge' %}deleting{% endif %}">
          {% include "_item_card.html" with item=item %}
        </article>
        {% if item.is_deleted %}
          <p>
            <i class="fa-solid fa-circle-xmark"></i> {% trans "Item has been deleted." %}
          </p>
        {% endif %}
        {% if item.child_items %}
          <p>
            <i class="fa-solid fa-circle-exclamation"></i> {% trans "Item contains sub-items." %}
          </p>
        {% endif %}
        {% if item.merged_to_item %}
          <p>
            <i class="fa-solid fa-circle-xmark"></i> {% trans "Item has been merged to another item." %}
          </p>
        {% endif %}
        {% if item.journal_exists %}
          <p>
            <i class="fa-solid fa-circle-exclamation"></i> {% trans "Item has been marked by users." %}
          </p>
        {% endif %}
        {% if new_item %}
          <div>
          <center><i class="fa-solid fa-angles-down"></i>
          <i class="fa-solid fa-angles-down"></i>
          <i class="fa-solid fa-angles-down"></i>
        </center>
      </div>
      <article class="item-card">{% include "_item_card.html" with item=new_item %}</article>
      {% if new_item.is_deleted %}
        <p>
          <i class="fa-solid fa-circle-xmark"></i> {% trans "Item has been deleted." %}
        </p>
      {% endif %}
      {% if new_item.child_items %}
        <p>
          <i class="fa-solid fa-circle-exclamation"></i> {% trans "Item contains sub-items." %}
        </p>
      {% endif %}
      {% if new_item.merged_to_item %}
        <p>
          <i class="fa-solid fa-circle-xmark"></i> {% trans "Item has been merged to another item." %}
        </p>
      {% endif %}
      {% if new_item.journal_exists %}
        <p>
          <i class="fa-solid fa-circle-exclamation"></i> {% trans "Item has been marked by users." %}
        </p>
      {% endif %}
    {% endif %}
  </div>
  <form method="post"
        {% if mode == "merge" %} action="{% url 'catalog:merge' item.url_path item.uuid %}" {% elif mode == "link" %} action="{% url 'catalog:link_edition' item.url_path item.uuid %}" {% endif %}
        onsubmit="return confirm('{% trans "This operation cannot be undone. Sure to merge?" %}');">
    {% csrf_token %}
    <input type="hidden"
           name="target_item_url"
           value="{{ request.POST.target_item_url }}">
    <input type="hidden" name="sure" value="1">
    <input type="submit" value="{% trans 'Yes' %}">
    <input type="reset" value="{% trans 'No' %}" onclick="history.go(-1)">
  </form>
</main>
{% include "_footer.html" %}
</body>
</html>
