{% import "bootstrap5/form.html" as wtf %}
{% extends "plugins/themes/templates/index.html" %}
{% block title %}{{ title }}{% endblock %}
{% block themes_container %}
  <h1>{{ title }}</h1>
  <div style="padding-top: 1em;"/>
  <form id="form_project" class="form" action="{{ url_for('upload_project') }}" method="post" style="padding-bottom: 25px;" enctype="multipart/form-data">
    <div class="well form-group">
      {{ form_project.csrf_token }}
      {{ wtf.render_field(form_project.upload, form_type="horizontal") }}
      {{ wtf.render_field(form_project.submit, class="btn btn-primary") }}
    </div>
  </form>  
  <div class="panel panel-default">
    <div class="panel-heading clearfix" style="overflow: hidden;">
      <div class="panel-title pull-left" style="padding-top: 7.5px;"><b>{{ i18n('plugins.themes.files.qgis_projects') }}</b></div>
    </div>
    <div clas="panel-body">
      <table class="table">
        <thead>
          <th>{{ i18n('plugins.themes.files.project') }}</th>
          <th></th>
        </thead>
        <tbody>
        {% for project in projects %}
          <tr>
            <td>{{ project[1] }}</td>
            <td style="text-align: right">
              <div class="btn-group">
                <a href="{{ url_for('delete_project', projectname=project[1]) }}" class="btn btn-danger" role="button" title="{{ i18n('plugins.themes.files.delete_project') }}" onclick="return confirm('{{ i18n('plugins.themes.files.confirm_message_delete_project', [project[1]]) }}');">
                  {{ utils.render_icon('trash') }}
                </a>
              </div>
            </td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
  <form id="form_layer" class="form" action="{{ url_for('upload_layer') }}" method="post" style="padding-bottom: 25px;" enctype="multipart/form-data">
    <div class="well form-group">
      {{ form_layer.csrf_token }}
      {{ wtf.render_field(form_layer.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
      {{ wtf.render_field(form_layer.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
    </div>
  </form>  
  <div class="panel panel-default">
    <div class="panel-heading clearfix" style="overflow: hidden;">
      <div class="panel-title pull-left" style="padding-top: 7.5px;"><b>{{ i18n('plugins.themes.files.geospatial_file') }}</b></div>
    </div>
    <div clas="panel-body">
      <table class="table">
        <thead>
          <th>{{ i18n('plugins.themes.common.layer') }}</th>
          <th></th>
        </thead>
        <tbody>
        {% for layer in layers %}
          <tr>
            <td>{{ layer }}</td>
            <td style="text-align: right">
              <div class="btn-group">
                <a href="{{ url_for('delete_layer', layername=layer) }}" 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]) }}');">
                  {{ utils.render_icon('trash') }}
                </a>
              </div>
            </td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
  <form id="form_template" class="form" action="{{ url_for('upload_template') }}" method="post" style="padding-bottom: 25px;" enctype="multipart/form-data">
    <div class="well form-group">
      {{ form_template.csrf_token }}
      {{ wtf.render_field(form_template.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
      {{ wtf.render_field(form_template.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
    </div>
  </form>
  <div class="panel panel-default">
    <div class="panel-heading clearfix" style="overflow: hidden;">
      <div class="panel-title pull-left" style="padding-top: 7.5px;"><b>{{ i18n('plugins.themes.info_templates.title') }}</b></div>
    </div>
    <div clas="panel-body">
      <table class="table">
        <thead>
          <th>{{ i18n('plugins.themes.info_templates.template') }}</th>
          <th></th>
        </thead>
        <tbody>
        {% for template in templates %}
          <tr>
            <td>{{ template }}</td>
            <td style="text-align: right">
              <div class="btn-group">
                <a href="{{ url_for('delete_template', templatename=template) }}" class="btn btn-danger" role="button" title="{{ i18n('plugins.themes.info_templates.delete_template') }}" onclick="return confirm('{{ i18n('plugins.themes.info_templates.confirm_message_delete_template', [template]) }}');">
                  {{ utils.render_icon('trash') }}
                </a>
              </div>
            </td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
{% endblock %}
