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

    <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
        {!! csrf_field() !!}
        <input type="hidden" name="type" value="{{isset(
      $type)?$type:$data['type']}}">
        <div class="layui-form-item">
            <label class="layui-form-label">{{ trans('notice.banner_link') }}</label>
            <div class="layui-input-block">
                <input type="text" name="banner_link" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset(
      $data['banner_link'])?$data['banner_link']:''}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">{{ trans('notice.banner_name') }}</label>
            <div class="layui-input-block">
                <input type="text" name="banner_name" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset(
      $data['banner_name'])?$data['banner_name']:''}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">{{ trans('notice.sort') }}</label>
            <div class="layui-input-block">
                <input type="text" name="sort" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset(
      $data['sort'])?$data['sort']:''}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">{{ trans('notice.banner_url') }}</label>
            <div class="layui-input-block">
                <input type="text" name="banner_url" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset(
      $data['banner_url'])?$data['banner_url']:''}}">
            </div>
        </div>

            <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>



        {{--@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--}}

        <br/><br/>
        <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(){
		//parent.window.location.reload();
        window.location.href="/admin/Banner/index?type="+{{isset(
      $type)?$type:$data['type']}};
	},2500);
}
    </script>
@endsection
