<% filter_params = params.permit(Submissions::Filter::ALLOWED_PARAMS).compact_blank %> <% is_show_tabs = (@pagy.count.nil? || @pagy.count >= 5) || params[:status].present? || filter_params.present? %> <% if Docuseal.demo? %><%= render 'shared/demo_alert' %><% end %>
<%= render 'dashboard/toggle_view', selected: 'submissions' %>

<%= t('submissions') %>

<% if params[:q].present? || @pagy.pages > 1 || filter_params.present? %> <%= render 'shared/search_input' %> <% end %> <% if can?(:create, ::Template) %> <%= link_to new_template_path, class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> <% end %> <% end %>
<% view_archived_html = capture do %> <% if current_account.submissions.where.not(archived_at: nil).exists? %>
<%= t('view_archived') %>
<% end %> <% end %> <% if is_show_tabs %>
<%= svg_icon('list', class: 'w-5 h-5') %> <%= t('all') %>
<%= svg_icon('clock', class: 'w-5 h-5') %> <%= t('pending') %>
<%= svg_icon('circle_check', class: 'w-5 h-5') %> <%= t('completed') %>
<%= render 'submissions_filters/applied_filters', filter_params: %> <%= render 'submissions_filters/filter_button', filter_params: %> <%= render 'submissions_filters/actions', filter_params: %>
<% end %> <% if @pagy.count.nil? || @pagy.count > 0 %>
<%= render partial: 'templates/submission', collection: @submissions, locals: { with_template: true } %>
<% end %> <% if params[:q].blank? && params[:status].blank? && filter_params.blank? && @pagy.count.present? && @pagy.count < 5 %> <%= render 'templates/dropzone' %> <% end %> <% if @submissions.present? || (params[:q].blank? && filter_params.blank?) %> <% if @pagy.pages > 1 %> <%= render 'shared/pagination', pagy: @pagy, items_name: 'submissions', left_additional_html: view_archived_html %> <% else %>
<%= view_archived_html %>
<% end %> <% elsif params[:q].present? || filter_params.present? %>
<%= t('submissions_not_found') %>
<% end %>