<%= render 'banner' %>
<% unless @template.archived_at? %>
<%= t('you_have_been_invited_to_submit_a_form') %>
<% end %>
<%= svg_icon('writing_sign', class: 'w-10 h-10') %>
<%= @template.name %>
<% if @template.archived_at? %>
<%= t('form_has_been_deleted_by_html', name: @template.account.name) %>
<% else %>
<%= t('invited_by_html', name: @template.account.name) %>
<% end %>
<% if !@template.archived_at? && !@template.account.archived_at? %>
<%= form_for @submitter, url: start_form_path(@template.slug), data: { turbo_frame: :_top }, method: :put, html: { class: 'space-y-4' } do |f| %>
<% if @error_message %>
<%= svg_icon('info_circle', class: 'stroke-current shrink-0 h-6 w-6 mt-1') %>
<%= @error_message %>
<% end %>
<% link_form_fields = @template.preferences.fetch('link_form_fields', ['email']) %>
<% multiple_fields = link_form_fields.size > 1 %>
<% if link_form_fields.include?('name') %>
<%= f.label :name, t('name'), class: 'label' %>
<%= f.text_field :name, value: current_user&.full_name || params[:name] || @submitter.name, required: true, class: 'base-input', placeholder: t(multiple_fields ? 'provide_your_name' : 'provide_your_name_to_start') %>
<% end %>
<% if link_form_fields.include?('email') %>
<%= f.label :email, t('email'), class: 'label' %>
<%= f.email_field :email, value: current_user&.email || params[:email] || @submitter.email, required: true, class: 'base-input', placeholder: t(multiple_fields ? 'provide_your_email' : 'provide_your_email_to_start') %>
<% end %>
<% if link_form_fields.include?('phone') %>
<%= f.label :phone, t('phone'), class: 'label' %>
<%= f.telephone_field :phone, value: params[:phone] || @submitter.phone, pattern: '^\+[0-9\s\-]+$', oninvalid: "this.value ? this.setCustomValidity('#{t('use_international_format_1xxx_')}') : ''", oninput: "this.setCustomValidity('')", required: true, class: 'base-input', placeholder: t(multiple_fields ? 'provide_your_phone_in_international_format' : 'provide_your_phone_in_international_format_to_start') %>
<% end %>
<%= f.button button_title(title: t('start'), disabled_with: t('starting')), class: 'base-button' %>
<% end %>
<% end %>