@extends('admin.layout-content')

@section('header')
    <style>

    </style>
@endsection

@section('content')
    <div class="layui-container sg-create-container">
        <div class="layui-col-sm8 layui-col-sm-offset2">
            <form class="layui-form" method="POST" action="{{ $pre_uri . 'update' }}">

                {{ csrf_field() }}
                <input type="hidden" name="id" value="{{ $item->id }}">
                <input type="hidden" name="is_root" value="1">
                @include('share.layui-form-item', ['type' => 'input', 'name' => 'name', 'label' => '用户名', 'required' => true, 'value' => $item->name])
                @include('share.layui-form-item', ['type' => 'select', 'name' => 'role_id', 'label' => '角色', 'selected_id' => $item->role_id, 'options' => $role_options])
                @include('share.layui-form-item', ['type' => 'input', 'input_type' => 'input', 'name' => 'phone', 'label' => '手机号', 'required' => true, 'value' => $item->phone])
                @include('share.layui-form-item', ['type' => 'input', 'input_type' => 'password', 'name' => 'password', 'label' => '密码', 'value' => '', 'placeholder' => '请输入密码，不修改留空'])
                @include('share.layui-form-item', ['type' => 'input', 'input_type' => 'password', 'name' => 'password_confirmation', 'label' => '确认密码', 'value' => ''])
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection

@section('footer')
    <script>
        $(function () {
            layui.use('form', function(){
                // var form = layui.form;

                // form.verify({
                //     integer: function (value) {
                //         var pattern = /^[1-9]\d*$/;
                //         if(!(pattern.test(value) || value === '0')) {
                //             return '排序必须为大于等于0的整数';
                //         }
                //     }
                // })
            });
        })
    </script>
@endsection