{% extends 'assets/base.html' %}
{% load bob %}
{% load i18n %}

{% load assets %}

{% block content %}

<div class="row-fluid">
  <h3>{% block form_title %}{% endblock %}</h3>
</div>

<div class="row-fluid">
  <div class="span12">
    <form id="{{ form_id }}" class="form form-horizontal" method="POST"{% if edit_mode %} enctype="multipart/form-data"{% endif %} {% dependency_data asset_form %}>
      {% csrf_token %}

    <div class="row-fluid">

      <div class="span6">
      {% with left_col_fieldsets=asset_form.fieldsets.items|slice:":2" %}
        {# 'basic info', 'financial info' #}
        {% for fieldset_label, fields in left_col_fieldsets %}
          <div class="well fieldset">
            <h6>{{fieldset_label}}</h6>

          {% for field in fields %}
            {% with field=asset_form|get_item:field %}
              {% if field.is_hidden %}
                {{ field }}
              {% elif field.html_name not in multivalues_fields or edit_mode %}
                {% field_wrapper field %}
              {% endif %}
            {% endwith %}
          {% endfor %}

          </div>
        {% endfor %}
      {% endwith %}
      </div>

      <div class="span6 user_info">
      {% with right_col_fieldsets=asset_form.fieldsets.items|slice:"2:" %}
        {# 'user info' #}
        {% for fieldset_label, fields in right_col_fieldsets %}
          <div class="well fieldset">
            <h6>{{fieldset_label}}</h6>

          {% for field in fields %}
            {% with field=asset_form|get_item:field %}
              {% if field.html_name not in multivalues_fields or edit_mode %}
                {% field_wrapper field %}
              {% endif %}
            {% endwith %}
          {% endfor %}
          </div>
        {% endfor %}
      {% endwith %}

        <div class="well">
          <h6>Additional Info</h6>
          {# mode(DC|BO) specific fields #}
          {% block additional_inputs %}{% endblock %}
        </div>

        <div id="one-level-textareas-wrapper" >
          <div id="one-level-textareas">
            {% block multivalue_inputs %} {# sn, barcode, imei #} {% endblock %}
          </div>
        </div>
      {% block tabular_info %}{% endblock %}
      {% block parts %}{% endblock %}
      </div>

    </div>

    <div class="row-fluid">
      <div class="span12">
        <div class="form-actions">
          <button name="asset" type="submit" class="btn btn-primary">
            {% trans "Save" %}
          </button>
        </div>
      </div>
    </div>

    </form>

  </div>
</div>

{% include 'assets/attachment_deletion.html' with attachment_parent=asset mode=mode parent_name='asset'%}

{% endblock %}
