adjust submitter edit
This commit is contained in:
committed by
Oleksandr Turchyn
parent
e0a297cf81
commit
d6474f0e6e
@@ -9,6 +9,13 @@ class SubmissionsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
@submission = Submissions.preload_with_pages(@submission)
|
@submission = Submissions.preload_with_pages(@submission)
|
||||||
|
|
||||||
|
unless @submission.submitters.all?(&:completed_at?)
|
||||||
|
ActiveRecord::Associations::Preloader.new(
|
||||||
|
records: [@submission],
|
||||||
|
associations: [submitters: :start_form_submission_events]
|
||||||
|
).call
|
||||||
|
end
|
||||||
|
|
||||||
render :show, layout: 'plain'
|
render :show, layout: 'plain'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ class SubmissionsDashboardController < ApplicationController
|
|||||||
@submissions = @submissions.pending if params[:status] == 'pending'
|
@submissions = @submissions.pending if params[:status] == 'pending'
|
||||||
@submissions = @submissions.completed if params[:status] == 'completed'
|
@submissions = @submissions.completed if params[:status] == 'completed'
|
||||||
|
|
||||||
@pagy, @submissions = pagy(@submissions.preload(submitters: :submission_events).order(id: :desc))
|
@pagy, @submissions = pagy(@submissions.preload(submitters: :start_form_submission_events).order(id: :desc))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ class SubmittersController < ApplicationController
|
|||||||
def edit
|
def edit
|
||||||
@submitter_email_message =
|
@submitter_email_message =
|
||||||
if @submitter.preferences['email_message_uuid'].present?
|
if @submitter.preferences['email_message_uuid'].present?
|
||||||
@submitter.account
|
@submitter.account.email_messages.find_by(uuid: @submitter.preferences['email_message_uuid'])
|
||||||
.email_messages
|
|
||||||
.find_by(uuid: @submitter.preferences['email_message_uuid'])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29,13 +27,16 @@ class SubmittersController < ApplicationController
|
|||||||
params.delete(:body)
|
params.delete(:body)
|
||||||
end
|
end
|
||||||
|
|
||||||
assign_preferences(@submitter, params)
|
submitter_preferences = Submitters.normalize_preferences(@submitter.account, current_user, params)
|
||||||
|
|
||||||
|
if submitter_preferences.key?('email_message_uuid')
|
||||||
|
submitter.preferences['email_message_uuid'] = submitter_preferences['email_message_uuid']
|
||||||
|
end
|
||||||
|
|
||||||
assign_submitter_attrs(@submitter, submitter_params)
|
assign_submitter_attrs(@submitter, submitter_params)
|
||||||
|
|
||||||
if @submitter.save
|
if @submitter.save
|
||||||
if @submitter.preferences['send_email'] || @submitter.preferences['send_sms']
|
maybe_resend_email_sms(@submitter, params)
|
||||||
Submitters.send_signature_requests([@submitter])
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_back fallback_location: submission_path(submission), notice: I18n.t('changes_have_been_saved')
|
redirect_back fallback_location: submission_path(submission), notice: I18n.t('changes_have_been_saved')
|
||||||
else
|
else
|
||||||
@@ -45,6 +46,24 @@ class SubmittersController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def maybe_resend_email_sms(submitter, params)
|
||||||
|
if params[:send_email] == '1' && submitter.email.present?
|
||||||
|
is_sent_recently = Docuseal.multitenant? &&
|
||||||
|
EmailEvent.exists?(email: submitter.email,
|
||||||
|
tag: 'submitter_invitation',
|
||||||
|
emailable: submitter,
|
||||||
|
event_type: 'send',
|
||||||
|
created_at: 4.hours.ago..Time.current)
|
||||||
|
|
||||||
|
SendSubmitterInvitationEmailJob.perform_async('submitter_id' => submitter.id) unless is_sent_recently
|
||||||
|
end
|
||||||
|
|
||||||
|
return if submitter.phone.blank?
|
||||||
|
return unless params[:send_sms] == '1'
|
||||||
|
|
||||||
|
SendSubmitterInvitationSmsJob.perform_async('submitter_id' => submitter.id)
|
||||||
|
end
|
||||||
|
|
||||||
def assign_submitter_attrs(submitter, attrs)
|
def assign_submitter_attrs(submitter, attrs)
|
||||||
submitter.phone = attrs[:phone].to_s.gsub(/[^0-9+]/, '') if attrs.key?(:phone)
|
submitter.phone = attrs[:phone].to_s.gsub(/[^0-9+]/, '') if attrs.key?(:phone)
|
||||||
|
|
||||||
@@ -55,22 +74,6 @@ class SubmittersController < ApplicationController
|
|||||||
submitter
|
submitter
|
||||||
end
|
end
|
||||||
|
|
||||||
def assign_preferences(submitter, attrs)
|
|
||||||
submitter_preferences = Submitters.normalize_preferences(submitter.account, current_user, attrs)
|
|
||||||
|
|
||||||
if submitter_preferences.key?('send_email')
|
|
||||||
submitter.preferences['send_email'] = submitter_preferences['send_email']
|
|
||||||
end
|
|
||||||
|
|
||||||
submitter.preferences['send_sms'] = submitter_preferences['send_sms'] if submitter_preferences.key?('send_sms')
|
|
||||||
|
|
||||||
if submitter_preferences.key?('email_message_uuid')
|
|
||||||
submitter.preferences['email_message_uuid'] = submitter_preferences['email_message_uuid']
|
|
||||||
end
|
|
||||||
|
|
||||||
submitter
|
|
||||||
end
|
|
||||||
|
|
||||||
def submitter_params
|
def submitter_params
|
||||||
params.require(:submitter).permit(:email, :name, :phone).transform_values(&:strip)
|
params.require(:submitter).permit(:email, :name, :phone).transform_values(&:strip)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class TemplatesController < ApplicationController
|
|||||||
submissions = submissions.pending if params[:status] == 'pending'
|
submissions = submissions.pending if params[:status] == 'pending'
|
||||||
submissions = submissions.completed if params[:status] == 'completed'
|
submissions = submissions.completed if params[:status] == 'completed'
|
||||||
|
|
||||||
@pagy, @submissions = pagy(submissions.preload(submitters: :submission_events).order(id: :desc))
|
@pagy, @submissions = pagy(submissions.preload(submitters: :start_form_submission_events).order(id: :desc))
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ class Submitter < ApplicationRecord
|
|||||||
|
|
||||||
has_many :document_generation_events, dependent: :destroy
|
has_many :document_generation_events, dependent: :destroy
|
||||||
has_many :submission_events, dependent: :destroy
|
has_many :submission_events, dependent: :destroy
|
||||||
|
has_many :start_form_submission_events, -> { where(event_type: :start_form) },
|
||||||
|
class_name: 'SubmissionEvent', dependent: :destroy, inverse_of: :submitter
|
||||||
|
|
||||||
scope :completed, -> { where.not(completed_at: nil) }
|
scope :completed, -> { where.not(completed_at: nil) }
|
||||||
|
|
||||||
|
|||||||
@@ -115,10 +115,10 @@
|
|||||||
<%= (@submission.template_submitters || @submission.template.submitters).find { |e| e['uuid'] == submitter&.uuid }&.dig('name') || "#{(index + 1).ordinalize} Submitter" %>
|
<%= (@submission.template_submitters || @submission.template.submitters).find { |e| e['uuid'] == submitter&.uuid }&.dig('name') || "#{(index + 1).ordinalize} Submitter" %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% if can?(:update, submitter) && !submitter.submission_events.exists?(event_type: 'start_form') && !@submission.archived_at? && !@submission.expired? %>
|
<% if signed_in? && can?(:update, submitter) && !submitter.completed_at? && !submitter.declined_at? && !@submission.archived_at? && !@submission.expired? && !submitter.start_form_submission_events.any? %>
|
||||||
<span class="tooltip tooltip-left" data-tip="<%= t('edit') %>">
|
<span class="tooltip tooltip-left" data-tip="<%= t('edit') %>">
|
||||||
<%= link_to edit_submitter_path(submitter), class: 'shrink-0 text-neutral-600 md:text-neutral-400 md:group-hover:text-neutral-600', data: { turbo_frame: 'modal' } do %>
|
<%= link_to edit_submitter_path(submitter), class: 'shrink-0 inline md:hidden md:group-hover:inline', data: { turbo_frame: 'modal' } do %>
|
||||||
<%= svg_icon('pencil', class: 'w-5 h-5 stroke-2') %>
|
<%= svg_icon('pencil', class: 'w-5 h-5') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<%= render 'shared/turbo_modal_large', title: t('edit_recipient') do %>
|
<%= render 'shared/turbo_modal_large', title: t('edit_recipient') do %>
|
||||||
<div class="px-5 mb-5 mt-4">
|
<div class="px-5 mb-5 mt-4">
|
||||||
<%= form_for '', url: submitter_path(@submitter), method: :patch, html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
<%= form_for '', url: submitter_path(@submitter), method: :patch, html: { autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
||||||
<div class="grid gap-4">
|
<div class="mb-2">
|
||||||
<submitter-item class="form-control">
|
<submitter-item class="form-control">
|
||||||
<submitters-autocomplete data-field="name">
|
<submitters-autocomplete data-field="name">
|
||||||
<%= text_field_tag 'submitter[name]', @submitter.name, autocomplete: 'off', class: 'base-input !h-10 w-full', placeholder: "#{t('name')} (#{t('optional')})", dir: 'auto' %>
|
<%= text_field_tag 'submitter[name]', @submitter.name, autocomplete: 'off', class: 'base-input !h-10 w-full', placeholder: "#{t('name')} (#{t('optional')})", dir: 'auto' %>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
<div class="grid md:grid-cols-2 gap-1">
|
<div class="grid md:grid-cols-2 gap-1.5 mt-1.5">
|
||||||
<submitters-autocomplete data-field="email">
|
<submitters-autocomplete data-field="email">
|
||||||
<%= email_field_tag 'submitter[email]', @submitter.email, autocomplete: 'off', class: 'base-input !h-10 mt-1.5 w-full', placeholder: "#{t('email')} (#{t('optional')})" %>
|
<%= email_field_tag 'submitter[email]', @submitter.email, autocomplete: 'off', class: 'base-input !h-10 mt-1.5 w-full', placeholder: "#{t('email')} (#{t('optional')})" %>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<%= render 'submissions/send_email', f:, template: @submitter.template, submitter: @submitter, resend_email: @submitter.sent_at?, submitter_email_message: @submitter_email_message, disable_save_as_default_template_option: true %>
|
<%= render 'submissions/send_email', f:, template: @submitter.template, submitter: @submitter, resend_email: @submitter.sent_at?, submitter_email_message: @submitter_email_message, disable_save_as_default_template_option: true %>
|
||||||
<%= render 'submissions/send_sms', f:, resend_sms: @submitter.sent_at? %>
|
<%= render 'submissions/send_sms', f:, resend_sms: @submitter.sent_at? %>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-control">
|
<div class="form-control mt-4">
|
||||||
<%= f.button button_title(title: t('update_recipient'), disabled_with: t('updating')), class: 'base-button' %>
|
<%= f.button button_title(title: t('update_recipient'), disabled_with: t('updating')), class: 'base-button' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="w-full flex flex-col md:flex-row space-y-4 md:space-y-0 md:justify-between px-5 md:px-6 pb-5 md:items-center pt-5 relative cursor-pointer">
|
<div class="w-full flex flex-col md:flex-row space-y-4 md:space-y-0 md:justify-between px-5 md:px-6 pb-5 md:items-center pt-5 relative cursor-pointer">
|
||||||
<a href="<%= submission_path(submission) %>" class="top-0 bottom-0 left-0 right-0 absolute"></a>
|
|
||||||
<% submitters = (submission.template_submitters || submission.template.submitters).filter_map { |item| submission.submitters.find { |e| e.uuid == item['uuid'] } } %>
|
<% submitters = (submission.template_submitters || submission.template.submitters).filter_map { |item| submission.submitters.find { |e| e.uuid == item['uuid'] } } %>
|
||||||
<% is_submission_completed = submitters.all?(&:completed_at?) && submitters.size.positive? %>
|
<% is_submission_completed = submitters.all?(&:completed_at?) && submitters.size.positive? %>
|
||||||
<% if submitters.size == 1 %>
|
<% if submitters.size == 1 %>
|
||||||
@@ -42,20 +41,20 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
<a href="<%= submission_path(submission) %>" class="flex z-[1]">
|
||||||
<span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold">
|
<span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold tooltip" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
<%= t(submitter.status) %>
|
<%= t(submitter.status) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="flex space-x-1 items-center z-[1]">
|
<span class="flex items-center z-[1]">
|
||||||
<a href="<%= submission_path(submission) %>" class="text-lg break-all peer">
|
<a href="<%= submission_path(submission) %>" class="text-lg break-all peer">
|
||||||
<%= submitter.name || submitter.email || submitter.phone %>
|
<%= submitter.name || submitter.email || submitter.phone %>
|
||||||
</a>
|
</a>
|
||||||
<% if can?(:update, submitter) && !submitter.submission_events.any? { |e| e.event_type == 'start_form' } && !submission.archived_at? && !submission.expired? %>
|
<% if can?(:update, submitter) && !submitter.start_form_submission_events.any? && !submission.archived_at? && !submission.expired? %>
|
||||||
<span class="tooltip tooltip-top md:opacity-0 md:hover:opacity-100 md:peer-hover:opacity-100" data-tip="<%= t('edit') %>">
|
<span class="pl-0.5 tooltip tooltip-top md:opacity-0 md:hover:opacity-100 md:peer-hover:opacity-100" data-tip="<%= t('edit') %>">
|
||||||
<%= link_to edit_submitter_path(submitter), class: 'text-neutral-600 shrink-0', data: { turbo_frame: 'modal' } do %>
|
<%= link_to edit_submitter_path(submitter), class: 'shrink-0', data: { turbo_frame: 'modal' } do %>
|
||||||
<%= svg_icon('pencil', class: 'w-5 h-5 stroke-2') %>
|
<%= svg_icon('pencil', class: 'w-5 h-5') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -65,8 +64,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex space-x-2 items-center z-[1]">
|
<div class="flex space-x-2 items-center z-[1]">
|
||||||
<% if submitter.completed_at? %>
|
<% if submitter.completed_at? %>
|
||||||
<form onsubmit="event.preventDefault()" class="flex-1 md:flex-none">
|
<div class="flex-1 md:flex-none">
|
||||||
<button onclick="event.stopPropagation()" class="w-full md:w-fit">
|
<div class="w-full md:w-fit">
|
||||||
<download-button data-src="<%= submitter_download_index_path(submitter.slug) %>" class="btn btn-sm btn-neutral text-white w-full md:w-36">
|
<download-button data-src="<%= submitter_download_index_path(submitter.slug) %>" class="btn btn-sm btn-neutral text-white w-full md:w-36">
|
||||||
<span class="flex items-center justify-center space-x-1 <%= 'md:space-x-2' if t('download').length < 11 %>" data-target="download-button.defaultButton">
|
<span class="flex items-center justify-center space-x-1 <%= 'md:space-x-2' if t('download').length < 11 %>" data-target="download-button.defaultButton">
|
||||||
<%= svg_icon('download', class: 'w-5 h-5 stroke-2') %>
|
<%= svg_icon('download', class: 'w-5 h-5 stroke-2') %>
|
||||||
@@ -77,11 +76,11 @@
|
|||||||
<span class="inline"><%= t('download')[..-2] %>...</span>
|
<span class="inline"><%= t('download')[..-2] %>...</span>
|
||||||
</span>
|
</span>
|
||||||
</download-button>
|
</download-button>
|
||||||
</button>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
<% elsif !submission.archived_at? && !template.archived_at? && !submission.expired? && !submitter.declined_at? %>
|
<% elsif !submission.archived_at? && !template.archived_at? && !submission.expired? && !submitter.declined_at? %>
|
||||||
<% if current_user.email == submitter.email %>
|
<% if current_user.email == submitter.email %>
|
||||||
<a href="<%= submit_form_url(slug: submitter.slug) %>" class="btn btn-sm btn-neutral btn-outline bg-white w-full md:w-36 flex z-[1]">
|
<a href="<%= submit_form_url(slug: submitter.slug) %>" data-turbo="false" target="_blank" class="btn btn-sm btn-neutral btn-outline bg-white w-full md:w-36 flex z-[1]">
|
||||||
<span class="flex items-center justify-center space-x-1 md:space-x-2">
|
<span class="flex items-center justify-center space-x-1 md:space-x-2">
|
||||||
<% if t('sign_now').length < 12 %>
|
<% if t('sign_now').length < 12 %>
|
||||||
<%= svg_icon('writing_sign', class: 'w-4 h-4 stroke-2') %>
|
<%= svg_icon('writing_sign', class: 'w-4 h-4 stroke-2') %>
|
||||||
@@ -91,23 +90,23 @@
|
|||||||
</a>
|
</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="flex-1 md:flex-none">
|
<div class="flex-1 md:flex-none">
|
||||||
<%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-sm btn-neutral text-white md:w-36 flex', icon_class: 'w-6 h-6 text-white', copy_title: t('copy_link').length < 10 ? t('copy_link') : t('copy'), copy_title_md: t('copy'), copied_title_md: t('copied') %>
|
<%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-sm btn-neutral text-white md:w-36 flex z-[1]', icon_class: 'w-6 h-6 text-white', copy_title: t('copy_link').length < 10 ? t('copy_link') : t('copy'), copy_title_md: t('copy'), copied_title_md: t('copied') %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="flex-1 md:flex-none">
|
<div class="flex-1 md:flex-none z-[1]">
|
||||||
<a href="<%= submission_path(submission) %>" class="btn btn-outline btn-sm w-full md:w-24">
|
<a href="<%= submission_path(submission) %>" class="btn btn-outline btn-sm w-full md:w-24">
|
||||||
<%= t('view') %>
|
<%= t('view') %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %>
|
<% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %>
|
||||||
<span data-tip="<%= t('archive') %>" class="sm:tooltip tooltip-top">
|
<span data-tip="<%= t('archive') %>" class="sm:tooltip tooltip-top">
|
||||||
<%= button_to button_title(title: nil, disabled_with: t(:archive).first(4), icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('archive'), method: :delete, onclick: 'event.stopPropagation()' %>
|
<%= button_to button_title(title: nil, disabled_with: t(:archive).first(4), icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('archive'), method: :delete %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
||||||
<span data-tip="<%= t('remove') %>" class="sm:tooltip tooltip-top">
|
<span data-tip="<%= t('remove') %>" class="sm:tooltip tooltip-top">
|
||||||
<%= button_to button_title(title: nil, disabled_with: t(:remove).first(3), icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission, permanently: true), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('remove'), method: :delete, data: { turbo_confirm: t('submission_deletion_is_irreversible_and_will_permanently_remove_all_associated_signed_documents_with_it_are_you_sure_') }, onclick: 'event.stopPropagation()' %>
|
<%= button_to button_title(title: nil, disabled_with: t(:remove).first(3), icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission, permanently: true), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('remove'), method: :delete, data: { turbo_confirm: t('submission_deletion_is_irreversible_and_will_permanently_remove_all_associated_signed_documents_with_it_are_you_sure_') } %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,11 +115,11 @@
|
|||||||
<div class="flex flex-col md:flex-row md:items-center gap-3">
|
<div class="flex flex-col md:flex-row md:items-center gap-3">
|
||||||
<% if is_submission_completed %>
|
<% if is_submission_completed %>
|
||||||
<% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
|
<% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
|
||||||
<div class="tooltip flex" data-tip="<%= l(latest_submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
<a href="<%= submission_path(submission) %>" class="z-[1] tooltip flex" data-tip="<%= l(latest_submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
<span class="badge <%= status_badges[latest_submitter.status] %> md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
<span class="badge <%= status_badges[latest_submitter.status] %> md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
||||||
<%= t(latest_submitter.status) %>
|
<%= t(latest_submitter.status) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</a>
|
||||||
<% elsif submission.expired? %>
|
<% elsif submission.expired? %>
|
||||||
<div class="tooltip flex" data-tip="<%= l(submission.expire_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
<div class="tooltip flex" data-tip="<%= l(submission.expire_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
<span class="badge badge-error md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
<span class="badge badge-error md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
||||||
@@ -133,55 +132,49 @@
|
|||||||
<div class="relative flex justify-between items-start md:items-center space-x-3">
|
<div class="relative flex justify-between items-start md:items-center space-x-3">
|
||||||
<span class="flex flex-col md:flex-row md:items-center gap-2">
|
<span class="flex flex-col md:flex-row md:items-center gap-2">
|
||||||
<% if !is_submission_completed && !submission.expired? %>
|
<% if !is_submission_completed && !submission.expired? %>
|
||||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
<a href="<%= submission_path(submission) %>" class="z-[1] tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
<span class="badge md:w-24 <%= status_badges[submitter.status] %> bg-opacity-50 uppercase text-xs font-semibold">
|
<span class="badge md:w-24 <%= status_badges[submitter.status] %> bg-opacity-50 uppercase text-xs font-semibold">
|
||||||
<%= t(submitter.status) %>
|
<%= t(submitter.status) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="flex space-x-1 items-center z-[1]">
|
<span class="flex items-center z-[1]">
|
||||||
<a href="<%= submission_path(submission) %>" class="text-lg break-all peer">
|
<a href="<%= submission_path(submission) %>" class="text-lg break-all peer">
|
||||||
<%= submitter.name || submitter.email || submitter.phone %>
|
<%= submitter.name || submitter.email || submitter.phone %>
|
||||||
</a>
|
</a>
|
||||||
<% if can?(:update, submitter) && !submitter.submission_events.any? { |e| e.event_type == 'start_form' } && !submission.archived_at? && !submission.expired? %>
|
<% if can?(:update, submitter) && !submitter.start_form_submission_events.any? && !submission.archived_at? && !submission.expired? %>
|
||||||
<span class="tooltip tooltip-top md:opacity-0 md:hover:opacity-100 md:peer-hover:opacity-100" data-tip="<%= t('edit') %>">
|
<span class="pl-0.5 tooltip tooltip-top md:opacity-0 md:hover:opacity-100 md:peer-hover:opacity-100" data-tip="<%= t('edit') %>">
|
||||||
<%= link_to edit_submitter_path(submitter), class: 'text-neutral-600 shrink-0', data: { turbo_frame: 'modal' } do %>
|
<%= link_to edit_submitter_path(submitter), class: 'shrink-0', data: { turbo_frame: 'modal' } do %>
|
||||||
<%= svg_icon('pencil', class: 'w-5 h-5 stroke-2') %>
|
<%= svg_icon('pencil', class: 'w-5 h-5') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<% if submitter.completed_at? && !is_submission_completed %>
|
<% if submitter.completed_at? && !is_submission_completed %>
|
||||||
<form onsubmit="event.preventDefault()">
|
<download-button data-src="<%= submitter_download_index_path(submitter.slug) %>" class="absolute md:relative top-0 right-0 btn btn-xs btn-neutral text-white md:w-36 z-[1]">
|
||||||
<button onclick="event.stopPropagation()">
|
<span class="flex items-center justify-center space-x-1 md:space-x-2" data-target="download-button.defaultButton">
|
||||||
<download-button data-src="<%= submitter_download_index_path(submitter.slug) %>" class="absolute md:relative top-0 right-0 btn btn-xs btn-neutral text-white md:w-36">
|
<%= svg_icon('download', class: 'w-4 h-4 stroke-2') %>
|
||||||
<span class="flex items-center justify-center space-x-1 md:space-x-2" data-target="download-button.defaultButton">
|
<span class="inline"><%= t('download') %></span>
|
||||||
<%= svg_icon('download', class: 'w-4 h-4 stroke-2') %>
|
</span>
|
||||||
<span class="inline"><%= t('download') %></span>
|
<span class="flex items-center justify-center space-x-1 md:space-x-2 hidden" data-target="download-button.loadingButton">
|
||||||
</span>
|
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin') %>
|
||||||
<span class="flex items-center justify-center space-x-1 md:space-x-2 hidden" data-target="download-button.loadingButton">
|
<span class="inline"><%= t('download')[..-2] %>...</span>
|
||||||
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin') %>
|
</span>
|
||||||
<span class="inline"><%= t('download')[..-2] %>...</span>
|
</download-button>
|
||||||
</span>
|
|
||||||
</download-button>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed && !submission.expired? && !submitter.declined_at? %>
|
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed && !submission.expired? && !submitter.declined_at? %>
|
||||||
<div class="relative flex items-center space-x-3">
|
<div class="relative flex items-center space-x-3">
|
||||||
<% if current_user.email == submitter.email %>
|
<% if current_user.email == submitter.email %>
|
||||||
<form data-turbo="false" method="get" action="<%= submit_form_url(slug: submitter.slug) %>">
|
<a href="<%= submit_form_url(slug: submitter.slug) %>" data-turbo="false" target="_blank" class="absolute md:relative top-0 right-0 btn btn-xs btn-outline btn-neutral bg-white w-28 md:w-36">
|
||||||
<button onclick="event.stopPropagation()" class="absolute md:relative top-0 right-0 btn btn-xs btn-outline btn-neutral bg-white w-28 md:w-36">
|
<span class="flex items-center justify-center space-x-1 md:space-x-2">
|
||||||
<span class="flex items-center justify-center space-x-1 md:space-x-2">
|
<% if t('sign_now').length < 12 %>
|
||||||
<% if t('sign_now').length < 12 %>
|
<%= svg_icon('writing_sign', class: 'w-4 h-4 stroke-2') %>
|
||||||
<%= svg_icon('writing_sign', class: 'w-4 h-4 stroke-2') %>
|
<% end %>
|
||||||
<% end %>
|
<span class="inline shrink-0"><%= t('sign_now') %></span>
|
||||||
<span class="inline shrink-0"><%= t('sign_now') %></span>
|
</span>
|
||||||
</span>
|
</a>
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'absolute md:relative top-0 right-0 btn btn-xs text-xs btn-neutral text-white w-28 md:w-36 flex', icon_class: 'w-4 h-4 text-white', copy_title: t('copy_link'), copy_title_md: t('copy_link').length < 10 ? t('copy_link') : t('copy'), copied_title_md: t('copied') %>
|
<%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'absolute md:relative top-0 right-0 btn btn-xs text-xs btn-neutral text-white w-28 md:w-36 flex z-[1]', icon_class: 'w-4 h-4 text-white', copy_title: t('copy_link'), copy_title_md: t('copy_link').length < 10 ? t('copy_link') : t('copy'), copied_title_md: t('copied') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -194,38 +187,37 @@
|
|||||||
<% if is_submission_completed %>
|
<% if is_submission_completed %>
|
||||||
<% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
|
<% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
|
||||||
<div class="flex-1 md:flex-none">
|
<div class="flex-1 md:flex-none">
|
||||||
<form onsubmit="event.preventDefault()" class="w-full md:w-fit">
|
<div class="w-full md:w-fit">
|
||||||
<button onclick="event.stopPropagation()" class="w-full">
|
<download-button data-src="<%= submitter_download_index_path(latest_submitter.slug) %>" class="btn btn-sm btn-neutral text-white w-full md:w-36 z-[1]">
|
||||||
<download-button data-src="<%= submitter_download_index_path(latest_submitter.slug) %>" class="btn btn-sm btn-neutral text-white w-full md:w-36">
|
<span class="flex items-center justify-center space-x-1 md:space-x-2" data-target="download-button.defaultButton">
|
||||||
<span class="flex items-center justify-center space-x-1 md:space-x-2" data-target="download-button.defaultButton">
|
<%= svg_icon('download', class: 'w-5 h-5 stroke-2') %>
|
||||||
<%= svg_icon('download', class: 'w-5 h-5 stroke-2') %>
|
<span class="inline"><%= t('download') %></span>
|
||||||
<span class="inline"><%= t('download') %></span>
|
</span>
|
||||||
</span>
|
<span class="flex items-center justify-center space-x-1 md:space-x-2 hidden" data-target="download-button.loadingButton">
|
||||||
<span class="flex items-center justify-center space-x-1 md:space-x-2 hidden" data-target="download-button.loadingButton">
|
<%= svg_icon('loader', class: 'w-5 h-5 animate-spin') %>
|
||||||
<%= svg_icon('loader', class: 'w-5 h-5 animate-spin') %>
|
<span class="inline"><%= t('download')[..-2] %>...</span>
|
||||||
<span class="inline"><%= t('download')[..-2] %>...</span>
|
</span>
|
||||||
</span>
|
</download-button>
|
||||||
</download-button>
|
</div>
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="flex-1 md:flex-none">
|
<div class="flex-1 md:flex-none z-[1]">
|
||||||
<a href="<%= submission_path(submission) %>" class="btn btn-outline btn-sm w-full md:w-24">
|
<a href="<%= submission_path(submission) %>" class="btn btn-outline btn-sm w-full md:w-24">
|
||||||
<%= t('view') %>
|
<%= t('view') %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<% if !submission.archived_at? && !template.archived_at? %>
|
<% if !submission.archived_at? && !template.archived_at? %>
|
||||||
<span data-tip="<%= t('archive') %>" class="sm:tooltip tooltip-top">
|
<span data-tip="<%= t('archive') %>" class="sm:tooltip tooltip-top">
|
||||||
<%= button_to button_title(title: nil, disabled_with: t(:archive).first(4), icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('archive'), method: :delete, onclick: 'event.stopPropagation()' %>
|
<%= button_to button_title(title: nil, disabled_with: t(:archive).first(4), icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('archive'), method: :delete %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
||||||
<span data-tip="<%= t('remove') %>" class="sm:tooltip tooltip-top">
|
<span data-tip="<%= t('remove') %>" class="sm:tooltip tooltip-top">
|
||||||
<%= button_to button_title(title: nil, disabled_with: t(:remove).first(3), icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission, permanently: true), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('remove'), method: :delete, data: { turbo_confirm: t('submission_deletion_is_irreversible_and_will_permanently_remove_all_associated_signed_documents_with_it_are_you_sure_') }, onclick: 'event.stopPropagation()' %>
|
<%= button_to button_title(title: nil, disabled_with: t(:remove).first(3), icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission, permanently: true), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: t('remove'), method: :delete, data: { turbo_confirm: t('submission_deletion_is_irreversible_and_will_permanently_remove_all_associated_signed_documents_with_it_are_you_sure_') } %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<a href="<%= submission_path(submission) %>" class="top-0 bottom-0 left-0 right-0 absolute"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user