@php
	$rev->load("document");
@endphp
<div class="card bg-body-secondary col-lg-3 col-12 p-0">
	<a href='/revision/{{ $rev->id }}'>
		<img class="card-img-top" src='{{ $rev->cover(320) }}'>
	</a>
	<div class="d-flex flex-column justify-content-between card-body h-100">
		<div>

            @if (($rev->revno != "") && ($rev->revno != "0"))
            <h5 class="card-title text-center">
                    {{ $rev->document->internal_id }}-{{ $rev->revno }}
                </h5>
            @else
                <h5 class="card-title text-center">
                    {{ $rev->document->internal_id }}
                </h5>
            @endif

			<div class="text-center"><strong>{{ $rev->document->title }}</strong></div>

			@if ($rev->document->subtitle)
			<div class="text-center">{{ $rev->document->subtitle }}</div>
			@endif

			@if ($rev->document->subsubtitle)
			<div class="text-center"><small>{{ $rev->document->subsubtitle }}</small></div>
			@endif
		</div>


		<div>
			<div class="row">
				<div class="col">
					<b>
						{{ fmt_date($rev->month, $rev->year) }}
					</b>
				</div>
				<div class="col">
					{{ $rev->info->Pages }} pages
				</div>
			</div>
			<div class="row">
				<div class="col">
					<b>
						Original
					</b>
				</div>
				<div class="col">
					{{ format_size(stat($rev->path() . "/doc.pdf")["size"]) }}
				</div>
			</div>
			<div class="btn-group w-100">
				<a class="btn btn-primary w-50" href='/pdf/{{ $rev->id }}/view/{{ $rev->filename() }}'>
					view
				</a>	
				<a class="btn btn-secondary w-50" href='/pdf/{{ $rev->id }}/download/{{ $rev->filename() }}'>
					download
				</a>	
			</div>
			@if (file_exists($rev->path() . "/ocr.pdf"))
				<div class="row">
					<div class="col">
						<b>
							OCR Version
						</b>
					</div>
					<div class="col">
						{{ format_size(stat($rev->path() . "/ocr.pdf")["size"]) }}
					</div>
				</div>
				<div class="btn-group w-100">
					<a class="btn btn-primary w-50" href='/pdf/{{ $rev->id }}/viewocr/{{ $rev->filename() }}'>
						view
					</a>	
					<a class="btn btn-secondary w-50" href='/pdf/{{ $rev->id }}/downloadocr/{{ $rev->filename() }}'>
						download
					</a>	
				</div>
			@endif
		</div>
	</div>
</div>
