{% load i18n %}

{% if user.is_authenticated or not sopds_auth %}
<div class="row expanded callout secondary" style="margin:0; padding-top:0">
<div class="large-4 columns" style="margin-top:1rem;">
<h5><a href="{% url "web:searchbooks" %}?searchtype=u">{% trans "BOOKSHELF" %}</a></h5>
{% if sopds_auth %}
<div class="row small-up-4">
{% for b in bookshelf %}
   <div class="column">
   <span data-tooltip aria-haspopup="true" class="has-tip" data-disable-hover="false" tabindex="1" title="{{b.title}}">
    <a href="{% url "web:searchbooks" %}?searchtype=i&searchterms={{b.book_id}}">
       <img class="thumbnail" src="{% url 'opds_catalog:thumb' b.book_id %}" type="image/jpeg" alt="{{b.title}}">
    </a>   
   </span></div>
{% endfor %}
</div>
{% else %}
{% blocktrans %}Bookshelf is available only SimpleOPDS Catalog mode with activated user authorization.{% endblocktrans %}
{% endif %}
</div>
<div class="large-4 columns" style="margin-top:1rem;">
<h5>{% trans "STATISTICS" %}</h5>
<p style="font-size:90%;">
<b>{% trans "This сatalog contains:" %}</b> 
<span class="label">{{ stats.allbooks }}</span> {% trans "books," %} 
<span class="label">{{ stats.allauthors }}</span> {% trans "authors," %} 
<span class="label">{{ stats.allgenres }}</span> {% trans "genres and" %} 
<span class="label">{{ stats.allseries }}</span> {% trans "series." %}
</p>
<p style="font-size:90%;">
<b>{% trans "Last collection scan date:" %}</b> 
<span class="label"> {% if stats.lastscan_date %}{{ stats.lastscan_date }}{% else %}{%  trans "Never" %}{% endif %}</span>
</p>
</div>
<div class="large-4 columns" style="padding:0; margin-top:1rem;">
	<div class="large-12 columns">
		<h5>{% trans "RANDOM BOOK" %}</h5>	
	</div>
	<div class="large-12 columns clearfix">    
	{% if random_book %}
		<img class="float-left" src="{% url 'opds_catalog:thumb' random_book.id %}" type="image/jpeg" width="80px" style="padding:0.3rem;">
		<p style="font-size:80%;line-height:1rem;margin-bottom:0.25rem; margin-top:0.25rem;"><b><a href="{% url "web:searchbooks" %}?searchtype=i&searchterms={{random_book.id}}">{{ random_book.title }}</a> </b></p>
		<div style="font-size:70%;text-align:justify;"> {{ random_book.annotation | truncatechars:400}} </div>	
	{% endif %}	
	</div>	
</div>
</div>
{% endif %}

<div class="large-12 columns sopdsmenu" style="margin:0;padding:0;">
	<div class="medium-6 columns">
		<ul class="menu show-for-medium">
		<li class="menu-text" style="padding:0"><a href="https://github.com/mitshel/sopds"><i class="fi-social-github"></i>GitHub</a></li>
		<li class="menu-text" style="padding:0"><a href="https://twitter.com/dmitsh"><i class="fi-social-twitter"></i>Twitter</a></li>
		</ul>
	</div>
	<div class="medium-6 columns">
		<ul class="menu align-right">
		<li class="menu-text" style="padding:0"><a href="http://www.sopds.ru/">SOPDS.RU v.{{ sopds_version }}</a></li>
		</ul>
	</div>
</div>
