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

<div class="page-header">
  <h2>settings</h2>
  <sl-divider vertical></sl-divider>
  <sl-button-group>
    <sl-button href="/system/settings/toml">update</sl-button>
    <sl-button href="/api/system/settings/toml">view</sl-button>
  </sl-button-group>
</div>

<form method="post">
  <table>
    <tr>
      <th>key</th>
      <th>type</th>
      <th>value</th>
    </tr>
    {% 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">
        <sl-checkbox name="{{ key }}" {{ "checked" if value }} value="true">
          {% elif info.types[key].value =="MULTILINE" %}
          length: {{ info.settings[key] | length }} /
          <sl-button href="/system/settings/multiline/{{ key }}">update</sl-button>
          {% else %}
          <sl-input name="{{ key }}" value="{{ value }}"></sl-input>
          {% endif %}
      </td>
    </tr>
    {% endif %}
    {% endfor %}
  </table>
  <sl-divider></sl-divider>
  <sl-button type="submit" variant="primary">save</sl-button>
</form>
{% endblock %}