display loan "card" in book.html

This commit is contained in:
Damien De Paoli
2020-11-24 20:41:45 +11:00
parent 725c362663
commit 332335fe03

View File

@@ -4,7 +4,7 @@
<h3><center>View/Edit Book</center></h1> <h3><center>View/Edit Book</center></h1>
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %} {% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
<div class="container"><div class="row"><form class="form col-lg-12"> <div class="container-fluid"><div class="row"><form class="form col-lg-9">
{% for key in keys %} {% for key in keys %}
<div class="form-row"> <div class="form-row">
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label> <label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
@@ -85,7 +85,7 @@
{% endif %} {% endif %}
</div class="form-row"> </div class="form-row">
{% endfor %} {% endfor %}
</form></div class="row"></div class="container"> </form>
{% if books.sub_book|length %} {% if books.sub_book|length %}
<p>sub_book is defined: {{books.sub_book}}</p> <p>sub_book is defined: {{books.sub_book}}</p>
{% endif %} {% endif %}
@@ -93,7 +93,20 @@
<p>subs is defined {{ books.subs }}</p> <p>subs is defined {{ books.subs }}</p>
{% endif %} {% endif %}
{% if books.loan|length %} {% if books.loan|length %}
<p>loan is defined: {{books.loan}}</p> <div class="col">
<div class="card border-info" style="max-width: 18rem;">
<div class="card-header">Loaned to</div>
<div class="card-body text-info">
<h5 class="card-title">{{books.loan[0].firstnames}} {{books.loan[0].surname}}</h5>
<p class="card-text">
Date Lent: {{books.loan[0].date_lent}}<br>
Contact: {{books.loan[0].contact_details}}
</div>
</div>
</div>
</div>
{% endif %} {% endif %}
</div class="row">
</div class="container">
{% endblock main_content %} {% endblock main_content %}