<%= @template.name %>

<%= button_to button_title(title: 'Remove', icon: svg_icon('trash', class: 'w-6 h-6')), template_path(@template), class: 'btn btn-outline', method: :delete, data: { turbo_confirm: 'Are you sure?' } %> <%= link_to new_template_path(base_template_id: @template.id), class: 'btn btn-outline', data: { turbo_frame: :modal } do %> <%= svg_icon('copy', class: 'w-6 h-6') %> Clone <% end %> <%= link_to edit_template_path(@template), class: 'btn btn-outline' do %> <%= svg_icon('pencil', class: 'w-6 h-6') %> Edit <% end %>
<% if !@pagy.count.zero? || @template.submitters.to_a.size == 1 %>

Submissions

<% if @template.submitters.to_a.size == 1 %> <%= render 'shared/clipboard_copy', text: start_form_url(slug: @template.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Share Link', copied_title: 'Copied to Clipboard' %> <% end %> <% unless @pagy.count.zero? %> <%= link_to new_template_submission_path(@template), class: 'btn btn-primary text-base', data: { turbo_frame: 'modal' } do %> <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> <% end %> <% end %>
<% end %> <% status_badges = { 'awaiting' => 'badge-info', 'sent' => 'badge-info', 'completed' => 'badge-success', 'opened' => 'badge-warning' } %> <% if @submissions.present? %>
<% @submissions.each do |submission| %> <% if submission.template.submitters.size == 1 %>
<% submitter = submission.submitters.first %>
<%= svg_icon('user', class: 'w-6 h-6 stroke-2') %> <%= submitter.email %>
<%= submitter.status %>
<% if submitter.completed_at? %>
<% else %> <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submission.submitters.first.slug), class: 'btn btn-sm btn-neutral text-white w-36 flex', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Link' %> <% end %> <%= button_to submitter.completed_at? ? 'Archive' : 'Remove', submission_path(submission), class: 'btn btn-outline btn-sm w-28', title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
<% else %>
<% submission.template.submitters.each_with_index do |item, index| %> <% submitter = submission.submitters.find { |e| e.uuid == item['uuid'] } %>
<%= render 'icons/user_number', class: 'w-6 h-6 stroke-2', number: index + 1 %> <%= submitter.email %> <% unless submission.submitters.all?(&:completed_at?) %>
<%= submitter.status %>
<%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-xs text-xs btn-neutral text-white w-32 flex', icon_class: 'w-4 h-4 text-white', copy_title: 'Copy Link' %>
<% end %>
<% end %>
<% if submission.submitters.all?(&:completed_at?) %>
<%= submitter.status %>
<% end %> <%= button_to submitter.completed_at? ? 'Archive' : 'Remove', submission_path(submission), class: 'btn btn-outline btn-sm w-28', title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
<% end %>
<% end %>
<%= render 'shared/pagination', pagy: @pagy, items_name: 'submissions' %> <% else %>

There are no Submissions yet

Send an invitation to fill and submit the documents via email

<%= link_to new_template_submission_path(@template), class: 'base-button mt-6', data: { turbo_frame: 'modal' } do %> <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> <% end %>
<% end %>