@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-timer"></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>
                            <p class="text-muted small">{{ __('auto.进游戏时长统计说明') }}</p>
                            <form class="well form-inline margin-top-20" method="get" action="">
                                <span style="padding-left: 10px">{{ __('auto.日期') }}：</span>
                                <input type="date" name="start_date" class="form-control" value="{{ $start_date }}" />
                                <span style="padding-left: 10px">{{ __('auto.至') }}</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="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
                            </form>
                            <br>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="12%">{{ __('auto.统计日期') }}</th>
                                    <th width="28%">{{ __('auto.游戏') }}</th>
                                    <th width="15%">{{ __('auto.上报次数') }}</th>
                                    <th width="22%">{{ __('auto.平均耗时（秒）') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($statistics as $stat)
                                    <tr>
                                        <td>{{ $stat['log_date'] }}</td>
                                        <td>{{ $stat['game_name'] }} <small class="text-muted">(ID: {{ $stat['game_id'] }})</small></td>
                                        <td>{{ $stat['enter_count'] }}</td>
                                        <td>{{ $stat['avg_duration_sec'] }}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            @if(count($statistics) == 0)
                                <div class="alert alert-info">
                                    <p>{{ __('auto.暂无进游戏时长统计数据') }}</p>
                                </div>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

