<%= render 'title', template: @template %> <% is_show_tabs = @pagy.pages > 1 || params[:status].present? %> <% if !@pagy.count.zero? || params[:q].present? %>

Submissions

<% if params[:q].present? || params[:status].present? || @pagy.pages > 1 %> <%= render 'shared/search_input' %> <% end %> <%= link_to new_template_submissions_export_path(@template), class: 'hidden md:flex btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %> <%= svg_icon('download', class: 'w-6 h-6 stroke-2') %> Export <% end %> <% if !@template.archived_at? && can?(:create, Submission) %> <%= link_to new_template_submission_path(@template), class: 'white-button !border', data: { turbo_frame: 'modal' } do %> <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> Add <% end %> <% end %>
<% end %> <% if is_show_tabs %>
<%= svg_icon('list', class: 'w-5 h-5') %> All
<%= params[:status].blank? ? @pagy.count : @base_submissions.count %>
<%= svg_icon('clock', class: 'w-5 h-5') %> Pending
<%= params[:status] == 'pending' ? @pagy.count : @base_submissions.pending.count %>
<%= svg_icon('circle_check', class: 'w-5 h-5') %> Completed
<%= params[:status] == 'completed' ? @pagy.count : @base_submissions.completed.count %>
<% end %> <% if @submissions.present? %>
<%= render partial: 'submission', collection: @submissions %>
<% view_archived_html = capture do %> <% if @template.submissions.where.not(archived_at: nil).exists? && !@template.archived_at? %>
View Archived
<% end %> <% end %> <% if @pagy.pages > 1 %> <%= render 'shared/pagination', pagy: @pagy, items_name: 'submissions', left_additional_html: view_archived_html %> <% else %>
<%= view_archived_html %>
<% end %> <% else %>

There are no Submissions

<% if @template.archived_at.blank? && params[:q].blank? %>

Send an invitation to fill and complete the form

<% if can?(:create, Submission) %> <%= link_to new_template_submission_path(@template, with_link: true), class: 'base-button mt-6', data: { turbo_frame: 'modal' } do %> <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> Send to Recipients <% end %> <% end %> <% if @template.submitters.size == 1 %> <%= link_to start_form_url(slug: @template.slug), class: 'white-button mt-6', target: '_blank', rel: 'noopener' do %> <%= svg_icon('writing', class: 'w-6 h-6') %> Sign it Yourself <% end %> <% else %> <%= link_to new_template_submission_path(@template, selfsign: true), class: 'white-button mt-6', data: { turbo_frame: 'modal' } do %> <%= svg_icon('writing', class: 'w-6 h-6') %> Sign it Yourself <% end %> <% end %> <% end %>
<% end %>