<%= render 'buyers/accounts/menu' %>
<h2>Service subscriptions of <%= h @account.org_name %></h2>

<table class="data">
  <thead>
    <tr>
      <th>Service</th>
      <th>Plan</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    <% @services.each do |service| %>
      <tr id="<%= dom_id(service) %>">
        <td><%= h service.name %></td>
        <td class="plan">
          <% if contract = @service_contracts.issued_by(service).first %>
            <%= contract.plan.name %>
          <%-end%>
        </td>
        <td class="action">
          <%- if contract -%>
            <%#= action_link_to :delete, admin_buyers_account_service_contract_path(@account, contract),
                               :'data-confirm' => 'Really delete this service contract?', :'data-method' => :delete %>
            <%= admin_change_service_plan_link @account, service, contract %>
          <%-else-%>
            <%= admin_subscribe_service_link @account, service, contract %>
          <%-end-%>
        </td>
      </tr>
    <%-end-%>
  </tbody>
</table>
