<div id="key-overview">
  <h2>Provider API key</h2>
  <p class="info">
    Use this key when calling 3scale's API to
    authenticate yourself. This key should be kept secret between you and
    3scale and never passed to other people.
  </p>
  <p class="InfoBox InfoBox--notice">
    We strongly suggest using <%= link_to 'service tokens', provider_admin_user_access_tokens_path(anchor: 'service-tokens') %> to authenticate against the Service Management API and <%= link_to 'access tokens', provider_admin_user_access_tokens_path(anchor: 'access-tokens') %> to authenticate against the Account Management API, the Analytics API and the Billing API. Their custom/limited access scopes make them inherently more secure than using this provider API key.
  </p>
  <p class="key">
    <%= h current_account.api_key %>
  </p>
</div>

<div id="account-column-wrapper">
  <div class="overview-box" id="account-overview">
    <h2>
      Details
      <% if can? :update, current_account %>
        <span class="operations">
          <%= link_to 'Edit', edit_provider_admin_account_path, :class => 'action edit' %>
        </span>
      <% end %>
    </h2>

    <table class="data">
      <% @account.defined_fields.each do |field| %>
        <% if @account.field_value(field.name).present? && field.visible_for?(current_user) -%>
          <tr>
            <th><%= @account.field_label(field.name) %></th>
            <td><%= h @account.field_value(field.name) %></td>
          </tr>
        <% end %>
      <% end %>
    </table>

    <% if ThreeScale.tenant_mode.multitenant? && can?(:destroy, current_account) %>
      <div id="account-cancellation">
        <h2>Account Cancellation</h2>
        <p>
          <% if @account.heroku? %>
            You can cancel your account from the Heroku dashboard.
          <% else %>
            Please email <%= mail_to 'support@3scale.net' %> if you would like to cancel your account.
          <% end %>
        </p>
      </div>
    <% end %>
  </div>
  <% if ThreeScale.tenant_mode.multitenant? %>
    <% plan = @account.bought_plan %>

    <div class="overview-box features" id="plan-overview">
      <h2>You are on the '<%= plan.name %>' plan
        <% if can? :upgrade, current_account %>
          <p data-object="plan" data-id="<%= plan.id %>">
            <%= link_to 'Upgrade', '#', :id => 'change-plan', :class => 'important-button' %>
          </p>
          <%= render 'change_plan' %>
        <% end %>
      </h2>

      <ul class="features">
        <% plan.features.each do |feature| %>
          <%= content_tag :li, h(feature.name), :class => 'present'  %>
        <% end %>

        <%  plan.issuer.features.visible.each do |feature| %>
          <% next if plan.feature_enabled?(feature.system_name) %>
          <%= content_tag(:li, h(feature.name), :class => 'absent') %>
        <% end %>
      </ul>
    </div>
  <% end %>
</div>

