app/views/carriers/_icon.html.erb
<%= render 'shared/pagination', items: carriers %>
<% @carriers.each_slice(4) do |carriers| %>
<div class="row mb-2">
<% carriers.each do |carrier| %>
<div class="col-md-3">
<div class="card carrier-card">
<% if carrier.photos.attached? %>
<div class="text-center">
<%= link_to carrier do %>
<%= image_tag(carrier.photos.first.variant(resize: "200x300").processed, class: "img-thumbnail img-fluid") %>
<% end %>
</div>
<% else %>
<%= link_to carrier do %>
<%= image_tag("img_placeholder.svg", class: "img-thumbnail placeholder-img") %>
<% end %>
<% end %>
<div class="card-body">
<div class="row"><div class="carrier-name"><strong><%= link_to carrier.name, carrier %></strong></div></div>
<div class="row"><div class="col">Item ID:</div><div class="col"><%= carrier.item_id %></div></div>
<div class="row"><div class="col">Current Location:</div><div class="col"><%= carrier.current_location.name %></div></div>
<div class="row"><div class="col">Category:</div><div class="col"><%= carrier.category.name %></div></div>
<div class="row"><div class="col">State:</div><div class="col"><strong><%= carrier.state.titleize %></strong></div></div>
<% if loan = carrier.outstanding_loan %>
<div class="row" title="Due: <%= loan.due_date %>">
<div class="col">
Due:
</div>
<div class="col" >
<div><%= distance_of_time_in_words(Time.zone.now, loan.due_date) %></div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<% end %>