@extends('vip.layouts')
@section('content')

    <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post"
          eventType=eventAjaxForm>
        {!! csrf_field() !!}
        <div class="layui-form-item">
            <label class="layui-form-label">分类名称</label>
            <div class="layui-input-inline">
                <input type="text" name="name" required lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">分类代码</label>
            <div class="layui-input-inline">
                <input type="text" name="codes" required lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">分类排序</label>
            <div class="layui-input-inline">
                <input type="number" name="sort" required lay-verify="required" autocomplete="off" class="layui-input" value="0">
            </div>
            <div class="layui-form-mid layui-word-aux">*越大排位越靠前</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否显示</label>
            <div class="layui-input-block">
                <input type="radio" name="is_show" value="1" title="是" checked>
                <input type="radio" name="is_show" value="0" title="否">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否外部游戏</label>
            <div class="layui-input-block">
                <input type="radio" name="external_game" value="1" title="是">
                <input type="radio" name="external_game" value="0" title="否" checked>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角标</label>
            <div class="layui-input-block">
                <input type="radio" name="corner" value="0" title="无" checked>
                <input type="radio" name="corner" value="1" title="热门">
                <input type="radio" name="corner" value="2" title="推荐">
                <input type="radio" name="corner" value="3" title="精选">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">玩法简介</label>
            <div class="layui-input-block">
                <input type="text" name="introduction" required lay-verify="introduction" autocomplete="off" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">详细说明</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea layui-hide" name="description" lay-verify="description" id="LAY_demo_editor"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-normal">重置</button>
            </div>
        </div>
    </form>

    <script>
        //Demo
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form,
                layedit = layui.layedit;
            var editIndex = layedit.build('LAY_demo_editor',{
                uploadImage:{
                    url: '/admin/GamePlay/upload'
                }
            });
            form.verify({
                name: function(value){
                    if(value.length == 0){
                        return '标题不能为空';
                    }
                },
                code: function(value){
                    if(value.length == 0){
                        return '代码不能为空';
                    }
                },
                description: function(value){
                    layedit.sync(editIndex);
                }
            });
            //监听提交
            form.on('submit(submitForm)', function (data) {
                return true;
            });
        });

    </script>
@endsection
