@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-settings"></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/recharge/rank'>
                                <spen style="padding-left: 10px">{{ __('auto.选择时间：') }}</spen>
                                <input type="date" step="01" name="start_time" class="form-control"
                                       value="{{$start_time}}"/>&nbsp;&nbsp;
                                <input type="date" step="01" name="end_time" class="form-control"
                                       value="{{$end_time}}"/>&nbsp;&nbsp;
                                <spen style="padding-left: 10px">{{ __('auto.选择排序：') }}</spen>
                                <select class="form-control" name="sort" value="{{$sort}}" style="color: black">
                                    <option value="">{{ __('auto.选择状态') }}</option>
                                    @foreach($sort_list as $k=>$v)
                                        <option value="{{$k}}" @if($k==$sort) selected @endif>{{$v}}</option>
                                    @endforeach
                                </select>

                                <span style="padding-left: 10px" >{{ __('auto.渠道名称：') }}</span>
                                <select class="form-control" name="Channel" value="{{$Channel}}" style="color: black">
                                    <option value="">{{ __('auto.全部渠道') }}</option>
                                    @foreach($channels as $key=>$val)
                                        <option value="{{$val}}" @if (  $Channel == $val )
                                            selected
                                            @endif>{{$val}}</option>
                                    @endforeach

                                </select> &nbsp;

                                <spen style="padding-left: 10px">{{ __('auto.咖啡金额区间搜索：') }}</spen>
                                <input type="number" value="{{$chargeMin}}" style="color: black;width: 10%;"
                                       class="form-control required" name="chargeMin">-
                                <input type="number" value="{{$chargeMax}}" style="color: black;width: 10%;"
                                       class="form-control required" name="chargeMax">




                                <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
                                <a href="/admin/recharge/rank"
                                   class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>&nbsp;&nbsp;
                                <a href="/admin/recharge/rank?excel=1&start_time={{$start_time}}&end_time={{$end_time}}"
                                   class="btn btn-sm btn-gradient-light btn-icon-text">{{ __('auto.导出') }}</a>
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="5%">{{ __('auto.排名') }}</th>
                                    <th width="7%">{{ __('auto.用户') }}ID</th>
                                    <th width="10%">{{ __('auto.游戏昵称') }}</th>
                                    <th width="10%">{{ __('auto.玩家渠道') }}</th>
                                    <th width="8%">{{ __('auto.玩家状态') }}</th>
                                    <th width="8%">{{ __('auto.手机号') }}</th>
                                    <th width="7%">{{ __('auto.咖啡总额') }}</th>

                                    <th width="6%">{{ __('auto.游戏时长') }}</th>
                                    <th width="10%">{{ __('auto.最后登录时间') }}</th>
                                    <th width="10%">{{ __('auto.注册时间') }}</th>
                                    <th width="10%">{{ __('auto.距上次登录时间') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td>{{ $v->rank }}</td>
                                        <td>
                                            <a href="/admin/global/id_find?UserID={{$v->UserID}}">{{$v->GameID}}</a>
                                        </td>
                                        <td>{{ $v->NickName }}</td>
                                        <td>{{ $v->Channel }}</td>
                                        <td>{{ $v->type}}</td>
                                        <td>{{ $v->PhoneNum }}</td>
                                        <td>{{ $v->money }}</td>
                                        <td>{{ $v->Experience }}</td>
                                        <td>{{ $v->LastLogonDate }}</td>
                                        <td>{{ $v->RegisterDate }}</td>
                                        <td>{{ $v->time }}{{ __('auto.天') }}</td>

                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }}
                                <b>{{ $list->appends([
    'start_time'=>$start_time,
    'end_time'=>$end_time,
    'sort'=>$sort,
    'chargeMin'=>$chargeMin,
    'chargeMax'=>$chargeMax,
    'Channel'=>$Channel,

    ])->total() }}</b>
                                {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>


        function last_login_start_timeFunc() {

            getFormat('00', '00', '00');

            document.getElementById("last_login_start_time").value = format
        }

        function last_login_end_timeFunc() {
            getFormat('23', '59', '59');
            document.getElementById("last_login_end_time").value = format
        }

        var data_obj = {
            'start_time': "{{$start_time}}",
            'end_time': "{{$end_time}}",
            'sort': "{{$sort}}",
        }


        function todayPayAmount(obj, val) {

            if (val == 'asc') {
                $(".todayPayAmount svg:eq(1)").children('path').attr('fill', '#707071');
                $(obj).children('path').attr('fill', 'red')

            } else {
                $(obj).children('path').attr('fill', 'red')
                $(".todayPayAmount svg:eq(0)").children('path').attr('fill', '#707071');
            }

            this.data_obj.todayPayAmount = val

            $.ajax({
                type: "get",
                url: "/admin/recharge/rank",
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                data: this.data_obj,
                success: function (msg) {

                    if (msg) {
                        $(".main-panel").html(msg)

                    }
                }
            })
        }
    </script>

@endsection
