<section class="content">
    <div class="row">
        <!-- left column -->
        <div class="col-md-12">
            <!-- general form elements -->
            <div class="box box-primary"  style="padding:0 10%">
                <div class="box-header with-border">
                    <h3 class="box-title">{{$title}}</h3>
                </div>
                <!-- /.box-header -->

                <!-- form start -->
                <form role="form" class="data_forum">
                    <div class="box-body">
                        <div class="form-group">
                            <label>用&ensp;户&ensp;名</label>
                            <input type="text" name="username" value="{{$user.username}}" placeholder="请输入用户名"  class="form-control"  />
                        </div>

                        <div class="form-group">
                            <label>昵&emsp;称</label>
                            <input type="text" name="nickname" value="{{$user.nickname}}" class="form-control" placeholder="请输入昵称">
                        </div>

                        <div class="form-group">
                            <label>密&emsp;码</label>
                            <input type="password" name="password" class="form-control" placeholder="请输入密码">
                        </div>

                        <div class="form-group">
                            <label>确认密码</label>
                            <input type="password" name="checkpassword" class="form-control" placeholder="请重复密码">
                        </div>

                        <div class="form-group">
                            <label>用&ensp;户&ensp;组</label>
                            <select class="form-control" name="groupid">
                                {{loop $group $val}}
                                <option value="{{$val.id}}" {{if $user['groupid'] == $val['id'] }}selected{{/if}}>{{$val.name}}</option>
                                {{/loop}}
                            </select>

                        </div>

                        <div class="form-group">
                            <label>备注</label>
                            <textarea class="form-control" name="remark">{{$user.remark}}</textarea>
                        </div>
                        <input type="hidden" name="id" value="{{$user.id}}" />

                    </div>
                    <!-- /.box-body -->
                </form>
            </div>
            <!-- /.box -->
        </div>
        <!-- /.row -->
    </div>
</section>

<script>
    require(['validate', 'cml'], function() {
        $(".data_forum").validate({
            rules:{
                username:{
                    required: true,
                    minlength:3,
                    maxlength:10
                },
                nickname:{
                    required: true,
                    minlength:3,
                    maxlength:20
                }
            },
            errorClass: "help-block",
            errorElement: "span",
            highlight:function(element, errorClass, validClass) {
                $(element).parents('.form-group').addClass('has-error');
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).parents('.form-group').removeClass('has-error');
                $(element).parents('.form_group').addClass('has-success');
            }
        });
    });
</script>