33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
<h1 class="my-4">My Books</h1>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">#</th>
|
|
<th scope="col">Title</th>
|
|
<th scope="col">Borrow date</th>
|
|
<th scope="col">Expected Return date</th>
|
|
<th scope="col">Actual Return date</th>
|
|
<th scope="col">Status</th>
|
|
<th scope="col">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @books.each_with_index do |book, index| %>
|
|
<% user_book = book.users_books.first %>
|
|
<tr>
|
|
<th scope="row"><%= index + 1 %></th>
|
|
<td><%= book.title %></td>
|
|
<td><%= decorate_date(user_book.created_at) %></td>
|
|
<td><%= decorate_date(user_book.due_date) %></td>
|
|
<td><%= decorate_date(user_book.returned_at) %></td>
|
|
<td><%= user_book.status.titleize %></td>
|
|
<% if user_book.returned? %>
|
|
<td></td>
|
|
<% else %>
|
|
<td td><%= link_to 'Return', returns_path(book), class: 'btn btn-primary btn-sm', data: { confirm: 'Are you sure?'} %></td>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<%= paginate @books, theme: 'twitter-bootstrap-4' %> |