@extends('layout.main')
@section('content')
    
    @if ($data)
        <div class="sixteen wide tablet fifteen wide computer column ">
            <div class="ui segment">
                
                <h4 class="ui dividing header teal centered">EDITAR DATOS DE SUCURSAL</h4>
                <br>

                <form class="ui form" id="frmEditar" autocomplete="off">
                    <input type="hidden" id="id_local" name="id_local" value="{{ $data->id_local }}">
                    
                    <div class="two fields">
                        <div class="field">
                            <label>Nombre</label>
                            <div class="ui small input">
                              <input type="text" name="nombre" maxlength="100" oninput="$.upperCase(this)" value="{{ $data->nombre }}">
                            </div>
                        </div>
                        <div class="field">
                            <label>Direccion</label>
                            <div class="ui small input">
                              <input type="text" name="direccion" maxlength="100" oninput="$.upperCase(this)" value="{{ $data->direccion }}">
                            </div>
                        </div>
                    </div>

                    <div class="two fields">
                        <div class="field">
                            <label>Telefono</label>
                            <div class="ui small input">
                              <input type="text" name="telefono" maxlength="30" value="{{ $data->telefono }}">
                            </div>
                        </div>
                        <div class="field">
                            <label>Tipo</label>
                            <select class="ui small input dropdown" name="id_tipo_local">
                                @foreach($tipo_local as $tipo)
                                    @if($tipo->id_tipo_local == $data->id_tipo_local)
                                        <option value="{{ $tipo->id_tipo_local }}" selected> {{ $tipo->nombre }} </option>
                                    @else
                                        <option value="{{ $tipo->id_tipo_local }}"> {{ $tipo->nombre }} </option>
                                    @endif
                                @endforeach
                            </select>  
                        </div>
                    </div> 


                    @if (Auth::guard("usuario")->user()->id_rol == 1)
                    <div class="two fields">
                        <div class="field">
                            <label>Serie Factura (no modificar)</label>
                            <div class="ui small {{ $data->id_local == 1 ? '' : 'disabled'}} input">
                              <input type="text" name="serie_factura" maxlength="5" oninput="$.upperCase(this)"  value="{{ $data->serie_factura }}">
                            </div>
                        </div>
                        <div class="field">
                            <label>Serie Boleta (no modificar)</label>
                            <div class="ui small {{ $data->id_local == 1 ? '' : 'disabled'}} input">
                              <input type="text" name="serie_boleta" maxlength="5" oninput="$.upperCase(this)"  value="{{ $data->serie_boleta }}">
                            </div>
                        </div>
                    </div> 
                    <div class="two fields">
                        <div class="field">
                            <label>Serie Guia de Remision (no modificar)</label>
                            <div class="ui small {{ $data->id_local == 1 ? '' : 'disabled'}} input">
                              <input type="text" name="serie_guia" maxlength="5" oninput="$.upperCase(this)"  value="{{ $data->serie_guia }}">
                            </div>
                        </div>
                    </div> 
                    @endif
                        
                    <div class="form_footer">
                        <a class="ui left floated default button" href="{{ URL::previous() }}"><i class="arrow left icon"></i>REGRESAR</a>
                        <div class="ui right floated primary button btn_guardar"><i class="save icon"></i>GUARDAR</div>
                    </div>    
                </form>

            </div>
        </div>

        <!--start update modal -->
        <div class="ui small basic modal" id="update_modal">
            <div class="ui icon header"><i class="paper plane icon"></i>Guardar cambios</div>
            <div class="content" style="text-align: center; font-size: 16px">
              <p>¿Está seguro que quiere guardar los cambios que hizo?</p>
            </div>
            <div class="actions">
                <div class="ui red basic cancel inverted button" title="Haga clic para salir"><i class="remove icon"></i>Cancelar</div>
                <div class="ui green ok inverted button" title="Haga clic para guardar cambios"> <i class="checkmark icon"></i>Guardar</div>
            </div>
        </div>
        <!--end update modal -->

    @else
        <div class="sixteen wide tablet fifteen wide computer column ">
            <div class="ui segment">
                <h3 class="ui header black centered">No se encuentra el registro que desea editar</h3>
            </div>
        </div>    
    @endif

@stop

@section('scripts')
    <script src="{{ asset('js/local/editar.js') }}"></script>
@stop


