{% extends "admin/base_site.html" %}
{% load humanize %}
{% load dash_tags %}
{% load i18n %}

{% block content_title %}
    {{ index_title|default:"Django Daisy Dashboard" }}
{% endblock %}

{% block content %}
    <div class="mt-3 grid gap-6">
        <div class="">
            <div aria-label="Card" class="card bg-base-100 card-bordered">
                <div class="card-body">
                    <div class="flex items-center justify-between">
                        <span class="font-medium">{% trans "History" %}</span>
                        <a class="btn btn-link" href="{{ logentry_changelist_url }}">{% trans "Show all" %}</a>
                    </div>
                    <div class="overflow-auto">
                        <table class="table">
                            <thead>
                            <tr>
                                <th class="w-100">{% trans "In" %}</th>
                                <th>{% trans "Action" %}</th>
                                <th>{% trans "At Time" %}</th>
                                <th>{% trans "Admin" %}</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for history in latest_history %}
                                <tr>
                                    <td>
                                        <a href="{{ history.get_admin_url }}"
                                           class="text-primary">
                                            {{ history.content_type }}
                                        </a>
                                    </td>
                                    <td>
                                        <a class="underline"
                                           href="{% url 'admin:admin_logentry_change' history.pk %}">{{ history.get_action_flag_display }}</a>
                                    </td>
                                    <td>
                                    <span class="text-muted">
                                        {{ history.action_time|naturaltime }}
                                    </span>
                                    </td>
                                    <td>
                                        <strong>
                                            <a href="{% get_user_admin_change_url history.user %}">{{ history.user }}</a>
                                        </strong>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}
