Files
books/templates/books.html

88 lines
2.7 KiB
HTML

{% extends "base.html" %}
{% block main_content %}
{% if page_title is not defined %}
{% set page_title="All Books" %}
{%endif %}
{% if not InDBox %}
<h3>{{page_title}}</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 %}
{% for h in ['Publisher','Condition','Owned','Covertype'] %}
{% if h not in hide_cols %}
<th>{{h}}</th>
{% endif %}
{% endfor %}
{% for h in ['Rating'] %}
{% if h in show_cols %}
<th>{{h}}</th>
{% endif %}
{% endfor %}
{% else %}
<th>Covertype</th><th>Add?</th>
{% endif %}
</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}}">&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.bals %}
<a href="/author/{{auth.author.id}}">{{auth.author.surname}}, {{auth.author.firstnames}}</a>
{% endfor %}
</td>
{% if not InDBox %}
{% if 'Publisher' not in hide_cols %}
<td>{{ GetPublisherById(book.publisher)}}</td>
{% endif %}
{% if 'Condition' not in hide_cols %}
{% set cond = GetConditionById(book.condition) %}
{% if cond == "N/A" %}
<td>N/A</td>
{% else %}
<td align="center">
{% if cond == "Good" %}
<svg width="22" height="22" fill="black">
<use xlink:href="{{url_for('static', filename='icons.svg')}}#book"/></svg>
{% elif cond == "Average" %}
<svg width="22" height="22" fill="orange">
<use xlink:href="{{url_for('static', filename='icons.svg')}}#book"/></svg>
{% elif cond == "Needs Replacing" %}
<svg width="22" height="22" fill="red">
<use xlink:href="{{url_for('static', filename='icons.svg')}}#book"/></svg>
{% endif %}
</td>
{% endif %}
{% endif %}
{% if 'Owned' not in hide_cols %}
<td>{{ GetOwnedById(book.owned)}}</td>
{% endif %}
{% endif %}
{% if 'Covertype' not in hide_cols %}
<td>{{ GetCovertypeById(book.covertype) }}</td>
{% endif %}
{% if InDBox %}
<td><input name="addsel-{{book.id}}" type="checkbox" onClick="ActivateBFLAddSelButton()"></td>
{% endif %}
{% if 'Rating' in show_cols %}
<td>{{ GetRatingById(book.rating) }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock main_content %}