@extends('admin.layouts.layout')

@section('title', 'Editando Secretário')

@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 Secretário</h4>
                    <span>Editando Secretário no Sistema</span>
                    <a class="btn btn-outline-primary btn-block d-grid gap-2" type="button"
                        href="{{ route('secretarios.index') }}" role="button">Ver todos</a>
                </div>
                <div class="card">
                    <div class="card-body">
                        <form action="{{ route('secretarios.update', $secretario->id) }}" method="POST"
                            class="form-horizontal" enctype="multipart/form-data">
                            @method('PUT')
                            @csrf
                            <div class="box box-info">
                                <div class="form-group">
                                    <label class="col-form-label">Nome <span>*</span></label>
                                    <input type="text" name="nome" value="{{ $secretario->nome }}"
                                        class="form-control @error('nome') is-invalid @enderror">
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <label class="col-form-label">Designação </label>
                                        <select name="id_cargo"
                                            class="form-control @error('id_cargo') is-invalid @enderror">
                                            @foreach ($cargos as $cargo)
                                                <option value="{{ $cargo->id }}"
                                                    {{ $secretario->id_cargo == $cargo->id ? 'selected' : '' }}>
                                                    {{ $cargo->descricao }}
                                                </option>
                                            @endforeach
                                        </select>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="col-form-label">Foto principal <span>*</span></label>
                                        <input type="file" name="foto" value="{{ $secretario->foto }}"
                                            class="form-control @error('foto') is-invalid @enderror">
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <label class="col-form-label">Detalhes </label>
                                        <input type="text" name="detalhes" value="{{ $secretario->detalhes }}"
                                            class="form-control @error('detalhes') is-invalid @enderror">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="col-form-label">Facebook </label>
                                        <input type="text" name="facebook" value="{{ $secretario->facebook }}"
                                            class="form-control @error('facebook') is-invalid @enderror">
                                    </div>                                                                    
                                </div>                               
                                <div class="row">
                                    <div class="col-md-6">
                                        <label class="col-form-label">Instagram </label>
                                        <input type="text" name="instagram" value="{{ $secretario->instagram }}"
                                            class="form-control @error('instagram') is-invalid @enderror">
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="col-form-label">Twitter </label>
                                        <input type="text" name="twitter" value="{{ $secretario->twitter }}"
                                            class="form-control @error('twitter') is-invalid @enderror">
                                    </div>  
                                </div>
                            </div>

                            <div class="form-row">
                                <div class="form-group col-md-1">
                                    <label class="col-form-label">Ativo</label><br>
                                    <label class="radio-inline">
                                        <input type="radio" name="status" value="S" checked>Sim
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="status" value="N">Não
                                    </label>
                                </div>
                            </div>
                            <h3 class="seo-info">SEO Informações</h3>
                            <div class="form-group">
                                <label class="col-form-label">Meta Título </label>
                                <input type="text" class="form-control @error('titulo') is-invalid @enderror"
                                    name="titulo" value="{{ $secretario->titulo }}">
                            </div>
                            <div class="form-group">
                                <label class="col-form-label">Meta Keywords </label>
                                <textarea type="text" class="form-control @error('keyword') is-invalid @enderror" name="keyword" rows="2"
                                    value="{{ $secretario->keyword }}"></textarea>
                            </div>
                            <div class="form-group">
                                <label class="col-form-label">Meta Descrição </label>
                                <textarea type="text" class="form-control @error('descricao') is-invalid @enderror" name="descricao" rows="2"
                                    value="{{ $secretario->descricao }}"></textarea>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-outline-success btn-sm btn-block"
                                    name="form1">Gravar</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
