<% @contracts.each do |contract| %>
  <% site = contract.get_site if contract.site_request.type == "existing" %>
  <tr>
    <td><%= contract.uid %>
    <td><%= contract.contract_user.name %></td>
    <td>
      <% case contract.site_request.type %>
      <% when "newsite" %>
        <span class="label label-success">New Site</span>
      <% when "existing" %>
        <span class="label label-warning">New Feature</span>
        <% if !site.nil? %>
          <div>Requested for : <a href="http://<%= site.site_domain %>" target="_blank"><%= site.title %></a></div>
        <% else %>
          Site Deleted
        <% end %>
      <% end %>
    </td>
    <td><%= contract.created_at.strftime("%y-%m-%d %H:%M") %></td>
    <td><%= (contract.confirmed ? "<span class='label label-success'>Yes</span>" : "<span class='label label-important'>No</span>").html_safe %></td>
    <td>
      <% if contract.site_request.type == "newsite" %>
        <a href="<%= see_contract_admin_client_management_path(contract.id) %>" class="btn btn-info">View</a>
      <% elsif contract.site_request.type == "existing" && !site.nil? %>
        <a href="<%= see_contract_admin_client_management_path(contract.id) %>" class="btn btn-info">View</a>
      <% end %>
    </td>
  </tr>
<% end %>