@extends('layouts.admin.theme')
@section("title", env("APP_NAME") . " :: Lista de Guias Turísticos")
@section('content')

    <div class="card shadow-sm">
        
        @php $headLine = "<i class='fa-solid fa-left-right'></i> Lista de Usuário"; @endphp
        
        @include('components.buttons._headLineButtonsBackAdd', [
            'headLine' => __($headLine),
            'routeAdd' => 'admin.guias.verify',
            'routeAddParams' => [], 
            'nameAdd' => __('Novo guia turísitico'),
            "permission" => "GERENCIADOR_DE_GUIAS_TURISTICOS",
        ])
        
        <div class="card-body">
            
            @include("errors.messageFlash")

            @include('components/forms/_filtroPesquisaDefault', [ 
                "id" => "turismoNauticoNovoGuiaTuristico", 
                "placeholder" => "Pesquisar por guia turísitico..."
            ])


            <x-tables._table :thead="['#', 'Criado em', 'Usuário', 'CPF', 'E-mail', 'Status', 'Ações']" :pagination="$guias->links()">
                <x-slot name="body">
                    @php $index = 0; @endphp
                    @foreach($guias as $guia)
                        <tr>
                            <td style="width: 150px">
                                @include('components.tables._openPhoto',[
                                    'asset' => $guia->user->photo,
                                    'alt' => $guia->user->firstName." ".$guia->user->lastName,
                                    'title' => $guia->user->firstName." ".$guia->user->lastName,
                                    'text' => 'Visualizar foto',
                                    'index' => $index,
                                    'style' => "width: 200px",
                                ])
                            </td>
                            <td>{{ date("d/m/Y H:m", strtotime($guia->created_at)) }}</td>
                            <td>
                                <strong>Nome: </strong>{{ $guia->user->firstName }} {{ $guia->user->lastName }}<br>
                                <strong>Pertence a: </strong>{{ $guia->pertence->name }}<br>
                            </td>
                            <td>{{ $guia->user->cpf }}</td>
                            <td>{{ $guia->user->email }}</td>
                            <td class="text-center align-middle">
                                @include('components/buttons/_status', [
                                    "index" => $index,
                                    "route" => "admin.guias.status",
                                    "id" => $guia->id,
                                    "status" => $guia->status,
                                    "permission" => "GERENCIADOR_DE_GUIAS_TURISTICOS",
                                ])
                            </td>
                            <td>
                                <div class="btn-group" role="group">
                                    @include('components/buttons/_editButton', [
                                        "route" => "admin.guias.edit",
                                        "id" => $guia->id,
                                        "fontawesome" => null,
                                        "title" => "Editar",
                                        "permission" => "GERENCIADOR_DE_GUIAS_TURISTICOS",
                                    ])


                                    @include('components/buttons/_deleteButton', [
                                        "message" => "* Este guia turístico será excluído e esta ação não poderá ser desfeita?",
                                        "route" => "admin.guias.destroy",
                                        "id" => $guia->id,
                                        "fontawesome" => null,
                                        "title" => "Excluir",
                                        "permission" => "GERENCIADOR_DE_GUIAS_TURISTICOS",
                                    ])
                                </div>
                            </td>

                        </tr>
                        @php $index++; @endphp
                    @endforeach
                </x-slot>
            </x-tables._table>
            
        </div>
    </div>
@endsection