@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">Cadastrando Agente Político</h4>
                    <p class="text-muted">Cadastrando Agente Político no Sistema</p>
                    <a class="btn btn-outline-primary btn-block d-grid gap-2" type="button"
                        href="{{ route('agentespoliticos.index') }}" role="button">Ver todos</a>
                </div>
                <div class="card">
                    <div class="card-body">
                        <form action="{{ route('agentespoliticos.store') }}" method="POST" class="form-horizontal"
                            enctype="multipart/form-data">
                            @csrf
                            <div class="box box-info">
                                <!-- Nome -->
                                <div class="row">
                                    <div class="form-group col-md-10">
                                        <label class="col-form-label">Nome <span>*</span></label>
                                        <input type="text" name="nome" value="{{ old('nome') }}"
                                            class="form-control @error('nome') is-invalid @enderror">
                                    </div>
                                    <!-- Status -->
                                    <div class="col-md-2">
                                        <label class="col-form-label">Ativo</label><br>
                                        <label class="radio-inline">
                                            <input type="radio" name="status" value="S"
                                                {{ old('status', 'S') == 'S' ? 'checked' : '' }}> Sim
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="status" value="N"
                                                {{ old('status') == 'N' ? 'checked' : '' }}> Não
                                        </label>
                                    </div>
                                </div>
                                <!-- Cargo -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <label class="col-form-label">Cargo </label>
                                        <select class="form-control @error('id_cargo') is-invalid @enderror"
                                            name="id_cargo">
                                            <option value="">Selecione</option>
                                            @foreach ($cargos as $cargo)
                                                <option value="{{ $cargo->id }}"
                                                    {{ old('id_cargo') == $cargo->id ? 'selected' : '' }}>
                                                    {{ $cargo->descricao }}
                                                </option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                <!-- Foto -->
                                <div class="form-group">
                                    <label class="col-form-label">Foto</label>
                                    <input type="file" name="foto"
                                        class="form-control @error('foto') is-invalid @enderror">
                                </div>
                                <!-- Contato -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <label class="col-form-label">Telefone</label>
                                        <input type="text" name="telefone" value="{{ old('telefone') }}"
                                            class="form-control @error('telefone') is-invalid @enderror">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="col-form-label">E-mail</label>
                                        <input type="email" name="email" value="{{ old('email') }}"
                                            class="form-control @error('email') is-invalid @enderror">
                                    </div>
                                </div>
<br>
                                <!-- Submit Button -->
                                <div class="form-group">
                                    <button type="submit" class="btn btn-outline-success btn-sm w-100"
                                        name="form1">Gravar</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
