<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="shortcut icon" type="image/icon" th:href="@{/images/favicon.ico}"/>
<title th:text="${appTitle + (breadcrumbs != null && !breadcrumbs.empty ? ' / ' + breadcrumbs[0] : '')}">SOPDS</title>
<!-- Foundation CSS -->
<link rel="stylesheet" type="text/css" th:href="@{/css/foundation.min.css}">
<link rel="stylesheet" type="text/css" th:href="@{/css/sopds.css}">
<link rel="stylesheet" type="text/css" th:href="@{/css/foundation-icons.css}">
</head>
<body>
<div class="row">
<div class="large-12 column">
<div th:replace="/fragments/top :: top"></div>
</div>
</div>
<div class="row">
<div class="large-12 column">
<div th:replace="/fragments/logo :: logo"></div>
</div>
</div>
<div class="row">
<div class="large-12 column">
<div th:replace="/fragments/menu :: menu"></div>
</div>
</div>
<div class="row">
<div class="large-12 column">
<div th:replace="/fragments/breadcrumbs :: breadcrumbs"></div>
</div>
</div>
<div th:if="${systemMessage != null}" class="row">
<div class="large-12 column">
<div th:replace="/fragments/messages :: messages"></div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<table>
<tr th:each="item : ${items}">
<!-- Каталоги -->
<td th:if="${item.isCatalog == 1}" width="80px" style="padding:0rem 0rem;">
<!-- Папка -->
<img th:if="${item.catType == 0}" th:src="@{/images/folder.png}" width="32px" alt="Папка">
<!-- ZIP архив -->
<img th:if="${item.catType == 1 or item.catType == 3}" th:src="@{/images/zip.png}" width="32px" alt="ZIP архив">
<!-- INPX файл -->
<img th:if="${item.catType == 2}" th:src="@{/images/inpx.png}" width="32px" alt="INPX файл">
</td>
<td th:if="${item.isCatalog == 1}">
<a th:href="@{/catalog(cat=${item.id})}" th:text="${item.title}">Название каталога</a>
</td>
<!-- Книги -->
<td th:if="${item.isCatalog != 1}" width="80px" style="padding:0rem 0rem;">
<img th:src="@{/images/text.png}" width="32px" alt="Книга">
<span class="success label" th:text="${item.format}">формат</span>
</td>
<td th:if="${item.isCatalog != 1}">
<a th:href="@{/searchbooks(searchtype='i', searchterms=${item.id})}">
<span th:text="${item.title}">Название книги</span>
<span th:if="${item.authors != null and !item.authors.empty}">
(
<span th:each="author, iter : ${item.authors}">
<span th:text="${author.fullName}">Автор</span>
<span th:if="${!iter.last}">, </span>
</span>
)
</span>
</a>
</td>
</tr>
</table>
<!-- Пагинация Foundation -->
<div th:if="${paginator != null and paginator.numPages > 1}">
<ul class="pagination" role="navigation" aria-label="Pagination">
<!-- Предыдущая страница -->
<li class="pagination-previous" th:classappend="${!paginator.hasPrevious} ? 'disabled' : ''">
<th:block th:if="${paginator.hasPrevious}">
<a th:href="@{/catalog(cat=${catId}, page=${paginator.previousPageNumber})}" aria-label="Previous page">
Предыдущая страница
</a>
</th:block>
<th:block th:unless="${paginator.hasPrevious}">
<span>Предыдущая страница</span>
</th:block>
</li>
<!-- Номера страниц -->
<th:block th:each="pageNum : ${paginator.pageRange}">
<li th:classappend="${paginator.number == pageNum} ? 'current' : ''">
<th:block th:if="${paginator.number == pageNum}">
<span th:text="${pageNum}">1</span>
</th:block>
<th:block th:unless="${paginator.number == pageNum}">
<a th:href="@{/catalog(cat=${catId}, page=${pageNum})}"
th:text="${pageNum}"
aria-label="Page ${pageNum}">1</a>
</th:block>
</li>
</th:block>
<!-- Следующая страница -->
<li class="pagination-next" th:classappend="${!paginator.hasNext} ? 'disabled' : ''">
<th:block th:if="${paginator.hasNext}">
<a th:href="@{/catalog(cat=${catId}, page=${paginator.nextPageNumber})}" aria-label="Next page">
Следующая страница
</a>
</th:block>
<th:block th:unless="${paginator.hasNext}">
<span>Следующая страница</span>
</th:block>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="large-12 column">
<div th:replace="/fragments/footer :: footer"></div>
</div>
</div>
<script th:src="@{/js/vendor/jquery.js}"></script>
<script th:src="@{/js/vendor/foundation.min.js}"></script>
<script>
$(document).foundation();
</script>
</body>
</html>