@component('panel.layouts.component', ['title' => 'سطوح دسترسی'])

    @slot('style')
    @endslot

    @slot('subject')
        <h1><i class="fa fa-users"></i> سطوح دسترسی </h1>
        <p>مدیریت سطوح دسترسی کاربران، اعطای دسترسی و نقش به کاربران.</p>
    @endslot

    @slot('breadcrumb')
        <li class="breadcrumb-item">سطوح دسترسی</li>
    @endslot

    @slot('content')
        <div class="row">
            <div class="col-md-12">
            @component('components.collapse-card', ['title' => 'لیست کاربران'])
                @slot('body')
                    @component('components.collapse-search')
                        @slot('form')
                            <form class="clearfix">
                                <div class="form-group">
                                    <label for="text-name-input">نام کاربر</label>
                                    <input type="text" class="form-control" id="text-name-input" placeholder="نام کاربر">
                                </div>
                                <button type="submit" class="btn btn-primary float-left">جستجو</button>
                            </form>
                        @endslot
                    @endcomponent

                    @component('components.table')
                        @slot('thead')
                            <tr>
                                <th>شناسه</th>
                                <th>نام</th>
                                <th># نقش‌ها</th>
                                @if(config('laratrust.panel.assign_permisions_to_user'))
                                    <th class="th"># دسترسی‌ها</th>@endif
                                <th>فعالیت</th>
                            </tr>
                        @endslot
                        @slot('tbody')
                            @forelse ($users as $user)
                                <tr>
                                    <td>
                                        {{$user->getKey()}}
                                    </td>
                                    <td>
                                        {{$user->name ?? 'این جدول ستون name را ندارد.'}}
                                    </td>
                                    <td>
                                        {{$user->roles_count}}
                                    </td>
                                    @if(config('laratrust.panel.assign_permisions_to_user'))
                                        <td>
                                            {{$user->permissions_count}}
                                        </td>
                                    @endif
                                    <td>
                                        <a  href="{{route('roles-assignment.edit', ['roles_assignment' => $user->id, 'model' => $modelKey])}}"
                                            class="btn btn-sm btn-primary">
                                            ویرایش
                                        </a>
                                    </td>
                                </tr>
                            @empty
                                <tr>
                                    <td colspan="5" class="text-center">موردی برای نمایش وجود ندارد.</td>
                                </tr>
                            @endforelse
                        @endslot
                    @endcomponent

                    {{--Paginate section--}}
                    @if ($modelKey)
                        {{ $users->withQueryString()->links() }}
                    @endif
                @endslot
            @endcomponent
            </div>
        </div>
    @endslot

    @slot('script')
    @endslot

@endcomponent