@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="gamename">
        @foreach($data['gameList'] as $k=>$v):
              @if($data['game_name']==$v['gameCode'])
                  <option value="{{$v['gameCode']}}" selected="selected">{{$v['name']}}</option>
              @else
                  <option value="{{$v['gameCode']}}">{{$v['name']}}</option>
              @endif
        @endforeach
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">期数</label>

    <div class="layui-input-inline" id="info_no">
    <input type="text" name="info_no" lay-verify="" autocomplete="off"  placeholder="请输入开奖期数" class="layui-input" value="">
    </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="codes"  lay-verify="" placeholder="请输入开奖号码" autocomplete="off" class="layui-input" value="">
    </div>
    <div 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="open_time" class="layui-input" id="form_open_time" placeholder="-" value="">
    </div>
    <div class="layui-form-mid layui-word-aux"><font color="red">注意：时间格式务必填写正确，如2014-10-10 10: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="2" selected="selected">已开奖</option>
          <option value="3">投注</option>
          <option value="1">封盘</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;
    });

    function cbFormSuccess(data) {
        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/infos/index';
        });
    }

    layui.use('laydate', function(){
      var laydate = layui.laydate;
      
      //时间选择器
      laydate.render({
        elem: '#form_open_time'
        ,type: 'datetime'
      });
    });
  });
</script>
@endsection
