|
|
|
@ -1,6 +1,8 @@
|
|
|
|
<%= render 'shared/turbo_modal_large', title: 'Preferences', close_after_submit: false do %>
|
|
|
|
<%= render 'shared/turbo_modal_large', title: 'Preferences' do %>
|
|
|
|
<% show_api = Docuseal.multitenant? || current_account.testing? || !current_account.linked_account_account %>
|
|
|
|
<% show_api = Docuseal.multitenant? || current_account.testing? || !current_account.linked_account_account %>
|
|
|
|
|
|
|
|
<% show_recipients = @template.submitters.to_a.length > 1 %>
|
|
|
|
<% options = [%w[General general]] %>
|
|
|
|
<% options = [%w[General general]] %>
|
|
|
|
|
|
|
|
<% options << %w[Recipients recipients] if show_recipients %>
|
|
|
|
<% options << ['API and Embedding', 'api'] if show_api %>
|
|
|
|
<% options << ['API and Embedding', 'api'] if show_api %>
|
|
|
|
<% if options.size > 1 %>
|
|
|
|
<% if options.size > 1 %>
|
|
|
|
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center mt-3 block">
|
|
|
|
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center mt-3 block">
|
|
|
|
@ -8,7 +10,7 @@
|
|
|
|
<% options.each_with_index do |(label, value), index| %>
|
|
|
|
<% options.each_with_index do |(label, value), index| %>
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
<%= radio_button_tag 'option', value, value == 'general', class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %>
|
|
|
|
<%= radio_button_tag 'option', value, value == 'general', class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %>
|
|
|
|
<label for="option_<%= value %>" class="<%= '!rounded-s-full' if index.zero? %> btn btn-focus btn-sm join-item md:w-48 peer-checked:btn-active normal-case <%= 'px-8 md:px-0' if value == 'general' %>">
|
|
|
|
<label for="option_<%= value %>" class="<%= '!rounded-s-full' if index.zero? %> btn btn-focus btn-sm join-item peer-checked:btn-active normal-case <%= 'px-8 md:px-0' if value.in?(%w[general recipients]) %> <%= options.size > 2 ? 'md:w-44' : 'md:w-48' %>">
|
|
|
|
<%= label %>
|
|
|
|
<%= label %>
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
@ -17,7 +19,7 @@
|
|
|
|
</toggle-visible>
|
|
|
|
</toggle-visible>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<div id="general" class="px-5 mb-4">
|
|
|
|
<div id="general" class="px-5 mb-4">
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-2' } do |f| %>
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-2' }, data: { close_on_submit: false } do |f| %>
|
|
|
|
<toggle-on-submit data-element-id="bcc_saved_alert"></toggle-on-submit>
|
|
|
|
<toggle-on-submit data-element-id="bcc_saved_alert"></toggle-on-submit>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:bcc_completed).new(@template.preferences['bcc_completed']) do |ff| %>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:bcc_completed).new(@template.preferences['bcc_completed']) do |ff| %>
|
|
|
|
<div class="form-control">
|
|
|
|
<div class="form-control">
|
|
|
|
@ -46,7 +48,7 @@
|
|
|
|
Signature request email
|
|
|
|
Signature request email
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="collapse-content">
|
|
|
|
<div class="collapse-content">
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' } do |f| %>
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' }, data: { close_on_submit: false } do |f| %>
|
|
|
|
<toggle-on-submit data-element-id="email_saved_alert1"></toggle-on-submit>
|
|
|
|
<toggle-on-submit data-element-id="email_saved_alert1"></toggle-on-submit>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:request_email_subject, :request_email_body).new(*(@template.preferences.values_at('request_email_subject', 'request_email_body').compact_blank.presence || AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_INVITATION_EMAIL_KEY).value.values_at('subject', 'body'))) do |ff| %>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:request_email_subject, :request_email_body).new(*(@template.preferences.values_at('request_email_subject', 'request_email_body').compact_blank.presence || AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_INVITATION_EMAIL_KEY).value.values_at('subject', 'body'))) do |ff| %>
|
|
|
|
<div class="form-control">
|
|
|
|
<div class="form-control">
|
|
|
|
@ -80,7 +82,7 @@
|
|
|
|
Documents copy email
|
|
|
|
Documents copy email
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="collapse-content">
|
|
|
|
<div class="collapse-content">
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' } do |f| %>
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' }, data: { close_on_submit: false } do |f| %>
|
|
|
|
<toggle-on-submit data-element-id="email_saved_alert2"></toggle-on-submit>
|
|
|
|
<toggle-on-submit data-element-id="email_saved_alert2"></toggle-on-submit>
|
|
|
|
<% configs = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_DOCUMENTS_COPY_EMAIL_KEY).value %>
|
|
|
|
<% configs = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_DOCUMENTS_COPY_EMAIL_KEY).value %>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:documents_copy_email_subject, :documents_copy_email_body, :documents_copy_email_enabled, :documents_copy_email_attach_audit).new(@template.preferences['documents_copy_email_subject'].presence || configs['subject'], @template.preferences['documents_copy_email_body'].presence || configs['body'], @template.preferences['documents_copy_email_enabled'], configs['attach_audit_log'] != false && @template.preferences['documents_copy_email_attach_audit'] != false) do |ff| %>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:documents_copy_email_subject, :documents_copy_email_body, :documents_copy_email_enabled, :documents_copy_email_attach_audit).new(@template.preferences['documents_copy_email_subject'].presence || configs['subject'], @template.preferences['documents_copy_email_body'].presence || configs['body'], @template.preferences['documents_copy_email_enabled'], configs['attach_audit_log'] != false && @template.preferences['documents_copy_email_attach_audit'] != false) do |ff| %>
|
|
|
|
@ -127,7 +129,7 @@
|
|
|
|
Completed notification email
|
|
|
|
Completed notification email
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="collapse-content">
|
|
|
|
<div class="collapse-content">
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' } do |f| %>
|
|
|
|
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' }, data: { close_on_submit: false } do |f| %>
|
|
|
|
<toggle-on-submit data-element-id="email_saved_alert3"></toggle-on-submit>
|
|
|
|
<toggle-on-submit data-element-id="email_saved_alert3"></toggle-on-submit>
|
|
|
|
<% configs = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY).value %>
|
|
|
|
<% configs = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY).value %>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:completed_notification_email_subject, :completed_notification_email_body, :completed_notification_email_enabled, :completed_notification_email_attach_audit, :completed_notification_email_attach_documents).new(@template.preferences['completed_notification_email_subject'].presence || configs['subject'], @template.preferences['completed_notification_email_body'].presence || configs['body'], @template.preferences['completed_notification_email_enabled'], configs['attach_audit_log'] != false && @template.preferences['completed_notification_email_attach_audit'] != false, configs['attach_documents'] != false && @template.preferences['completed_notification_email_attach_documents'] != false) do |ff| %>
|
|
|
|
<%= f.fields_for :preferences, Struct.new(:completed_notification_email_subject, :completed_notification_email_body, :completed_notification_email_enabled, :completed_notification_email_attach_audit, :completed_notification_email_attach_documents).new(@template.preferences['completed_notification_email_subject'].presence || configs['subject'], @template.preferences['completed_notification_email_body'].presence || configs['body'], @template.preferences['completed_notification_email_enabled'], configs['attach_audit_log'] != false && @template.preferences['completed_notification_email_attach_audit'] != false, configs['attach_documents'] != false && @template.preferences['completed_notification_email_attach_documents'] != false) do |ff| %>
|
|
|
|
@ -176,6 +178,48 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if show_recipients %>
|
|
|
|
|
|
|
|
<div id="recipients" class="hidden mt-2 mb-4 px-5">
|
|
|
|
|
|
|
|
<%= form_for @template, url: template_recipients_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1', id: :submitters_form } do |f| %>
|
|
|
|
|
|
|
|
<div class="space-y-3 divide-y">
|
|
|
|
|
|
|
|
<% @template.submitters.each_with_index do |submitter, index| %>
|
|
|
|
|
|
|
|
<div class="pt-3">
|
|
|
|
|
|
|
|
<%= f.fields_for :submitters, item = Struct.new(:name, :uuid, :is_requester, :email, :linked_to_uuid, :option).new(*submitter.values_at('name', 'uuid', 'is_requester', 'email', 'linked_to_uuid')), index: do |ff| %>
|
|
|
|
|
|
|
|
<% item.option = item.is_requester.present? ? 'is_requester' : (item.email.present? ? 'email' : (item.linked_to_uuid.present? ? "linked_to_#{item.linked_to_uuid}" : '')) %>
|
|
|
|
|
|
|
|
<%= ff.hidden_field :uuid %>
|
|
|
|
|
|
|
|
<div class="form-control">
|
|
|
|
|
|
|
|
<%= ff.text_field :name, class: 'w-full outline-none border-transparent focus:border-transparent focus:ring-0 bg-base-100 px-1 peer mb-2', autocomplete: 'off', placeholder: "#{index + 1}#{(index + 1).ordinal} Party", required: true %>
|
|
|
|
|
|
|
|
<% if @template.submitters.size == 2 %>
|
|
|
|
|
|
|
|
<%= ff.email_field :email, class: 'base-input', autocomplete: 'off', placeholder: 'Default Email', disabled: ff.object.is_requester, id: field_uuid = SecureRandom.uuid %>
|
|
|
|
|
|
|
|
<% else %>
|
|
|
|
|
|
|
|
<toggle-attribute data-target-id="<%= email_field_uuid = SecureRandom.uuid %>" data-class-name="hidden" data-value="email">
|
|
|
|
|
|
|
|
<%= ff.select :option, [['Not specified', 'not_set'], ['Submission requester', 'is_requester'], ['Specified email', 'email'], *(@template.submitters - [submitter]).map { |e| ["Same as #{e['name']}", "linked_to_#{e['uuid']}"] }], {}, class: 'base-select mb-3' %>
|
|
|
|
|
|
|
|
</toggle-attribute>
|
|
|
|
|
|
|
|
<%= ff.email_field :email, class: "base-input #{'hidden' if item.option != 'email'}", autocomplete: 'off', placeholder: 'Default Email', id: email_field_uuid %>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if @template.submitters.size == 2 %>
|
|
|
|
|
|
|
|
<div class="mt-3">
|
|
|
|
|
|
|
|
<label class="flex items-center space-x-2 cursor-pointer">
|
|
|
|
|
|
|
|
<toggle-attribute data-target-id="<%= field_uuid %>" class="flex" data-attribute="disabled">
|
|
|
|
|
|
|
|
<%= ff.check_box :is_requester, class: 'base-checkbox' %>
|
|
|
|
|
|
|
|
</toggle-attribute>
|
|
|
|
|
|
|
|
<span class="select-none">
|
|
|
|
|
|
|
|
Submission requester
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-control mt-6 pb-2">
|
|
|
|
|
|
|
|
<%= f.button button_title(title: 'Save', disabled_with: 'Updating'), class: 'base-button' %>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
<% if show_api %>
|
|
|
|
<% if show_api %>
|
|
|
|
<div id="api" class="hidden mt-2 mb-4 px-5">
|
|
|
|
<div id="api" class="hidden mt-2 mb-4 px-5">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
|