@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 }}">
                @include('share.layui-form-item', ['type' => 'select', 'name' => 'device_id', 'label' => '设备类型', 'selected_id' => $item->device_id, 'options' => $device_options])
                @include('share.layui-form-item', ['type' => 'input', 'name' => 'name', 'label' => '设备名称', 'required' => true, 'value' => $item->name])
                @include('share.layui-form-item', ['type' => 'input', 'input_type' => 'input', 'name' => 'sort', 'label' => '排序', 'required' => true, 'value' => $item->sort])
                <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