{% extends base %}
{% load date_extras %}
{% load staticfiles %}

{% block navigation %}
    {% include "components/navigator.html" with space='django:log_update' %}
{% endblock %}

{% block content %}

<form id="form" method="post" autocomplete="off">
    {% csrf_token %}
    <input type="hidden" id="action" name="action" value="{{action}}"/>
    <input type="hidden" name="path" value="{{path}}"/>
    <input type="hidden" name="back" value="{{back}}"/>
    <input type="hidden" name="log_id" value="{{log.id}}"/>
    {% include "components/navigator_inputs.html" %}

    <div class="panel panel-default">
        <div class="panel-body">
            <div class="form-group">
                <div class="col-sm-4"><label>Date</label></div>
                <div class="col-sm-8"><input class="form-control" type="text" name="date" value="{{ log.date|date:'d/m/Y H:i' }}" disabled/></div>
            </div>
            <div class="form-group">
                <div class="col-sm-4"><label>Table</label></div>
                <div class="col-sm-8"><input class="form-control" type="text" name="model" value="{{ log.model }}" disabled/></div>
            </div>
            <div class="form-group">
                <div class="col-sm-4"><label>Ref</label></div>
                <div class="col-sm-8"><input class="form-control" type="text" name="ref" value="{{ log.ref }}" disabled/></div>
            </div>
            <div class="form-group">
                <div class="col-sm-4"><label>Utilisateur</label></div>
                <div class="col-sm-8"><input class="form-control" type="text" name="author" value="{{ log.author }}" disabled/></div>
            </div>
            <div class="form-group">
                <div class="col-sm-4"><label>Action</label></div>
                <div class="col-sm-8"><input class="form-control" type="text" name="action" value="{{ log.action }}" disabled/></div>
            </div>
        </div>
    </div>

    {% if log_items %}
    <table class="table table-hover">
        <thead>
        <th>&nbsp;</th>
        <th>Avant</th>
        <th>Après</th>
        </thead>
        {% for log_item in log_items %}
        <tr>
            <td>{{ log_item.key }}</td>
            <td>{{ log_item.old }}</td>
            <td>{{ log_item.new }}</td>
        </tr>
        {% endfor %}
    </table>
    {% endif %}
</form>

{% endblock %}