TODO-28 - completed and used to reduce unwanted cols for on wish list, and add rating for poor rating books

This commit is contained in:
2021-01-09 15:32:55 +11:00
parent 3c4cdeb4fb
commit 40e2ac1a34
4 changed files with 82 additions and 53 deletions

View File

@@ -103,7 +103,7 @@
</div class="collapse navbar-collapse">
</nav>
{% if message|length %}
{% if message is defined and message|length %}
<div class="row alert alert-{{alert}}">
{{message|safe}}
{{ ClearStatus() }}

View File

@@ -1,24 +1,38 @@
{% extends "base.html" %}
{% block main_content %}
{% if page_title is not defined %}
{% set page_title="All Books" %}
{%endif %}
{% if not InDBox %}
<h3>All Books</h1>
<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 %}
<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>
<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 %}
@@ -29,30 +43,42 @@
{{ 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>
{% if not InDBox %}
{% if 'Publisher' not in hide_cols %}
<td>{{ GetPublisherById(book.publisher)}}</td>
{% 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 %}
{% 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" %}
<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 %}
{% 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>
</table>
{% endblock main_content %}