<%= link_to(@is_archived ? templates_shared_index_path : root_path, class: 'flex items-center mb-1 md:mb-0') do %> <%= svg_icon('chevron_left', class: 'w-5 h-5') %> <%= @is_archived ? t('back_to_active') : t('home') %> <% end %>

<%= svg_icon('folder', class: 'w-9 h-9 flex-shrink-0') %> <%= t('shared') %> <% if @is_archived %> <%= t('archived') %> <% end %>

<% if params[:q].present? || @pagy.count.nil? || @pagy.count > 1 %> <%= render 'shared/search_input' %> <% end %>
<% view_archived_html = capture do %> <% if @has_archived && params[:q].blank? %>
<%= t('view_archived') %>
<% end %> <% end %> <% if @pagy.count.nil? || @pagy.count > 0 %>
<%= render partial: 'templates/template', collection: @templates %>
<% elsif params[:q].present? %>
<%= t('templates_not_found') %>
<% if @related_submissions.present? %>

<%= t('submissions') %>

<%= render partial: 'templates/submission', collection: @related_submissions, locals: { with_template: true } %>
<%= render 'shared/pagination', pagy: @related_submissions_pagy, items_name: 'submissions', next_page_path: @is_archived ? submissions_archived_index_path(q: params[:q]) : submissions_path(q: params[:q]) %> <% end %> <% end %> <% if @pagy.pages > 1 %> <%= render 'shared/pagination', pagy: @pagy, items_name: 'templates', left_additional_html: view_archived_html %> <% else %>
<%= view_archived_html %>
<% end %>