{% extends '@OxHoardBundle//layout.html.twig' %}
{% block title %}Reference Details {{ reference.id }}{% endblock %}
{% block body -%}
<div class="marginTop clearfix"></div>
<div id="content" class="container">
<div class="row">
<div><a href="{% if referer %}{{ referer }}{% else %}{{ path('reference')}}{% endif %}"><h2><span class="fa fa-chevron-left"></span> Back to the list</h2></a></div>
{% if is_authorised_to_edit %}
<div class="edit-btn"><a href="{{ path('reference_edit', { 'id': reference.id }) }}"><h2>Edit this Reference <span class="fa fa-chevron-right"></span></h2></a></div>
{% endif %}
<h1>Reference Details - {{ reference }}</h1>
{% embed '@OxHoardBundle/flash.html.twig' %}{% endembed %}
<div class="hoardlistview-6col marginTop">
<div class="datalabel">Reference Type</div><div class=data>{{ reference.referenceType }}</div>
{% if reference.abbreviation %}
<div class="datalabel">Abbreviation</div><div class="data">{{reference.abbreviation}}</div>
{% endif %}
{% if reference.authors %}
<div class="datalabel">Authors</div><div class="data">{{reference.authors}}</div>
{% endif %}
{% if reference.editors %}
<div class="datalabel">Editors</div><div class="data">{{reference.editors}}</div>
{% endif %}
{% if reference.title %}
<div class="datalabel">Title</div><div class="data">{{reference.title}}</div>
{% endif %}
{% if reference.titleEdition %}
<div class="datalabel">Title (journal, series)</div><div class="data">{{reference.titleEdition}}</div>
{% endif %}
{% if reference.volume %}
<div class="datalabel">Volume</div><div class="data">{{reference.volume}}</div>
{% endif %}
{% if reference.place %}
<div class="datalabel">Place</div><div class="data">{{reference.place}}</div>
{% endif %}
{% if reference.year %}
<div class="datalabel">Year</div><div class="data">{{reference.year}}</div>
{% endif %}
{% if reference.pages %}
<div class="datalabel">Pages</div><div class="data">{{reference.pages}}</div>
{% endif %}
{% if reference.uri1 %}
<div class="datalabel">URI 1</div><div class="data"><a href="{{reference.uri1}}" target="_blank">{{reference.uri1}} <i class="fa fa-external-link"></i></a></div>
{% endif %}
{% if reference.uri1AccessionDate and is_authenticated %}
<div class="datalabel">URI 1 accession date</div><div class="data">{{reference.uri1AccessionDate | date('Y-m-d')}}</div>
{% endif %}
{% if reference.uri2 %}
<div class="datalabel">Zenon URI</div><div class="data"><a href="{{reference.uri2}}" target="_blank">{{reference.uri2}} <i class="fa fa-external-link"></i></a></div>
{% endif %}
{% if reference.uri2AccessionDate and is_authenticated %}
<div class="datalabel">Zenon URI accession date</div><div class="data">{{reference.uri2AccessionDate | date('Y-m-d')}}</div>
{% endif %}
{% if reference.fullyEntered %}
<div class="datalabel">Fully entered</div><div class="data">{% if reference.fullyEntered %}Yes{% else %}No{% endif %}</div>
{% endif %}
{% if reference.comment %}
<div class="datalabel">Comment</div><div class="data">{{reference.comment}}</div>
{% endif %}
{% if is_authenticated and reference.internalNote %}
<div class="datalabel">Internal note</div><div class="data">{{reference.internalNote}}</div>
{% endif %}
<br>
{% if hoards %}
<div class="datalabel">Hoards referring to this publication:</div>
<div class="data">
{% set totalHoardsInCol = ((hoards|length)/4)|round(0, 'ceil') %}
{% for hoard in hoards %}
{% if hoards|length > 8 and loop.index0 is divisible by(totalHoardsInCol) %}
<div class="col-md-3">
{% endif %}
<a href="{{ path('hoard_show', { 'id':hoard.id }) }}">
{{ hoard }},
{% for country in hoard.getCountries %}
{{ country }}
{% endfor %}
</a>
<br>
{% if hoards|length > 8 and (((loop.index0 + 1) is divisible by(totalHoardsInCol)) or ((loop.index0 + 1) == hoards|length)) %}
</div>
{% endif %}
{% endfor %}
</div>
<br>
{% endif %}
{% if reference.filePath and (is_authenticated or reference.isFilePublic) %}
<div class="datalabel">
<a href="{{ path("reference_file", { 'id': reference.id }) }}" class="btn btn-info">View PDF <i class="fa fa-file-pdf-o"></i> </a>
</div>
<div style="padding: 20px"></div>
{% endif %}
</div>
</div>
</div>
{% endblock %}