<div{{ attributes.defaults(stimulus_controller('monitor_list')) }} class="overflow-scroll">
    {% if this.isWidget == false %}
        <div class="flex flex-row mb-2 justify-end">
            <twig:DownloadSearch search_path="app_search" placeholder="Find {{ type == "complete" ? "a" : "an" }} {{ type }} monitor..." />
        </div>
    {% endif %}
    <table id="monitor_list" class="divide-y divide-gray-200 bg-gray-50 overflow-hidden rounded-lg table-auto w-full" {{ turbo_stream_listen('App\\Monitor\\Framework\\Entity\\Monitor') }}>
        <thead>
        <tr class="bg-orange-500 bg-filter bg-blur-lg bg-opacity-80 text-gray-950">
            <th scope="col"
                class="px-6 py-3 text-start text-xs font-medium uppercase truncate">
                Title
            </th>
            <th scope="col"
                class="px-6 py-3 text-start text-xs font-medium uppercase">
                ID
            </th>
            <th scope="col"
                class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
                Search Count
            </th>
            <th scope="col"
                class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
                Created at
            </th>
            <th scope="col"
                class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
                Last Search Date
            </th>
            <th scope="col"
                class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
                Type
            </th>
            <th scope="col"
                class="px-6 py-3 text-start text-xs font-medium uppercase">
                Status
            </th>
            <th class="hidden md:table-cell"></th>
        </tr>
        </thead>
        <tbody id="monitors" class="divide-y divide-gray-50">
        {% if this.monitors.items|length > 0 %}
            {% for monitor in this.monitors.items %}
                <twig:MonitorListRow :monitor="monitor" isWidget="{{ this.isWidget }}" />
            {% endfor %}
            {% if this.isWidget and this.monitors.items|length > 5 %}
                <tr  id="monitor_view_all">
                    <td colspan="100%" class="py-2 whitespace-nowrap bg-orange-300 uppercase text-xs font-medium text-center text-black min-w-[50ch] max-w-[50ch] truncate">
                        <a href="{{ path('app_monitors') }}">View All Monitors</a>
                    </td>
                </tr>
            {% endif %}
        {% else %}
            <tr id="active_monitors_no_monitors">
                <td class="px-6 py-4 whitespace-nowrap text-xs uppercase text-center col-span-2 font-medium text-stone-800" colspan="100%">
                    No monitors
                </td>
            </tr>
        {% endif %}
        </tbody>
    </table>

    {% if this.isWidget == false %}
        {% if this.monitors.items|length > 0 %}
            {% set paginator = this.monitors %}
            {% include 'partial/paginator.html.twig' %}
        {% endif %}
    {% endif %}
</div>

