{% extends 'ledger/base.html' %}
{% load i18n %}
{% load humanize %}
{% load static %}
{% load ledger %}

{% block page_title %}Corporation Ledger{% endblock %}
{% block page_topic %}<h1 class="page-header text-center">{% trans "Corporation Ledger" %}</h1>{% endblock page_topic %}

{% block header_nav_collapse_left %}

{% include 'ledger/partials/menu/corp/navigation.html' with memberaudit=memberaudit %}

{% endblock header_nav_collapse_left %}

{% block header_nav_collapse_right %}

{% include 'ledger/partials/menu/corp/administration.html' with memberaudit=memberaudit %}

{% endblock header_nav_collapse_right %}

{% block vow_block %}
<div class="card-body container-fluid">
    <div class="card-body bg-primary rounded-top d-flex">
        <h3>{% trans "Corporation Ledger" %} </h3>
        <div class="dropdown px-2">
            <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                Year
            </button>
            <ul class="dropdown-menu" id="yearDropdown">
                {% for year in years %}
                    <li><a class="dropdown-item" href="#">{{ year }}</a></li>
                {% endfor %}
            </ul>
        </div>
        <div class="dropdown">
            <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
              Month
            </button>
            <ul class="dropdown-menu" id="monthDropdown">
                <li><a class="dropdown-item" data-bs-month-id="1" href="#">{% trans "January" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="2" href="#">{% trans "February" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="3" href="#">{% trans "March" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="4" href="#">{% trans "April" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="5" href="#">{% trans "May" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="6" href="#">{% trans "June" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="7" href="#">{% trans "July" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="8" href="#">{% trans "August" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="9" href="#">{% trans "September" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="10" href="#">{% trans "October" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="11" href="#">{% trans "November" %}</a></li>
                <li><a class="dropdown-item" data-bs-month-id="12" href="#">{% trans "December" %}</a></li>
            </ul>
        </div>
    </div>
    <ul class="nav nav-tabs" id="ledger-ratting" role="tablist">
        <li class="nav-item">
            <a id="currentMonthLink" class="nav-link active" href="#tab-current_month" data-bs-toggle="tab" role="tab" data-bs-target="#tab-current_month">
                Month - {% now "F" %}
            </a>
        </li>
        <li class="nav-item">
            <a id="currentYearLink" class="nav-link" href="#tab-all_month" data-bs-toggle="tab" role="tab" data-bs-target="#tab-all_month">
                Year - {% now "Y" %}
            </a>
        </li>
    </ul>
    <div class="tab-content rounded-bottom">
        <div class="tab-content">
            {% include 'ledger/corpledger/month.html' %}
            {% include 'ledger/corpledger/year.html' with years=years %}
        </div>
    </div>
</div>

<!-- Tab Session -->
{% include 'ledger/modals/modal_dialog.html' with name="ViewCharacter" %}
{% endblock %}
{% block extra_css %}
{% include 'ledger/bundles/table-css.html' %}
{% endblock %}
{% block extra_javascript %}
{% if NIGHT_MODE or theme == "allianceauth.theme.darkly.auth_hooks.DarklyThemeHook" %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/billboard.js/3.12.4/theme/dark.min.css" integrity="sha512-TqGQ+TI2SXQF94++95bI8awt0VEW3pPOMmg66zzy57g0i82qe4BdHvMz6Fh7BbkMFiqq0TQ2yO/bnhC4yBCvhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
{% else %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/billboard.js/3.12.4/billboard.min.css" integrity="sha512-ECDNDgViBSnrgXOO8/eOIqHkrbWKhmlgN1yfDrWUgJI9zOX0nK8k0bLAGdPrfCANd+xhvrusvblcvawG7cqlzg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
{% endif %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.9.0/d3.min.js" integrity="sha512-vc58qvvBdrDR4etbxMdlTt4GBQk1qjvyORR2nrsPsFPyrs+/u5c3+1Ct6upOgdZoIl7eq6k3a1UPDSNAQi/32A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/billboard.js/3.12.4/billboard.min.js" integrity="sha512-/cNN6+3RhTdLjXMj9HAsHESe8G3AokZzjc06eexZBWgXZHcq5Bmp8BFnmajTFOk2QVVVH+DbHXqCNj5IKshkzg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% include 'bundles/datatables-js-bs5.html' %}
<script type="application/javascript">
    $('#modalViewCharacterContainer').on('show.bs.modal', function (event) {
        let button = $(event.relatedTarget)
        let ajax_url = button.data('ajax_url');

        $("#modalViewCharacterContent").load(ajax_url)
    });
</script>
<script type="application/javascript">
    let corporationsettings = {
        corporation_pk: {{ corporation_pk }},
    };
</script>
<script type="application/javascript" src="{% static 'ledger/js/corpledger.js' %}"></script>
{% endblock extra_javascript %}
{% block extra_script %}
{% endblock extra_script %}
