{% extends "base.html" %}
{% load i18n %}
{% load translations %}

{% block breadcrumbs %}
<li><a href="{{ project.get_absolute_url }}">{{ project.name }}</a></li>
{% if component %}
<li><a href="{{ component.get_absolute_url }}">{{ component.name }}</a></li>
{% if translation %}
<li><a href="{{ translation.get_absolute_url }}">{{ translation.language }}</a></li>
{% endif %}
{% endif %}
<li>{% trans "Search and replace" %}</li>
{% endblock %}

{% block content %}

{% trans "Please review and confirm the search and replace results." as msg %}
{% show_message "info" msg %}

<form method="POST">
{% csrf_token %}
{{ form.search.as_hidden }}
{{ form.replacement.as_hidden }}
{{ confirm.confirm }}

<table class="table">
{% for unit in matching %}
<tr>
<td rowspan="3">
<input type="checkbox" name="units" checked="1" value="{{ unit.pk }}" id="confirm_{{ unit.pk }}" />
</td>
<td>
<a href="{{ unit.get_absolute_url }}" class="btn btn-default btn-sm pull-right flip"><i class="fa fa-pencil"></i> {% trans "Edit" %}</a>
<label for="confirm_{{ unit.pk }}">{{ unit }}</label>
</td>
</tr>
<tr>
<td>{% format_translation unit.target unit.translation.language unit.translation.plural search_match=search_query match='replaced'%}</td>
</tr>
<tr>
<td>{% format_translation unit.replacement unit.translation.language unit.translation.plural search_match=replacement match='replacement' %}</td>
</tr>
{% endfor %}
</table>
<input type="submit" class="btn btn-success" value="{% trans "Process" %}" />
</form>

{% endblock %}

