{% extends "admin/change_form.html" %}
{% load i18n %}

{% block field_sets %}
{% block content %}
<div id="content-main">
	<div>
		<!-- Object information -->
		<fieldset class="module aligned hero-unit">
			<h2>{% trans "Object info" %}</h2>
			<div class="form-row">
				<div>
					<label>{% trans "Content type" %}:</label>
					<p>{{ original.content_type }} - {{ original.obj_description }} {% trans "with" %} pk={{ original.object_id }}</p>
				</div>
			</div>
			<div class="form-row">
				<div>
					<label>{% trans "Operation" %}:</label>
					<p>{{ original.operation_name }}</p>
				</div>
			</div>
			<div class="form-row">
				<div>
					<label>{% trans "Description" %}:</label>
					<p><div>{{ original.description|linebreaksbr }}</div></p>
				</div>
			</div>
		</fieldset>
		
		<!-- Info about request -->
		<fieldset class="module aligned hero-unit">
			<h2>{% trans "Request info" %}</h2>
			<div class="form-row">
				<div>
					<label>{% trans "Date" %}:</label>
					<p>{{ original.audit_request.date }}</p>
				</div>
			</div>
			<div class="form-row">
				<div>
					<label>{% trans "Request ID" %}:</label>
					<p>{{ original.audit_request.request_id }}</p>
				</div>
			</div>
			<div class="form-row">
				<div>
					<label>{% trans "Username" %}:</label>
					<p>{{ original.audit_request.user }}</p>
				</div>
			</div>
			<div class="form-row">
				<div>
					<label>IP:</label>
					<p>{{ original.audit_request.ip }}</p>
				</div>
			</div>
			<div class="form-row">
				<div>
					<label>{% trans "path" %}:</label>
					<p>{{ original.audit_request.path }}</p>
				</div>
			</div>
		</fieldset>
		
		<!-- Fields -->
		<fieldset class="module aligned hero-unit">
			<h2>{% trans "Fields were changed" %}</h2>
			<div class="form-row">
				<table class="table table-striped" width="400">
					<tr>
						<th align="left">{% trans "Field" %}</th>
						<th align="left">{% trans "Old value" %}</th>
						<th align="left">{% trans "New value" %}</th>
					</tr>
					{% for fc in original.field_changes.all %}
						<tr>
							<td align="left">{{ fc.field }}</td>
							{% if original.operation_name == "delete" or original.operation_name == "excluir"%}
								<td align="left">{{ fc.new_value|default_if_none:'' }}</td>
								<td align="left"></td>
							{% else %}
								<td align="left">{{ fc.old_value|default_if_none:'' }}</td>
								<td align="left">{{ fc.new_value|default_if_none:'' }}</td>
							{% endif %}
						</tr>
					{% endfor %}
				</table>
			</div>
		</fieldset>
	</div>
</div>
{% endblock %}
{% endblock %}
{% block submit_buttons_bottom %}{% endblock %}