@extends('layouts/full')

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

@section('breadcrumb')
	<ul class="bread_crumb">
		<li><a title="Radioprogrammering" href="{{url('radio/gids')}}">Radioprogrammering</a></li>
		<li class="separator icon_small_arrow right_gray">&nbsp;</li>
		<li>Programma-informatie</li>
	</ul>
@endsection 

@section('content')
@php($now = new \DateTimeImmutable())
<div class="page_layout page_margin_top clearfix">
	<div class="row page_margin_top">
		<div class="column column_2_3">
			<div class="post single">
				<p>{!!$program->description!!}</p>
			</div>
		</div>
		<div class="column column_1_3">
			<div id="komende_uitzendingen">
				<h4 class="box_header page_margin_top_section">Komende week</h4>
				@if(($next = $program->next) && count($next))
				<ul class="blog podcasts">
				@foreach($next as $n)
				  <li class="post">
					<p class="post_details simple">
						<b>{{$n->name}}</b><br/>
						@if($n->starts < $now) 
						  Nu te horen tot {{$n->ends->format('H:i')}} uur<br />
						  <a href="{{ $player = url('luister/live') }}" target="_radioplayer" class="action_button" onclick="window.open('{{$player}}', '_radioplayer','width=400,height=400'); return false;"><span class="fa fa-play"></span> <span>Luister live</span></a>
						  @break
						@else
						  {{ Formatter::relativeDate( $n->starts, 'W d m' ) }} om {{ $n->starts->format('H:i') }} uur.
						@endif
					</p>
				  </li>
				@endforeach
				</ul>
				@else
				<p>Er staat komende week geen uitzending van {{$program->name}} gepland.</p>
				@endif
			</div>

			<div class="clearfix"></div>
			<h4 class="box_header page_margin_top_section clearfix">Terugluisteren</h4>
			<div class="tabs no_scroll clearfix">
					<ul class="tabs_navigation clearfix">
						<li>
							<a href="#uitzending" title="Uitzendingen">
								Uitzending
							</a>
							<span></span>
						</li>
						<li>
							<a href="#fragmenten" title="Contact">
								Fragmenten
							</a>
							<span></span>
						</li>
					</ul>
					<div id="uitzending">
						<div class="clearfix"></div>
						<p>U kunt uitzendingen tot twee weken geleden terugluisteren. <a href="#fragmenten">Fragmenten</a> blijven onbeperkt beschikbaar.</p>
	
						@if(($recent = $program->recent) && count($recent))
						<ul class="blog podcasts">
						@foreach($recent as $r)
						  @php($duration = $r->ends->diff($r->starts)->h)
						  <li class="post">
							<p class="post_details simple">
								<b>{{$r->name}}</b><br/>
								{{ Formatter::relativeDate( $r->starts, 'W d m' ) }} om {{ $r->starts->format('H:i') }} uur. <br />
								@if($r->rerun || $r->nonstop)
								  <span title="U kunt geen herhalingen en non-stopuitzendingen terugluisteren."><span class="action_button disabled"><span class="fa fa-play"></span> <span>Luister terug</span></a>
								@else
								  <a href="{{$url = url('radio/luister/programma/' . $r->starts->format('Y/m/d/H') . '/' . $duration)}}" target="_radioplayer" class="action_button" onclick="window.open('{{$url}}', '_radioplayer', 'width=400,height=400'); return false;"><span class="fa fa-play"></span> <span>Luister terug</span></a>
								@endif
							</p>
						  </li>
						@endforeach
						</ul>
						@endif
					</div>
					<div id="fragmenten">
						<div class="clearfix"></div>
						<p>Fragmenten uit dit programma, zoals interviews, vindt u onder "Radio &ndash; Fragment gemist".</p>
						<p>
							<a href="{{ url('radio/gemist/programma' . $program->url) }}" class="action_button">
								<span class="fa fa-list"></span>
								<span>Bekijk alle fragmenten</span>
							</a>
						</p>
					</div>
				</div>

				<div id="contact">
					@if($program->email)
					<h4 class="box_header page_margin_top_section">Contact</h4>
					<p><a href="mailto:{{$program->email}}@nhgooi.nl" class="action_button">
						<span class="fa fa-envelope"></span>
						<span>{{$program->email}}@nhgooi.nl</a>
					</a></p> 
					@endif
				</div>

				@if(($hosts = $program->hosts) && count($hosts))
				<ul class="list">
				@foreach($hosts as $host) 
				  <li class="bullet style_2">{{ Html::mailto($host->email . '@nhgooi.nl', $host->name) }}</li>
				@endforeach
				</ul>
				@endif
				</div><!--./left_content-->
				</div><!--./col-->
				</div><!--./row-->
				</div><!--./row-->
		</div>
	</div>
</div>
@endsection
