@extends('layouts/sidebar')

@section('title') 
  {{$news->title}}
@endsection

@section('breadcrumb')
	<ul class="bread_crumb">
		<li><a title="Nieuws" href="{{route('nieuws')}}">Nieuws</a></li>
		<li class="separator icon_small_arrow right_gray">&nbsp;</li>
		<li><a title="{{$news->region->title}}" href="{{route('nieuws.regio', $news->region->slug)}}">{{$news->region->title}}</a></li>
		<li class="separator icon_small_arrow right_gray">&nbsp;</li>
		<li>Details</li>
	</ul>
@endsection 

@section('content')

<div class="row">
	<div class="post single small_image">
		<ul class="post_details clearfix">
			@if($news->region && $news->region->title != "Regio")
			<li class="detail category">Regio <a href="{{route('nieuws.regio', $news->region->slug)}}" title="{{$news->region->title}}">{{$news->region->title}}</a></li>
			@endif
			@if($news->theme && $news->theme->title != "Overig")
			<li class="detail category">Thema <a href="{{route('nieuws.thema', $news->theme->slug)}}" title="{{$news->theme->title}}">{{$news->theme->title}}</a></li>
			@endif
			<li class="detail date">		
				{{Formatter::relativeDate($news->published)}} om {{$news->published->format('H:i')}}
				@if($news->edited && ($news->edited->format('d m H i') != $news->published->format('d m H i')))
					| bijgewerkt:
					@if($news->edited->format('d m') != $news->published->format('d m'))
					{{strtolower(Formatter::relativeDate($news->edited))}} 
					@endif
					om {{$news->edited->format('H:i')}} uur
				@endif
			</li>
			@if($news->author)
			<li class="detail author">{{$news->author}}</li>
			@endif
		</ul>


		@if($news->podcast)
			@include('widgets/mediaplayer')
			<div class="announcement">
				<div>
					<audio controls>
					<source src="{{ $url = url( $apiUrl . 'podcast/download' . $news->podcast->url . "?auth=" . $news->podcast->auth )}}" type="audio/mpeg" /> 
					</audio>
				</div>
				<ul class="post_details clearfix">
					<li class="detail date">
							{{ Formatter::relativeDate($news->podcast->created) }} uitgezonden 
							@if($news->podcast->program) in <a href="{{ route('programma') . $news->podcast->program->url }}">{{ $news->podcast->program->name }}</a> @endif
					</li>
					<li class="detail category">
						<a href="{{ route('gemist.fragment') . $news->podcast->url }}">
							<span class="fa "></span>
							<span>Meer over dit fragment</span>
						</a>
					</li>
				</ul>
			</div>
		@endif

		<div class="post_content page_margin_top clearfix">
			<div class="content_box">
				@if($news->images)
					@if(count($news->images) == 1)
					<div class="post_image_box">
						<a href="{{$imgBase . $news->images[0]->url}}" class="post_image prettyPhoto" rel="prettyPhoto" title="{{$news->images[0]->title}}">
							<img src='{{$imgBase . $news->images[0]->url}}' alt='{{$news->images[0]->title}}'>
						</a>
						<div class="sentence">
							<span class="text">{{$news->images[0]->title}}</span>
							@if(isset($news->images[0]->author))
								<span class="author">{{$news->images[0]->author}}</span>
							@endif
						</div>
					</div>
					@else
					<div class="horizontal_carousel_container thin page_margin_top gallery_control">
						<ul class="horizontal_carousel control-for-post-gallery visible-5 autoplay-0 scroll-1 navigation-1 easing-easeInOutQuint duration-750">
							@foreach($news->images as $image)
							<li>
								<a href="#"><img src='{{$imgBase . $image->url}}'></a>
							</li>
							@endforeach
						</ul>
					</div>
					<div id="control-by-post-gallery" class="horizontal_carousel_container big margin_top_10">
						<ul id="post-gallery" class="horizontal_carousel visible-1 autoplay-0 scroll-1 navigation-1 easing-easeInOutQuint duration-750">
						@foreach($news->images as $image)
							<li>
								<a href="{{$imgBase . $image->url}}" data-rel="gallery" title="{{$image->title}}">
									<span class="icon fullscreen animated"></span>
									<img src='{{$imgBase . $image->url}}' alt='{{$image->title}}'>
								</a>
							</li>
						</ul>
						@endforeach
					</div>
					@endif
				@endif

				@if(is_array($news->content))
					@include('partial/nh_story', ['content' => $news->content])
				@else
				<div class="text">
					<p>{!!$news->content!!}</p>
				</div>
				@endif
				
				@if($news->source && $news->source->show)
				<div class="post-source">
				<p>Bron: {{$news->source->title}}</p>
				</div>
				@endif

				{{--
				@include('widgets/share')
				--}}

				<div class="row page_margin_top">
				{{--
					<ul class="taxonomies tags left clearfix">
						@if($news->keywords)
						@foreach($news->keywords as $keyword)
						<li>
							<a href="{{route('nieuws/onderwerp/' . $keyword)}}" title="Zoek meer nieuws met het onderwerp {{$keyword}}">{{$keyword}}</a>
						</li>
						@endforeach
						@endif
					</ul>
				--}}
					<ul class="taxonomies categories right clearfix">
						<li>
							<a href="{{route('nieuws.thema', $news->theme->slug)}}" title="Zoek meer nieuws met het thema {{$news->theme->title}}">{{$news->theme->title}}</a>
						</li>
						<li>
							<a href="{{route('nieuws.regio', $news->region->slug)}}" title="Zoek meer nieuws uit de regio {{$news->region->title}}">{{$news->region->title}}</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

@endsection
