{% load i18n %}
{% load sizefieldtags %}
{% load crispy_forms_tags %}


<div class="label label-info label-100" id="modify-the-resources">
  {% trans "Modify the resources" %}
</div>
<form method="POST" action="{{ op.resources_change.get_url }}" id="vm-details-resources-form">
  {% csrf_token %}

  {{ resources_form.flavor|as_crispy_field }}

  <button type="submit" class="btn btn-success btn-sm change-resources-button"
    id="vm-details-resources-save" data-vm="{{ instance.pk }}">
    <i class="fa fa-floppy-o"></i> {% trans "Save resources" %}
  </button>
</form>

<hr />

<div id="vm-details-resources-disk">
  <h3>
    <div class="pull-right">
      <div id="disk-ops">
        {% include "dashboard/vm-detail/_disk-operations.html" %}
      </div>
    </div>
    {% trans "Disks" %}
  </h3>
  <div class="clearfix"></div>

  {% if not instance.disks.all %}
    {% trans "No disks are added." %}
  {% endif %}
  {% for d in instance.disks.all %}
    <h4 class="list-group-item-heading dashboard-vm-details-network-h3">
      {% with long_remove=True %}
        {% include "dashboard/_disk-list-element.html" %}
      {% endwith %}
    </h4>
  {% endfor %}
</div>

<hr />
{% if instance.disks.all %}
  <div id="vm-details-resize-how-to">
    <i class="fa fa-question"></i>
    {% url "info.resize" as resize_url %}
    {% blocktrans with url=resize_url %}
    If you need help resizing the disks check out our <a href="{{ url }}">resize how-to.</a>
    {% endblocktrans %}
  </div>
{% endif %}

{% if user.is_superuser %}
<hr/>

<div class="row">
  <div class="col-sm-12">
    <h3>
      {% trans "Required traits" %}
    </h3>

    {% crispy traits_form %}
  </div>
</div>

<hr/>

<div class="row">
  <div class="col-sm-12">
    <h3>
      {% trans "Raw data" %}
    </h3>

    {% crispy raw_data_form %}
  </div>
</div>

{% endif %}

{% block extra_js %}
  <style>
    label {padding-top: 6px;}
    .form-group {margin-bottom: 8px;}
  </style>
{% endblock %}
