@extends('layouts.index')
@section('contenido')
<div class="content">
	<div class="card">
		<div class="card-header header-elements-inline">
			<h5 class="card-title">EDITAR CÓDIGO POSTAL</h5>
			<div class="header-elements">
				<div class="list-icons">
				    <a class="list-icons-item" data-action="collapse"></a>
				</div>
			</div>
		</div>

		<div class="card-body">
			<form action="{{ route('codigo.actualizar',$codigo->id) }}" method="POST">
                @csrf
                <fieldset>
                    <div class="collapse show">
                        <div class="form-group">
                            <label>Seleccione país</label>
                            <select class="form-control" name="id_pais">
                                @foreach ($paises as $pais)
                                    <option {{ $codigo->id_pais == $pais['id'] ? "selected" : "" }} value="{{$pais['id']}}">{{$pais['descripcion_pais']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Seleccione departamento</label>
                            <select class="form-control" name="id_departamento">
                                @foreach ($departamentos as $departamento)
                                    <option {{ $codigo->id_departamento == $departamento['id'] ? "selected" : "" }} value="{{$departamento['id']}}">{{$departamento['descripcion_departamento']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Seleccione municipio</label>
                            <select class="form-control" name="id_municipio">
                                @foreach ($municipios as $municipio)
                                    <option {{ $codigo->id_municipio == $municipio['id'] ? "selected" : "" }} value="{{$municipio['id']}}">{{$municipio['descripcion_municipio']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Seleccione región</label>
                            <select class="form-control" name="id_region">
                                @foreach ($regiones as $region)
                                    <option {{ $codigo->id_region == $region['id'] ? "selected" : "" }} value="{{$region['id']}}">{{$region['descripcion_region']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Seleccione gira</label>
                            <select class="form-control" name="id_gira">
                                @foreach ($giras as $gira)
                                    <option {{ $codigo->id_gira == $gira['id'] ? "selected" : "" }} value="{{$gira['id']}}">{{$gira['descripcion_gira']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Seleccione zona</label>
                            <select class="form-control" name="id_zona">
                                @foreach ($zonas as $zona)
                                    <option {{ $codigo->id_zona == $zona['id'] ? "selected" : "" }} value="{{$zona['id']}}">{{$zona['descripcion_zona']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Ingrese código postal*</label>
                            <input type="text" class="form-control" name="descripcion" value="{{$codigo->descripcion_zona_codigo_postal}}" placeholder="" required>
                        </div>
                    </div>
                </fieldset>

				<div class="text-right">
					<button type="submit" class="btn btn-primary">Actualizar código postal<i class="icon-floppy-disk ml-2"></i></button>
				</div>
            </form>

		</div>
	</div>
</div>

@endsection

@section('javascript')
<script>
    jQuery( document ).ready(function() {

    });
</script>
@endsection
