@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-block">
                <input type="text" name="title" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset(
      $data['title'])?$data['title']:''}}">
            </div>
        </div>


        <label class="layui-form-label">{{ trans('notice.type') }}</label>
        <div class="layui-input-block">
            <select name="type" id="type" lay-verify="" autocomplete="off" eventType="event-query"  value="{{isset(
      $data['type'])?$data['type']:''}}" class="layui-input">
                <option value="">{{ trans('menu.select_menutype') }}</option>
                @foreach(trans('status.advert') as $k=>$v):
                @if(!empty($data['type']))
                    @if($k == $data['type'])
                        <option selected = "selected" value="{{$k}}">{{$v}}</option>
                    @else
                        <option value="{{$k}}">{{$v}}</option>
                    @endif
                @else
                    <option value="{{$k}}">{{$v}}</option>
                @endif
                @endforeach
            </select>
        </div>

        <br/>

        <label class="layui-form-label">{{ trans('notice.status') }}</label>
        <div class="layui-input-block">
            <select name="status" id="status" lay-verify="" autocomplete="off" eventType="event-query"  value="{{isset(
      $data['status'])?$data['status']:''}}" class="layui-input">
                <option value="">{{ trans('menu.select_menutype') }}</option>
                @foreach(trans('status.system_user.status') as $k=>$v):
                @if(!empty($data['status']))
                    @if($k == $data['status'])
                        <option selected = "selected" value="{{$k}}">{{$v}}</option>
                    @else
                        <option value="{{$k}}">{{$v}}</option>
                    @endif
                @else
                    <option value="{{$k}}">{{$v}}</option>
                @endif
                @endforeach
            </select>
        </div>

        <br/>
        {{--@if(isset($select))--}}
        {{--<div class="layui-form-item">--}}
            {{--<label class="layui-form-label">发送选择类型</label>--}}
            {{--<div class="layui-input-block">--}}
                {{--<select name="type" id="testSelect">--}}
                    {{--<option  value="">请选择</option>--}}
                    {{--<option  value="1" selected>在线会员</option>--}}
                    {{--<option  value="2">所以会员</option>--}}
                    {{--<option  value="3">会员组</option>--}}
                    {{--<option  value="4">自己选择</option>--}}
                {{--</select>--}}
            {{--</div>--}}
        {{--</div>--}}
        {{--@endif--}}

        <div class="layui-form-item">
            <div class="layui-input-block">
                @if(!isset($data['toname']))
                @if(checkRriv('/admin/Message/view'))<button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>@endif
                <button type="reset" class="layui-btn layui-btn-normal">重置</button>
                    @else

                @endif
            </div>
        </div>


    </form>

    <script>

        //Demo
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;

            var editIndex = layedit.build('LAY_demo_editor');
            form.verify({
                title: function(value){
                    if(value.length < 5){
                        return '标题至少得5个字符啊';
                    }
                }
                ,pass: [/(.+){6,12}$/, '密码必须6到12位']
                ,content: function(value){
                    layedit.sync(editIndex);
                }
            });
            //监听提交
            form.on('submit(submitForm)', function (data) {
                return true;
            });


        });
        //创建一个编辑器
function cbFormSuccess(data){
	layer.msg(data.msg);
	setTimeout(function(){
        window.location.href='/admin/Advert/index';
		//parent.window.location.reload();
	},2500);
}
    </script>
@endsection
