first commit for removing books from a loan itself, works and the scaffold is there for adding new books, code to be written
This commit is contained in:
@@ -1,7 +1,43 @@
|
||||
<h3>Loaned Books</h1>
|
||||
<script>
|
||||
function ActivateBFLRemSelButton()
|
||||
{
|
||||
$('#bfl-remsel-btn').removeClass('disabled')
|
||||
$('#bfl-remsel-btn').attr('disabled',false)
|
||||
}
|
||||
|
||||
function RemoveSelFromLoan()
|
||||
{
|
||||
var params=$("#book_table :input").serializeArray()
|
||||
$('#dbox').modal('hide')
|
||||
$.post( "/rem_books_from_loan/" + {{loan_id}}, params, function(data) { $('#bfl-existing').html('U SHOULD NEVER SEE THIS: calling the rem_books_from_loan page') } )
|
||||
window.location = "/loan/" + {{loan_id}}
|
||||
}
|
||||
|
||||
function ShowDBox()
|
||||
{
|
||||
$('#dbox').modal('show')
|
||||
$.post( "/books_for_loan/" + {{loan_id}}, function(data) {$('#bfl-existing').html(data) } );
|
||||
}
|
||||
function FindNewBFL()
|
||||
{
|
||||
$.post( "/search",{ 'term': $('#bfl-search-term').val(), 'InDBox': 1 }, function(data) { $('#bfl-new').html(data) ; $('#bfl-addsel-btn').show() } );
|
||||
}
|
||||
</script>
|
||||
|
||||
{% if not InDBox %}
|
||||
<h3>Loaned Books</h3>
|
||||
{% endif %}
|
||||
|
||||
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
|
||||
<thead>
|
||||
<tr class="thead-light"><th>Title</th></tr>
|
||||
<tr class="thead-light">
|
||||
<th>Title</th>
|
||||
<th>Author(s)</th>
|
||||
<th>Covertype</th>
|
||||
{% if InDBox %}
|
||||
<th>Remove?</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for book in books %}
|
||||
@@ -11,7 +47,20 @@
|
||||
{% 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>
|
||||
<td>{{ GetCovertypeById(book.covertype) }}</td>
|
||||
{% if InDBox %}
|
||||
<td><input name="bfl-rem-{{book.id}}" type="checkbox" onClick="ActivateBFLRemSelButton()"></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if not InDBox %}
|
||||
<button type="button" class="btn btn-primary" onClick="ShowDBox()">Add/Remove Books in Loan</button>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user