{% extends 'base_assets.html' %}
{% load widget_tweaks %}
{% block title %}Cable Type{% endblock %}

{% block content %}
<div class="page-header">
  <h1>
      {% if create %}Create{% elif edit %}Edit{% endif %} Cable Type
  </h1>
</div>
{% if create %}
<form method="POST" action="{% url 'cable_type_create'%}">
{% elif edit %}
<form method="POST" action="{% url 'cable_type_update' object.id %}">
{% endif %}
{% include 'form_errors.html' %}
{% csrf_token %}
<input type="hidden" name="id" value="{{ object.id|default:0 }}" hidden=true>
<div class="row">
  <div class="col-sm-12">
    {% if create or edit %}
    <div class="form-group">
      <label for="{{ form.plug.id_for_label }}">Plug</label>
      {% render_field form.plug|add_class:'form-control'%}
    </div>
    <div class="form-group">
      <label for="{{ form.socket.id_for_label }}">Socket</label>
      {% render_field form.socket|add_class:'form-control'%}
    </div>
    <div class="form-group">
      <label for="{{ form.circuits.id_for_label }}">Circuits</label>
      {% render_field form.circuits|add_class:'form-control' value=object.circuits %}
    </div>
    <div class="form-group">
      <label for="{{ form.cores.id_for_label }}">Cores</label>
      {% render_field form.cores|add_class:'form-control' value=object.cores %}
    </div>
    <div class="pull-left">
        <button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-floppy-disk"></i> Save</button>
        <br>
        <button type="reset" class="btn btn-link">Cancel</button>
    </div>
    {% else %}
    <dl>
      <dt>Socket</dt>
      <dd>{{ object.socket|default_if_none:'-' }}</dd>

      <dt>Plug</dt>
      <dd>{{ object.plug|default_if_none:'-' }}</dd>

      <dt>Circuits</dt>
      <dd>{{ object.circuits|default_if_none:'-' }}</dd>

      <dt>Cores</dt>
      <dd>{{ object.cores|default_if_none:'-' }}</dd>
    </dl>
    {% endif %}
  </div>
</div>
</form>
{% endblock %}
