{% extends "inc/base.j2" %}
{% block content %}

<div class="page-header">
  <h2>settings</h2>
  <nav>
    <a href="/system/settings/toml">update via toml</a>
    <a href="/api/system/settings/toml">view toml</a>
  </nav>
</div>

<form method="post">
  <table>
    <thead>
      <tr>
        <th>key</th>
        <th>type</th>
        <th>value</th>
      </tr>
    </thead>
    <tbody>
    {% for key, value in info.settings.items() %}
    {% if key not in info.hidden %}
    <tr>
      <td title="{{ info.descriptions[key] }}">{{ key }}</td>
      <td>{{ info.types[key].value }}</td>
      <td>
        {% if info.types[key].value == "BOOLEAN" %}
        <input type="hidden" name="{{ key }}" value="false">
        <input type="checkbox" name="{{ key }}" {{ "checked" if value }} value="true">
        {% elif info.types[key].value =="MULTILINE" %}
        length: {{ info.settings[key] | length }} /
        <a href="/system/settings/multiline/{{ key }}">update</a>
        {% else %}
        <input name="{{ key }}" value="{{ value }}">
        {% endif %}
      </td>
    </tr>
    {% endif %}
    {% endfor %}
    </tbody>
  </table>
  <hr>
  <button type="submit">save</button>
</form>
{% endblock %}
