@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">Editando Comentário</h4>
                    <a class="btn btn-outline-primary btn-block d-grid gap-2" type="button"
                        href="{{ route('comentarios.index') }}" role="button">Ver todos</a>
                </div>
                <div class="card">
                    <div class="card-body">
                        <form action="{{ route('comentarios.update', $comentarios->id) }}" method="POST"
                            class="form-horizontal">
                            @method('PUT')
                            @csrf
                            <div class="box box-info">

                                <div class="row">
                                    <div class="form-group col-md-2">
                                        <label class="col-form-label">Notícia</label>
                                        <input type="text" name="id_noticia" value="{{ $comentarios->id_noticia }}"
                                            class="form-control @error('id_noticia') is-invalid @enderror" disabled>
                                    </div>
                                    <div class="form-group col-md-10">
                                        <label class="col-form-label">Título da Notícia</label>
                                        <input type="text" name="titulo_noticia" class="form-control" disabled>
                                    </div>
                                </div>
                                <div class="form-group col-md-12">
                                    <label class="col-form-label">Autor</label>
                                    <input type="text" name="autor" value="{{ $comentarios->autor }}"
                                        class="form-control @error('autor') is-invalid @enderror" disabled>
                                </div>
                            </div>

                            <div class="form-group" id="showPageContent">
                                <label class="col-form-label">Comentário</label>
                                <textarea type="text" class="form-control" @error('comentario') is-invalid @enderror bodyfield" rows="5"
                                    name="comentario" id="editor">{{ $comentarios->comentario }}</textarea>
                            </div>

                            <div class="row">
                                <div class="form-group col-md-10">
                                    <label class="col-form-label">Email</label>
                                    <input type="text" name="email" value="{{ $comentarios->email }}"
                                        class="form-control @error('email') is-invalid @enderror" disabled>
                                </div>

                                <div class="form-group col-md-2">
                                    <label class="control-label">Ativo</label>
                                    <select class="form-control" name="ativo" value="{{ $comentarios->ativo }}">
                                        <option value="S" @if ($comentarios['ativo'] == 'S') selected @endif>Sim
                                        </option>
                                        <option value="N" @if ($comentarios['ativo'] == 'N') selected @endif>Não
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <br>
                            <div class="form-group row">
                                <div class="col-sm-12">
                                    <input type="submit" value="Salvar"
                                        class="btn btn-sm btn-block btn-outline-success w-100">
                                </div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
