@extends('layouts.app')

@section('style')

@endsection
@section('content')
    <?php
    if( $user_edit->active == 1){
        $active = 'si';
    }else{
        $active = 'no';
    }
    $select = ['no','si'];
    ?>

    <div class="alert alert-success" role="alert" style="display: none">...</div>

    @if(session()->has('message'))

        <div class="alert alert-success alert-dismissable">
            <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>

            {{ session()->get('message') }}
        </div>

    @endif
    <div class="panel panel-default center-block " style="width: 60%;padding: 2%; margin-top: 5%" >

        <h3 class="text-center" >{{$user_edit->name}}</h3>

        <form action="{{URL::to('/')}}/admin/user/update" method="POST" style="padding: 4%; margin-top: 5%">
            <div class="form-group">
                <label >Nombre</label><br>
                <input type="text" name="name" value="{{old('name', $user_edit->name) }}">
            </div>
            <div class="form-group">
                <label for="">Apellido </label><br>

                <input type="text" name="surname" value="{{old('surname',$user_edit->surname)}}">
            </div>
            <div class="form-group">
                <label for="">Email</label><br>
                <input type="text" name="email"  value="{{ old('email',$user_edit->email )}}">
            </div>
            <div class="form-group">

                <label for="">Active</label><br>

                    <select  class="js-example-data"  name="active"  style="width: 10%;border-radius: 5%">
                    {{--<option value="">Seleccione estado...</option>--}}
                    @foreach($select as $key => $s)

                        <option value="{{$key}}"

                                @if ($active == $s)
                                selected="selected"

                            @endif
                            >{{$s}}</option>

                    @endforeach

                </select>

            </div>
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <input type="hidden" name="id" value="{{ $user_edit->id }}">


            <button type="button" onclick="form.submit()" class="btn btn-default" name="submit_1">Guardar</button>

        </form>
    </div>
    @endsection