@extends('admin.layouts.layout')
@section('content')
    <div class="row match-height">
        <div class="col-md-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title text-primary">Páginas</h4>
                    <p class="text-muted">Cadastro de Páginas no Sistema</p>
                    <a class="btn btn-outline-primary btn-block d-grid gap-2" type="button"
                        href="{{ route('paginas.create') }}" role="button">Nova Página</a>
                </div>
                <div class="card">
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-sm table-hover">
                                <thead>
                                    <tr>
                                        <th scope="col">Código</th>
                                        <th scope="col">Descrição</th>
                                        <th scope="col">Slug</th>
                                        <th scope="col">Layout</th>
                                        <th scope="col">Ações</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($paginas as $pagina)
                                        <tr>
                                            <td scope="row">{{ $pagina->id }}</td>
                                            <td scope="row">{{ $pagina->nome }}</td>
                                            <td scope="row">{{ $pagina->slug }}</td>
                                            <td scope="row">{{ $pagina->layout }}</td>
                                            <td>
                                                <a href="{{ route('paginas.edit', ['pagina' => $pagina->id]) }}"
                                                    class="btn btn-sm btn-outline-warning">Editar</a>
                                                <form class="d-inline" method="POST"
                                                    action="{{ route('paginas.destroy', ['pagina' => $pagina->id]) }}"
                                                    onSubmit="return confirm('Tem certeza que deseja excluir?')">
                                                    @method('DELETE')
                                                    @csrf
                                                    <button class="btn btn-sm btn-outline-danger">Exluir</button>
                                                </form>
                                            </td>
                                        </tr>
                                    @endforeach

                                </tbody>
                            </table>
                        </div>
                        {{ $paginas->links('pagination::bootstrap-4') }}
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
