@extends('base.base')
@section('base')
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">绑定关系查询</h3>
                </div>
                <div class="card-body">
                    <form class="form-inline" method="get" action="{{ route('admin.extension_new.daily_binding') }}">
                        <div class="form-group mb-2 mr-2">
                            <label class="mr-2">选择注册时间：</label>
                            <input type="datetime-local" step="01" name="start_time" class="form-control" value="{{$start_time}}" id="start_time">
                        </div>
                        <div class="form-group mb-2 mr-2">
                            <input type="datetime-local" step="01" name="end_time" class="form-control" value="{{$end_time}}" id="end_time">
                        </div>
                        <div class="form-group mb-2 mr-2">
                            <label class="mr-2">会员ID：</label>
                            <input class="form-control" type="text" name="GameID" value="{{$GameID}}">
                        </div>
                        <div class="form-group mb-2 mr-2">
                            <label class="mr-2">上级ID：</label>
                            <input class="form-control" type="text" name="SpreaderID" value="{{$spreaderID}}">
                        </div>
                        <div class="form-group mb-2 mr-2">
                            <label class="mr-2">选择创建时间：</label>
                            <select name="date" class="form-control">
                                <option value="">请选择</option>
                                @foreach($dates as $key=>$val)
                                    <option value="{{$key}}" @if("$date" == $key) selected @endif>{{$val}}</option>
                                @endforeach
                            </select>
                        </div>
                        <button type="submit" class="btn btn-primary mb-2 mr-2">搜索</button>
                        <a href="{{ route('admin.extension_new.daily_binding') }}" class="btn btn-warning mb-2">清空</a>
                    </form>

                    <h3>累计裂变新增人数：{{$list->total()}}</h3>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>会员ID</th>
                                    <th>TA的上级ID</th>
                                    <th>账号创建时间</th>
                                    <th>最后登录时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach($list as $v)
                                <tr>
                                    <td>
                                        <a href="/admin/global/id_find?UserID={{$v->UserID}}">
                                            {{$v->GameID}}
                                        </a>
                                    </td>
                                    <td>
                                        <a href="/admin/global/id_find?UserID={{$v->SpreaderUserID}}">
                                            {{ $v->SpreaderID }}
                                        </a>
                                    </td>
                                    <td>{{$v->RegisterDate}}</td>
                                    <td>{{ $v->LastLogonDate }}</td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                    <div class="card-footer clearfix">
                        总共 <b>{{ $list->appends([
                                'start_time' => $start_time,
                                'end_time' => $end_time,
                                'GameID' => $GameID,
                                'SpreaderID' => $spreaderID,
                                'date' => $date
                            ])->total() }}</b> 条,分为<b>{{ $list->lastPage() }}</b>页
                        {{ $list->links() }}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection

@section('scripts')
<script>
    $(function() {
        $('#start_time, #end_time').datetimepicker({
            format: 'YYYY-MM-DD HH:mm:ss'
        });
    });
</script>
@endsection
