@extends('hello')

@section('content')
<div class="page-header">
	<h1>{{ $film->name }} <small>{{ $tfilm['tagline']}}</small></h1>
</div>

<div class="row">
	<div class="col-md-3">
				@if(!is_null($film->gesehen))
					<div class="label label-success"><span class="glyphicon glyphicon-check"></span> Gesehen am {{ $film->gesehen }}</div>
				@else
					<div class="label label-danger"><span class="glyphicon glyphicon-unchecked"></span> Nicht gesehen</div>
				@endif
	</div>
	<div class="col-md-9">
		<ul class="nav nav-tabs">
			<li class="active"><a href="#ueberblick" data-toggle="tab">Überblick</a></li>
			<li><a href="#cast" data-toggle="tab">Schauspieler</a></li>
			<li><a href="#trailer" data-toggle="tab">Trailer</a></li>
		</ul>
	</div>
</div>
<div class="row">
	<div class="col-md-3 thumbnail">
		<img src="{{ $poster }}" alt="{{ $film->name }} Poster">
	</div>

	<div class="col-md-9 tab-content">
		<div class="tab-pane active" id='ueberblick'>
			<div class="pull-right">
				<a class="btn btn-xs btn-primary" href="http://themoviedb.org/movie/{{ $film->tvdbid }}">themoviedb.org</a>
				<a class="btn btn-xs btn-warning" href="http://imdb.com/title/{{ $tfilm['imdb_id'] }}">IMDB</a>
			</div>
			<dl class="dl-horizontal">
				<dt>Originaltitel</dt>
				<dd>{{ $tfilm['original_title'] }}</dd>
				<dt>Erschienen</dt>
				<dd>
					{{ $tfilm['release_date']}} -
					@foreach($tfilm['production_countries'] as $pc)
						<abbr title="{{$pc['name']}}">{{$pc['iso_3166_1']}}</abbr> 
					@endforeach
					@foreach($tfilm['production_companies'] as $pc)
						- {{$pc['name']}}
					@endforeach
				</dd>
				<dt>Genre</dt>
				<dd>
					@foreach($tfilm['genres'] as $g)
						<span class="label label-default">{{$g['name']}}</span>
					@endforeach
				</dd>
				<dt>Bewertung</dt>
				<dd>{{ $tfilm['vote_average']}} von 10 
				</dd>
				@for($i = 0; $i < 3 && $i < count($cast['crew']); $i++)
					<dt>{{$cast['crew'][$i]['job']}}</dt>
					<dd>{{$cast['crew'][$i]['name']}}</dd>
				@endfor

				<p></p>
				<dt>Inhalt</dt>
				<dd>{{ $tfilm['overview'] }}</dd>
			</dl>
		</div>
		<div class="tab-pane" id="cast">
				<div class="row" style="margin-top:10px;">
				@for($i = 0; $i < 10 && $i < count($cast['cast']); $i++)
					<div class="col-md-6">
						<div class="pull-left" style="margin-right:5px; min-height: 80px;"><img class="img-thumbnail media-object" src="{{ !is_null($cast['cast'][$i]['profile_path']) ? $tmdb->getImageUrl($cast['cast'][$i]['profile_path'], TMDb::IMAGE_PROFILE, 'w185') : "http://d3a8mw37cqal2z.cloudfront.net/assets/649ae87ebcf4285/images/no-profile-w185.jpg"}}" alt="{{$cast['cast'][$i]['name']}}" width="55"></div>
						<div class="media-body">
							<h4 class="media-heading">{{$cast['cast'][$i]['name']}}</h4>
							{{$cast['cast'][$i]['character']}}
						</div>
					</div>
					@if($i % 2 == 1)
				</div><div class="row">
					@endif
				@endfor
				</div>
		</div>
		<div class="tab-pane" id="trailer">
			@foreach($trail['youtube'] as $yt)
				<iframe width="420" height="315" src="//www.youtube.com/embed/{{ $yt['source'] }}" frameborder="0" allowfullscreen></iframe>
			@endforeach
		</div>
	</div>
</div>

<div class="clearfix"></div>
<hr>
@if($votes > 0)
<h2>Abstimmung</h2>
<p>Insgesamt haben <b>{{$votes}}</b> Personen abgestimmt. <b>{{$vposi}}</b> davon waren <i>dafür</i>.

<div class="progress">
  <div class="progress-bar progress-bar-success" style="width: {{ $vposi / $votes * 100}}%">
    <span class="sr-only">{{$vposi}} von {{$votes}} (dafür)</span>
  </div>
  <div class="progress-bar progress-bar-danger" style="width: 10%">
    <span class="sr-only">{{ $votes - $vposi}} von {{ $votes }} Complete (dagegen)</span>
  </div>
</div>

<hr>@endif

<h2>Kommentare</h2>

<p>Melde Dich an, um diesen Film zu kommentieren.</p>

@foreach($comments as $comment)

<div class="media">
	<a class="pull-left" href="#">
		<img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $comment->autor->email ) ) ) . "?s=40" }}" alt="{{ $comment->autor->name }}">
	</a>
	<div class="media-body">
		<h4 class="media-heading">{{ $comment->autor->name }} <small>{{$comment->updated_at}}</small></h4>
		{{$comment->text}}
	</div>
</div>

@endforeach



@stop

@section('title')
{{ $film->name }} ~ 
@stop