{% load widget_tweaks %}
<div class="panel panel-default">
  <div class="panel-heading">
    Cable Details
  </div>
  <div class="panel-body">
    {% if create or edit or duplicate %}
    <div class="form-group">
      <label for="{{ form.cable_type.id_for_label }}">Cable Type</label>
      <div class="input-group">
        {% render_field form.cable_type|add_class:'form-control' %}
      </div>
    </div>
    <div class="form-group">
      <label for="{{ form.length.id_for_label }}">Length</label>
      <div class="input-group">
        {% render_field form.length|add_class:'form-control' %}
        <span class="input-group-addon">{{ form.length.help_text }}</span>
      </div>
    </div>
    <div class="form-group">
      <label for="{{ form.csa.id_for_label }}">Cross Sectional Area</label>
      <div class="input-group">
        {% render_field form.csa|add_class:'form-control' value=object.csa %}
        <span class="input-group-addon">{{ form.csa.help_text }}</span>
      </div>
    </div>
    {% else %}
    <dl>
      <dt>Cable Type</dt>
      <dd>{{ object.cable_type|default_if_none:'-' }}</dd>

      <dt>Length</dt>
      <dd>{{ object.length|default_if_none:'-' }}m</dd>

      <dt>Cross Sectional Area</dt>
      <dd>{{ object.csa|default_if_none:'-' }}mm²</dd>
    </dl>
    {% endif %}
  </div>
</div>
