<%- cinstances = @account.bought_cinstances -%>

<%- if cinstances.size == 1 -%>
  <div class="dashboard_bubble round">
    <div id="applications_widget">
    <% cinstances.first.tap do |cinstance| %>
      <h2>Application</h2>

      <table class="list">
        <tr>
          <th>Name</th>
          <td>
            <%= link_to cinstance.name, admin_buyers_application_path(cinstance) %>
          </td>
        </tr>

        <tr>
          <th>Service</th>
          <td><%= h cinstance.service.name %></td>
        </tr>

        <tr>
          <th>Plan</th>
          <td><%= h cinstance.plan.name %></td>
        </tr>

        <tr>
          <th>State</th>
          <td><%= h cinstance.state.to_s.humanize %></td>
        </tr>
      </table>

      <%- cache [ 'v1', 'cinstance', 'sparklines', cinstance.service, cinstance ] do %>
        <%= render 'stats/sparklines', :cinstance => cinstance, :metrics => cinstance.service.metrics.top_level %>
      <%- end %>
    <% end %>
    </div>
  </div>
<% end %>

