@extends('hello')

@section('content')
    <div class="page-header"><h1>Statistiken</h1></div>

    <div class="row">
        @foreach($stats as $stat)
            <div class="col-md-4">
                <div class="panel panel-default">
                    <div class="panel-heading">{{$stat["name"]}}</div>
                    <div class="panel-body">
                        <?php $top = $stat["vals"]->shift(); $prop = $stat['prop']; ?>
                        <div>
                            @if($stat['type'] === "User")
                                <div class="pull-left" style="margin-right:5px">
                                    <img class="img-circle media-object" src="{{$top->$prop->getAvatar()}}" width="47">
                                </div>
                            @endif
                                @if($stat['type'] === "Film")
                                    <div class="pull-left" style="margin-right:5px">
                                        <img class="media-object" src="{{$top->$prop->getPoster()}}" height="47">
                                    </div>
                                @endif
                            <div class="media-body">
                                <h4 class="media-heading">{{is_object($top->$prop) ? $top->$prop->name : dd($top)}}</h4>
                                <b>{{$top->count}}</b> {{$top->count ==1 ? $stat['entr'][0] : $stat['entr'][1] }}
                            </div>
                        </div>
                        @foreach($stat['vals'] as $top)
                            <?php $prop = $stat['prop']; ?>
                            <div style="margin-top: 10px;">
                                @if($stat['type'] === "User")
                                    <div class="pull-left" style="margin-right:5px">
                                        <img class="img-circle media-object" src="{{$top->$prop->getAvatar()}}" width="20">
                                    </div>
                                @endif
                                    @if($stat['type'] === "Film")
                                        <div class="pull-left" style="margin-right:5px">
                                            <img class="media-object" src="{{$top->$prop->getPoster()}}" height="20">
                                        </div>
                                    @endif
                                <div class="media-body">
                                    <h5 class="media-heading">{{$top->$prop->name}} &mdash; <b>{{$top->count}}</b> {{$top->count ==1 ? $stat['entr'][0] : $stat['entr'][1] }}</h5>
                                </div>
                            </div>
                        @endforeach
                    </div>
                </div>
            </div>
        @endforeach
    </div>
@stop

@section('title')
    Statistiken ~
@stop

@section('script')

@stop
