@extends('layouts.default')


@section('content')
				<div class="col-xs-12">
					<div class='maincolumn CW_box_style'>
@include('layouts.flashdata')						
						<div class='row' style="margin-bottom:0px">
							<div class="col-xs-8">
								@include('media.layouts.nav')
							</div>
							<div class="col-xs-4 text-center">
								<h2 class='thumbHeader'>View <small>Entity</small></h2>
							</div>
						</div>
						<div class='row'>
							<div class="col-xs-8">
							@include('media.browse.layouts.breadcrumb', array('format' => $entity->format, 'domain' => $entity->domain, 'documentType' => $entity->documentType, 'document' => $entity))
							</div>
							<div class="col-xs-4 text-center">
								<div class="btn-group tabButtons">
								  <a href='#entity' class="btn btn-default active"><i class='fa fa-file-text-o fa-fw'></i>Entity</a>
								  <a href='#activity' class="btn btn-default"><i class='fa fa-expand fa-fw'></i>Activity</a>
								  @yield('dropdownActions', View::make('media.view.text.layouts.dropdownActions', compact('entity')))
								</div>								
							</div>
						</div>
						<div class="tab-content">
							<div class="tab-pane fade in active" id="entity">
								<div class='table-responsive'>
									<table class='table table-striped'>
										<tbody>
											<tr>
												<td>URI</td>
												<td>
													<a href='#'>{{ $entity->_id }}</a>
												</td>
											</tr>
											@if($entity->wasDerivedFrom)
											<tr>
												<td>Was derived from</td>
												<td>{{ link_to('files/view/?URI=' . $entity->wasDerivedFrom->_id, $entity->wasDerivedFrom->_id) }}</td>
											</tr>
											@endif
											@if($entity->wasGeneratedBy)
											<tr class='wasGeneratedBy'>
												<td>Was generated by</td>
												<td><a href='#activity'>{{ $entity->wasGeneratedBy->_id }}</a></td>
											</tr>
											@endif											
											<tr>
												<td>Title</td>
												<td>{{ $entity->title }}</td>
											</tr>
											@if($entity->extension)
											<tr>
												<td>Extension</td>
												<td>{{ $entity->extension }}</td>
											</tr>
											@endif
											<tr>
												<td>Format</td>
												<td>{{ link_to('files/browse/text/', $entity->format) }}</td>
											</tr>
											<tr>
												<td>Domain</td>
												<td>{{ link_to('files/browse/text/'. $entity->domain, $entity->domain) }}</td>
											</tr>
											<tr>
												<td>Document type</td>
												<td>{{ link_to('files/browse/text/'. $entity->domain . '/' . $entity->documentType, $entity->documentType) }}</td>
											</tr>
											<tr>
												<td>Created by</td>
												<td>{{ link_to('#', $entity->wasAttributedToUserAgent->firstname . ' '. $entity->wasAttributedToUserAgent->lastname) }}</td>
											</tr>
										</tbody>
									</table>
								</div>
								@yield('entityContent', View::make('media.view.text.layouts.entity_content')->with('entityContent', $entity->content))
							</div>
							<div class="tab-pane fade" id="activity">
								@yield('activity', View::make('media.view.text.layouts.activity')->with('activity', $entity->wasGeneratedBy))
							</div>
						</div>
					</div>
				</div>	
@stop

@section('end_javascript')
<script type="text/javascript">
		$(document).ready(function () {
			$('.tabButtons > a').click(function (e) {
			  e.preventDefault();

			  $('.tabButtons > a').removeClass('active');
			  $(this).addClass('active');

			  $('.thumbHeader small').text($(this).text());
			  $(this).tab('show')
			});

			$('.wasGeneratedBy a').click(function(e) {
				$('.tabButtons a[href="#activity"]').click();
			});
		});
	</script>

	@yield('extra_js')
@stop