@extends('admin.master')

@section('top')
    <div class="top-breadcrumb pull-left">
        <h5>修改用户信息</h5>
        <a class="btn btn-xs btn-default goback" onclick="javascript:history.go(-1);">
            <i class="iconfont icon-back-copy"></i><span>返回</span>
        </a>
    </div>
@endsection

@section('content')
{!! Form::model($user, ['route' => ['admin.user.update', $user->id], 'method'=>'put', 'class'=>'form-horizontal form-detail']) !!}
<input type="password" value="" class="pass-hidden">
<div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="home">
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"><span class="red pl-5">*</span>名称：</label>
            <div class="col-sm-5">
                {!! Form::text('name', null, ['class'=>'form-control']) !!}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"><span class="red pl-5">*</span>账号：</label>
            <div class="col-sm-5">
              @if(auth()->user()->isMaster() || $user->username != 'admin')
                {!! Form::text('username', null, ['class'=>'form-control']) !!}
              @else
                <input class="form-control" name="username" type="text" value="{{ $user->username }}" readonly>
              @endif
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"><span class="red pl-5">*</span>邮箱：</label>
            <div class="col-sm-5">
                {!! Form::text('email', null, ['class'=>'form-control']) !!}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"><span class="red pl-5">*</span>密码：</label>
            <div class="col-sm-5">
                <input type="password" name="password" class="form-control" autocomplete="off">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"><span class="red pl-5">*</span>重复密码：</label>
            <div class="col-sm-5">
                <input type="password" class="form-control" name="password_confirmation">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"><span class="red pl-5">*</span>选择角色：</label>
            <div class="col-sm-5">
                {!! Form::select('role_id', ['' => '==请选择=='] + $roles, !$user->roles->isEmpty() ? $user->roles[0]->id : '', ['class'=>'form-control']) !!}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label label-width"></label>
            <div class="col-sm-5">
                {!! Form::submit('提交', ['class'=>'btn btn-primary']) !!}
            </div>
        </div>
    </div>
</div>
{!! Form::close() !!}
@endsection