@extends('vip.layouts')
@section('content')
    <style>
        .layui-laydate-range {
            width: auto;
        }

         .layui-table-body {
             position: relative;
             overflow: auto;
             margin-right: -1px;
         }
    </style>

    @push('dataTableJS')

        //获取表头
        var tit=function (game){
            var header=[];
            $.ajax({
                type: 'post',
                url: '/admin/Sixlottery/index?data=1&game='+ game,
                data: {},
                dataType: 'json',
                async: false,
                success: function (json) {
                header=json.data.dataCols
                }
            });
            return header;
        }

/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            game_no:$('#form_game_no').val(),
            star_time:$('#form_star_time').val(),
            end_time:$('#form_end_time').val(),
        }
      });
    }
  };
$('.lay-btn-diy').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });

  //重置表单
  $('.reset').on('click',function(){
	  $('input').val('');
	  $('#form_trade_type').val('');
	  //var type = $(this).data('type');
	  //active[type] ? active[type].call(this) : '';
  });
    //刷新表单
    $('.set').on('click',function(){
    //var type = $(this).data('type');
    //active[type] ? active[type].call(this) : '';
    });*/
    @endpush
    <script type="text/html" id="taked">
        <!-- 这里的 checked 的状态只是演示 -->
		@{{#if(d.status==1){ }}
			<p style="color:green;">{{trans('status.game.status')[1]}}</p>
		@{{#}else{ }}
			@{{#if(d.status==2){ }}
				<p style="color:red;">{{trans('status.game.status')[2]}}</p>
			@{{#}else{ }}
				 <p style="color:#00868B;">{{trans('status.game.status')[3]}}</p>
			@{{#} }}
		@{{#} }}
    </script>
    <script type="text/html" id="editinfo">
      <a class="layui-btn layui-btn-primary layui-btn-xs edit" lay-event="detail" pid="identity" uri="/admin/SixlotteryTime/edit?identity=" href="/admin/SixlotteryTime/edit?identity= @{{d.identity}}&game={{$game}}"> 修改 </a>
    </script>
	
<form class="layui-form" action="/Admin/SixlotteryTime/Addnext" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
{!! csrf_field() !!}
	<div class="layui-table-box">
		<div class="layui-table-header">
			<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-even="">
				<thead>
					<tr>
						<th data-field="id" data-minwidth="120" colspan="6" style="padding: 0px;">
							<div class="layui-table-cell laytable-cell-1-id">
								<span>新增下一期</span>
							</div>
						</th>
					</tr>
				</thead>
			</table>
		</div>
		<div class="layui-table-body layui-table-main">
			<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-even="">
				<tbody>
          <tr data-index="0" class="" style="display: none;">
            <td data-field="id" data-minwidth="50" width="100">
              <div class="layui-table-cell laytable-cell-1-id">游戏</div>
            </td>
            <td data-field="admin_name" data-minwidth="120" colspan="5" style="padding: 0px 5px;margin:0px;">
              <div class="layui-table-cell laytable-cell-1-admin_name" style="width:200px;">
                  <select name="game" id="form_game"  autocomplete="off" eventType="event-query">
                      @foreach($gameList as $k=>$v):
                          @if($game==$v['table_name'])
                              <option value="{{$v['table_name']}}" selected="selected">{{$v['name']}}</option>
                          @else
                              <option value="{{$v['table_name']}}">{{$v['name']}}</option>
                          @endif
                      @endforeach
                  </select>
              </div>
            </td>
          </tr>

					<tr data-index="0" class="">
						<td data-field="id" data-minwidth="50" width="100">
							<div class="layui-table-cell laytable-cell-1-id">游戏期号</div>
						</td>
						<td data-field="admin_name" data-minwidth="120" colspan="5" style="padding: 0px 5px;margin:0px;">
							<div class="layui-table-cell laytable-cell-1-admin_name" style="width:200px;">
								  <input type="text" name="game_no" required  lay-verify="required" autocomplete="off" class="layui-input" value="" style="height:25px;">
							</div>
						</td>
					</tr>
					
					<tr data-index="2">
						<td data-field="id" data-minwidth="120">
							<div class="layui-table-cell laytable-cell-1-id">开奖时间</div>
						</td>
						<td data-field="admin_name" data-minwidth="120" style="padding: 0px 5px;margin:0px;">
							<div class="layui-table-cell laytable-cell-1-admin_name" style="width:200px;">
								  <input type="text" name="open_time" class="layui-input" id="form_open_time" placeholder="-">
							</div>
						</td>
						<td data-field="id" data-minwidth="120">
							<div class="layui-table-cell laytable-cell-1-id">开盘时间</div>
						</td>
						<td data-field="admin_name" data-minwidth="120" style="padding: 0px 5px;margin:0px;">
							<div class="layui-table-cell laytable-cell-1-admin_name" style="width:200px;">
								<input type="text" name="openpand_time" class="layui-input" id="form_openpand_time" placeholder="-">
							</div>
						</td>
						<td data-field="id" data-minwidth="120">
							<div class="layui-table-cell laytable-cell-1-id">封盘时间</div>
						</td>
						<td data-field="admin_name" data-minwidth="120" style="padding: 0px 5px;margin:0px;">
							<div class="layui-table-cell laytable-cell-1-admin_name" style="width:200px;">
								<input type="text" name="close_time" class="layui-input" id="form_close_time" placeholder="-">
							</div>
						</td>
					</tr>
					<tr data-index="3">
						<td data-field="id" data-minwidth="120">
							<div class="layui-table-cell laytable-cell-1-id">操作</div>
						</td>
						<td data-field="admin_name" data-minwidth="120" colspan="5" style="padding: 0px 5px;margin:0px;">
							<div class="layui-table-cell laytable-cell-1-admin_name">
								  <button class="layui-btn layui-btn-sm" lay-submit lay-filter="submitForm">新增下一期</button>
								  <button type="reset" class="layui-btn layui-btn-sm layui-btn-normal">重置</button>
							</div>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>

</form>

    <!---开奖管理-->
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 text">

            <form class="layui-form rewrite" action="" eventType=eventForm>
                <div class="layui-form-item">
                    <div class="layui-inline" style="display: none;">
                        <label class="layui-form-label">游戏</label>
                        <div class="layui-input-inline">
                            <select name="game" id="form_game"  autocomplete="off" eventType="event-query">
                                @foreach($gameList as $k=>$v):
                                    @if($game==$v['table_name'])
                                        <option value="{{$v['table_name']}}" selected="selected">{{$v['name']}}</option>
                                    @else
                                        <option value="{{$v['table_name']}}">{{$v['name']}}</option>
                                    @endif
                                @endforeach
                            </select>
                        </div>

                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('gamemenu.game_no') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="game_no" id="form_game_no" lay-verify="" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $game_no }}">
                        </div>

                    </div>

                    <!--<div class="layui-inline">
                        <label class="layui-form-label">{{ trans('gamemenu.star_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="star_time" id="form_star_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query value="{{trans('status.default_time.seven_day')}}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('gamemenu.end_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="end_time" id="form_end_time" placeholder=" - " lay-verify=""
                                   autocomplete="off" class="layui-input test-item" eventType=event-query value="{{trans('status.default_time.etime')}}">
                        </div>
                    </div>-->

                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload"
                           style="opacity: 1; pointer-events: auto;" eventType=event-query-submit>提交</a>
                        <!--<a class="layui-btn   layui-btn-sm  layui-btn-normal reset" data-type="reload"
                           style="opacity: 1; pointer-events: auto;" eventType=event-query-submit>重置</a>
                           <a class="layui-btn layui-btn-sm layui-btn-green set" data-type="reload" style="opacity: 1; pointer-events: auto;"><i class="layui-icon" eventType=event-query-submit>ဂ</i></a>-->
						  <a class="layui-btn layui-btn-sm lay-btn-diy" href="/Admin/SixlotteryRes/index?game={{$game}}" style="opacity: 1; pointer-events: auto;">开奖号码详情</a>
                    </div>
                </div>
            </form>
            @include('vip.datatable')
        </div>
    </div>
 
<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.reload();
	},2500);
}
});
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //时间选择器
  laydate.render({
    elem: '#form_open_time'
    ,type: 'datetime'
  });
  laydate.render({
    elem: '#form_openpand_time'
    ,type: 'datetime'
  });
  laydate.render({
    elem: '#form_close_time'
    ,type: 'datetime'
  });
});
</script>

@endsection
