@extends('flatlab::layout')

@section('header_title')
    {{ __('flatlab::core.title') }}
@endsection

@section('main-content')
<div class='col-lg-6 col-lg-offset-3'>
    <div class="panel">
        <div class="panel-heading">
            <h3><i class='fa fa-user-plus'></i> Editar Usuario: {{ $user->name }}</h3>
        </div>
        <div class="panel-body">
            {{ Form::model($user, array('route' => array('users.update', $user->id), 'method' => 'PUT')) }}{{-- Form model binding to automatically populate our fields with user data --}}

                <div class="form-group">
                    {{ Form::label('name', 'Name') }}
                    {{ Form::text('name', null, array('class' => 'form-control')) }}
                </div>

                <div class="form-group">
                    {{ Form::label('email', 'Email') }}
                    {{ Form::email('email', null, array('class' => 'form-control')) }}
                </div>

                <h5>Roles Disponibles</b></h5>
                @foreach ($roles as $role)
                    {{ Form::checkbox('roles[]',  $role->id, $user->roles ) }}
                    {{ Form::label($role->name, ucfirst($role->name)) }}<br>
                @endforeach
                <div class="form-group">
                    {{ Form::label('password', 'Contraseña') }}<br>
                    {{ Form::password('password', array('class' => 'form-control')) }}

                </div>

                <div class="form-group">
                    {{ Form::label('password', 'Confirmar Contraseña') }}<br>
                    {{ Form::password('password_confirmation', array('class' => 'form-control')) }}
                </div>

                {{ Form::submit('Guardar Usuario', array('class' => 'btn btn-primary')) }}

            {{ Form::close() }}
            <hr>
            @include('flatlab::errors.list') 
        </div>
    </div>
</div>
@endsection

@push('extra_css')
    <!-- Enviar un css a la vista principal-->
@endpush

@push('plugins_js')
    <!-- Enviar un plugin a la vista principal-->
@endpush

@push('extra_scripts')
    <!-- Enviar un script a la vista principal-->
@endpush
