{% extends "plugins/themes/templates/index.html" %}
{% block title %}{{ title }}{% endblock %}
{% block themes_container %}
  <h1>{{ title }}</h1>
  <a href="{{ url_for('new_backgroundlayer', type='wms') }}" class="btn btn-success" role="button" title="{{ i18n('plugins.themes.backgroundlayers.new_wms_layer') }}">
    {{ utils.render_icon('plus-lg') }} WMS
  </a>
  <a href="{{ url_for('new_backgroundlayer', type='wmts') }}" class="btn btn-success" role="button" title="{{ i18n('plugins.themes.backgroundlayers.new_wmts_layer') }}">
    {{ utils.render_icon('plus-lg') }} WMTS
  </a>
  <a href="{{ url_for('new_backgroundlayer', type='xyz') }}" class="btn btn-success" role="button" title="{{ i18n('plugins.themes.backgroundlayers.new_xyz_layer') }}">
    {{ utils.render_icon('plus-lg') }} XYZ
  </a>
  <div style="padding-top: 1em;"/>
    <div clas="panel-body">
      <table class="table">
        <thead>
          <th>ID</th>
          <th>{{ i18n('interface.common.type') }}</th>
          <th>{{ i18n('interface.common.name') }}</th>
          <th>{{ i18n('interface.common.title') }}</th>
          <th></th>
        </thead>
        <tbody>
        {% for layer in backgroundlayers %}
          <tr>
            <td>{{ loop.index }}</td>
            <td>{{ layer.type }}</td>
            <td>{{ layer.name }}</td>
            <td>{{ layer.title }}</td>
            <td style="text-align: right">
              {% if layer.type == "wms" %}
                <a href="{{ url_for('edit_backgroundlayer', index=loop.index0) }}" class="btn btn-primary" role="button" title="{{ i18n('plugins.themes.backgroundlayers.edit_layer') }}">
                  {{ utils.render_icon('pencil') }}
                </a>
              {% endif %}
              <a href="{{ url_for('delete_backgroundlayer', index=loop.index0) }}" class="btn btn-danger" role="button" title="{{ i18n('plugins.themes.common.delete_layer') }}" onclick="return confirm('{{ i18n('plugins.themes.common.confirm_message_delete_layer', [layer.title]) }}');">
                {{ utils.render_icon('trash') }}
              </a>
            </td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
{% endblock %}
