<main class="max-w-md mx-auto px-2 mt-12 mb-4">
  <div class="space-y-6 mx-auto">
    <div class="space-y-6">
      <div class="flex items-center justify-center">
        <%= render 'banner' %>
      </div>
      <div class="flex items-center bg-base-200 rounded-xl p-4 mb-4">
        <div class="flex items-center">
          <div class="mr-3">
            <%= svg_icon('writing_sign', class: 'w-10 h-10') %>
          </div>
          <div>
            <p dir="auto" class="text-lg font-bold mb-1"><%= @submitter.submission.template&.name %></p>
            <p dir="auto" class="text-sm">
              <%= t(@submitter.with_signature_fields? ? 'signed_on_time' : 'completed_on_time', time: l(@submitter.completed_at.to_date, format: :long)) %>
            </p>
          </div>
        </div>
      </div>
    </div>
    <div dir="auto" class="text-center text-2xl font-semibold">
      <%= @submitter.with_signature_fields? ? t('document_has_been_signed_already') : t('form_has_been_submitted_already') %>
    </div>
    <% if Docuseal.multitenant? || Accounts.can_send_emails?(@submitter.account) %>
      <toggle-submit class="block">
        <%= button_to button_title(title: t('send_copy_to_email'), disabled_with: t('sending'), icon: svg_icon('mail_forward', class: 'w-6 h-6')), send_submission_email_index_path, params: { template_slug: @template.slug, email: params[:email] }, class: 'base-button w-full' %>
      </toggle-submit>
    <% end %>
    <% if Templates.filter_undefined_submitters(@template.submitters).size == 1 && %w[api embed mcp].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false && @template.shared_link? %>
      <toggle-submit class="block">
        <%= button_to button_title(title: t('resubmit'), disabled_with: t('resubmit'), icon: svg_icon('reload', class: 'w-6 h-6')), start_form_path(@template.slug), params: { submitter: params.permit(:name, :email, :phone).compact_blank, resubmit: true }, method: :put, class: 'white-button w-full' %>
      </toggle-submit>
    <% end %>
  </div>
</main>
<%= render 'shared/attribution', link_path: '/start', account: @submitter.account %>
