@extends(Theme::viewName('layout'))
@section('title', trans('admin.users_title'))

@section('breadcrumb')
    <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
    <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
    <li class="breadcrumb-item active">@lang('navigation.breadcrumb.users')</li>
@endsection

@section('content')
    <div class="container">
        <div class="row">
            <div class="col">
                <h1>@lang('admin.list_users_title')</h1>
                <div class="alert alert-info" style="margin-bottom: 30px;">
                    <i class="fa fa-fw fa-info"></i> @lang('admin.list_users_intro')
                </div>

                <table class="table table-hover table-striped">
                    <tbody>
                    @foreach ($users as $user)
                        <tr>
                            <td>
                                <span style="font-size: 1.3em;"><a href="{{ route('users.edit', ['id' => $user->id]) }}">{{ $user->name }}</a>@if ($user->is_admin) <i class="fa fa-fw fa-cog"></i>@endif</span><br/>
                                {{ $user->email }} <a href="mailto:{{ $user->email }}"><i class="fa fa-fw fa-mail-forward"></i></a>
                            </td>
                            <td>
                                @if (!$user->is_activated)
                                    <span style="font-style: italic; color: #888888;">@lang('admin.user_pending')</span>
                                @endif
                            </td>
                            <td class="text-right">
                                <a href="{{ route('users.delete', ['id' => $user->id]) }}" class="btn btn-danger">@lang('forms.delete_action')</a>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>

                <div class="text-center">
                    {{ $users->links() }}
                </div>

                <div class="pull-right" style="margin-top: 10px;">
                    @can('admin:manage-groups')
                        <a href="{{ route('groups.index') }}" class="btn btn-link">@lang('admin.list_groups_title')</a>
                    @endcan
                    <a href="{{ route('users.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_user')</a>
                </div>
            </div>
        </div>
    </div>
@endsection