{% extends 'base/layout.html' %}
{% load form_helpers %}

{% block title %}
  {% if object.pk %}Edit {{ object }}{% else %}Add Z-Wave Device{% endif %}
{% endblock %}

{% block content %}
  <form action="" method="post" enctype="multipart/form-data" class="form-object-edit">
    {% csrf_token %}
    <div class="row">
      <div class="col col-md-6">
        <div class="card">
          <h5 class="card-header">Device Details</h5>
          <div class="card-body">
            {% render_field form.network %}
            {% render_field form.name %}
            {% render_field form.node_id %}
            {% render_field form.device_type %}
            {% render_field form.status %}
            {% render_field form.description %}
          </div>
        </div>
      </div>
      <div class="col col-md-6">
        <div class="card">
          <h5 class="card-header">Product Information</h5>
          <div class="card-body">
            {% render_field form.manufacturer_id %}
            {% render_field form.product_type %}
            {% render_field form.product_id %}
            {% render_field form.firmware_version %}
            {% render_field form.hardware_version %}
            {% render_field form.library_type %}
            {% render_field form.protocol_version %}
            {% render_field form.application_version %}
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col col-md-6">
        <div class="card">
          <h5 class="card-header">Capabilities</h5>
          <div class="card-body">
            {% render_field form.is_secure %}
            {% render_field form.is_frequent_listener %}
            {% render_field form.is_beaming %}
            {% render_field form.is_routing %}
            {% render_field form.max_baud_rate %}
          </div>
        </div>
      </div>
      <div class="col col-md-6">
        <div class="card">
          <h5 class="card-header">Status Information</h5>
          <div class="card-body">
            {% render_field form.last_seen %}
            {% render_field form.battery_level %}
            {% render_field form.signal_strength %}
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col col-md-12 text-end">
        <a href="{{ return_url }}" class="btn btn-outline-danger">Cancel</a>
        <button type="submit" name="_save" class="btn btn-primary">Save</button>
        <button type="submit" name="_addanother" class="btn btn-outline-primary">Save & Add Another</button>
      </div>
    </div>
  </form>
{% endblock %}
