@extends('hello');

@section('content')
<div class="row">
	<div class="col-md-6">
		<div class="panel panel-info">
			<div class="panel-heading">Meistgew&uuml;nschter Film</div>
			<div class="panel-body">
				<img src="{{$image}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
				<h4>{{$topfilm->name}}</h4>
				<p><span class="glyphicon glyphicon-thumbs-up"></span>&nbsp;{{$topfilm->upvotes}} 
					<span class="glyphicon glyphicon-thumbs-down"></span>&nbsp;{{$topfilm->downvotes}}</p>
				@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">
				{{ link_to_route('film', "Filmdetails", array($topfilm->id), array('class' => 'list-group-item'))}}
			</div>
		</div>
	</div>

	<div class="col-md-6">
		<div class="panel panel-primary">
			<div class="panel-heading">N&auml;chster Film</div>
			<div class="panel-body">
				<img src="{{$nimage}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
				<h4>{{is_object($nextfilm) ? $nextfilm->name : "Steht nicht fest"}}</h4>
				@if(is_object($nextfilm) && !is_null(Auth::user()) && Auth::user()->admin)	<a href='{{ url('mark-read/' . $nextfilm->id) }}' class='btn btn-success btn-xs'>Gesehen</a>
				@endif
			</div>

			@if(is_object($nextfilm))
			<div class="list-group">
				{{ link_to_route('film', "Filmdetails", array($nextfilm->id), array('class' => 'list-group-item'))}}
			</div>
			@endif
		</div>
	</div>


</div>

<div class="row">
	<div class="col-md-6">
		<div class="panel panel-success">
			<div class="panel-heading">Neue Vorschl&auml;ge</div>
			
			<div class="list-group">
				@foreach ($vorgeschlagen as $film)
					<a href="{{ route('film', array($film->id)); }}" class="list-group-item">{{$film->name}} <small>({{ $film->besitzer->name }})</small></a>
				@endforeach	
			</div>
		</div>
	</div>
	<div class="col-md-6">
		<div class="panel panel-danger">
			<div class="panel-heading">Gesehene Filme</div>
	
			<div class="list-group">
				@foreach ($gesehen as $film)
					{{ link_to_route('film', $film->name, array($film->id), array('class' => 'list-group-item'))}}
				@endforeach		
			</div>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-md-6">
		<div class="panel-group" id="accordion">
			@foreach ($news as $new)
				<div class="panel panel-warning">
					<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>{{$new->ersteller->name}} - {{\Carbon\Carbon::parse($new->updated_at)->format('d.m.Y')}}</small>
						</h5>
					</div>
					<div id="news{{$new->id}}" class="panel-collapse collapse">
						<div class="panel-body">{{nl2br(htmlentities($new->body))}}</div>
					</div>
				</div>					
			@endforeach	
		</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">
						<h6 class='list-group-item-heading'>{{$kommentar->autor->name}}
							<small>in {{ $kommentar->objekt->name }}</small>
						</h6>
					<p class='list-group-item-text'>
						{{ $kommentar->text }}
					</p>
					</a>
				@endforeach		
			</div>
		</div>
	</div>
</div>

@stop
