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

{% block aux_menu %}
    {% if unit_model %}
        <div class="column is-12">{% period_navigation 'unit-ic' %}</div>
    {% elif entity %}
        <div class="column is-12">{% period_navigation 'entity-ic' %}</div>
    {% elif ledger %}
        <div class="column is-12">{% period_navigation 'ledger-ic' %}</div>
    {% endif %}
{% endblock %}

{% block view_content %}
    <div class="card">
        <div class="card-content has-text-centered">
            <div class="container mb-4">
                <div class="columns">
                    <div class="column">
                        {% if entity %}
                            <h1 class="is-size-2 has-text-weight-light">{{ entity.name }}</h1>
                        {% elif ledger %}
                            <h1 class="is-size-2 has-text-weight-light">{{ ledger.name }}</h1>
                        {% endif %}
                        {% if unit_model %}
                            <h3 class="is-size-4 has-text-weight-medium is-italic">{{ unit_model.name }} {% trans 'Unit' %}</h3>
                        {% endif %}

                        <h1 class="is-size-2 has-text-weight-bold">{% trans 'Income Statement' %}</h1>
                        <h2 class="is-size-2 has-text-weight-light">
                            {% if quarter %}{{ year }} | Q{{ quarter }}
                                {% elif month %}{{ start_date | date:'F, Y' }}
                            {% else %}Fiscal Year {{ year }}
                            {% endif %}</h2>
                        <h3 class="is-size-4 is-italic has-font-weight-light">
                            {% if month %}{% trans 'For the month ended' %} {{ to_date | date:'F j, Y' }}
                                {% elif quarter %}{% trans 'For the quarter ended' %} {{ to_date | date:'F j, Y' }}
                                {% else %}{% trans 'For the fiscal year ended' %} {{ to_date | date:'F j, Y' }}
                            {% endif %}
                        </h3>
                    </div>
                </div>
            </div>

            {% income_statement_table io_model=object %}

            {% if ledger %}
                <a class="button is-fullwidth is-dark my-2"
                   href="{% url 'django_ledger:ledger-list' entity_slug=view.kwargs.entity_slug %}">Go
                    Back</a>
            {% elif entity %}
                <a class="button is-fullwidth is-dark my-2"
                   href="{% url 'django_ledger:entity-dashboard' entity_slug=view.kwargs.entity_slug %}">Go
                    Back</a>
            {% endif %}
            <a class="button is-fullwidth is-light my-2"
               href="?by_unit=1">{% trans 'By Unit' %}</a>

            <a class="button is-fullwidth is-link my-2"
               href="{{ request.path }}?format=pdf">{% trans 'Download PDF' %}</a>
        </div>
    </div>

{% endblock %}
