Files
docuseal/app/views/submissions/new.html.erb
T

48 lines
3.3 KiB
Plaintext
Raw Normal View History

2025-04-08 15:24:17 +03:00
<% require_phone_2fa = @template.preferences['require_phone_2fa'] == true %>
2025-12-08 09:32:03 +02:00
<% require_email_2fa = @template.preferences['require_email_2fa'] == true %>
2025-07-27 10:27:12 +03:00
<% prefillable_fields = @template.fields.select { |f| f['prefillable'] } %>
2026-07-04 15:47:40 +03:00
<% viewer_submitter_uuids = Set.new(@template.submitters.pluck('uuid')) - Set.new(@template.fields.to_a.pluck('submitter_uuid')) %>
2026-02-11 12:16:05 +02:00
<% default_tab = cookies.permanent[:add_recipients_tab].presence || 'email' %>
2025-12-19 11:55:25 +02:00
<% recipient_form_fields = Accounts.load_recipient_form_fields(current_account) if prefillable_fields.blank? %>
2026-06-26 15:11:54 +03:00
<% can_send_emails = Accounts.can_send_emails?(current_account) %>
2025-12-19 11:55:25 +02:00
<% only_detailed = require_phone_2fa || require_email_2fa || prefillable_fields.present? || recipient_form_fields.present? %>
2026-02-12 09:22:08 +02:00
<% with_list = @template.variables_schema.blank? %>
<% variables_form = render 'variables_form', schema: @template.variables_schema if @template.variables_schema.present? && @template.variables_schema.any? { |_, v| !v['disabled'] } %>
2024-09-23 11:38:08 +03:00
<%= render 'shared/turbo_modal_large', title: params[:selfsign] ? t('add_recipients') : t('add_new_recipients') do %>
2026-02-12 09:22:08 +02:00
<% options = [only_detailed ? nil : [t('via_email'), 'email'], only_detailed ? nil : [t('via_phone'), 'phone'], [t('detailed'), 'detailed'], with_list ? [t('upload_list'), 'list'] : nil].compact %>
2026-03-16 08:52:42 +02:00
<% if options.size > 1 %>
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center px-2 mt-4 block">
<div class="flex justify-center">
<% options.each_with_index do |(label, value), index| %>
<%= content_tag(value == 'list' ? 'span' : 'toggle-cookies', data: { value:, key: 'add_recipients_tab' }) do %>
<%= radio_button_tag 'option', value, value == (only_detailed ? 'detailed' : default_tab), class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %>
<label for="option_<%= value %>" class="block bg-base-200 md:min-w-[112px] text-sm font-semibold whitespace-nowrap py-1.5 px-4 peer-checked:bg-base-300 <%= 'hidden sm:inline-block' if value == 'list' %> <%= 'rounded-l-3xl' if index.zero? %> <%= 'rounded-r-3xl sm:rounded-r-none' if value == 'detailed' && index != options.size - 1 %> <%= 'rounded-r-3xl' if index == options.size - 1 %>">
<%= label %>
</label>
<% end %>
2026-02-11 12:16:05 +02:00
<% end %>
2026-03-16 08:52:42 +02:00
</div>
</toggle-visible>
<% end %>
2024-09-16 00:52:59 +03:00
<div class="px-5 mb-5 mt-4">
2025-07-27 10:27:12 +03:00
<% unless only_detailed %>
2026-02-11 12:16:05 +02:00
<div id="email" class="<%= 'hidden' if default_tab != 'email' %>">
2026-07-04 15:47:40 +03:00
<%= render 'email_form', template: @template, variables_form:, can_send_emails:, viewer_submitter_uuids: %>
2025-04-08 15:24:17 +03:00
</div>
2026-02-11 12:16:05 +02:00
<div id="phone" class="<%= 'hidden' if default_tab != 'phone' %>">
2026-02-12 09:22:08 +02:00
<%= render 'phone_form', template: @template, variables_form: %>
2025-04-08 15:24:17 +03:00
</div>
<% end %>
2026-02-11 12:16:05 +02:00
<div id="detailed" class="<%= 'hidden' if !only_detailed && default_tab != 'detailed' %>">
2026-07-04 15:47:40 +03:00
<%= render 'detailed_form', template: @template, require_phone_2fa:, require_email_2fa:, prefillable_fields:, recipient_form_fields:, variables_form:, can_send_emails:, viewer_submitter_uuids: %>
2024-03-30 19:37:48 +02:00
</div>
2026-02-12 09:22:08 +02:00
<% if with_list %>
<div id="list" class="hidden">
2026-07-04 15:47:40 +03:00
<%= render 'list_form', template: @template, can_send_emails:, viewer_submitter_uuids: %>
2026-02-12 09:22:08 +02:00
</div>
<% end %>
2025-04-10 00:56:16 +03:00
<%= render 'submissions/error' %>
2023-09-03 14:05:31 +03:00
</div>
2023-09-25 01:57:10 +03:00
<%= content_for(:modal_extra) %>
2023-05-21 17:59:36 +03:00
<% end %>