{% from "components/folder-path.html" import folder_path, page_title_folder_path %} {% from "components/pill.html" import pill %} {% from "components/message-count-label.html" import message_count_label %} {% from "components/textbox.html" import textbox %} {% from "components/live-search.html" import live_search %} {% from "components/form.html" import form_wrapper %} {% from "components/page-footer.html" import page_footer %} {% extends "withnav_template.html" %} {% set page_title = 'Templates' %} {% block service_page_title %} {{ page_title_folder_path( template_folder_path, fallback_page_title=page_title, show_fallback_page_title=not current_service.all_template_folders ) }} {% endblock %} {% block maincolumn_content %} {% if (not current_service.all_templates) and (not current_service.all_template_folders) %}

{{ page_title }}

{% if current_user.has_permissions('manage_templates') %}

You need a template before you can send {% if 'letter' in current_service.permissions %} emails, text messages or letters {%- else -%} emails or text messages {%- endif %}.

Add a new template {% else %}

You need to ask your service manager to add templates before you can send {% if 'letter' in current_service.permissions %} emails, text messages or letters {%- else -%} emails or text messages {%- endif %}.

{% endif %} {% else %}
{{ folder_path( folders=template_folder_path, service_id=current_service.id, template_type=template_type, fallback_page_title=page_title, show_fallback_page_title=not current_service.all_template_folders ) }}
{% if current_user.has_permissions('manage_templates') %}
Add new template {% if can_manage_folders and current_template_folder_id %} Manage {% endif %}
{% endif %}
{% if show_template_nav %}
{{ pill(template_nav_items, current_value=template_type, show_count=False) }}
{% endif %} {{ live_search(target_selector='#template-list .template-list-item', show=show_search_box, form=search_form) }} {% if can_manage_folders %} {% call form_wrapper() %} {% include 'views/templates/_template_list.html' %} {% with templates=templates, template_folders=template_folders, templates_and_folders_form=templates_and_folders_form %} {% include 'views/templates/_move_to.html' %} {% endwith %} {% endcall %} {% else %} {% include 'views/templates/_template_list.html' %} {% endif %} {% endif %} {% endblock %}