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

            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('routes.cate_id') }}:</label>
                <div class="layui-input-block">
                  <select name="cate_id" >
                    <option value="0"></option>
                    @foreach($datas as $v)
                    @if(isset($v['id']))
                            @if($v['id']== $data['cate_id'])
                                <option selected = "selected" value="{{$v['id']}}">{{$v['name']}}</option>
                            @else
                                <option value="{{$v['id']}}">{{$v['name']}}</option>
                            @endif
                        @else
                            <option value="" disabled>{{$v}}</option>
                        @endif
                      <!-- <option selected = "selected" value="{{$v['id']}}">{{ $v['name'] }}</option> -->
                    @endforeach
                  </select>
                </div>
              </div>

			             <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('routes.rdesc') }}:</label>
                <div class="layui-input-block">
                <textarea type="text" name="rdesc"  style="width: 100%;height: 150px;" id="rdesc"  required  lay-verify="" placeholder="" autocomplete="off" class="layui-input">@isset($data) {{ $data['rdesc'] }} @endisset</textarea>
                </div>
            </div>

			      <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('routes.remark') }}:</label>
                <div class="layui-input-block">
                <textarea  name="remark"   id="remark"  style="width: 100%;height: 150px;"  lay-verify="" placeholder="" autocomplete="off" class="layui-input" >@isset($data) {{ $data['remark'] }} @endisset </textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('routes.ip') }}:</label>
                <div class="layui-input-block">
                <input  name="ip"   id="ip"    lay-verify="" placeholder="" autocomplete="off" class="layui-input" value="@isset($data) {{ $data['ip'] }} @endisset">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('routes.url') }}:</label>
                <div class="layui-input-block">
                <input  name="url"   id="url"    lay-verify="" placeholder="" autocomplete="off" class="layui-input" value="@isset($data) {{ $data['url'] }} @endisset">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('routes.sort') }}:</label>
                <div class="layui-input-block">
                 <input name="sort"   id="sort"    lay-verify="" placeholder="" autocomplete="off" class="layui-input" value="@isset($data) {{ $data['sort'] }} @endisset">
                </div>
            </div>


@if(S('ACTION')!='view')
  <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-primary">重置</button>
    </div>
  </div>
@endif
</form>

<script>
//Demo
layui.use(['form'], function(){
  var form = layui.form;

  //监听提交
  form.on('submit(submitForm)', function(data){
    return true;
  });
});
function cbFormSuccess(data){
	layer.msg(data.msg);
	setTimeout(function(){
    window.location.href='/admin/Routes/index';
		// parent.window.location.reload();
	},2500);
}
lay('.test-item').each(function(){
    laydate.render({
        elem: this
        ,type: 'datetime'
        ,trigger: 'click'
    });
});
</script>
@endsection
