@extends('backend.layouts.app')

@section('title', __('labels.backend.access.users.management') . ' | ' . __('labels.backend.access.users.deactivated'))

@section('breadcrumb-links')
    @include('backend.auth.user.includes.breadcrumb-links')
@endsection

@section('content')
<div class="card">
    <div class="card-body">
        <div class="row">
            <div class="col-sm-5">
                <h4 class="card-title mb-0">
                    @lang('labels.backend.access.users.management')
                    <small class="text-muted">@lang('labels.backend.access.users.deactivated')</small>
                </h4>
            </div><!--col-->
        </div><!--row-->
        <div class="row ml-1">
            {{ html()->form('GET', route('admin.auth.user.deactivated'))->class('form-inline')->open() }}
            <div class="col">
                <div class="row">
                    {{ html()->label('Name or email','search')
                                }}
                </div>
                <div class="row">
                    {{ html()->text('search')->class('form-control')
             ->placeholder('User name or email')->value(app('request')->input('search')) }}

                </div>
            </div>
            <div class="col ml-1">
                <div class="row">
                    {{ html()->label('Institution','institution')
                      }}
                </div>
                <div class="row">
                    {{ html()->select('institution',$institutions->pluck('text', 'id'))->style('width:300px')->class('form-control')->value(app('request')->input('institution'))
                      }}
                </div>
            </div>
            <div class="col ml-1">
                <div class="row">
                    {{ html()->label('Position','position')
                      }}
                </div>
                <div class="row">
                    {{ html()->select('position',$positions->pluck('text', 'id'))->style('width:300px')->class('form-control')->value(app('request')->input('position'))
                      }}
                </div>
            </div>
            <div class="col ml-1">
                <div class="row">
                    {{ html()->label('Lab','lab')
                      }}
                </div>
                <div class="row">
                    {{ html()->select('lab',$labs->pluck('name', 'id'))->style('width:300px')->class('form-control')->value(app('request')->input('lab'))
                      }}
                </div>
            </div>
            <div class="col ml-1">
                <div class="row">&nbsp;
                </div>
                    <div class="row">
                &nbsp;{!!form_submit('<i class="fas fa-search"></i>','btn btn-success ') !!}
                </div>
            </div>
            {{html()->form()->close()}}
        </div>
        <div class="row mt-4">
            <div class="col">
                <div class="table-responsive">
                    <table class="table w-100">
                        <thead>
                        <tr>
                            <th>@lang('labels.backend.access.users.table.last_name')</th>
                            <th>@lang('labels.backend.access.users.table.first_name')</th>
                            <th>@lang('labels.backend.access.users.table.email')</th>
                            <th>@lang('labels.backend.access.users.table.confirmed')</th>
                            <th>Beta user</th>
                            <th>@lang('labels.backend.access.users.table.roles')</th>
                            <th>Institution</th>
                            <th>Position</th>
{{--                            <th>@lang('labels.backend.access.users.table.other_permissions')</th>--}}
                            <th>@lang('labels.backend.access.users.table.social')</th>
                            <th>@lang('labels.backend.access.users.table.last_updated')</th>
                            <th>@lang('labels.general.actions')</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if($users->count())
                            @foreach($users as $user)
                                <tr>
                                    <td>{{ $user->last_name }}</td>
                                    <td>{{ $user->first_name }}</td>
                                    <td>{{ $user->email }}</td>

                                    <td>@include('backend.auth.user.includes.confirm', ['user' => $user])</td>
                                    <td>{{ $user->is_beta_user?'Yes':'No' }}</td>
                                    <td>{{ $user->roles_label }}</td>
                                    <td>{{ $user->roles_label }}</td>
{{--                                    <td>{{ $user->permissions_label }}</td>--}}
                                    <td>@include('backend.auth.user.includes.social-buttons', ['user' => $user])</td>
                                    <td>{{ $user->updated_at->diffForHumans() }}</td>
                                    <td class="btn-td">@include('backend.auth.user.includes.actions', ['user' => $user])</td>
                                </tr>
                            @endforeach
                        @else
                            <tr><td colspan="9"><p class="text-center">@lang('strings.backend.access.users.no_deactivated')</p></td></tr>
                        @endif
                        </tbody>
                    </table>
                </div>
            </div><!--col-->
        </div><!--row-->
        <div class="row">
            <div class="col-7">
                <div class="float-left">
                    {!! $users->total() !!} {{ trans_choice('labels.backend.access.users.table.total', $users->total()) }}
                </div>
            </div><!--col-->

            <div class="col-5">
                <div class="float-right">
                    {!! $users->render() !!}
                </div>
            </div><!--col-->
        </div><!--row-->
    </div><!--card-body-->
</div><!--card-->
@endsection
