@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">Comentários</h4>
                    <p class="text-muted">Cadastro de Comentários no Sistema</p>
                    <div class="card">
                        <div class="card-body">

                            <!-- Table -->
                            <div class="table-responsive">
                                <table class="table table-sm table-hover">
                                    <thead>
                                        <tr>
                                            <th scope="col">Código</th>
                                            <th scope="col">Autor</th>
                                            <th scope="col">E-Mail</th>
                                            <th scope="col">Comentário (suprimido)</th>
                                            <th scope="col">Ativo</th>
                                            <th scope="col">Ações</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach ($comentarios as $comentario)
                                            <tr>
                                                <td scope="row">{{ $comentario->id }}</td>
                                                <td scope="row">{{ $comentario->autor }}</td>
                                                <td scope="row">{{ $comentario->comentario }}</td>
                                                <td scope="row">{{ $comentario->email }}</td>
                                                <td scope="row">{{ $comentario->ativo }}</td>
                                                <td>
                                                    <a href="{{ route('comentarios.edit', $comentario->id) }}"
                                                        class="btn btn-sm btn-outline-warning">Editar</a>
                                                    <form class="d-inline" method="POST"
                                                        action="{{ route('comentarios.destroy', $comentario->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>
                            {{ $comentarios->links() }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
