@extends('layouts.nova')

@php
    $headerBreadcrumbs = collect([
        (object) ['name' => $page_title, 'url' => route('legacy.monthly_commentators')],
    ]);
@endphp

@section('content')
<x-nova-page-header
    section="Comments"
    :title="$page_title"
    icon="fa-ranking-star"
    :breadcrumbs="$headerBreadcrumbs"
    description="List of users who post the most comments in the current month."
    headerClass="pb-6"
/>

<div class="container-fluid legacy-page pt-8">

    <div class="container-main">
        <div class="panel panel-default effect2">
            <div class="panel-body">
                <table class="table table-bordered table-striped table-hover">
                    <thead>
                        <tr>
                            <th>Thumb</th>
                            <th>Name</th>
                            <th>Level</th>
                            <th>Country</th>
                            <th>Comments</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($rows as $row)
                            <tr>
                                <td width="50" class="text-center">
                                    <a href="/profile/{{ (int)$row->user_id }}/{{ rawurlencode($row->uname) }}">
                                        <img src="{{ \App\Support\AvatarUrl::forUser((int) $row->user_id, null, 32) }}" width="30" alt="{{ $row->uname }}">
                                    </a>
                                </td>
                                <td>
                                    <a href="/profile/{{ (int)$row->user_id }}/{{ rawurlencode($row->uname) }}">{{ $row->uname }}</a>
                                </td>
                                <td width="100" class="text-center">
                                    <img src="/gfx/member_stars/{{ (int)$row->user_type }}.gif" alt="level">
                                </td>
                                <td width="100" class="text-center">
                                    @if (!empty($row->country_flag))
                                        <img width="20" title="{{ $row->country_name }}" src="/gfx/flags/{{ rawurlencode($row->country_flag) }}" alt="{{ $row->country_name }}">
                                    @endif
                                </td>
                                <td width="100" class="text-center">{{ (int)$row->num_comments }}</td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>

                <div class="paginationMenu text-center">
                    {{ $rows->withQueryString()->links('pagination::bootstrap-4') }}
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
