Files
books/templates/books.html

36 lines
1.3 KiB
HTML

{% extends "base.html" %}
{% block main_content %}
<h3>All Books</h1>
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead>
<tr class="thead-light"><th>Title</th><th>Author</th><th>Publisher</th><th>Condition</th><th>Owned</th><th>Covertype</th></tr>
</thead>
<tbody>
{% for book in books %}
<tr>
{% if book.sub_book_num is defined %}
<td data-sort="{{book.parent_id}}.{{book.sub_book_num}}"><a href="/book/{{book.id}}">&nbsp;&nbsp;&nbsp;&nbsp;{{book.title}}</a></td>
{% else %}
<td data-sort="{{book.id}}"><a href="/book/{{book.id}}">{{book.title}}</a></td>
{% endif %}
<td>{{ book.author[0]['surname'] }}, {{book.author[0]['firstnames']}}</td>
<td>{{ GetPublisherById(book.publisher)}}</td>
<td align="center">
{% set cond = GetConditionById(book.condition) %}
{% if cond == "Good" %}
<i class="fas fa-book" style="color:black"></i>
{% elif cond == "Average" %}
<i class="fas fa-book" style="color:orange"></i>
{% else %}
<i class="fas fa-book" style="color:red"></i>
{% endif %}
</td>
<td>{{ GetOwnedById(book.owned)}}</td>
<td>{{ GetCovertypeById(book.covertype) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock main_content %}