{% block submenu_dashboard %}
    <div class="container" id="dashboard-nav">
    
    <h1>{{ rstate|capitalize }} {{ table_title }}</h1>
    <div class="row">  
        <div class="col-6">
            <ul class="nav nav-pills">
            {% for key, item in dashboard.items() %}
                <li class="nav-item">
                    <a class="nav-link {{ css_classes[key] }}" href="{{ url_for('dashboard.index', rtype=key, rstate=rstate) }}" >
                    {{ item.name }} 
                    {% if count_match %}
                        ({{ count_match[key] }})
                    {% endif %}
                    </a>
                </li>
            {% endfor %}    
            </ul>
        </div>
        <div class="col-6">
            <ul class="nav nav-pills justify-content-end">
                <li class="nav-item"> 
                    {% include 'pages/dashboard_search_form.html' %}
                </li>
                <li class="nav-item">
                    <a class="nav-link {{ css_classes['active'] }}" href="{{ url_for('dashboard.index', rtype=rtype, rstate='active') }}" >Active</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {{ css_classes['expired'] }}" href="{{ url_for('dashboard.index', rtype=rtype, rstate='expired') }}" >Expired</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {{ css_classes['all'] }}" href="{{ url_for('dashboard.index', rtype=rtype, rstate='all') }}" >All</a>
                </li>
            </ul>
        </div>
    </div>
    
    {% if search_query %}
    <div class="row mt-2">
        <div class="col-12">
            <div class="alert alert-info alert-dismissible fade show py-2" role="alert">
                <small>
                    <i class="bi bi-search"></i> Searching for: <strong>{{ search_query }}</strong>
                    {% if count_match and count_match[rtype] is defined %}
                        <span class="badge bg-primary ms-2">{{ count_match[rtype] }} results in {{ rtype|upper }}</span>
                        {% for other_type, count in count_match.items() %}
                            {% if other_type != rtype and count > 0 %}
                                <span class="badge bg-secondary ms-1">{{ count }} in {{ other_type|upper }}</span>
                            {% endif %}
                        {% endfor %}
                    {% endif %}
                </small>
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" data-clear-url="{{ url_for('dashboard.clear_search') }}"></button>
            </div>
        </div>
    </div>
    {% endif %}
    
    <hr />

{% endblock %}