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

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

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

		{% if candidates is empty %}
			<p>{% trans %}lookup_no_results{% endtrans %}</p>
			<a class="btn btn-primary"
			   href="{{ path('book_new', {id: book_id}) }}">{% trans %}add_action_add_manual{% endtrans %}</a>
		{% else %}
			<p>{% trans %}lookup_pick{% endtrans %}</p>
			<table class="table">
				<thead>
				<tr>
					<th>{% trans %}book_title_header{% endtrans %}</th>
					<th>{% trans %}book_author_header{% endtrans %}</th>
					<th>{% trans %}book_publisher_header{% endtrans %}</th>
					<th>{% trans %}book_publication_year_header{% endtrans %}</th>
					<th></th>
				</tr>
				</thead>
				<tbody>
				{% for candidate in candidates %}
					<tr>
						<td>{{ candidate.title }}</td>
						<td>{{ candidate.author }}</td>
						<td>{{ candidate.publisher }}</td>
						<td>{{ candidate.publicationYear }}</td>
						<td><a class="btn btn-sm" href="{{ path('book_new', {
								id: book_id,
								title: candidate.title,
								author: candidate.author,
								language: candidate.language,
								publisher: candidate.publisher,
								publicationLoc: candidate.publicationLoc,
								publicationYear: candidate.publicationYear,
								isbn: candidate.isbn,
								issn: candidate.issn,
							}) }}">{% trans %}lookup_use{% endtrans %}</a></td>
					</tr>
				{% endfor %}
				</tbody>
			</table>
		{% endif %}
	</div>
{% endblock %}
