@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>
                    用户数据(新)
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">用户数据</a></li>
                        <li class="breadcrumb-item active" aria-current="page">用户数据(新)</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">用户数据(新)</h4>
                            <form class="well form-inline margin-top-20" method="get" action="/admin/global/user_new_list">
                                <div>
                                    <span style="padding-left: 10px">{{ __('auto.会员ID：') }}</span>
                                    <input class="form-control" type="text" name="GameID" value="{{$gameID}}">

                                    <span style="padding-left: 10px">{{ __('auto.注册时间：') }}</span>
                                    <input type="datetime-local" step="01" name="start_time" id="start_time" class="form-control" value="{{$startTime}}" onclick="start_times('start_time')"/>
                                    <input type="datetime-local" step="01" name="end_time" id="end_time" class="form-control" value="{{$endTime}}" onclick="end_times('end_time')"/>

                                    <span style="padding-left: 10px">{{ __('auto.上次离线时间') }}：</span>
                                    <input type="datetime-local" step="01" name="lstart_time" id="lstart_time" class="form-control" value="{{$lstartTime}}" onclick="start_times('lstart_time')"/>
                                    <input type="datetime-local" step="01" name="lend_time" id="lend_time" class="form-control" value="{{$lendTime}}" onclick="end_times('lend_time')"/>
                                    <br>

                                    <span style="padding-left: 10px">{{ __('auto.渠道名称：') }}</span>
                                    <select class="form-control" name="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;&nbsp;

                                    <span style="padding-left: 10px">充值金额范围：</span>
                                    <input class="form-control" type="text" name="minRecharge" placeholder="最小" style="width:80px" value="{{$minRecharge}}">
                                    ~
                                    <input class="form-control" type="text" name="maxRecharge" placeholder="最大" style="width:80px" value="{{$maxRecharge}}">
                                    &nbsp;&nbsp;

                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
                                    <a href="/admin/global/user_new_list" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>&nbsp;&nbsp;
                                    <a href="/admin/global/user_new_list?excel=1&GameID={{$gameID}}&start_time={{$startTime}}&end_time={{$endTime}}&lstart_time={{$lstartTime}}&lend_time={{$lendTime}}&channel={{$channel}}&minRecharge={{$minRecharge}}&maxRecharge={{$maxRecharge}}"
                                       class="btn btn-sm btn-gradient-light btn-icon-text">{{ __('auto.导出') }}</a>
                                </div>
                            </form>

                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="6%">UserID</th>
                                    <th width="6%">{{ __('auto.会员') }}ID</th>
                                    <th width="8%">{{ __('auto.昵称') }}</th>
                                    <th width="8%">{{ __('auto.余额') }}</th>
                                    <th width="6%">{{ __('auto.状态') }}</th>
                                    <th width="10%">{{ __('auto.上次离线时间') }}</th>
                                    <th width="10%">{{ __('auto.注册日期') }}</th>
                                    <th width="6%">{{ __('auto.渠道名称') }}</th>
                                    <th width="8%">{{ __('auto.手机号') }}</th>
                                    <th width="8%">充值</th>
                                    <th width="8%">提现</th>
                                    <th width="8%">总输赢</th>
                                    <th width="6%">{{ __('auto.设置') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$item)
                                    <tr>
                                        <td>{{$item->UserID}}</td>
                                        <td>
                                            <a href="/admin/global/id_find?UserID={{$item->UserID}}">
                                                {{$item->GameID}}
                                            </a>
                                        </td>
                                        <td>{{$item->NickName}}</td>
                                        <td>{{$item->Score}}</td>
                                        <td>{{$item->Nullity}}</td>
                                        <td>{{ $item->LastLogonDate ? date('Y-m-d H:i:s', strtotime($item->LastLogonDate)) : '' }}</td>
                                        <td>{{ $item->RegisterDate ? date('Y-m-d H:i:s', strtotime($item->RegisterDate)) : '' }}</td>
                                        <td>{{$item->Channel}}</td>
                                        <td>{{$item->PhoneNum}}</td>
                                        <td>{{$item->Recharge ?? 0}}</td>
                                        <td>{{$item->Withdraw ?? 0}}</td>
                                        <td>{{$item->totalScore ?? 0}}</td>
                                        <td>
                                            <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="update({{$item->UserID}})">
                                                {{ __('auto.修改') }}
                                                <i class="mdi mdi-file-check btn-icon-append"></i>
                                            </button>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                        <div class="box-footer clearfix" id="pages">
                            {{ __('auto.总共') }} <b>{{ $list->appends([
                                    'GameID'=>$gameID,
                                    'start_time'=>$startTime,
                                    'end_time'=>$endTime,
                                    'lstart_time'=>$lstartTime,
                                    'lend_time'=>$lendTime,
                                    'channel'=>$channel,
                                    'minRecharge'=>$minRecharge,
                                    'maxRecharge'=>$maxRecharge,
                                ])->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                            {!! $list->links() !!}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function start_times(id) {
            getFormat('00', '00', '00');
            document.getElementById(id).value = format
        }

        function end_times(id) {
            getFormat('23', '59', '59');
            document.getElementById(id).value = format
        }

        function update(id) {
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.修改配置') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/global/user_update?id=' + id
            });
        }
    </script>
@endsection
