{% extends basetemplate|default:"base.html" %}
{% load generic %}
{% load history %}
{% load crispy_forms_tags %}
{% load static %}
{% load i18n %}

{% block styles %}
  {{ block.super }}
  <link rel="stylesheet" href="{% static 'css/history.css' %}" />
{% endblock styles %}

{% block content %}
  <div class="container">
    <h4 class="mb-4">
      {% blocktranslate with url=object.get_absolute_url %}Merging values of <a href="{{ url }}">{{ other }}</a> into <a href="{{ url }}">{{ object }}</a>{% endblocktranslate %}
    </h4>
    <div class="alert alert-warning" role="alert">
      {% blocktranslate with url=object.get_absolute_url %}After the merge <a href="{{ url }}">{{ other }}</a> will be deleted!{% endblocktranslate %}
    </div>
    <table class="table table-sm table-hover table-bordered difftable">
      <thead>
        <tr>
          <th></th>
          <th>{% translate "Old value" %}</th>
          <th>{% translate "New value" %}</th>
        </tr>
      </thead>
      <tbody>
        {% for change in changes %}
          <tr>
            <th>{{ change.field }}</th>
            <td>{{ change|get_diff_old }}</td>
            <td>{{ change|get_diff_new }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
    {% if form %}
      {% crispy form form.helper %}
    {% endif %}
  </div>
{% endblock %}
