<h2>Sent Invitations</h2>

<table class="data" id="invitations">
  <thead>
    <tr>
      <th>Recipient</th>
      <th>Sent</th>
      <th>Accepted?</th>
      <th colspan="2">
        <% if can?(:create, Invitation) and can?(:see, :multiple_users) %>
          <%= link_to_unless_current 'Invite a New Team Member', new_provider_admin_account_invitation_path, :class => 'action add' %>
       <% end %>
      </th>
    </tr>
  </thead>

  <tbody>
    <% @invitations.each do |invitation| %>
      <tr id="<%= dom_id(invitation) %>">
        <td><%= h invitation.email %></td>
        <td><%= invitation_sent_date(invitation) %></td>
        <td><%= invitation_status(invitation) %></td>

        <td>
          <% if can? :manage, invitation %>
            <% unless invitation.accepted? -%>
              <%= fancy_link_to("Resend", resend_provider_admin_account_invitation_path(invitation), {:method => :put, :class => 'refresh', "data-id" => invitation.id}) %>
            <% end -%>
          <% end -%>
        </td>
        <td>
          <% if can? :manage, invitation %>
            <%= delete_link_for provider_admin_account_invitation_path(invitation), data: { confirm: 'Are you sure you want to delete this invitation?' } %>
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= will_paginate @invitations %>
