@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">
      <select style="width: 100px;" id="game" lay-filter="game" name="game">
        @foreach($data['gameList'] as $k=>$v):
            <option value="{{$v['table_name']}}">{{$v['name']}}</option>
        @endforeach
      </select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">起始期号</label>
    <div class="layui-input-inline" style="width: 250px;">
      <input type="text" name="start_code" maxlength="15" lay-verify="" placeholder="请输入起始期号" autocomplete="off" class="layui-input" value="">
    </div>
    <div style="margin-left: 110px;" class="layui-form-mid layui-word-aux"><font color="red">注意：起始期号只能为数字</font></div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">起始时间</label>
    <div class="layui-input-inline">
      <input type="text" name="start_date" class="layui-input" id="form_start_date" placeholder="-" value="">
    </div>
    <div style="margin-left: 110px;" class="layui-form-mid layui-word-aux"><font color="red">注意：时间格式务必填写正确，如2014-10-10</font></div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-block">
      <select style="width: 100px;" id="status" lay-filter="game" name="status">
          <option value="1" selected="selected">启用</option>
          <option value="2">禁用</option>
      </select>
    </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'], function(){
    var form = layui.form;
    //监听提交
    form.on('submit(submitForm)', function(data){
      return true;
    });

    layui.use('laydate', function(){
      var laydate = layui.laydate;
      
      //时间选择器
      laydate.render({
        elem: '#form_start_date'
        ,type: 'date'
      });
    });
  });

    function cbFormSuccess(data) {
        if(data.status==1){
          var a = layer.alert('本日的修改成功，将在明日的生成期号上生效', {}, function () {
            var index = parent.layer.getFrameIndex(window.name); 
            parent.layer.close(index); //再执行关闭
            parent.window.location.reload();
          });
        }else{
          var a = layer.alert(data.msg, {}, function () {
            var index = parent.layer.getFrameIndex(window.name); 
            parent.layer.close(index); //再执行关闭
            parent.window.location.reload();
            //window.history.go(-1);
            //window.location.href='/admin/Setstartcode/index';
          });
        }
    }
</script>
@endsection
