@extends('admin')
@section('contentData')


    @if (session()->has('message-ok'))
        <div class="alert alert-success">

            {{ session('message-ok') }}
        </div>
    @endif
    @php
        /** @var User $user */
        use App\User;
        $user = Auth::user();
     @endphp
    <h2 style="color: #0095fe; font-family: Calibri,serif;">Správa uživatelů</h2>
    <div style=' width: 850px; padding: 40px;background-image: url("{{URL::asset('/resources/images/bg-top1.png')}}"); background-repeat:no-repeat; background-size: 10px 100%; border-radius: 10px; background-color: whitesmoke;'>
       <a href="{{ route('users-add') }}">
           <input type="button" style="width: 150px; height: 37px; background-color: darkorange; border: 0 darkorange; font-size: 20px; font-family: Calibri,serif; margin-bottom: 15px; color: whitesmoke; border-radius: 5px;" value="Přidat uživatele"/>
       </a>
        <table width="100%" id="table">
            <thead style='background-image: url("{{URL::asset('/resources/images/bg-top1.png')}}"); background-repeat:no-repeat; background-size: 100%; color: white;'>
                <tr>
                    <th scope="col" style="padding-left: 10px; width: 30px;">#</th>
                    <th scope="col" style="padding-left: 10px; width: 30px;" class="nosort">ID</th>
                    <th scope="col">Jméno</th>
                    <th scope="col">Email</th>
                    <th scope="col">Aktivní</th>
                    <th scope="col">Obnovit heslo</th>
                    <th scope="col" style="width: 20px;" class="nosort"></th>
                    <th scope="col" style="width: 20px;" class="nosort"> </th>
                </tr>
            </thead>
            <tbody>
            <tr class="info">

                <th scope="row" style="padding-left: 10px;">1</th>
                <th scope="row" style="padding-left: 10px;">{{$user->id}}</th>
                <td>{{$user->name}}</td>
                <td>{{$user->email}}</td>
                <td>Ano</td>
                <td style="text-align: center"><a href="{{ route('users-resendPass',$user->id) }}">Obnovit</a></td>
                <td style="width: 20px;" class="nosort"> <a href="{{ route('users-edit',$user->id) }}"><img src="{{URL::asset('/resources/images/btn-edit.png')}}" alt="Edit"/></a></td>
                <td style="width: 20px;" class="nosort">  <a href="{{ route('users-changePass',$user->id) }}"><img src="{{URL::asset('/resources/images/btn-password.png')}}" alt="Změna hesla"/></a></td>
            </tr>
            @foreach($otherUsers as $id => $data)
                @php
                    if ($id%2 == 0)
                    {
                      $rowColor = "#e5e5e5";
                    }
                    else
                    {
                        $rowColor = "whitesmoke";
                    }
                @endphp
                <tr style="background-color: {{$rowColor}};">
                    <th scope="row" style="padding-left: 10px;">{{$id+2}}</th>
                    <th scope="row" style="padding-left: 10px;">{{$data->id}}</th>
                    <td>{{$data->name}}</td>
                    <td>{{$data->email}}</td>
                    <td>@if($data->email_verified_at !== null) Ano @else Ne @endif</td>
                    <td style="text-align: center"><a href="{{ route('users-resendPass',$data->id) }}">Obnovit</a></td>
                    <td style="width: 20px;"> <a href="{{ route('users-edit',$data->id) }}"><img src="{{URL::asset('/resources/images/btn-edit.png')}}" alt="Edit"/></a></td>
                    <td style="width: 20px;"> <a href="{{ route('users-delete',$data->id) }}"><img src="{{URL::asset('/resources/images/btn-delete.png')}}" alt="Edit"/></a></td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>

@endsection
