{% extends "base.html.twig" %}
{% block css %}
<link id="bsdp-css" href="https://unpkg.com/bootstrap-datepicker@1.9.0/dist/css/bootstrap-datepicker3.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify@3.7.3/dist/tagify.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" />
{% endblock %}
{% block title %} {{ 'Soortenlijst'|trans }} {% if app.request.locale == 'nl' %}{{ title.namenl }}{% else %}{{ title.nameen }}{% endif %} {% endblock %}
{% block body %}
<p> </p>
<div class="row flex-md-row h-md-250 position-relative">
<div class="col-md-9 position-static">
<!-- Begin Page Content -->
<h2>{{ 'Soortenlijst'|trans }}
{% if type == 'location' %}<a href="{{ path('locations_fossil', { 'id': title.id })}}">
{% elseif type == 'era' %}<a href="{{ path('glossary', { 'id': title.glossary.id, 'url': title.glossary.url })}}">
{% endif %}
{% if app.request.locale == 'nl' %}{{ title.namenl }}{% else %}{{ title.nameen }}{% endif %}
</a>
</h2>
<p></p>
<div class="row">
<div class="col-sm-12">
<a href="{{ path('specieslist_item', { 'type' : type, 'id' : id })}}"><button class="btn btn-paleontica"><span class="feather-18" data-feather="arrow-left-circle"></span> {{ 'Terug'|trans }}</button></a>
<h3>{% if taxanomytype is not null %}<a href="{{ path('glossary_by_title', {title: taxanomytype.namescientific|lower}) }}"><img src="/images/icons/fossil/has_{{ taxanomytype.namescientific|lower }}{{ taxanomytype.namescientificclarification }}.png"></a>{% if app.request.locale == 'nl' %}{{ taxanomytype.namenl }}{% else %}{{ taxanomytype.nameen }}{% endif %}{% else %}{{ 'Onbekend'|trans }}{% endif %}</h3>
</div>
</div>
<div class="row d-flex justify-content-between">
<div class="col-sm-2">
{{ fossils.getTotalItemCount }} {{ 'gevonden'|trans }}.
</div>
<div class="col-sm-6 pagnation-paleontica">
{{ knp_pagination_render(fossils) }}
</div>
</div>
{% for fossil in fossils %}
<div class="row">
<div class="col-sm-12">
<b>
{% if fossil.genus is null or fossil.genus is empty %}
{% set fossildbsearchgenusurl = '' %}
{% set genus = '' %}
{% set genus_set = 0 %}
{% else %}
{% set fossildbsearchgenusurl = '[{"value":"' ~ fossil.genus ~ '"}]' %}
{% set genus = fossil.genus %}
{% set genus_set = 1 %}
{% endif %}
{% if fossil.species is null or fossil.species is empty %}
{% set fossildbsearchspeciesurl = '' %}
{% set species = '' %}
{% set species_set = 0 %}
{# ToDo-Ante: make this work
{% elseif fossil.species == "sp."%}
{% set fossildbsearchspeciesurl = '' %}
{% set species = fossil.species %}
{% set species = '' %} #}
{% else %}
{% set fossildbsearchspeciesurl = '[{"value":"' ~ fossil.species ~ '"}]' %}
{% set species = fossil.species %}
{% set species_set = 1 %}
{% endif %}
{# genus and species #}
{% if genus_set == 1 and species_set == 1 %}
<i><a href="{{ path('fossildb', { 'page': '1', 'filter[genus]': fossildbsearchgenusurl, 'filter[species]': fossildbsearchspeciesurl }) }}">{{ genus }} {{ species }}</i></a></b>
{# genus #}
{% elseif genus_set == 1 and species_set == 0 %}
<i><a href="{{ path('fossildb', { 'page': '1', 'filter[genus]': fossildbsearchgenusurl }) }}">{{ genus }}</i></a></b>
{# species #}
{% elseif genus_set == 0 and species_set == 1 %}
<i><a href="{{ path('fossildb', { 'page': '1', 'filter[species]': fossildbsearchspeciesurl }) }}">{{ species }}</i></a></b>
{# none #}
{% elseif (fossil.genus is null or fossil.genus is empty) and (fossil.species is null or fossil.species is empty)%}
{{ '[Ongedetermineerd]'|trans }}
{% endif %}
{% if fossil.author is defined and fossil.author != ""%} ({{ fossil.author }}{% if fossil.authoryear is defined and fossil.authoryear != "" %}, {{ fossil.authoryear }}{% endif %}){% endif %}</b>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{# ToDo-Ante: gallery per soort niet per fossil.id #}
{#{{% set random_id = random(0, 10000) %}}#}
{% set random_id = null %}
{% for fossil in fossil.fossils %}
{% if random_id is null %}{% set random_id = fossil.id %}{% endif %}
{% for photo in fossil.FossildbPhotos %}
{% set thumbnail = '/uploads/fossildb/' ~ photo.filename|slice(0, 2) ~ "/" ~ photo.filename %}
<a href="/uploads/fossildb/{{photo.filename|slice(0, 2)}}/{{photo.filename}}" data-toggle="lightbox" data-gallery="fossildb-gallery-{{ random_id }}"><img src="{{ thumbnail|imagine_filter('fossildb_thumb_tiny') }}" class="img-fluid img-thumbnail"></a>
{% endfor %}
{% endfor %}
</div>
</div>
<br><br>
{% endfor %}
<div class="row d-flex justify-content-between">
<div class="col-sm-2">
</div>
<div class="col-sm-6 pagnation-paleontica">
{{ knp_pagination_render(fossils) }}
</div>
</div>
<p></p>
<!-- END Page Content -->
</div>
{% include 'sidebar.html.twig' %}
</div>
{% endblock %}
{% block javascript %}
<script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.jquery.min.js"></script>
<script src="https://unpkg.com/bootstrap-datepicker@1.9.0/dist/js/bootstrap-datepicker.min.js"></script>
<script>
jQuery(document).ready(function() {
$('.js-datepicker').datepicker({
calendarWeeks: true,
autoclose: true,
clearBtn: true,
todayHighlight: true,
format: "dd-mm-yyyy",
});
$('.js-autocomplete').each(function() {
var autocompleteUrl = $(this).data('autocomplete-url');
$(this).autocomplete({hint: false}, [
{
source: function(query, cb) {
$.ajax({
url: autocompleteUrl+'?query='+query,
}).then(function(data) {
cb(data.pages);
});
},
displayKey: 'id',
name: 'page',
debounce: 500 // only request every 1/2 second
}
])
});
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
<script>
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
$(this).ekkoLightbox({
wrapping: true,
});
});
</script>
{% endblock %}