{% extends 'base.html.twig' %}

{% block title %}{% trans %}borrow_list_title{% endtrans %}{% endblock %}

{% block content %}
	<div class="page_content">
		<h2>{% trans %}borrow_list_title{% endtrans %}</h2>

		{% if pagination.getTotalItemCount() == 0 %}
			<p>{% trans %}borrow_list_empty{% endtrans %}</p>
		{% endif %}
	</div>

	{% if pagination.getTotalItemCount() > 0 %}
		<div class="results">
			{% for borrow in pagination %}
				{% embed 'book/_tile.html.twig' with {book: borrow.book} %}
					{% block status %}
						<span class="label label-rounded label-warning">{{ 'borrow_lent_to'|trans({'%who%': borrow.who, '%date%': borrow.at|date('Y-m-d')}) }}</span>
					{% endblock %}
				{% endembed %}
			{% endfor %}

			{{ knp_pagination_render(pagination) }}
		</div>
	{% endif %}
{% endblock %}
