<% if !@objects.empty? %>
  <% @objects.each do |obj| %>
    <div class="item-history">
      <% case obj.type %>
      <% when "newsite" %>
        <span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">New Site</a></span>
      <% when "existing" %>
        <span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">New Request for <strong><%= obj.get_site.title %></strong></a></span>
      <% when "addsites" %>
        <span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">Request for adding sites</a></span>
      <% end %>
      <div class="info-site">
        <span class="url-site"><i class="fa fa-hashtag" aria-hidden="true"></i>Request ID: <%= obj.uid %></a></span>
        <% if obj.type == "existing" %>
          <span class="url-site"><i class="fa fa-laptop" aria-hidden="true"></i><a href="http://<%= obj.get_site.site_domain %>" target="_blank"><%= obj.get_site.site_domain %></a></span>
        <% end %>
        <span class="time-site"><i class="fa fa-clock-o" aria-hidden="true"></i>Time :&nbsp;&nbsp;<%= obj.created_at.strftime("%d %B %Y - %H:%M") %></span>
      </div>
      <% if obj.completed %>
        <span class="status-detail confirmed">Completed</span>
      <% else %>
        <span class="status-detail requested">Requested</span>
      <% end %>
      <span class="action-site">
      <% if !obj.completed %>
        <a href="<%= cpanel_cancel_request_path(obj.uid, :page => params[:page]) %>" class="btn btn-warning cancel-request-btn">Cancel</a>
      <% else %>
        <% if (obj.type == "newsite" || obj.type == "existing") && !obj.request_contract.nil? %>
          <a href="/cpanel/contract/<%= obj.request_contract.uid  %>?page=<%= params[:page] %>" class="btn btn-info">Contract</a>
        <% end %>
      <% end %>
      </span>
    </div>
  <% end %>
  <input type="hidden" class="total-pages" value="<%= @objects.total_pages %>">
<% else %>
  <div id="error-msg-area" class="cp-message-box">
    <div class="message-text">
      Sorry, we found nothing.
    </div>
  </div>
<% end %>