{% extends "base.html.j2" %}
{% block content %}
<h1>Edit printer</h1>
<div class="row">
  <form method="post">
    <div class="row">
      <div class="six columns">
        <label for="name">Printer name</label>
        <input type="text" name="name" value="{{ printer.name }}" />
      </div>
      <div class="six columns">
        <label for="chassis">Chassis</label>
        <select name="chassis_id">
          {% for c in ctx.db.list_chassis() %}
          <option value="{{c.id}}" {% if printer.chassis_id == c.id %}selected{%endif%}>{{c.name}}</option>
          {% endfor %}
        </select>
      </div>
    </div>
    <div class="row">
      <div class="twelve columns">
        <label for="url">Printer base URL</label>
        <input type="text" name="url" value="{{ printer.url }}" />
      </div>
    </div>
    <div class="row">
      <div class="twelve columns">
        <label for="url">Printer stream URL</label>
        <input type="text" name="stream_url" value="{{ printer.stream_url or ''}}" />
      </div>
    </div>
    <div class="row">
      <div class="twelve columns">
        <label for="api_key">API key</label>
        <input type="text" name="api_key" value="{{ printer.api_key }}" />
      </div>
    </div>
    <div class="row">
      <div class="four columns">
        <label for="filament">Filament load</label>
        <select name="filament_id">
          {% for f in ctx.db.list_filament() %}
          <option value="{{f.id}}" {% if printer.filament_id == f.id %}selected{%endif%}>{{f.name}}</option>
          {% endfor %}
        </select>
      </div>
      <div class="four columns">
        <label for="nozzle_diameter">Nozzle diameter (mm)</label>
        <input type="text" name="nozzle_diameter" value="{{ printer.nozzle_diameter}}" />
      </div>
      <div class="four columns">
        <label for="enabled">Printing enabled</label>
        <select name="enabled">
          <option value="1" {% if printer.enabled %}selected{%endif%}>Enabled</option>
          <option value="0" {% if not printer.enabled %}selected{%endif%}>Disabled</option>
        </select>
      </div>
    </div>
    <div class="row">
      <input type="hidden" name="id" value="{{ printer.id }}" />
      <input id="submit" type="submit" value="Submit" />
    </div>
  </form>
</div>
{% endblock %}
