<div class="form-group row">
    <div class="col-md-6">
    {!! html()->label( 'Nom','name') !!}
    {!! html()->text('name', null)->attributes([($mode=="show"?'disabled':''), 'placeholder' => 'Nom','class' => 'form-control text-uppercase']) !!}
    </div>

</div>


<div class="form-group row">
    <div class="col-md-6">
    {!! html()->label( 'Email','email') !!}
    {!! html()->email('email', null)->attributes([($mode=="show"?'disabled':''), 'placeholder' => 'Email','class' => 'form-control text-lowercase']) !!}
    </div>
</div>


<div class="form-group row">
    <div class="col-md-4">
    {!! html()->label( 'Mot de passe','password') !!}
    {!! html()->password('password', null)->attributes([($mode=="show"?'disabled':''), 'placeholder' => 'Mot de passe','class' => 'form-control text-lowercase']) !!}
    </div>
</div>

<div class="form-group row">
    <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
        {!! html()->checkbox('change_pwd', null)->attributes([($mode=="show"?'disabled':''),'id' => 'change_pwd', 'class' => 'custom-control-input']) !!}
        <label class="custom-control-label" for="change_pwd">Changer à la prochaine connexion</label>
    </div>
</div>

<div class="form-group row">
    <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
        {!! html()->checkbox('actif', null)->attributes([($mode=="show"?'disabled':''),'id' => 'actif', 'class' => 'custom-control-input']) !!}
        <label class="custom-control-label" for="actif">Actif</label>
    </div>
</div>

<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            {!! html()->label( 'Rôles','roles') !!}
            <select id="users_role" name="users_role[]" class="select2"
                multiple="" data-placeholder="Choisissez un rôle..." style="width: 100%;" data-select2-id="8" {{ ($mode=="show"?'disabled':'') }} >
                    @foreach($liste_roles as $role=>$nom_role)
                        <option
                            {!! (in_array($nom_role,$t_getroles)?"selected":"") !!}
                            value="{!! $nom_role !!}">{!! $nom_role !!}
                        </option>
                    @endforeach
            </select>
        </div>
    </div>
</div>

<div class='form-group'>
    @if($mode=="show")
        @if($user_sel->IsModifiable) <a class="btn btn-primary" href="{!! url('users/'.$user_sel->id.'/edit') !!}" id="btn_modifier">Modifier</a>@endif
    @else
        {!! html()->button('Enregistrer')->value('Enregistrer')->type('submit')->attributes(['class' => 'btn btn-primary']) !!}
    @endif

    @if(($mode=="show") && $user_sel->IsSupprimable)
        {{ html()->form('DELETE', url('/users/'. $user_sel->id))->open() }}
        &nbsp;<button class="btn btn-danger" onclick="if(!confirm('Voulez-vous vraiment supprimer cet utilisateur ?')) return false;">Supprimer</button>
        {{ html()->form()->close() }}
    @endif


    &nbsp;<a class="btn btn-warning"  href="{!! url('users/') !!}">Retour</a>
</div>

