@extends('hello')

@section('content')
<div class="row">
	<div class="col-md-6">
		@if(is_object($nextfilm))
		<div class="panel panel-primary">
			<div class="panel-heading">N&auml;chster Film</div>
			<div class="panel-body">
				<img src="{{$images["next"]}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
				<h4>
					{{ $nextfilm->name }}
					<small><span class="badge">
						<img class="img-circle" src="{{ $nextfilm->besitzer->getAvatar() }}" width="20"> {{$nextfilm->besitzer->name}}
					</span></small>
				</h4>
				{{ link_to_route('film', "Filmdetails", array($nextfilm->id), array('class' => 'btn btn-info btn-xs'))}}
				@if(!is_null(Auth::user()) && Auth::user()->admin)	<a href='{{ url('mark-read/' . $nextfilm->id) }}' class='btn btn-success btn-xs'>Gesehen</a>
				@endif
			</div>
		</div>
		@endif

		<div class="panel panel-primary">
			<div class="panel-heading">Meistgew&uuml;nschter Film</div>
			<div class="panel-body">
				<?php $topfilm = $meistgw->shift(); ?>
				<img src="{{$images["top"]}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
				<h4>
					{{$topfilm->name}}
					<small><span class="badge">
						<img class="img-circle" src="{{ $topfilm->besitzer->getAvatar() }}" width="20"> {{$topfilm->besitzer->name}}
					</span></small>
				</h4>
				<p><span class="glyphicon glyphicon-thumbs-up"></span>&nbsp;{{$topfilm->getUpvotes()}}
					<span class="glyphicon glyphicon-transfer"></span>&nbsp;{{$topfilm->getVotes()}}</p>
				{{ link_to_route('film', "Filmdetails", array($topfilm->id), array('class' => 'btn btn-info btn-xs'))}}
				@if(!is_null(Auth::user()) && Auth::user()->admin)
					<a href='{{ url('view-next/' . $topfilm->id) }}' class='btn btn-success btn-xs'>Als n&auml;chstes sehen</a>
				@endif
			</div>

			<div class="list-group">
				@foreach ($meistgw as $film)
					<a href="{{ route('film', array($film->id)); }}" class="list-group-item">{{$film->name}} <small><span class="badge">
						<img class="img-circle" src="{{ $film->besitzer->getAvatar() }}" width="16"> {{$film->besitzer->name}}
					</span></small></a>
				@endforeach
				<i>{{ link_to('beliebt', 'Mehr...', array('class' => 'list-group-item')); }}</i>
			</div>
		</div>

			<div class="panel panel-success">
				<div class="panel-heading">Neue Vorschl&auml;ge</div>
				<div class="panel-body">
					<?php $topfilm = $vorgeschlagen->shift(); ?>
					<img src="{{$images["neu"]}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
					<h4>{{$topfilm->name}}
						<small><span class="badge">
							<img class="img-circle" src="{{ $topfilm->besitzer->getAvatar() }}" width="20"> {{$topfilm->besitzer->name}}
						</span></small>
					</h4>
					<p><span class="glyphicon glyphicon-thumbs-up"></span>&nbsp;{{$topfilm->getUpvotes()}}
						<span class="glyphicon glyphicon-transfer"></span>&nbsp;{{$topfilm->getVotes()}}</p>
					{{ link_to_route('film', "Filmdetails", array($topfilm->id), array('class' => 'btn btn-info btn-xs'))}}
					@if(!is_null(Auth::user()) && Auth::user()->admin)
						<a href='{{ url('view-next/' . $topfilm->id) }}' class='btn btn-success btn-xs'>Als n&auml;chstes sehen</a>
					@endif
				</div>
				<div class="list-group">
					@foreach ($vorgeschlagen as $film)
						<a href="{{ route('film', array($film->id)); }}" class="list-group-item">{{$film->name}} <small><span class="badge">
						<img class="img-circle" src="{{ $film->besitzer->getAvatar() }}" width="15"> {{$film->besitzer->name}}
					</span></small></a>
					@endforeach
					<i>{{ link_to('vorgeschlagen', 'Mehr...', array('class' => 'list-group-item')); }}</i>
				</div>
			</div>

		<div class="panel panel-danger">
			<div class="panel-heading">Gesehene Filme</div>
			<div class="panel-body">
				<?php $topfilm = $gesehen->shift(); ?>
				<img src="{{$images["alt"]}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
				<h4>{{$topfilm->name}}
					<small><span class="badge">
						<img class="img-circle" src="{{ $topfilm->besitzer->getAvatar() }}" width="20"> {{$topfilm->besitzer->name}}
					</span></small></h4>
				<p>Bewertung:
					@if($topfilm->getBewertung() > 0)
						<span class="label label-{{$labels[round($topfilm->getBewertung())]}}">{{$topfilm->getBewertung()}}</span>
						@else
						&mdash;
					@endif
				</p>
				<p>{{ link_to_route('film', "Filmdetails", array($topfilm->id), array('class' => 'btn btn-info btn-xs'))}}</p>
			</div>

			<div class="list-group">
				@foreach ($gesehen as $film)
					<a href="{{ route('film', array($film->id)); }}" class="list-group-item">{{$film->name}} <small><span class="badge">
						<img class="img-circle" src="{{ $film->besitzer->getAvatar() }}" width="16"> {{$film->besitzer->name}}
					</span></small></a>
				@endforeach
				<i>{{ link_to('gesehen', 'Mehr...', array('class' => 'list-group-item')); }}</i>
			</div>
		</div>
		<div class="panel panel-warning">
			<div class="panel-heading">Abgelehnte Filme</div>
			<div class="panel-body">
				<?php $topfilm = $abgelehnt->shift(); ?>
				<img src="{{$images["declined"]}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
				<h4>{{$topfilm->name}}
					<small><span class="badge">
						<img class="img-circle" src="{{ $topfilm->besitzer->getAvatar() }}" width="20"> {{$topfilm->besitzer->name}}
					</span></small></h4>
				<p>Bewertung:
					@if($topfilm->getBewertung() > 0)
						<span class="label label-{{$labels[round($topfilm->getBewertung())]}}">{{$topfilm->getBewertung()}}</span>
						@else
						&mdash;
					@endif
				</p>
				<p>{{ link_to_route('film', "Filmdetails", array($topfilm->id), array('class' => 'btn btn-info btn-xs'))}}</p>
			</div>

			<div class="list-group">
				@foreach ($abgelehnt as $film)
					<a href="{{ route('film', array($film->id)); }}" class="list-group-item">{{$film->name}} <small><span class="badge">
						<img class="img-circle" src="{{ $film->besitzer->getAvatar() }}" width="16"> {{$film->besitzer->name}}
					</span></small></a>
				@endforeach
				<i>{{ link_to('abgelehnt', 'Mehr...', array('class' => 'list-group-item')); }}</i>
			</div>
		</div>
	</div>

	<div class="col-md-6">
		<div class="panel panel-default">
			<div class="panel-heading">Letzte Kommentare</div>
	
			<div class="list-group">
				@foreach ($kommentare as $kommentar)
					<a href="{{ url("film/" . $kommentar->film) }}" class="list-group-item" style="padding-bottom: 2px">
						<h6 class='list-group-item-heading'><span class="badge">
						<img class="img-circle" src="{{ $kommentar->autor->getAvatar() }}" width="16"> {{$kommentar->autor->name}}
					</span>
							<small>in</small> <i>{{ $kommentar->objekt->name }}</i>
						</h6></a>
					<p class='panel-body' style="padding-top: 0; padding-bottom: 3px; ">
						@if($kommentar->bewertung > 0)
							<small>Hat den Film mit <span class="label label-{{$labels[round($kommentar->bewertung)]}}">{{$kommentar->bewertung}}</span> bewertet.</small><br>
						@endif
						{{ $kommentar->text }}
					</p>
					<hr style="padding: 0; margin: 0">
				@endforeach		
			</div>
		</div>
		<div class="panel-group" id="accordion">
			@foreach ($news as $new)
				<div class="panel panel-info">
					<div class="panel-heading">
						<h4 class="panel-title">
							<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#news{{$new->id}}">{{$new->headline}}</a>
							<small>
									<span class="badge">
										<img class="img-circle" src="{{ $new->ersteller->getAvatar() }}" width="16"> {{$new->ersteller->name}}
									</span> - {{\Carbon\Carbon::parse($new->updated_at)->format('d.m.Y')}}</small>
						</h4>
					</div>
					<div id="news{{$new->id}}" class="panel-collapse collapse {{$new === $news[0] ? "in" : ""}}">
						<div class="panel-body">{{nl2br(htmlentities($new->body))}}</div>
					</div>
				</div>
			@endforeach
		</div>

	</div>
	</div>
</div>

@stop
