Files
books/templates/books.html

59 lines
1.8 KiB
HTML

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