@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                <i class="mdi mdi-wrench"></i>
              </span>
                    {{ __('auto.代理列表') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ __('auto.代理管理') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.代理列表') }}</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">{{ __('auto.代理列表') }}</h4>
                            <form class="well form-inline margin-top-20" method="get" action='/admin/subordinate/list'>
                                <div>
                                    <spen style="padding-left: 10px" >{{ __('auto.游戏ID：') }}</spen>
                                    <input class="form-control" type="text" name="game_id" value="{{$game_id}}" placeholder="{{ __('auto.输入游戏') }}ID">
                                    <spen style="padding-left: 10px" >{{ __('auto.用户昵称：') }}</spen>
                                    <input class="form-control" type="text" name="nickname" style="width: 15%; " value="{{$nickname}}" placeholder="{{ __('auto.请输入用户昵称') }}">
                                    <spen style="padding-left: 10px" >{{ __('auto.注册时间：') }}</spen>
                                    <input type="date"  step="01" name="start_time" class="form-control" value="{{$start_time}}" />
                                    <input type="date"  step="01" name="end_time" class="form-control" value="{{$end_time}}" />
                                    <button type="button" class="btn btn-sm btn-gradient-success btn-icon-text" onclick="add()"><i class="mdi mdi-plus btn-icon-prepend"></i>{{ __('auto.添加代理') }}</button>
                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>
                                    <a href="/admin/subordinate/list" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>
                                </div>
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ __('auto.用户昵称') }}</th>
                                    <th>{{ __('auto.用户') }}ID</th>
                                    <th>{{ __('auto.上级') }}ID</th>
                                    <th>{{ __('auto.等级') }}</th>
                                    <th>{{ __('auto.点位') }}</th>
                                    <th>{{ __('auto.创建时间') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td style="width: 10%">{{ $v->NickName }}</td>
                                        <td style="width: 13%">{{ $v->GameID }}</td>
                                        <td style="width: 10%">{{ $v->SpGameId }}</td>
                                        <td style="width: 10%">{{ $v->Level }}</td>
                                        <td style="width: 10%">{{ $v->Commission }}&nbsp;&nbsp;<button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="set({{ $v->UserID }})">{{ __('auto.点位设置') }}</button></td>
                                        <td style="width: 10%">{{ $v->CreateAt }}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }} <b>{{ $list->appends(['nickname'=>$nickname,'game_id'=>$game_id,'start_time'=>$start_time,'end_time'=>$end_time])->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function auth(id){
            myConfirm("{{ __('auto.是否继续') }}?",function(){
                var auth= document.getElementById('auth'+id).value;
                myRequest("/admin/subordinate/auth/"+id,"post",{auth:auth},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }
        function set(id){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.设置点位') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['30%', '30%'],
                content: '/admin/subordinate/setcommission/'+id
            });
        }
        function add(){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.添加菜单') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/subordinate/add/'
            });
        }
        function players(id){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.玩家列表') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['50%', '80%'],
                content: '/admin/subordinate/players/'+id
            });
        }
        function subs(id){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.代理列表') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['50%', '80%'],
                content: '/admin/subordinate/subs/'+id
            });
        }
    </script>
@endsection
