@extends('layouts.admin.theme')
@section('title', env('APP_NAME') . ' :: Visite Angra - Lista de Categorias')
@section('content')

    <div class="card shadow-sm">

        @php $headLine = "<i class='fa-solid fa-layer-group fa-2x'></i> Visite Angra - Lista de Categorias"; @endphp

        @include('components.buttons._headLineButtonsBackAdd', [
            'headLine' => __($headLine),
            'routeBack' => 'admin.visiteAngra.index',
            'routeBackParams' => [], 
            'nameBack' => __("Voltar"),
            'routeAdd' => 'admin.visiteAngra.categorias.create',
            'routeAddParams' => [], 
            'nameAdd' => __('Nova categoria'),
            "permission" => "GERENCIADOR_VISITE_ANGRA",
        ])

        @include("components.cards._cardNavVisiteAngra")
        
        <div class="card-body">

            @include("errors.messageFlash")

            @include('components/forms/_filtroPesquisaDefault', [ 
                "id" => "visiteAngraListaCategorias", 
                "placeholder" => "Pesquisar por categoria..."])


            <x-tables._table :thead="['Tipo','Categoria','Status','Ações']" :pagination="$categorias->links()">
                <x-slot name="body">
                    @php $index = 0; @endphp
                     @foreach($categorias as $categoria)

                        <tr>
                            <td>
                                @include('components.tables._getEnumValue', [
                                        "EnumClass" => App\Enums\StatusTipoCategoriaVisiteAngra::cases(),
                                        "arg" => $categoria->tipo,
                                    ])
                            </td>
                            <td>{{ $categoria->categoria }}</td>
                            <td>

                                @include('components/buttons/_status', [
                                        "index" => $index,
                                        "route" => "admin.visiteAngra.categorias.status",
                                        "id" => $categoria->id,
                                        "status" => $categoria->status,
                                        "permission" => "GERENCIADOR_VISITE_ANGRA",
                                    ])

                            </td>
                            <td>
                                <div class="btn-group" role="group">

                                    @include('components/buttons/_editButton', [
                                            "route" => "admin.visiteAngra.categorias.edit",
                                            "id" => $categoria->id,
                                            "fontawesome" => null,
                                            "title" => "Editar",
                                            "permission" => "GERENCIADOR_VISITE_ANGRA",
                                        ])

                                    @include('components/buttons/_deleteButton', [
                                            "message" => "* Esta categoria será excluída e esta ação não poderá ser desfeita?",
                                            "route" => "admin.visiteAngra.categorias.destroy",
                                            "id" => $categoria->id,
                                            "fontawesome" => null,
                                            "title" => "Excluir",
                                            "permission" => "GERENCIADOR_VISITE_ANGRA",
                                        ])

                                </div>
                            </td>
                        </tr>


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

        </div>
    </div>
@endsection