{% extends './layout/default' %}

{% block breadcrumbs %}
    {{ Breadcrumbs.render(Route.getCurrentRoute.getName, objectType) }}
{% endblock %}

{% block content %}
    {% if accounts.count() > 0 %}
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <div class="box" id="account-index-{{ objectType }}">
                    <div class="box-header with-border">
                        <h3 class="box-title">
                            {{ subTitle }}
                        </h3>
                        <div class="box-tools pull-right">
                            <div class="btn-group">
                                <button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><span class="fa fa-ellipsis-v"></span></button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="{{ route('accounts.create', objectType) }}"><span
                                                class="fa fa-plus fa-fw"></span> {{ ('make_new_' ~ objectType ~ '_account')|_ }}
                                        </a></li>
                                </ul>
                            </div>
                        </div>


                    </div>

                    <div class="box-body no-padding">
                        <div style="padding:8px;">
                            <a href="{{ route('accounts.create', objectType) }}" class="btn btn-success"><span class="fa fa-plus fa-fw"></span> {{ ('make_new_' ~ objectType ~ '_account')|_ }}</a>
                        </div>

                        {% include 'list.accounts' %}
                    </div>
                    <div class="box-footer">
                        <p>
                            <a href="{{ route('accounts.create', objectType) }}" class="btn btn-success"><span
                                    class="fa fa-plus fa-fw"></span> {{ ('make_new_' ~ objectType ~ '_account')|_ }}</a>
                        </p>
                        {% if inactiveCount > 0 %}
                            <p><small>
                                    <em>
                                        <a href="{{ route('accounts.inactive.index', objectType) }}" class="text-muted">
                                            {{ trans_choice('firefly.inactive_account_link', inactiveCount) }}
                                        </a>
                                    </em>
                                </small>
                            </p>
                        {% endif %}
                        {% if inactivePage %}
                            <p><small class="text-muted">
                                    <em>
                                        {{ 'all_accounts_inactive'|_ }}
                                        <a href="{{ route('accounts.index', objectType) }}">
                                            {{ trans('firefly.active_account_link', {count: inactiveCount}) }}
                                        </a>
                                    </em>
                                </small>
                            </p>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
    {% if accounts.count() == 0 and page == 1 %}
        {% include 'partials.empty' with {objectType: objectType, type: 'accounts',route: route('accounts.create', [objectType])} %}

        {% if inactiveCount > 0 %}
            <p class="text-center"><small>
                    <em>
                        <a href="{{ route('accounts.inactive.index', objectType) }}" class="text-muted">
                            {{ trans_choice('firefly.inactive_account_link', inactiveCount) }}
                        </a>
                    </em>
                </small>
            </p>
        {% endif %}

    {% endif %}
{% endblock %}

{% block styles %}

{% endblock %}

{% block scripts %}
    <script type="text/javascript" nonce="{{ JS_NONCE }}">
        var objectType = '{{ objectType|escape }}';
    </script>
    <script src="v1/js/lib/jquery-ui.min.js?v={{ FF_BUILD_TIME }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>
    <script type="text/javascript" nonce="{{ JS_NONCE }}" src="v1/js/ff/accounts/index.js?v={{ FF_BUILD_TIME }}"></script>
{% endblock %}
