<div class="col-lg-4 mb-4" id="book_<%= book.id%>">
  <div class="card h-100 shadow-sm">
    <h4 class="card-header"><%= book.title %></h4>
    <div class="card-body">
      <p class="card-text">
        <span> <%= book.description %> </span>
    </div>
    <% if current_user %>
      <div class="card-footer">
        <% if book.available_copies > 0 %>
          <% unless current_user.books.include?book %>
            <%= link_to 'Borrow', borrow_path(book), class: "btn btn-success", remote: true %>
          <% else %>
            <%= link_to 'Borrowed', 'javascript:;', class: "btn btn-primary", remote: true %>
          <% end %>
        <% else %>
          <a href="javascript:;" class= "btn btn-secondary">Not available</a>
        <% end %>
      </div>
    <% end %>
  </div>
</div>