@extends('base.base')
@section('base')
    <!-- Content Area -->
    <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>
                    User Protect Logs
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Game Data</a></li>
                        <li class="breadcrumb-item active" aria-current="page">User Protect Logs</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">User Protect Logs</h4>

                            <form class="well form-inline margin-top-20" method="get" action="/admin/game_data/protect_logs">
                                <div class="form-group">
                                    <span style="padding-left: 10px">GameID:</span>
                                    <input class="form-control" type="text" name="GameID" style="width: 10%;" value="{{ $gameID }}">

                                    <span style="padding-left: 10px">VIP Protect:</span>
                                    <select class="form-control" name="vip" style="color: black">
                                        @foreach($vipOptions as $k => $text)
                                            <option value="{{ $k }}" @if((string)$vip === (string)$k) selected @endif>
                                                {{ $text }}
                                            </option>
                                        @endforeach
                                    </select>

                                    <span style="padding-left: 10px">Start Date:</span>
                                    <input type="date" name="start_date" class="form-control" value="{{ $start_date }}"/>

                                    <span style="padding-left: 10px">End Date:</span>
                                    <input type="date" name="end_date" class="form-control" value="{{ $end_date }}"/>

                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="Search"/>&nbsp;&nbsp;
                                    <a href="/admin/game_data/protect_logs" class="btn btn-sm btn-gradient-warning btn-icon-text">Reset</a>
                                </div>
                            </form>

                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>GameID</th>
                                    <th>Register Time</th>
                                    <th>Last Login Time</th>
                                    <th>VIP Protect</th>
                                    <th>Win Amount</th>
                                    <th>Multiplier</th>
                                    <th>Protect Time</th>
                                    <th>Game</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr>
                                        <td>
                                            <a href="/admin/global/id_find?UserID={{ $item->UserID }}">
                                                {{ $item->GameID }}
                                            </a>
                                        </td>
                                        <td>{{ $item->RegisterDate }}</td>
                                        <td>{{ $item->LastLogonDate }}</td>
                                        <td>
                                            @if($item->VIP)
                                                <span class="badge badge-danger">VIP</span>
                                            @else
                                                <span class="badge badge-secondary">No</span>
                                            @endif
                                        </td>
                                        <td>{{ $item->WinAmount }}</td>
                                        <td>{{ $item->Multiplier }}</td>
                                        <td>{{ $item->CreateTime }}</td>
                                        <td>{{ $item->KindName ?? '' }} @if($item->GameCode) ({{ $item->GameCode }}) @endif</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>

                            <div class="box-footer clearfix" id="pages">
                                Total <b>{{ $list->appends([
                                        'GameID'     => $gameID,
                                        'vip'        => $vip,
                                        'start_date' => $start_date,
                                        'end_date'   => $end_date,
                                    ])->total() }}</b> records, <b>{{ $list->lastPage() }}</b> pages
                                {!! $list->links() !!}
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

