@extends('adminlte::page')

@section('title', 'Listado de Usuarios')

@section('content_header')
    <h1>Listado de Usuarios</h1>
@stop

@section('content')
    <div class="row">
        <div class="col-xl-12">
            <div class="card">
                <div class="card-body">
                    <div class="text-right p-4">
                        <a href="{{route('administrations.users.create')}}" class="btn btn-success"><i class="fas fa-fw  fa-plus"></i> Nuevo Usuario</a>
                    </div>
                    <div class="table-responsive">
                        <table class="table  table-bordered table-striped table-hover table-s table-list" id="table-list">
                            <thead  class="thead-dark">
                                <tr>
                                    <th width="10">N</th>
                                    <th>Email</th>
                                    <th>Nombres</th>
                                    <th>Apellidos</th>
                                    <th>Rol</th>
                                    <th width="80">Foto</th>
                                    <th width="80">Estado</th>
                                    <th width="120">Fecha Creación</th>
                                    <th width="70"></th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach ($users as $user)
                                <tr>
                                    <td class="text-right">{{ $loop->iteration}}</td>
                                    <td>{{ $user->email}}</td>
                                    <td>{{ $user->person->names}}</td>
                                    <td>{{ $user->person->last_name." ".$user->person->mother_last_name }}</td>
                                    <td>{{ $user->role->name}}</td>
                                    <td class="text-center">
                                        @if (!is_null($user->profile_photo_path) && !empty($user->profile_photo_path))
                                            <img src="{{ asset('storage/'.$user->profile_photo_path)}}" class="img img-thumbnail" width="80">
                                        @endif
                                    </td>
                                    <td class="text-center"><span class="badge badge-pill badge-{{ $user->activated?'success':'dark'}}">{{ $user->activated?'Activo':'Desactivado'}}</span></td>
                                    <td>{{ $user->created_at}}</td>
                                    <td>
                                        <a href="{{ route('administrations.users.show',$user->id)}}" class="btn btn-xs btn-light viewdata"><i class="fas fa-fw  fa-eye" title="Ver"></i></a>

<a href="{{ route('administrations.siatusers.destroy',$user->id)}}" class="btn btn-xs btn-danger deletelink" title="Eliminar" data-title-delete="¿Esta seguro de eliminar el Usuario: {{mb_strtoupper($user->person->last_name." ".$user->person->mother_last_name. " ".$user->person->names)}}? " ><i class="fas fa-fw  fa-trash" title="Ver"></i></a>                                        

                                        <a href="{{ route('administrations.users.destroy',$user->id)}}" class="btn btn-xs btn-danger deletelink" title="Eliminar" data-title-delete="¿Esta seguro de eliminar el Usuario: {{mb_strtoupper($user->person->last_name." ".$user->person->mother_last_name)}}? <br><br> Recuerde que todos los datos registrados con este usuario podrían no estar disponible" ><i class="fas fa-fw  fa-trash" title="Ver"></i></a>
                                        {{-- <a href="" class="btn btn-xs btn-danger"><i class="fas fa-fw  fa-trash"></i></a> --}}
                                    </td>
                                </tr>
                                @endforeach

                            </tbody>
                        </table>
                    </div>
            </div>
            </div>
        </div>

    </div>
@stop

@section('css')

@stop

@section('js')
@stop
