@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">
                <input type="text" name="name_chinese" required  lay-verify="required" placeholder="请输入联赛名称" autocomplete="off" value="{{ isset($name_chinese)?$name_chinese:'' }}" class="layui-input" readonly="readonly">
            </div>
        </div>

        @foreach ($odds_code as $k=>$user)
            <div class="layui-form-item">
                <label class="layui-form-label">{{$user['odds_code']}}</label>
                <div class="layui-input-block">
                    @foreach ($allteam[$k] as $kk=>$post)
                    <div style="padding-left:20px;width:120px;height: 100px; float: left;">{{$allteam[$k][$kk]['team']}}
                    @if ($stdisplay[$k][$kk]['status']==1 && $stdisplay[$k][$kk]['status'])
                        <div onclick="iskq(0,{{$stdisplay[$k][$kk]['id']}},{{$isgold[$k]}},{{$stdisplay[$k][$kk]['lg_id']}})" class="layui-input-inline checkbox">
                            <input type="checkbox" checked lay-skin="switch" lay-text="是|否" class="layui-input" eventType=event-query>
                        </div>
                    @else
                        <div onclick="iskq(1,{{$stdisplay[$k][$kk]['id']}},{{$isgold[$k]}},{{$stdisplay[$k][$kk]['lg_id']}})" class="layui-input-inline checkbox">
                            <input type="checkbox"  lay-skin="switch" lay-text="是|否" class="layui-input" eventType=event-query>
                        </div>
                    @endif
                    </div>
                    @endforeach
                </div>
            </div>
        @endforeach


        <!-- @if(S('ACTION')!='view')
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <a class="layui-btn layui-btn-sm lay-btn-diy" href="javascript:history.go(-1)" style="background-color:#1E9FFF;width: 92px; height: 38px;line-height: 38px;font-size: 14px;">返回</a>
                    <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>
        var id;
        var aa;
        layui.use(['form'], function(){
            var form = layui.form;
            form.on('select(sect)',function(data){
                id = data.value;
                //console.log(id);
                $.ajax({
                    type:'get',
                    url:'/admin/SoccerLeague/getcountry',
                    data:{id:id},
                    dataType:'json',
                    success:function(data){  //请求成功回调函数
                        //console.log(data);
                        var option = '';
                        var dd = '';
                        option += '<option value></option>';
                        //dd += '<dd lay-value class="layui-select-tips">请选择</dd>';
                        for(var i=0;i<data.length;i++){  //循环获取返回值，并组装成html代码
                            option += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                        }
                        $("#country").html(option);
                        //重新渲染select
                        form.render('select');
                    },
                });
            })
            //监听提交
            form.on('submit(submitForm)', function(data){
                return true;
            });
        });

        function iskq(isstatus,id,isgold,lg_id){
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/admin/ZqChampionsLeague/ajaxstatus',
                data: {id:id,isstatus:isstatus,isgold:isgold,lg_id:lg_id},
                success: function(data) {
            // alert(data);
                    if(data.status==1){
                        layer.msg('更新成功！！！');
                        location. reload()//刷新当前页面
                    }else{
                        layer.msg('更新失败,请联系管理员');
                        location. reload()//刷新当前页面
                    }
                }
            })
        }

    </script>
@endsection
