{% extends 'django_ledger/layouts/base.html' %}
{% load i18n %}
{% load static %}
{% load django_ledger %}

{% block header_buttons %}
    <a href="{% url 'django_ledger:entity-create' %}"
       class="button is-success  is-outlined">
        <span class="icon">{% icon 'bi:plus-lg' 20 %}</span>
        <span>{% trans 'New Entity' %}</span>
    </a>
{% endblock %}

{% block content %}
    <section class="section">
        <div class="container">
            <div class="columns is-centered is-multiline">
                {% for entity in entities %}
                    <div class="column is-4">
                        <div class="card">
                            <div class="card-content">
                                <p class="title is-4">{{ entity.name }}</p>
                                <p class="subtitle is-6 has-text-grey">{{ entity.slug }}</p>
                                <div class="buttons">
                                    <a href="{{ entity.get_dashboard_url }}"
                                       class="button is-small is-primary">
                                        <span class="icon">{% icon 'bi:eye' 16 %}</span>
                                        <span>{% trans 'Dashboard' %}</span>
                                    </a>
                                    <a href="{{ entity.get_delete_url }}"
                                       class="button is-small is-danger">
                                        <span class="icon">{% icon 'bi:trash' 16 %}</span>
                                        <span>{% trans 'Delete' %}</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                {% empty %}
                    <div class="column is-6 has-text-centered">
                        <div class="box">
                            <p class="is-size-4">{% trans 'No entities found.' %}</p>
                            <a href="{% url 'django_ledger:entity-create' %}"
                               class="button is-primary mt-4">{% trans 'Create Your First Entity' %}</a>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
    </section>
{% endblock %}