{% extends "withnav_template.html" %}
{% from "components/folder-path.html" import folder_path, page_title_folder_path %}
{% from "components/textbox.html" import textbox %}
{% from "components/checkbox.html" import checkbox, checkboxes %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}

{% block service_page_title %}
  {{ page_title_folder_path(template_folder_path) }}
{% endblock %}

{% block maincolumn_content %}

  <div class="grid-row bottom-gutter-1-2">
    <div class="column-whole">
      {{ folder_path(
        folders=template_folder_path,
        service_id=current_service.id,
        template_type='all',
        current_user=current_user,
        link_current_item=True
      ) }}
    </div>
  </div>

  {% call form_wrapper(action=url_for('main.manage_template_folder', service_id=current_service.id, template_folder_id=template_folder_id)) %}
    {{ textbox(form.name, width='1-1') }}
    {% if current_user.has_permissions("manage_service") and form.users_with_permission.all_service_users %}
      {{ checkboxes(form.users_with_permission, collapsible_opts={ 'field': 'team member' }) }}
    {% endif %}

    {{ page_footer(
      'Save',
      delete_link=url_for(
        '.delete_template_folder',
        service_id=current_service_id,
        template_folder_id=template_folder_id
      ),
      delete_link_text="Delete this folder") }}
  {% endcall %}

{% endblock %}
