Commit 80a160103db15017c996d0bb406b6553abda7b00

Show 'copy'/loan details
  
2222
2323 map.connect('books', '/books', controller="book", action="index")
2424 map.connect('book', '/book/{id}', controller="book", action="show")
25 map.connect('copy', '/copy/{id}', controller="book", action="show_copy")
2526 map.connect('checkout_copy', '/copy/{id}/checkout', controller="book", action="checkout")
2627 map.connect('checkin_copy', '/copy/{id}/checkin', controller="book", action="checkin")
2728 map.resource('user', 'users')
  
2222 abort(404)
2323 c.users = [(user.user_id, user.name) for user in model.User.query()]
2424 return render("books/show.mako")
25 def show_copy(self, id):
26 c.copy = model.Copy.query().get(id)
27 if c.copy is None:
28 abort(404)
29 c.users = [(user.user_id, user.name) for user in model.User.query()]
30 return render("books/show_copy.mako")
2531 def checkout(self, id):
2632 copy = model.Copy.query().get(id)
2733 if copy is None:
  
1515<table border="0" cellspacing="5" cellpadding="5">
1616 <tr><th>Copy ID</th><th>Acquired On</th><th>Condition</th><th>Checked Out?</th><th>Checked Out To</th><th>Due Date</th><th>Actions</th></tr>
1717% for copy in c.item.copies:
18 <tr><td>${copy.copy_id}</td><td>${copy.acquired_date}</td><td>${copy.condition_notes}</td><td>${copy.is_out()}</td><td>${copy.current_loan().user.name if copy.is_out() else u""}</td><td>${copy.current_loan().due_date if copy.is_out() else u""}</td><td>
18 <tr><td>${copy.copy_id}</td><td>${copy.acquired_date}</td><td>${copy.condition_notes}</td><td>${copy.is_out()}</td><td>${copy.current_loan().user.name if copy.is_out() else u""}</td><td>${copy.current_loan().due_date if copy.is_out() else u""}</td><td>${h.link_to("Details", url("copy", id=copy.copy_id))} —
1919% if copy.is_out():
2020${h.form(url('checkin_copy', id=copy.copy_id))}
2121${h.submit("checkin", "Checkin")}
  
1<%inherit file="/layout.mako"/>
2<%def name="pagetitle()">
3Item: "${c.copy.item.title}", copy ID ${c.copy.copy_id}
4</%def>
5<p>${h.link_to("All Items", url("books"))} — ${h.link_to("General view of this item", url("book", id=c.copy.item.item_id))}</p>
6<table border="0" cellspacing="5" cellpadding="5">
7 <tr><td>Item ID</td><td>${c.copy.item.item_id}</td></tr>
8 <tr><td>Title</td><td>${c.copy.item.title}</td></tr>
9 <tr><td>Author</td><td>${c.copy.item.author}</td></tr>
10 <tr><td>EAN</td><td>${c.copy.item.ean}</td></tr>
11 <tr><td>Publication Date</td><td>${c.copy.item.pub_date}</td></tr>
12 <tr><td>Kind</td><td>${c.copy.item.kind}</td></tr>
13</table>
14<table border="0" cellspacing="5" cellpadding="5">
15 <tr><td>Copy ID</td><td>${c.copy.copy_id}</td></tr>
16 <tr><td>Acquired On</td><td>${c.copy.acquired_date}</td></tr>
17 <tr><td>Condition</td><td>${c.copy.condition_notes}</td></tr>
18</table>
19
20<p>Loans
21<table border="0" cellspacing="5" cellpadding="5">
22 <tr><th>User's Name</th><th>User's Address</th><th>Checkout Date</th><th>Due Date</th><th>Returned</th></tr>
23% for loan in c.copy.loans:
24<tr><td>${loan.user.name}</td><td>${loan.user.address}</td><td>${loan.checked_out}</td><td>${loan.due_date}</td><td>${loan.returned}</td></tr>
25% endfor
26</table>
27</p>