mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d813e184b | ||
|
|
fd23674e87 | ||
|
|
3b9d35acf1 | ||
|
|
17fc6e2f1c | ||
|
|
2e132d8b5a | ||
|
|
53bef85a63 | ||
|
|
99ad6e36ac | ||
|
|
bfa41ac35f | ||
|
|
bc4414a368 | ||
|
|
26ae5f1d80 | ||
|
|
be4962a02a | ||
|
|
e72090c2e0 | ||
|
|
ad8bca8bf4 | ||
|
|
22be3b37cf | ||
|
|
cfc32ee522 | ||
|
|
10fbdf6612 | ||
|
|
3604fb6461 | ||
|
|
24392d0258 | ||
|
|
4ab1065773 | ||
|
|
50b0f7e5ed | ||
|
|
be4a0505bc | ||
|
|
bd853c6265 | ||
|
|
5a1efd0e27 | ||
|
|
71b8cc7172 | ||
|
|
126a36dbf3 | ||
|
|
90db64cc03 | ||
|
|
227a067c77 | ||
|
|
dc24df0d4c | ||
|
|
2598962c5b | ||
|
|
b4884e94f6 | ||
|
|
4741e64178 | ||
|
|
25fe35e212 | ||
|
|
92909cea09 | ||
|
|
b16322dd5b | ||
|
|
a04c04141c | ||
|
|
90f21d3ed9 | ||
|
|
f31225e8c2 | ||
|
|
eead1b2bc4 | ||
|
|
f90a4e5576 | ||
|
|
50987ce38b | ||
|
|
26113ac3a6 | ||
|
|
0b7b72ce16 | ||
|
|
95d48b2808 | ||
|
|
8fecf94a28 | ||
|
|
66dd87b290 | ||
|
|
d20e8cc37d | ||
|
|
c189e2ed20 | ||
|
|
57f8f45320 | ||
|
|
5684baf1e0 | ||
|
|
b6f307690d | ||
|
|
66c44f8ff5 | ||
|
|
8f3592c481 | ||
|
|
dc8b1e0741 | ||
|
|
b806a6afc5 | ||
|
|
d43f8f4dd8 | ||
|
|
37c9bf5741 | ||
|
|
a0d37f516f | ||
|
|
2764a18252 | ||
|
|
96cf228e74 | ||
|
|
ff6ff3a51e | ||
|
|
9472a6b5b0 |
No files matched your search
@@ -11,7 +11,7 @@ jobs:
|
|||||||
- name: Install Ruby
|
- name: Install Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 3.3.3
|
ruby-version: 3.3.4
|
||||||
- name: Cache gems
|
- name: Cache gems
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
- name: Install Ruby
|
- name: Install Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 3.3.3
|
ruby-version: 3.3.4
|
||||||
- name: Cache gems
|
- name: Cache gems
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
@@ -100,7 +100,7 @@ jobs:
|
|||||||
- name: Install Ruby
|
- name: Install Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 3.3.3
|
ruby-version: 3.3.4
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Metrics/MethodLength:
|
|||||||
Max: 30
|
Max: 30
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'db/migrate/**'
|
- 'db/migrate/**'
|
||||||
|
- 'spec/**/*'
|
||||||
|
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Max: 15
|
Max: 15
|
||||||
@@ -46,6 +47,8 @@ Layout/LineLength:
|
|||||||
|
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Max: 45
|
Max: 45
|
||||||
|
Exclude:
|
||||||
|
- spec/**/*
|
||||||
|
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Max: 500
|
Max: 500
|
||||||
@@ -65,6 +68,9 @@ RSpec/ExampleLength:
|
|||||||
RSpec/MultipleMemoizedHelpers:
|
RSpec/MultipleMemoizedHelpers:
|
||||||
Max: 6
|
Max: 6
|
||||||
|
|
||||||
|
Metrics/BlockNesting:
|
||||||
|
Max: 4
|
||||||
|
|
||||||
Rails/I18nLocaleTexts:
|
Rails/I18nLocaleTexts:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
FROM ruby:3.3.3-alpine as fonts
|
FROM ruby:3.3.4-alpine as fonts
|
||||||
|
|
||||||
WORKDIR /fonts
|
WORKDIR /fonts
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ RUN apk --no-cache add fontforge wget && wget https://github.com/satbyy/go-noto-
|
|||||||
|
|
||||||
RUN fontforge -lang=py -c 'font1 = fontforge.open("FreeSans.ttf"); font2 = fontforge.open("NotoSansSymbols2-Regular.ttf"); font1.mergeFonts(font2); font1.generate("FreeSans.ttf")'
|
RUN fontforge -lang=py -c 'font1 = fontforge.open("FreeSans.ttf"); font2 = fontforge.open("NotoSansSymbols2-Regular.ttf"); font1.mergeFonts(font2); font1.generate("FreeSans.ttf")'
|
||||||
|
|
||||||
FROM ruby:3.3.3-alpine as webpack
|
FROM ruby:3.3.4-alpine as webpack
|
||||||
|
|
||||||
ENV RAILS_ENV=production
|
ENV RAILS_ENV=production
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
@@ -32,7 +32,7 @@ COPY ./app/views ./app/views
|
|||||||
|
|
||||||
RUN echo "gem 'shakapacker'" > Gemfile && ./bin/shakapacker
|
RUN echo "gem 'shakapacker'" > Gemfile && ./bin/shakapacker
|
||||||
|
|
||||||
FROM ruby:3.3.3-alpine as app
|
FROM ruby:3.3.4-alpine as app
|
||||||
|
|
||||||
ENV RAILS_ENV=production
|
ENV RAILS_ENV=production
|
||||||
ENV BUNDLE_WITHOUT="development:test"
|
ENV BUNDLE_WITHOUT="development:test"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '3.3.3'
|
ruby '3.3.4'
|
||||||
|
|
||||||
gem 'arabic-letter-connector', require: 'arabic-letter-connector/logic'
|
gem 'arabic-letter-connector', require: 'arabic-letter-connector/logic'
|
||||||
gem 'aws-sdk-s3', require: false
|
gem 'aws-sdk-s3', require: false
|
||||||
|
|||||||
+3
-2
@@ -324,6 +324,7 @@ GEM
|
|||||||
date
|
date
|
||||||
net-protocol
|
net-protocol
|
||||||
net-pop (0.1.2)
|
net-pop (0.1.2)
|
||||||
|
net-protocol
|
||||||
net-protocol (0.2.2)
|
net-protocol (0.2.2)
|
||||||
timeout
|
timeout
|
||||||
net-smtp (0.4.0)
|
net-smtp (0.4.0)
|
||||||
@@ -434,7 +435,7 @@ GEM
|
|||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
retriable (3.1.2)
|
retriable (3.1.2)
|
||||||
rexml (3.3.3)
|
rexml (3.3.6)
|
||||||
strscan
|
strscan
|
||||||
rotp (6.3.0)
|
rotp (6.3.0)
|
||||||
rqrcode (2.2.0)
|
rqrcode (2.2.0)
|
||||||
@@ -624,7 +625,7 @@ DEPENDENCIES
|
|||||||
webmock
|
webmock
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 3.3.3p89
|
ruby 3.3.4p94
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.5.3
|
2.5.3
|
||||||
@@ -15,6 +15,7 @@ class AccountConfigsController < ApplicationController
|
|||||||
AccountConfig::FORCE_SSO_AUTH_KEY,
|
AccountConfig::FORCE_SSO_AUTH_KEY,
|
||||||
AccountConfig::FLATTEN_RESULT_PDF_KEY,
|
AccountConfig::FLATTEN_RESULT_PDF_KEY,
|
||||||
AccountConfig::WITH_SIGNATURE_ID,
|
AccountConfig::WITH_SIGNATURE_ID,
|
||||||
|
AccountConfig::COMBINE_PDF_RESULT_KEY,
|
||||||
AccountConfig::REQUIRE_SIGNING_REASON_KEY
|
AccountConfig::REQUIRE_SIGNING_REASON_KEY
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ module Api
|
|||||||
params[:before] = Time.zone.at(params[:before].to_i) if params[:before].present?
|
params[:before] = Time.zone.at(params[:before].to_i) if params[:before].present?
|
||||||
|
|
||||||
submitters = paginate(
|
submitters = paginate(
|
||||||
submitters.preload(template: :folder, submission: [:submitters, { audit_trail_attachment: :blob }],
|
submitters.preload(template: :folder, submission: [:submitters, { audit_trail_attachment: :blob,
|
||||||
|
combined_document_attachment: :blob }],
|
||||||
documents_attachments: :blob, attachments_attachments: :blob),
|
documents_attachments: :blob, attachments_attachments: :blob),
|
||||||
field: :completed_at
|
field: :completed_at
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,10 +19,14 @@ module Api
|
|||||||
|
|
||||||
submissions = paginate(submissions.preload(:created_by_user, :submitters,
|
submissions = paginate(submissions.preload(:created_by_user, :submitters,
|
||||||
template: :folder,
|
template: :folder,
|
||||||
|
combined_document_attachment: :blob,
|
||||||
audit_trail_attachment: :blob))
|
audit_trail_attachment: :blob))
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
data: submissions.as_json(Submissions::SerializeForApi::SERIALIZE_PARAMS),
|
data: submissions.map do |s|
|
||||||
|
Submissions::SerializeForApi.call(s, s.submitters, params,
|
||||||
|
with_events: false, with_documents: false, with_values: false)
|
||||||
|
end,
|
||||||
pagination: {
|
pagination: {
|
||||||
count: submissions.size,
|
count: submissions.size,
|
||||||
next: submissions.last&.id,
|
next: submissions.last&.id,
|
||||||
@@ -76,7 +80,7 @@ module Api
|
|||||||
end
|
end
|
||||||
|
|
||||||
render json: build_create_json(submissions)
|
render json: build_create_json(submissions)
|
||||||
rescue Submitters::NormalizeValues::BaseError => e
|
rescue Submitters::NormalizeValues::BaseError, DownloadUtils::UnableToDownload => e
|
||||||
Rollbar.warning(e) if defined?(Rollbar)
|
Rollbar.warning(e) if defined?(Rollbar)
|
||||||
|
|
||||||
render json: { error: e.message }, status: :unprocessable_entity
|
render json: { error: e.message }, status: :unprocessable_entity
|
||||||
@@ -154,7 +158,7 @@ module Api
|
|||||||
:completed, :phone, :application_key, :external_id, :reply_to, :go_to_last,
|
:completed, :phone, :application_key, :external_id, :reply_to, :go_to_last,
|
||||||
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
|
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
|
||||||
fields: [:name, :uuid, :default_value, :value, :title, :description,
|
fields: [:name, :uuid, :default_value, :value, :title, :description,
|
||||||
:readonly, :redacted, :validation_pattern, :invalid_message,
|
:readonly, :validation_pattern, :invalid_message,
|
||||||
{ default_value: [], value: [], preferences: {} }] }]]
|
{ default_value: [], value: [], preferences: {} }] }]]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ module Api
|
|||||||
with_urls: true,
|
with_urls: true,
|
||||||
with_events: false,
|
with_events: false,
|
||||||
params:)
|
params:)
|
||||||
|
rescue Submitters::NormalizeValues::BaseError, DownloadUtils::UnableToDownload => e
|
||||||
|
Rollbar.warning(e) if defined?(Rollbar)
|
||||||
|
|
||||||
|
render json: { error: e.message }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
def submitter_params
|
def submitter_params
|
||||||
@@ -87,7 +91,7 @@ module Api
|
|||||||
:completed, :phone, :application_key, :external_id, :go_to_last,
|
:completed, :phone, :application_key, :external_id, :go_to_last,
|
||||||
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
|
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
|
||||||
fields: [[:name, :uuid, :default_value, :value,
|
fields: [[:name, :uuid, :default_value, :value,
|
||||||
:readonly, :redacted, :validation_pattern, :invalid_message,
|
:readonly, :validation_pattern, :invalid_message,
|
||||||
{ default_value: [], value: [], preferences: {} }]] }
|
{ default_value: [], value: [], preferences: {} }]] }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module Api
|
|||||||
|
|
||||||
preview_image_attachments =
|
preview_image_attachments =
|
||||||
ActiveStorage::Attachment.joins(:blob)
|
ActiveStorage::Attachment.joins(:blob)
|
||||||
.where(blob: { filename: '0.jpg' })
|
.where(blob: { filename: ['0.png', '0.jpg'] })
|
||||||
.where(record_id: schema_documents.map(&:id),
|
.where(record_id: schema_documents.map(&:id),
|
||||||
record_type: 'ActiveStorage::Attachment',
|
record_type: 'ActiveStorage::Attachment',
|
||||||
name: :preview_images)
|
name: :preview_images)
|
||||||
@@ -97,7 +97,7 @@ module Api
|
|||||||
:name,
|
:name,
|
||||||
:external_id,
|
:external_id,
|
||||||
{
|
{
|
||||||
submitters: [%i[name uuid]],
|
submitters: [%i[name uuid is_requester invite_by_uuid invite_by_uuid linked_to_uuid email]],
|
||||||
fields: [[:uuid, :submitter_uuid, :name, :type,
|
fields: [[:uuid, :submitter_uuid, :name, :type,
|
||||||
:required, :readonly, :default_value,
|
:required, :readonly, :default_value,
|
||||||
:title, :description,
|
:title, :description,
|
||||||
|
|||||||
@@ -11,30 +11,29 @@ class StartFormController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@submitter = @template.submissions.new(account_id: @template.account_id)
|
@submitter = @template.submissions.new(account_id: @template.account_id)
|
||||||
.submitters.new(uuid: @template.submitters.first['uuid'])
|
.submitters.new(uuid: (filter_undefined_submitters(@template).first ||
|
||||||
|
@template.submitters.first)['uuid'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
return redirect_to start_form_path(@template.slug) if @template.archived_at?
|
return redirect_to start_form_path(@template.slug) if @template.archived_at?
|
||||||
|
|
||||||
@submitter = Submitter.where(submission: @template.submissions.where(expire_at: Time.current..)
|
@submitter = find_or_initialize_submitter(@template, submitter_params)
|
||||||
.or(@template.submissions.where(expire_at: nil)).where(archived_at: nil))
|
|
||||||
.order(id: :desc)
|
|
||||||
.then { |rel| params[:resubmit].present? ? rel.where(completed_at: nil) : rel }
|
|
||||||
.find_or_initialize_by(**submitter_params.compact_blank)
|
|
||||||
|
|
||||||
if @submitter.completed_at?
|
if @submitter.completed_at?
|
||||||
redirect_to start_form_completed_path(@template.slug, email: submitter_params[:email])
|
redirect_to start_form_completed_path(@template.slug, email: submitter_params[:email])
|
||||||
else
|
else
|
||||||
if @template.submitters.to_a.size > 1 && @submitter.new_record?
|
if filter_undefined_submitters(@template).size > 1 && @submitter.new_record?
|
||||||
@error_message = 'Not found'
|
@error_message = 'Not found'
|
||||||
|
|
||||||
return render :show
|
return render :show
|
||||||
end
|
end
|
||||||
|
|
||||||
assign_submission_attributes(@submitter, @template) if @submitter.new_record?
|
if (is_new_record = @submitter.new_record?)
|
||||||
|
assign_submission_attributes(@submitter, @template)
|
||||||
|
|
||||||
is_new_record = @submitter.new_record?
|
Submissions::AssignDefinedSubmitters.call(@submitter.submission)
|
||||||
|
end
|
||||||
|
|
||||||
if @submitter.save
|
if @submitter.save
|
||||||
if is_new_record
|
if is_new_record
|
||||||
@@ -56,14 +55,21 @@ class StartFormController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def find_or_initialize_submitter(template, submitter_params)
|
||||||
|
Submitter.where(submission: template.submissions.where(expire_at: Time.current..)
|
||||||
|
.or(template.submissions.where(expire_at: nil)).where(archived_at: nil))
|
||||||
|
.order(id: :desc)
|
||||||
|
.where(declined_at: nil)
|
||||||
|
.then { |rel| params[:resubmit].present? ? rel.where(completed_at: nil) : rel }
|
||||||
|
.find_or_initialize_by(**submitter_params.compact_blank)
|
||||||
|
end
|
||||||
|
|
||||||
def assign_submission_attributes(submitter, template)
|
def assign_submission_attributes(submitter, template)
|
||||||
resubmit_submitter =
|
resubmit_submitter =
|
||||||
if params[:resubmit].present?
|
(Submitter.where(submission: template.submissions).find_by(slug: params[:resubmit]) if params[:resubmit].present?)
|
||||||
Submitter.where(submission: @template.submissions).find_by(slug: params[:resubmit])
|
|
||||||
end
|
|
||||||
|
|
||||||
submitter.assign_attributes(
|
submitter.assign_attributes(
|
||||||
uuid: template.submitters.first['uuid'],
|
uuid: (filter_undefined_submitters(template).first || @template.submitters.first)['uuid'],
|
||||||
ip: request.remote_ip,
|
ip: request.remote_ip,
|
||||||
ua: request.user_agent,
|
ua: request.user_agent,
|
||||||
values: resubmit_submitter&.preferences&.fetch('default_values', nil) || {},
|
values: resubmit_submitter&.preferences&.fetch('default_values', nil) || {},
|
||||||
@@ -80,6 +86,7 @@ class StartFormController < ApplicationController
|
|||||||
submitter.submission ||= Submission.new(template:,
|
submitter.submission ||= Submission.new(template:,
|
||||||
account_id: template.account_id,
|
account_id: template.account_id,
|
||||||
template_submitters: template.submitters,
|
template_submitters: template.submitters,
|
||||||
|
submitters: [submitter],
|
||||||
source: :link)
|
source: :link)
|
||||||
|
|
||||||
submitter.account_id = submitter.submission.account_id
|
submitter.account_id = submitter.submission.account_id
|
||||||
@@ -87,6 +94,10 @@ class StartFormController < ApplicationController
|
|||||||
submitter
|
submitter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filter_undefined_submitters(template)
|
||||||
|
Templates.filter_undefined_submitters(template)
|
||||||
|
end
|
||||||
|
|
||||||
def submitter_params
|
def submitter_params
|
||||||
params.require(:submitter).permit(:email, :phone, :name).tap do |attrs|
|
params.require(:submitter).permit(:email, :phone, :name).tap do |attrs|
|
||||||
attrs[:email] = Submissions.normalize_email(attrs[:email])
|
attrs[:email] = Submissions.normalize_email(attrs[:email])
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class SubmissionsDownloadController < ApplicationController
|
|||||||
return head :not_found
|
return head :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:combined]
|
if params[:combined] == 'true'
|
||||||
url = build_combined_url(submitter)
|
url = build_combined_url(submitter)
|
||||||
|
|
||||||
if url
|
if url
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class SubmitFormController < ApplicationController
|
|||||||
return redirect_to submit_form_completed_path(@submitter.slug) if @submitter.completed_at?
|
return redirect_to submit_form_completed_path(@submitter.slug) if @submitter.completed_at?
|
||||||
return render :archived if @submitter.submission.template.archived_at? || @submitter.submission.archived_at?
|
return render :archived if @submitter.submission.template.archived_at? || @submitter.submission.archived_at?
|
||||||
return render :expired if @submitter.submission.expired?
|
return render :expired if @submitter.submission.expired?
|
||||||
|
return render :declined if @submitter.declined_at?
|
||||||
|
|
||||||
Submitters.preload_with_pages(@submitter)
|
Submitters.preload_with_pages(@submitter)
|
||||||
|
|
||||||
@@ -56,6 +57,8 @@ class SubmitFormController < ApplicationController
|
|||||||
return render json: { error: 'Form has been expired.' }, status: :unprocessable_entity
|
return render json: { error: 'Form has been expired.' }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return render json: { error: 'Form has been declined.' }, status: :unprocessable_entity if submitter.declined_at?
|
||||||
|
|
||||||
Submitters::SubmitValues.call(submitter, params, request)
|
Submitters::SubmitValues.call(submitter, params, request)
|
||||||
|
|
||||||
head :ok
|
head :ok
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SubmitFormDeclineController < ApplicationController
|
||||||
|
skip_before_action :authenticate_user!
|
||||||
|
skip_authorization_check
|
||||||
|
|
||||||
|
def create
|
||||||
|
submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
||||||
|
|
||||||
|
return redirect_to submit_form_path(submitter.slug) if submitter.declined_at? ||
|
||||||
|
submitter.completed_at? ||
|
||||||
|
submitter.submission.archived_at? ||
|
||||||
|
submitter.submission.expired? ||
|
||||||
|
submitter.submission.template.archived_at?
|
||||||
|
|
||||||
|
ApplicationRecord.transaction do
|
||||||
|
submitter.update!(declined_at: Time.current)
|
||||||
|
|
||||||
|
SubmissionEvents.create_with_tracking_data(submitter, 'decline_form', request, { reason: params[:reason] })
|
||||||
|
end
|
||||||
|
|
||||||
|
user = submitter.submission.created_by_user || submitter.template.author
|
||||||
|
|
||||||
|
SubmitterMailer.declined_email(submitter, user).deliver_later!
|
||||||
|
SendFormDeclinedWebhookRequestJob.perform_async('submitter_id' => submitter.id)
|
||||||
|
|
||||||
|
redirect_to submit_form_path(submitter.slug)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SubmitFormDownloadController < ApplicationController
|
||||||
|
skip_before_action :authenticate_user!
|
||||||
|
skip_authorization_check
|
||||||
|
|
||||||
|
FILES_TTL = 5.minutes
|
||||||
|
|
||||||
|
def index
|
||||||
|
submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
||||||
|
|
||||||
|
return redirect_to submitter_download_index_path(submitter.slug) if submitter.completed_at?
|
||||||
|
|
||||||
|
return head :unprocessable_entity if submitter.declined_at? ||
|
||||||
|
submitter.submission.archived_at? ||
|
||||||
|
submitter.submission.expired? ||
|
||||||
|
submitter.submission.template.archived_at?
|
||||||
|
|
||||||
|
last_completed_submitter = submitter.submission.submitters
|
||||||
|
.where.not(id: submitter.id)
|
||||||
|
.where.not(completed_at: nil)
|
||||||
|
.max_by(&:completed_at)
|
||||||
|
|
||||||
|
attachments =
|
||||||
|
if last_completed_submitter
|
||||||
|
Submitters.select_attachments_for_download(last_completed_submitter)
|
||||||
|
else
|
||||||
|
submitter.submission.template.schema_documents.preload(:blob)
|
||||||
|
end
|
||||||
|
|
||||||
|
urls = attachments.map do |attachment|
|
||||||
|
ActiveStorage::Blob.proxy_url(attachment.blob, expires_at: FILES_TTL.from_now.to_i)
|
||||||
|
end
|
||||||
|
|
||||||
|
render json: urls
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SubmitFormInviteController < ApplicationController
|
||||||
|
skip_before_action :authenticate_user!
|
||||||
|
skip_authorization_check
|
||||||
|
|
||||||
|
def create
|
||||||
|
submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
||||||
|
|
||||||
|
return head :unprocessable_entity unless can_invite?(submitter)
|
||||||
|
|
||||||
|
invite_submitters = filter_invite_submitters(submitter)
|
||||||
|
|
||||||
|
ApplicationRecord.transaction do
|
||||||
|
invite_submitters.each do |item|
|
||||||
|
attrs = submitters_attributes.find { |e| e[:uuid] == item['uuid'] }
|
||||||
|
|
||||||
|
next unless attrs
|
||||||
|
|
||||||
|
submitter.submission.submitters.create!(**attrs, account_id: submitter.account_id)
|
||||||
|
|
||||||
|
SubmissionEvents.create_with_tracking_data(submitter, 'invite_party', request, { uuid: submitter.uuid })
|
||||||
|
end
|
||||||
|
|
||||||
|
submitter.submission.update!(submitters_order: :preserved)
|
||||||
|
end
|
||||||
|
|
||||||
|
submitter.submission.submitters.reload
|
||||||
|
|
||||||
|
if invite_submitters.all? { |s| submitter.submission.submitters.any? { |e| e.uuid == s['uuid'] } }
|
||||||
|
Submitters::SubmitValues.call(submitter, ActionController::Parameters.new(completed: 'true'), request)
|
||||||
|
|
||||||
|
head :ok
|
||||||
|
else
|
||||||
|
head :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def can_invite?(submitter)
|
||||||
|
!submitter.declined_at? &&
|
||||||
|
!submitter.completed_at? &&
|
||||||
|
!submitter.submission.archived_at? &&
|
||||||
|
!submitter.submission.expired? &&
|
||||||
|
!submitter.submission.template.archived_at?
|
||||||
|
end
|
||||||
|
|
||||||
|
def filter_invite_submitters(submitter)
|
||||||
|
(submitter.submission.template_submitters || submitter.submission.template.submitters).select do |s|
|
||||||
|
s['invite_by_uuid'] == submitter.uuid && submitter.submission.submitters.none? { |e| e.uuid == s['uuid'] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def submitters_attributes
|
||||||
|
params.require(:submission).permit(submitters: [%i[uuid email]]).fetch(:submitters, [])
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -7,8 +7,10 @@ class SubmitFormValuesController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
||||||
|
|
||||||
return render json: {} if submitter.completed_at?
|
return render json: {} if submitter.completed_at? || submitter.declined_at?
|
||||||
return render json: {} if submitter.submission.template.archived_at? || submitter.submission.archived_at?
|
return render json: {} if submitter.submission.template.archived_at? ||
|
||||||
|
submitter.submission.archived_at? ||
|
||||||
|
submitter.submission.expired?
|
||||||
|
|
||||||
value = submitter.values[params['field_uuid']]
|
value = submitter.values[params['field_uuid']]
|
||||||
attachment = submitter.attachments.where(created_at: params[:after]..).find_by(uuid: value) if value.present?
|
attachment = submitter.attachments.where(created_at: params[:after]..).find_by(uuid: value) if value.present?
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class TemplatesController < ApplicationController
|
|||||||
params.require(:template).permit(
|
params.require(:template).permit(
|
||||||
:name,
|
:name,
|
||||||
{ schema: [%i[attachment_uuid name]],
|
{ schema: [%i[attachment_uuid name]],
|
||||||
submitters: [%i[name uuid]],
|
submitters: [%i[name uuid is_requester linked_to_uuid invite_by_uuid email]],
|
||||||
fields: [[:uuid, :submitter_uuid, :name, :type,
|
fields: [[:uuid, :submitter_uuid, :name, :type,
|
||||||
:required, :readonly, :default_value,
|
:required, :readonly, :default_value,
|
||||||
:title, :description,
|
:title, :description,
|
||||||
@@ -123,7 +123,7 @@ class TemplatesController < ApplicationController
|
|||||||
if template.account == current_account
|
if template.account == current_account
|
||||||
redirect_to(edit_template_path(@template))
|
redirect_to(edit_template_path(@template))
|
||||||
else
|
else
|
||||||
redirect_back(fallback_location: root_path, notice: 'Template has been clonned')
|
redirect_back(fallback_location: root_path, notice: 'Template has been cloned')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class TemplatesPreferencesController < ApplicationController
|
|||||||
authorize!(:update, @template)
|
authorize!(:update, @template)
|
||||||
|
|
||||||
@template.preferences = @template.preferences.merge(template_params[:preferences])
|
@template.preferences = @template.preferences.merge(template_params[:preferences])
|
||||||
@template.preferences = @template.preferences.reject { |_, v| v.is_a?(String) && v.blank? }
|
@template.preferences = @template.preferences.reject { |_, v| (v.is_a?(String) || v.is_a?(Hash)) && v.blank? }
|
||||||
@template.save!
|
@template.save!
|
||||||
|
|
||||||
head :ok
|
head :ok
|
||||||
@@ -23,12 +23,16 @@ class TemplatesPreferencesController < ApplicationController
|
|||||||
documents_copy_email_subject documents_copy_email_body
|
documents_copy_email_subject documents_copy_email_body
|
||||||
documents_copy_email_enabled documents_copy_email_attach_audit
|
documents_copy_email_enabled documents_copy_email_attach_audit
|
||||||
completed_notification_email_attach_documents
|
completed_notification_email_attach_documents
|
||||||
|
completed_redirect_url
|
||||||
completed_notification_email_subject completed_notification_email_body
|
completed_notification_email_subject completed_notification_email_body
|
||||||
completed_notification_email_enabled completed_notification_email_attach_audit]
|
completed_notification_email_enabled completed_notification_email_attach_audit] +
|
||||||
|
[completed_message: %i[title body]]
|
||||||
).tap do |attrs|
|
).tap do |attrs|
|
||||||
attrs[:preferences] = attrs[:preferences].transform_values do |value|
|
attrs[:preferences] = attrs[:preferences].transform_values do |value|
|
||||||
if %w[true false].include?(value)
|
if %w[true false].include?(value)
|
||||||
value == 'true'
|
value == 'true'
|
||||||
|
elsif value.respond_to?(:compact_blank)
|
||||||
|
value.compact_blank
|
||||||
else
|
else
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class TemplatesRecipientsController < ApplicationController
|
||||||
|
load_and_authorize_resource :template
|
||||||
|
|
||||||
|
def create
|
||||||
|
authorize!(:update, @template)
|
||||||
|
|
||||||
|
@template.submitters =
|
||||||
|
submitters_params.map { |s| s.reject { |_, v| v.is_a?(String) && v.blank? } }
|
||||||
|
|
||||||
|
@template.save!
|
||||||
|
|
||||||
|
render json: { submitters: @template.submitters }
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def submitters_params
|
||||||
|
params.require(:template).permit(
|
||||||
|
submitters: [%i[name uuid is_requester invite_by_uuid linked_to_uuid email option]]
|
||||||
|
).fetch(:submitters, {}).values.filter_map do |s|
|
||||||
|
next if s[:uuid].blank?
|
||||||
|
|
||||||
|
if s[:is_requester] == '1' && s[:invite_by_uuid].blank?
|
||||||
|
s[:is_requester] = true
|
||||||
|
else
|
||||||
|
s.delete(:is_requester)
|
||||||
|
end
|
||||||
|
|
||||||
|
s.delete(:invite_by_uuid) if s[:invite_by_uuid].blank?
|
||||||
|
|
||||||
|
option = s.delete(:option)
|
||||||
|
|
||||||
|
if option.present?
|
||||||
|
case option
|
||||||
|
when 'is_requester'
|
||||||
|
s[:is_requester] = true
|
||||||
|
when 'not_set'
|
||||||
|
s.delete(:is_requester)
|
||||||
|
s.delete(:email)
|
||||||
|
s.delete(:linked_to_uuid)
|
||||||
|
s.delete(:invite_by_uuid)
|
||||||
|
when /\Alinked_to_(.*)\z/
|
||||||
|
s[:linked_to_uuid] = ::Regexp.last_match(-1)
|
||||||
|
when /\Ainvite_by_(.*)\z/
|
||||||
|
s[:invite_by_uuid] = ::Regexp.last_match(-1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -52,7 +52,7 @@ class TemplatesUploadsController < ApplicationController
|
|||||||
def create_file_params_from_url
|
def create_file_params_from_url
|
||||||
tempfile = Tempfile.new
|
tempfile = Tempfile.new
|
||||||
tempfile.binmode
|
tempfile.binmode
|
||||||
tempfile.write(conn.get(Addressable::URI.parse(params[:url]).display_uri.to_s).body)
|
tempfile.write(DownloadUtils.call(params[:url]).body)
|
||||||
tempfile.rewind
|
tempfile.rewind
|
||||||
|
|
||||||
file = ActionDispatch::Http::UploadedFile.new(
|
file = ActionDispatch::Http::UploadedFile.new(
|
||||||
@@ -65,10 +65,4 @@ class TemplatesUploadsController < ApplicationController
|
|||||||
|
|
||||||
{ files: [file] }
|
{ files: [file] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def conn
|
|
||||||
Faraday.new do |faraday|
|
|
||||||
faraday.response :follow_redirects
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -5,6 +5,7 @@ class WebhookPreferencesController < ApplicationController
|
|||||||
form.viewed
|
form.viewed
|
||||||
form.started
|
form.started
|
||||||
form.completed
|
form.completed
|
||||||
|
form.declined
|
||||||
template.created
|
template.created
|
||||||
template.updated
|
template.updated
|
||||||
submission.created
|
submission.created
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ import EmailsTextarea from './elements/emails_textarea'
|
|||||||
import ToggleOnSubmit from './elements/toggle_on_submit'
|
import ToggleOnSubmit from './elements/toggle_on_submit'
|
||||||
import PasswordInput from './elements/password_input'
|
import PasswordInput from './elements/password_input'
|
||||||
import SearchInput from './elements/search_input'
|
import SearchInput from './elements/search_input'
|
||||||
|
import ToggleAttribute from './elements/toggle_attribute'
|
||||||
|
import LinkedInput from './elements/linked_input'
|
||||||
|
import CheckboxGroup from './elements/checkbox_group'
|
||||||
|
|
||||||
import * as TurboInstantClick from './lib/turbo_instant_click'
|
import * as TurboInstantClick from './lib/turbo_instant_click'
|
||||||
|
|
||||||
@@ -89,9 +92,14 @@ safeRegisterElement('toggle-cookies', ToggleCookies)
|
|||||||
safeRegisterElement('toggle-on-submit', ToggleOnSubmit)
|
safeRegisterElement('toggle-on-submit', ToggleOnSubmit)
|
||||||
safeRegisterElement('password-input', PasswordInput)
|
safeRegisterElement('password-input', PasswordInput)
|
||||||
safeRegisterElement('search-input', SearchInput)
|
safeRegisterElement('search-input', SearchInput)
|
||||||
|
safeRegisterElement('toggle-attribute', ToggleAttribute)
|
||||||
|
safeRegisterElement('linked-input', LinkedInput)
|
||||||
|
safeRegisterElement('checkbox-group', CheckboxGroup)
|
||||||
|
|
||||||
safeRegisterElement('template-builder', class extends HTMLElement {
|
safeRegisterElement('template-builder', class extends HTMLElement {
|
||||||
connectedCallback () {
|
connectedCallback () {
|
||||||
|
document.addEventListener('turbo:submit-end', this.onSubmit)
|
||||||
|
|
||||||
this.appElem = document.createElement('div')
|
this.appElem = document.createElement('div')
|
||||||
|
|
||||||
this.appElem.classList.add('md:h-screen')
|
this.appElem.classList.add('md:h-screen')
|
||||||
@@ -107,17 +115,29 @@ safeRegisterElement('template-builder', class extends HTMLElement {
|
|||||||
withPayment: this.dataset.withPayment === 'true',
|
withPayment: this.dataset.withPayment === 'true',
|
||||||
isPaymentConnected: this.dataset.isPaymentConnected === 'true',
|
isPaymentConnected: this.dataset.isPaymentConnected === 'true',
|
||||||
withFormula: this.dataset.withFormula === 'true',
|
withFormula: this.dataset.withFormula === 'true',
|
||||||
|
withSendButton: this.dataset.withSendButton !== 'false',
|
||||||
|
withSignYourselfButton: this.dataset.withSignYourselfButton !== 'false',
|
||||||
withConditions: this.dataset.withConditions === 'true',
|
withConditions: this.dataset.withConditions === 'true',
|
||||||
currencies: (this.dataset.currencies || '').split(',').filter(Boolean),
|
currencies: (this.dataset.currencies || '').split(',').filter(Boolean),
|
||||||
acceptFileTypes: this.dataset.acceptFileTypes
|
acceptFileTypes: this.dataset.acceptFileTypes
|
||||||
})
|
})
|
||||||
|
|
||||||
this.app.mount(this.appElem)
|
this.component = this.app.mount(this.appElem)
|
||||||
|
|
||||||
this.appendChild(this.appElem)
|
this.appendChild(this.appElem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSubmit = (e) => {
|
||||||
|
if (e.detail.success && e.detail?.formSubmission?.formElement?.id === 'submitters_form') {
|
||||||
|
e.detail.fetchResponse.response.json().then((data) => {
|
||||||
|
this.component.template.submitters = data.submitters
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
disconnectedCallback () {
|
disconnectedCallback () {
|
||||||
|
document.removeEventListener('turbo:submit-end', this.onSubmit)
|
||||||
|
|
||||||
this.app?.unmount()
|
this.app?.unmount()
|
||||||
this.appElem?.remove()
|
this.appElem?.remove()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ button[disabled] .enabled {
|
|||||||
@apply input input-bordered bg-white;
|
@apply input input-bordered bg-white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.base-input-slim {
|
||||||
|
@apply input input-bordered bg-white h-10;
|
||||||
|
}
|
||||||
|
|
||||||
.base-textarea {
|
.base-textarea {
|
||||||
@apply textarea textarea-bordered bg-white rounded-3xl;
|
@apply textarea textarea-bordered bg-white rounded-3xl;
|
||||||
}
|
}
|
||||||
@@ -100,7 +104,7 @@ button[disabled] .enabled {
|
|||||||
.autocomplete {
|
.autocomplete {
|
||||||
background: white;
|
background: white;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
font: 14px/22px "-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
font: 16px/25px "-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@apply border border-base-300 mt-1 rounded-md;
|
@apply border border-base-300 mt-1 rounded-md;
|
||||||
@@ -111,7 +115,7 @@ button[disabled] .enabled {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete > div {
|
.autocomplete > div {
|
||||||
@apply px-2 py-1 font-normal text-sm;
|
@apply px-2 py-1.5 font-normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete .group {
|
.autocomplete .group {
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
export default class extends HTMLElement {
|
||||||
|
connectedCallback () {
|
||||||
|
this.items.forEach((item) => {
|
||||||
|
item.addEventListener('change', (e) => {
|
||||||
|
this.items.forEach((item) => {
|
||||||
|
item.checked = item === e.target && e.target.checked
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
get items () {
|
||||||
|
return this.querySelectorAll('input[type="checkbox"]')
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
export default class extends HTMLElement {
|
||||||
|
connectedCallback () {
|
||||||
|
if (this.target) {
|
||||||
|
this.input.value = this.target.value
|
||||||
|
|
||||||
|
this.target.addEventListener('input', (e) => {
|
||||||
|
this.input.value = e.target.value
|
||||||
|
})
|
||||||
|
|
||||||
|
this.target.addEventListener('linked-input.update', (e) => {
|
||||||
|
this.input.value = e.target.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get input () {
|
||||||
|
return this.querySelector('input')
|
||||||
|
}
|
||||||
|
|
||||||
|
get target () {
|
||||||
|
if (this.dataset.targetId) {
|
||||||
|
const listItem = this.closest('[data-targets="dynamic-list.items"]')
|
||||||
|
|
||||||
|
if (listItem) {
|
||||||
|
return listItem.querySelector(`#${this.dataset.targetId}`)
|
||||||
|
} else {
|
||||||
|
return document.getElementById(this.dataset.targetId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ export default class extends HTMLElement {
|
|||||||
|
|
||||||
if (input && item[field]) {
|
if (input && item[field]) {
|
||||||
input.value = item[field]
|
input.value = item[field]
|
||||||
|
input.dispatchEvent(new CustomEvent('linked-input.update', { bubbles: true }))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textarea && item[field]) {
|
if (textarea && item[field]) {
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
export default class extends HTMLElement {
|
||||||
|
connectedCallback () {
|
||||||
|
this.input.addEventListener('change', (event) => {
|
||||||
|
if (this.dataset.attribute) {
|
||||||
|
this.target[this.dataset.attribute] = event.target.checked
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.dataset.className) {
|
||||||
|
this.target.classList.toggle(this.dataset.className, event.target.value !== this.dataset.value)
|
||||||
|
if (this.dataset.className === 'hidden' && this.target.tagName === 'INPUT') {
|
||||||
|
this.target.disabled = event.target.value !== this.dataset.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.dataset.attribute === 'disabled') {
|
||||||
|
this.target.value = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
get input () {
|
||||||
|
return this.querySelector('input[type="checkbox"]') || this.querySelector('select')
|
||||||
|
}
|
||||||
|
|
||||||
|
get target () {
|
||||||
|
return document.getElementById(this.dataset.targetId)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ export default actionable(class extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSubmit = (e) => {
|
onSubmit = (e) => {
|
||||||
if (e.detail.success) {
|
if (e.detail.success && e.detail?.formSubmission?.formElement?.dataset?.closeOnSubmit !== 'false') {
|
||||||
this.close()
|
this.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ safeRegisterElement('submission-form', class extends HTMLElement {
|
|||||||
|
|
||||||
this.app = createApp(Form, {
|
this.app = createApp(Form, {
|
||||||
submitter: JSON.parse(this.dataset.submitter),
|
submitter: JSON.parse(this.dataset.submitter),
|
||||||
|
inviteSubmitters: JSON.parse(this.dataset.inviteSubmitters),
|
||||||
canSendEmail: this.dataset.canSendEmail === 'true',
|
canSendEmail: this.dataset.canSendEmail === 'true',
|
||||||
previousSignatureValue: this.dataset.previousSignatureValue,
|
previousSignatureValue: this.dataset.previousSignatureValue,
|
||||||
goToLast: this.dataset.goToLast === 'true',
|
goToLast: this.dataset.goToLast === 'true',
|
||||||
|
|||||||
@@ -18,9 +18,15 @@ if (token) {
|
|||||||
transform (payload) {
|
transform (payload) {
|
||||||
payload.body.telemetry = []
|
payload.body.telemetry = []
|
||||||
|
|
||||||
const string = JSON.stringify(payload)
|
if (payload.request.query_string) {
|
||||||
|
payload.request.query_string = ''
|
||||||
|
}
|
||||||
|
|
||||||
return JSON.parse(string.replace(/(\/[des]\/)\w{6}/g, (_, m) => m))
|
if (payload.request.url) {
|
||||||
|
payload.request.url = payload.request.url.replace(/(\/[sdep]\/)(\w{5})[^/]+/, '$1$2')
|
||||||
|
}
|
||||||
|
|
||||||
|
return payload
|
||||||
},
|
},
|
||||||
payload: {
|
payload: {
|
||||||
client: {
|
client: {
|
||||||
|
|||||||
@@ -226,7 +226,8 @@ export default {
|
|||||||
},
|
},
|
||||||
submitter: {
|
submitter: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: false,
|
||||||
|
default: () => ({})
|
||||||
},
|
},
|
||||||
withSignatureId: {
|
withSignatureId: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|||||||
@@ -21,14 +21,14 @@
|
|||||||
:values="values"
|
:values="values"
|
||||||
:field="field"
|
:field="field"
|
||||||
:area="area"
|
:area="area"
|
||||||
:submittable="true"
|
:submittable="submittable"
|
||||||
:field-index="fieldIndex"
|
:field-index="fieldIndex"
|
||||||
:scroll-padding="scrollPadding"
|
:scroll-padding="scrollPadding"
|
||||||
:submitter="submitter"
|
:submitter="submitter"
|
||||||
:with-field-placeholder="withFieldPlaceholder"
|
:with-field-placeholder="withFieldPlaceholder"
|
||||||
:with-signature-id="withSignatureId"
|
:with-signature-id="withSignatureId"
|
||||||
:is-active="currentStep === step"
|
:is-active="currentStep === step"
|
||||||
:with-label="withLabel && !withFieldPlaceholder"
|
:with-label="withLabel && !withFieldPlaceholder && step.length < 2"
|
||||||
:is-value-set="step.some((f) => f.uuid in values)"
|
:is-value-set="step.some((f) => f.uuid in values)"
|
||||||
:attachments-index="attachmentsIndex"
|
:attachments-index="attachmentsIndex"
|
||||||
@click="$emit('focus-step', stepIndex)"
|
@click="$emit('focus-step', stepIndex)"
|
||||||
@@ -58,6 +58,11 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
submittable: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
submitter: {
|
submitter: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -181,6 +181,10 @@ export default {
|
|||||||
spread: 140
|
spread: 140
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window.decline_button) {
|
||||||
|
window.decline_button.setAttribute('disabled', 'true')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
sendCopyToEmail () {
|
sendCopyToEmail () {
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
:scroll-padding="scrollPadding"
|
:scroll-padding="scrollPadding"
|
||||||
@focus-step="[saveStep(), currentField.type !== 'checkbox' ? isFormVisible = true : '', goToStep($event, false, true)]"
|
@focus-step="[saveStep(), currentField.type !== 'checkbox' ? isFormVisible = true : '', goToStep($event, false, true)]"
|
||||||
/>
|
/>
|
||||||
|
<FieldAreas
|
||||||
|
:steps="readonlyConditionalFields.map((e) => [e])"
|
||||||
|
:values="readonlyConditionalFields.reduce((acc, f) => { acc[f.uuid] = f.default_value; return acc }, {})"
|
||||||
|
:submitter="submitter"
|
||||||
|
:submittable="false"
|
||||||
|
/>
|
||||||
<FormulaFieldAreas
|
<FormulaFieldAreas
|
||||||
v-if="formulaFields.length"
|
v-if="formulaFields.length"
|
||||||
:fields="formulaFields"
|
:fields="formulaFields"
|
||||||
@@ -64,7 +70,7 @@
|
|||||||
:class="{ 'md:px-4': isBreakpointMd }"
|
:class="{ 'md:px-4': isBreakpointMd }"
|
||||||
>
|
>
|
||||||
<form
|
<form
|
||||||
v-if="!isCompleted"
|
v-if="!isCompleted && !isInvite"
|
||||||
ref="form"
|
ref="form"
|
||||||
:action="submitPath"
|
:action="submitPath"
|
||||||
method="post"
|
method="post"
|
||||||
@@ -430,6 +436,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<InviteForm
|
||||||
|
v-else-if="isInvite"
|
||||||
|
:submitters="inviteSubmitters"
|
||||||
|
:submitter-slug="submitterSlug"
|
||||||
|
:authenticity-token="authenticityToken"
|
||||||
|
:url="baseUrl + submitPath + '/invite'"
|
||||||
|
:style="{ maxWidth: isBreakpointMd ? '582px' : '' }"
|
||||||
|
@success="[isInvite = false, performComplete($event)]"
|
||||||
|
/>
|
||||||
<FormCompleted
|
<FormCompleted
|
||||||
v-else
|
v-else
|
||||||
:is-demo="isDemo"
|
:is-demo="isDemo"
|
||||||
@@ -479,6 +494,7 @@ import TextStep from './text_step'
|
|||||||
import NumberStep from './number_step'
|
import NumberStep from './number_step'
|
||||||
import DateStep from './date_step'
|
import DateStep from './date_step'
|
||||||
import MarkdownContent from './markdown_content'
|
import MarkdownContent from './markdown_content'
|
||||||
|
import InviteForm from './invite_form'
|
||||||
import FormCompleted from './completed'
|
import FormCompleted from './completed'
|
||||||
import { IconInnerShadowTop, IconArrowsDiagonal, IconWritingSign, IconArrowsDiagonalMinimize2 } from '@tabler/icons-vue'
|
import { IconInnerShadowTop, IconArrowsDiagonal, IconWritingSign, IconArrowsDiagonalMinimize2 } from '@tabler/icons-vue'
|
||||||
import AppearsOn from './appears_on'
|
import AppearsOn from './appears_on'
|
||||||
@@ -516,6 +532,7 @@ export default {
|
|||||||
IconWritingSign,
|
IconWritingSign,
|
||||||
AttachmentStep,
|
AttachmentStep,
|
||||||
InitialsStep,
|
InitialsStep,
|
||||||
|
InviteForm,
|
||||||
MultiSelectStep,
|
MultiSelectStep,
|
||||||
IconInnerShadowTop,
|
IconInnerShadowTop,
|
||||||
DateStep,
|
DateStep,
|
||||||
@@ -542,6 +559,11 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
inviteSubmitters: {
|
||||||
|
type: Array,
|
||||||
|
required: false,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
withSignatureId: {
|
withSignatureId: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -733,6 +755,7 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isCompleted: false,
|
isCompleted: false,
|
||||||
|
isInvite: false,
|
||||||
isFormVisible: this.expand !== false,
|
isFormVisible: this.expand !== false,
|
||||||
showFillAllRequiredFields: false,
|
showFillAllRequiredFields: false,
|
||||||
currentStep: 0,
|
currentStep: 0,
|
||||||
@@ -802,6 +825,9 @@ export default {
|
|||||||
currentField () {
|
currentField () {
|
||||||
return this.currentStepFields[0]
|
return this.currentStepFields[0]
|
||||||
},
|
},
|
||||||
|
readonlyConditionalFields () {
|
||||||
|
return this.fields.filter((f) => f.readonly && f.conditions?.length && this.checkFieldConditions(f))
|
||||||
|
},
|
||||||
stepFields () {
|
stepFields () {
|
||||||
return this.fields.filter((f) => !f.readonly).reduce((acc, f) => {
|
return this.fields.filter((f) => !f.readonly).reduce((acc, f) => {
|
||||||
const prevStep = acc[acc.length - 1]
|
const prevStep = acc[acc.length - 1]
|
||||||
@@ -933,12 +959,12 @@ export default {
|
|||||||
return acc && isEmpty(this.values[c.field_uuid])
|
return acc && isEmpty(this.values[c.field_uuid])
|
||||||
} else if (['not_empty', 'checked'].includes(c.action)) {
|
} else if (['not_empty', 'checked'].includes(c.action)) {
|
||||||
return acc && !isEmpty(this.values[c.field_uuid])
|
return acc && !isEmpty(this.values[c.field_uuid])
|
||||||
} else if (['equal', 'contains'].includes(c.action)) {
|
} else if (['equal', 'contains'].includes(c.action) && field) {
|
||||||
const option = field.options.find((o) => o.uuid === c.value)
|
const option = field.options.find((o) => o.uuid === c.value)
|
||||||
const values = [this.values[c.field_uuid]].flat()
|
const values = [this.values[c.field_uuid]].flat()
|
||||||
|
|
||||||
return acc && values.includes(this.optionValue(option, field.options.indexOf(option)))
|
return acc && values.includes(this.optionValue(option, field.options.indexOf(option)))
|
||||||
} else if (['not_equal', 'does_not_contain'].includes(c.action)) {
|
} else if (['not_equal', 'does_not_contain'].includes(c.action) && field) {
|
||||||
const option = field.options.find((o) => o.uuid === c.value)
|
const option = field.options.find((o) => o.uuid === c.value)
|
||||||
const values = [this.values[c.field_uuid]].flat()
|
const values = [this.values[c.field_uuid]].flat()
|
||||||
|
|
||||||
@@ -1110,7 +1136,7 @@ export default {
|
|||||||
const formData = new FormData(this.$refs.form)
|
const formData = new FormData(this.$refs.form)
|
||||||
const isLastStep = this.currentStep === this.stepFields.length - 1
|
const isLastStep = this.currentStep === this.stepFields.length - 1
|
||||||
|
|
||||||
if (isLastStep && !emptyRequiredField) {
|
if (isLastStep && !emptyRequiredField && !this.inviteSubmitters.length) {
|
||||||
formData.append('completed', 'true')
|
formData.append('completed', 'true')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,18 +1175,10 @@ export default {
|
|||||||
if (emptyRequiredField === nextStep) {
|
if (emptyRequiredField === nextStep) {
|
||||||
this.showFillAllRequiredFields = true
|
this.showFillAllRequiredFields = true
|
||||||
}
|
}
|
||||||
|
} else if (this.inviteSubmitters.length) {
|
||||||
|
this.isInvite = true
|
||||||
} else {
|
} else {
|
||||||
this.isCompleted = true
|
this.performComplete(response)
|
||||||
|
|
||||||
const respData = await response.text()
|
|
||||||
|
|
||||||
if (respData) {
|
|
||||||
this.onComplete(JSON.parse(respData))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.completedRedirectUrl) {
|
|
||||||
window.location.href = this.completedRedirectUrl
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -1176,6 +1194,21 @@ export default {
|
|||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.isSubmitting = false
|
this.isSubmitting = false
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
async performComplete (resp) {
|
||||||
|
this.isCompleted = true
|
||||||
|
|
||||||
|
if (resp) {
|
||||||
|
const respData = await resp.text()
|
||||||
|
|
||||||
|
if (respData) {
|
||||||
|
this.onComplete(JSON.parse(respData))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.completedRedirectUrl) {
|
||||||
|
window.location.href = this.completedRedirectUrl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ const en = {
|
|||||||
reviewed: 'Reviewed',
|
reviewed: 'Reviewed',
|
||||||
other: 'Other',
|
other: 'Other',
|
||||||
authored_by_me: 'Authored by me',
|
authored_by_me: 'Authored by me',
|
||||||
|
invite: 'Invite',
|
||||||
|
email: 'Email',
|
||||||
approved_by: 'Approved by',
|
approved_by: 'Approved by',
|
||||||
reviewed_by: 'Reviewed by',
|
reviewed_by: 'Reviewed by',
|
||||||
authored_by: 'Authored by',
|
authored_by: 'Authored by',
|
||||||
@@ -85,6 +87,8 @@ const en = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const es = {
|
const es = {
|
||||||
|
invite: 'Invitar',
|
||||||
|
email: 'Correo electrónico',
|
||||||
approved: 'Aprobado',
|
approved: 'Aprobado',
|
||||||
reviewed: 'Revisado',
|
reviewed: 'Revisado',
|
||||||
other: 'Otro',
|
other: 'Otro',
|
||||||
@@ -170,6 +174,8 @@ const es = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const it = {
|
const it = {
|
||||||
|
invite: 'Invita',
|
||||||
|
email: 'Email',
|
||||||
approved: 'Approvato',
|
approved: 'Approvato',
|
||||||
reviewed: 'Revisionato',
|
reviewed: 'Revisionato',
|
||||||
other: 'Altro',
|
other: 'Altro',
|
||||||
@@ -255,6 +261,8 @@ const it = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const de = {
|
const de = {
|
||||||
|
invite: 'Einladen',
|
||||||
|
email: 'E-Mail',
|
||||||
approved: 'Genehmigt',
|
approved: 'Genehmigt',
|
||||||
reviewed: 'Überprüft',
|
reviewed: 'Überprüft',
|
||||||
other: 'Andere',
|
other: 'Andere',
|
||||||
@@ -340,6 +348,8 @@ const de = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fr = {
|
const fr = {
|
||||||
|
invite: 'Inviter',
|
||||||
|
email: 'Courriel',
|
||||||
approved: 'Approuvé',
|
approved: 'Approuvé',
|
||||||
reviewed: 'Révisé',
|
reviewed: 'Révisé',
|
||||||
other: 'Autre',
|
other: 'Autre',
|
||||||
@@ -425,6 +435,8 @@ const fr = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pl = {
|
const pl = {
|
||||||
|
invite: 'Zaproś',
|
||||||
|
email: 'E-mail',
|
||||||
approved: 'Zaakceptowany',
|
approved: 'Zaakceptowany',
|
||||||
reviewed: 'Przejrzany',
|
reviewed: 'Przejrzany',
|
||||||
other: 'Inny',
|
other: 'Inny',
|
||||||
@@ -510,6 +522,8 @@ const pl = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uk = {
|
const uk = {
|
||||||
|
invite: 'Запросити',
|
||||||
|
email: 'Електронна пошта',
|
||||||
approved: 'Затверджено',
|
approved: 'Затверджено',
|
||||||
reviewed: 'Переглянуто',
|
reviewed: 'Переглянуто',
|
||||||
other: 'Інше',
|
other: 'Інше',
|
||||||
@@ -595,6 +609,8 @@ const uk = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cs = {
|
const cs = {
|
||||||
|
invite: 'Pozvat',
|
||||||
|
email: 'E-mail',
|
||||||
approved: 'Schváleno',
|
approved: 'Schváleno',
|
||||||
reviewed: 'Zkontrolováno',
|
reviewed: 'Zkontrolováno',
|
||||||
other: 'Jiné',
|
other: 'Jiné',
|
||||||
@@ -680,6 +696,8 @@ const cs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pt = {
|
const pt = {
|
||||||
|
invite: 'Convidar',
|
||||||
|
email: 'E-mail',
|
||||||
approved: 'Aprovado',
|
approved: 'Aprovado',
|
||||||
reviewed: 'Revisado',
|
reviewed: 'Revisado',
|
||||||
other: 'Outro',
|
other: 'Outro',
|
||||||
@@ -765,6 +783,8 @@ const pt = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const he = {
|
const he = {
|
||||||
|
invite: 'הזמן',
|
||||||
|
email: 'דוא"ל',
|
||||||
approved: 'מאושר',
|
approved: 'מאושר',
|
||||||
reviewed: 'נסקר',
|
reviewed: 'נסקר',
|
||||||
other: 'אחר',
|
other: 'אחר',
|
||||||
@@ -851,6 +871,8 @@ const he = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nl = {
|
const nl = {
|
||||||
|
invite: 'Uitnodigen',
|
||||||
|
email: 'E-mail',
|
||||||
approved: 'Goedgekeurd',
|
approved: 'Goedgekeurd',
|
||||||
reviewed: 'Beoordeeld',
|
reviewed: 'Beoordeeld',
|
||||||
other: 'Anders',
|
other: 'Anders',
|
||||||
@@ -937,6 +959,8 @@ const nl = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ar = {
|
const ar = {
|
||||||
|
invite: 'دعوة',
|
||||||
|
email: 'البريد الإلكتروني',
|
||||||
approved: 'موافق عليه',
|
approved: 'موافق عليه',
|
||||||
reviewed: 'تمت مراجعته',
|
reviewed: 'تمت مراجعته',
|
||||||
other: 'آخر',
|
other: 'آخر',
|
||||||
@@ -1022,6 +1046,8 @@ const ar = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ko = {
|
const ko = {
|
||||||
|
invite: '초대하기',
|
||||||
|
email: '이메일',
|
||||||
approved: '승인됨',
|
approved: '승인됨',
|
||||||
reviewed: '검토됨',
|
reviewed: '검토됨',
|
||||||
other: '기타',
|
other: '기타',
|
||||||
|
|||||||
@@ -50,6 +50,26 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
<span
|
||||||
|
class="tooltip"
|
||||||
|
:data-tip="t('click_to_upload')"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
class="btn btn-outline btn-sm font-medium inline-flex flex-nowrap"
|
||||||
|
>
|
||||||
|
<IconUpload :width="16" />
|
||||||
|
<input
|
||||||
|
:key="uploadImageInputKey"
|
||||||
|
type="file"
|
||||||
|
hidden
|
||||||
|
accept="image/*"
|
||||||
|
@change="drawImage"
|
||||||
|
>
|
||||||
|
<span class="hidden sm:inline">
|
||||||
|
{{ t('upload') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
<a
|
<a
|
||||||
v-if="modelValue || computedPreviousValue"
|
v-if="modelValue || computedPreviousValue"
|
||||||
href="#"
|
href="#"
|
||||||
@@ -97,7 +117,7 @@
|
|||||||
<img
|
<img
|
||||||
v-if="modelValue || computedPreviousValue"
|
v-if="modelValue || computedPreviousValue"
|
||||||
:src="attachmentsIndex[modelValue || computedPreviousValue].url"
|
:src="attachmentsIndex[modelValue || computedPreviousValue].url"
|
||||||
class="mx-auto bg-white border border-base-300 rounded max-h-72"
|
class="mx-auto bg-white border border-base-300 rounded max-h-44"
|
||||||
>
|
>
|
||||||
<canvas
|
<canvas
|
||||||
v-show="!modelValue && !computedPreviousValue"
|
v-show="!modelValue && !computedPreviousValue"
|
||||||
@@ -120,16 +140,18 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { cropCanvasAndExportToPNG } from './crop_canvas'
|
import { cropCanvasAndExportToPNG } from './crop_canvas'
|
||||||
import { IconReload, IconTextSize, IconSignature, IconArrowsDiagonalMinimize2 } from '@tabler/icons-vue'
|
import { IconReload, IconTextSize, IconUpload, IconSignature, IconArrowsDiagonalMinimize2 } from '@tabler/icons-vue'
|
||||||
import SignaturePad from 'signature_pad'
|
import SignaturePad from 'signature_pad'
|
||||||
import AppearsOn from './appears_on'
|
import AppearsOn from './appears_on'
|
||||||
import MarkdownContent from './markdown_content'
|
import MarkdownContent from './markdown_content'
|
||||||
|
import SignatureStep from './signature_step'
|
||||||
|
|
||||||
const scale = 3
|
const scale = 3
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'InitialsStep',
|
name: 'InitialsStep',
|
||||||
components: {
|
components: {
|
||||||
|
IconUpload,
|
||||||
AppearsOn,
|
AppearsOn,
|
||||||
IconReload,
|
IconReload,
|
||||||
IconTextSize,
|
IconTextSize,
|
||||||
@@ -178,7 +200,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
isInitialsStarted: !!this.previousValue,
|
isInitialsStarted: !!this.previousValue,
|
||||||
isUsePreviousValue: true,
|
isUsePreviousValue: true,
|
||||||
isDrawInitials: false
|
isDrawInitials: false,
|
||||||
|
uploadImageInputKey: Math.random().toString()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -229,6 +252,15 @@ export default {
|
|||||||
this.intersectionObserver?.disconnect()
|
this.intersectionObserver?.disconnect()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
drawOnCanvas: SignatureStep.methods.drawOnCanvas,
|
||||||
|
drawImage (event) {
|
||||||
|
this.remove()
|
||||||
|
this.isInitialsStarted = true
|
||||||
|
|
||||||
|
this.drawOnCanvas(event.target.files[0], this.$refs.canvas)
|
||||||
|
|
||||||
|
this.uploadImageInputKey = Math.random().toString()
|
||||||
|
},
|
||||||
remove () {
|
remove () {
|
||||||
this.$emit('update:model-value', '')
|
this.$emit('update:model-value', '')
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<template>
|
||||||
|
<form
|
||||||
|
ref="form"
|
||||||
|
action="post"
|
||||||
|
method="post"
|
||||||
|
class="mx-auto"
|
||||||
|
@submit.prevent="submit"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="authenticity_token"
|
||||||
|
:value="authenticityToken"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-for="(submitter, index) in submitters"
|
||||||
|
:key="submitter.uuid"
|
||||||
|
:class="{ 'mt-4': index !== 0 }"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
:value="submitter.uuid"
|
||||||
|
hidden
|
||||||
|
name="submission[submitters][][uuid]"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
:for="submitter.uuid"
|
||||||
|
dir="auto"
|
||||||
|
class="label text-2xl"
|
||||||
|
>
|
||||||
|
{{ t('invite') }} {{ submitter.name }}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
:id="submitter.uuid"
|
||||||
|
dir="auto"
|
||||||
|
class="base-input !text-2xl w-full"
|
||||||
|
:placeholder="t('email')"
|
||||||
|
type="email"
|
||||||
|
required
|
||||||
|
autofocus="true"
|
||||||
|
name="submission[submitters][][email]"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="mt-6 md:mt-8"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="base-button w-full flex justify-center"
|
||||||
|
:disabled="isSubmitting"
|
||||||
|
>
|
||||||
|
<span class="flex">
|
||||||
|
<IconInnerShadowTop
|
||||||
|
v-if="isSubmitting"
|
||||||
|
class="mr-1 animate-spin"
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
{{ t('submit') }}
|
||||||
|
</span><span
|
||||||
|
v-if="isSubmitting"
|
||||||
|
class="w-6 flex justify-start mr-1"
|
||||||
|
><span>...</span></span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { IconInnerShadowTop } from '@tabler/icons-vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'InviteForm',
|
||||||
|
components: {
|
||||||
|
IconInnerShadowTop
|
||||||
|
},
|
||||||
|
inject: ['t'],
|
||||||
|
props: {
|
||||||
|
submitters: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
authenticityToken: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
submitterSlug: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
emits: ['success'],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
isSubmitting: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submit () {
|
||||||
|
this.isSubmitting = true
|
||||||
|
|
||||||
|
return fetch(this.url, {
|
||||||
|
method: 'POST',
|
||||||
|
body: new FormData(this.$refs.form)
|
||||||
|
}).then((response) => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
this.$emit('success')
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.isSubmitting = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -569,8 +569,11 @@ export default {
|
|||||||
this.remove()
|
this.remove()
|
||||||
this.isSignatureStarted = true
|
this.isSignatureStarted = true
|
||||||
|
|
||||||
const file = event.target.files[0]
|
this.drawOnCanvas(event.target.files[0], this.$refs.canvas)
|
||||||
|
|
||||||
|
this.uploadImageInputKey = Math.random().toString()
|
||||||
|
},
|
||||||
|
drawOnCanvas (file, canvas) {
|
||||||
if (file && file.type.match('image.*')) {
|
if (file && file.type.match('image.*')) {
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
|
|
||||||
@@ -580,7 +583,6 @@ export default {
|
|||||||
img.src = event.target.result
|
img.src = event.target.result
|
||||||
|
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = this.$refs.canvas
|
|
||||||
const context = canvas.getContext('2d')
|
const context = canvas.getContext('2d')
|
||||||
|
|
||||||
const aspectRatio = img.width / img.height
|
const aspectRatio = img.width / img.height
|
||||||
@@ -615,8 +617,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.readAsDataURL(file)
|
reader.readAsDataURL(file)
|
||||||
|
|
||||||
this.uploadImageInputKey = Math.random().toString()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
maybeSetSignedUuid (signedUuid) {
|
maybeSetSignedUuid (signedUuid) {
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ export default {
|
|||||||
const textarea = this.$refs.textarea
|
const textarea = this.$refs.textarea
|
||||||
|
|
||||||
textarea.style.height = 'auto'
|
textarea.style.height = 'auto'
|
||||||
textarea.style.height = textarea.scrollHeight + 'px'
|
textarea.style.height = Math.min(250, textarea.scrollHeight) + 'px'
|
||||||
},
|
},
|
||||||
toggleTextArea () {
|
toggleTextArea () {
|
||||||
this.isTextArea = true
|
this.isTextArea = true
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
/>
|
/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<a
|
<a
|
||||||
|
v-if="withSignYourselfButton"
|
||||||
:href="template.submitters.length > 1 ? `/templates/${template.id}/submissions/new?selfsign=true` : `/d/${template.slug}`"
|
:href="template.submitters.length > 1 ? `/templates/${template.id}/submissions/new?selfsign=true` : `/d/${template.slug}`"
|
||||||
class="btn btn-primary btn-ghost text-base hidden md:flex"
|
class="btn btn-primary btn-ghost text-base hidden md:flex"
|
||||||
:target="template.submitters.length > 1 ? '' : '_blank'"
|
:target="template.submitters.length > 1 ? '' : '_blank'"
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
|
v-if="withSendButton"
|
||||||
:href="`/templates/${template.id}/submissions/new?with_link=true`"
|
:href="`/templates/${template.id}/submissions/new?with_link=true`"
|
||||||
data-turbo-frame="modal"
|
data-turbo-frame="modal"
|
||||||
class="white-button md:!px-6"
|
class="white-button md:!px-6"
|
||||||
@@ -132,6 +134,17 @@
|
|||||||
<span class="whitespace-nowrap">Save and Preview</span>
|
<span class="whitespace-nowrap">Save and Preview</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
:href="`/templates/${template.id}/preferences`"
|
||||||
|
data-turbo-frame="modal"
|
||||||
|
class="flex space-x-2"
|
||||||
|
@click="closeDropdown"
|
||||||
|
>
|
||||||
|
<IconAdjustments class="w-6 h-6 flex-shrink-0" />
|
||||||
|
<span class="whitespace-nowrap">Preferences</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
@@ -402,7 +415,7 @@ import Contenteditable from './contenteditable'
|
|||||||
import DocumentPreview from './preview'
|
import DocumentPreview from './preview'
|
||||||
import DocumentControls from './controls'
|
import DocumentControls from './controls'
|
||||||
import MobileFields from './mobile_fields'
|
import MobileFields from './mobile_fields'
|
||||||
import { IconPlus, IconUsersPlus, IconDeviceFloppy, IconChevronDown, IconEye, IconWritingSign, IconInnerShadowTop, IconInfoCircle } from '@tabler/icons-vue'
|
import { IconPlus, IconUsersPlus, IconDeviceFloppy, IconChevronDown, IconEye, IconWritingSign, IconInnerShadowTop, IconInfoCircle, IconAdjustments } from '@tabler/icons-vue'
|
||||||
import { v4 } from 'uuid'
|
import { v4 } from 'uuid'
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { en as i18nEn } from './i18n'
|
import { en as i18nEn } from './i18n'
|
||||||
@@ -426,6 +439,7 @@ export default {
|
|||||||
Contenteditable,
|
Contenteditable,
|
||||||
IconUsersPlus,
|
IconUsersPlus,
|
||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
|
IconAdjustments,
|
||||||
IconEye,
|
IconEye,
|
||||||
IconDeviceFloppy
|
IconDeviceFloppy
|
||||||
},
|
},
|
||||||
@@ -479,6 +493,16 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
withSendButton: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
withSignYourselfButton: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
inputMode: {
|
inputMode: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -758,6 +782,9 @@ export default {
|
|||||||
this.documentRefs = []
|
this.documentRefs = []
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
closeDropdown () {
|
||||||
|
document.activeElement.blur()
|
||||||
|
},
|
||||||
t (key) {
|
t (key) {
|
||||||
return this.i18n[key] || i18nEn[key] || key
|
return this.i18n[key] || i18nEn[key] || key
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ class ProcessSubmitterCompletionJob
|
|||||||
Submissions::EnsureResultGenerated.call(submitter)
|
Submissions::EnsureResultGenerated.call(submitter)
|
||||||
|
|
||||||
if is_all_completed && submitter.completed_at == submitter.submission.submitters.maximum(:completed_at)
|
if is_all_completed && submitter.completed_at == submitter.submission.submitters.maximum(:completed_at)
|
||||||
|
if submitter.submission.account.account_configs.exists?(key: AccountConfig::COMBINE_PDF_RESULT_KEY, value: true)
|
||||||
|
Submissions::GenerateCombinedAttachment.call(submitter)
|
||||||
|
end
|
||||||
|
|
||||||
Submissions::GenerateAuditTrail.call(submitter.submission)
|
Submissions::GenerateAuditTrail.call(submitter.submission)
|
||||||
|
|
||||||
enqueue_completed_emails(submitter)
|
enqueue_completed_emails(submitter)
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SendFormDeclinedWebhookRequestJob
|
||||||
|
include Sidekiq::Job
|
||||||
|
|
||||||
|
sidekiq_options queue: :webhooks
|
||||||
|
|
||||||
|
USER_AGENT = 'DocuSeal.co Webhook'
|
||||||
|
|
||||||
|
MAX_ATTEMPTS = 10
|
||||||
|
|
||||||
|
def perform(params = {})
|
||||||
|
submitter = Submitter.find(params['submitter_id'])
|
||||||
|
|
||||||
|
attempt = params['attempt'].to_i
|
||||||
|
config = Accounts.load_webhook_config(submitter.submission.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
|
return if url.blank?
|
||||||
|
|
||||||
|
preferences = Accounts.load_webhook_preferences(submitter.submission.account)
|
||||||
|
|
||||||
|
return if preferences['form.declined'] == false
|
||||||
|
|
||||||
|
ActiveStorage::Current.url_options = Docuseal.default_url_options
|
||||||
|
|
||||||
|
resp = begin
|
||||||
|
Faraday.post(url,
|
||||||
|
{
|
||||||
|
event_type: 'form.declined',
|
||||||
|
timestamp: Time.current,
|
||||||
|
data: Submitters::SerializeForWebhook.call(submitter)
|
||||||
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'User-Agent' => USER_AGENT)
|
||||||
|
rescue Faraday::Error
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if (resp.nil? || resp.status.to_i >= 400) && attempt <= MAX_ATTEMPTS &&
|
||||||
|
(!Docuseal.multitenant? || submitter.account.account_configs.exists?(key: :plan))
|
||||||
|
SendFormDeclinedWebhookRequestJob.perform_in((2**attempt).minutes, {
|
||||||
|
'submitter_id' => submitter.id,
|
||||||
|
'attempt' => attempt + 1,
|
||||||
|
'last_status' => resp&.status.to_i
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -78,6 +78,24 @@ class SubmitterMailer < ApplicationMailer
|
|||||||
subject:)
|
subject:)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def declined_email(submitter, user)
|
||||||
|
@current_account = submitter.submission.account
|
||||||
|
@submitter = submitter
|
||||||
|
@submission = submitter.submission
|
||||||
|
@user = user
|
||||||
|
|
||||||
|
assign_message_metadata('submitter_declined', @submitter)
|
||||||
|
|
||||||
|
I18n.with_locale(submitter.account.locale) do
|
||||||
|
mail(from: from_address_for_submitter(submitter),
|
||||||
|
to: user.role == 'integration' ? user.friendly_name.sub(/\+\w+@/, '@') : user.friendly_name,
|
||||||
|
reply_to: @submitter.friendly_name,
|
||||||
|
subject: I18n.t(:name_declined_by_submitter,
|
||||||
|
name: @submission.template.name.truncate(20),
|
||||||
|
submitter: @submitter.name || @submitter.email || @submitter.phone))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def documents_copy_email(submitter, to: nil, sig: false)
|
def documents_copy_email(submitter, to: nil, sig: false)
|
||||||
@current_account = submitter.submission.account
|
@current_account = submitter.submission.account
|
||||||
@submitter = submitter
|
@submitter = submitter
|
||||||
@@ -139,7 +157,7 @@ class SubmitterMailer < ApplicationMailer
|
|||||||
total_size = 0
|
total_size = 0
|
||||||
audit_trail_data = nil
|
audit_trail_data = nil
|
||||||
|
|
||||||
if with_audit_log && submitter.submission.audit_trail.present?
|
if with_audit_log && submitter.submission.audit_trail.present? && documents.first&.name != 'combined_document'
|
||||||
audit_trail_data = submitter.submission.audit_trail.download
|
audit_trail_data = submitter.submission.audit_trail.download
|
||||||
|
|
||||||
total_size = audit_trail_data.size
|
total_size = audit_trail_data.size
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class AccountConfig < ApplicationRecord
|
|||||||
FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf'
|
FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf'
|
||||||
WITH_SIGNATURE_ID = 'with_signature_id'
|
WITH_SIGNATURE_ID = 'with_signature_id'
|
||||||
REQUIRE_SIGNING_REASON_KEY = 'require_signing_reason'
|
REQUIRE_SIGNING_REASON_KEY = 'require_signing_reason'
|
||||||
|
COMBINE_PDF_RESULT_KEY = 'combine_pdf_result_key'
|
||||||
|
|
||||||
DEFAULT_VALUES = {
|
DEFAULT_VALUES = {
|
||||||
SUBMITTER_INVITATION_EMAIL_KEY => {
|
SUBMITTER_INVITATION_EMAIL_KEY => {
|
||||||
|
|||||||
@@ -86,4 +86,10 @@ class Submission < ApplicationRecord
|
|||||||
ActiveStorage::Blob.proxy_url(audit_trail.blob)
|
ActiveStorage::Blob.proxy_url(audit_trail.blob)
|
||||||
end
|
end
|
||||||
alias audit_log_url audit_trail_url
|
alias audit_log_url audit_trail_url
|
||||||
|
|
||||||
|
def combined_document_url
|
||||||
|
return if combined_document.blank?
|
||||||
|
|
||||||
|
ActiveStorage::Blob.proxy_url(combined_document.blob)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -47,7 +47,9 @@ class SubmissionEvent < ApplicationRecord
|
|||||||
phone_verified: 'phone_verified',
|
phone_verified: 'phone_verified',
|
||||||
start_form: 'start_form',
|
start_form: 'start_form',
|
||||||
view_form: 'view_form',
|
view_form: 'view_form',
|
||||||
|
invite_party: 'invite_party',
|
||||||
complete_form: 'complete_form',
|
complete_form: 'complete_form',
|
||||||
|
decline_form: 'decline_form',
|
||||||
api_complete_form: 'api_complete_form'
|
api_complete_form: 'api_complete_form'
|
||||||
}, scope: false
|
}, scope: false
|
||||||
|
|
||||||
|
|||||||
+13
-2
@@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
# id :bigint not null, primary key
|
# id :bigint not null, primary key
|
||||||
# completed_at :datetime
|
# completed_at :datetime
|
||||||
|
# declined_at :datetime
|
||||||
# email :string
|
# email :string
|
||||||
# ip :string
|
# ip :string
|
||||||
# metadata :text not null
|
# metadata :text not null
|
||||||
@@ -59,7 +60,9 @@ class Submitter < ApplicationRecord
|
|||||||
scope :completed, -> { where.not(completed_at: nil) }
|
scope :completed, -> { where.not(completed_at: nil) }
|
||||||
|
|
||||||
def status
|
def status
|
||||||
if completed_at?
|
if declined_at?
|
||||||
|
'declined'
|
||||||
|
elsif completed_at?
|
||||||
'completed'
|
'completed'
|
||||||
elsif opened_at?
|
elsif opened_at?
|
||||||
'opened'
|
'opened'
|
||||||
@@ -82,7 +85,15 @@ class Submitter < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def first_name
|
||||||
|
name.split(/\s+/, 2).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def last_name
|
||||||
|
name.split(/\s+/, 2).last
|
||||||
|
end
|
||||||
|
|
||||||
def status_event_at
|
def status_event_at
|
||||||
completed_at || opened_at || sent_at || created_at
|
declined_at || completed_at || opened_at || sent_at || created_at
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% encrypted_config = @encrypted_config || EncryptedConfig.find_or_initialize_by(account: current_account, key: EncryptedConfig::APP_URL_KEY) %>
|
<% encrypted_config = @encrypted_config || EncryptedConfig.find_or_initialize_by(account: current_account, key: EncryptedConfig::APP_URL_KEY) %>
|
||||||
<% if !Docuseal.multitenant? && can?(:manage, encrypted_config) && !current_account.testing? %>
|
<% if !Docuseal.multitenant? && can?(:manage, encrypted_config) && !current_account.testing? && ENV['APP_URL'].blank? %>
|
||||||
<%= fields_for encrypted_config do |ff| %>
|
<%= fields_for encrypted_config do |ff| %>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<%= ff.label :value, 'App URL', class: 'label' %>
|
<%= ff.label :value, 'App URL', class: 'label' %>
|
||||||
@@ -123,6 +123,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::COMBINE_PDF_RESULT_KEY) %>
|
||||||
|
<% if can?(:manage, account_config) %>
|
||||||
|
<%= form_for account_config, url: account_configs_path, method: :post do |f| %>
|
||||||
|
<%= f.hidden_field :key %>
|
||||||
|
<div class="flex items-center justify-between py-2.5">
|
||||||
|
<span>
|
||||||
|
Combine completed documents and Audit Log
|
||||||
|
</span>
|
||||||
|
<%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render 'integrations' %>
|
<%= render 'integrations' %>
|
||||||
|
|||||||
@@ -13,20 +13,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.error-page h1 {
|
.error-page h1 {
|
||||||
font-weight: 700;
|
|
||||||
font-size: 3em;
|
|
||||||
color: #291434;
|
|
||||||
margin: 0 0 0.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-page h2 {
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 10em;
|
font-size: 10em;
|
||||||
color: #3BBFF7;
|
color: #3BBFF7;
|
||||||
margin: 0 0 0.1em;
|
margin: 0 0 0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-page h3 {
|
.error-page h2 {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 1.75em;
|
font-size: 1.75em;
|
||||||
color: #291434;
|
color: #291434;
|
||||||
@@ -56,9 +49,8 @@
|
|||||||
<body class="error-page">
|
<body class="error-page">
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
<div>
|
<div>
|
||||||
<h1>DocuSeal</h1>
|
<h1>404</h1>
|
||||||
<h2>404</h2>
|
<h2>Sorry, we couldn't find this page.</h2>
|
||||||
<h3>Sorry, we couldn't find this page.</h3>
|
|
||||||
</div>
|
</div>
|
||||||
<a rel="noopener noreferrer" href="/" class="btn">Back to homepage</a>
|
<a rel="noopener noreferrer" href="/" class="btn">Back to homepage</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,20 +13,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.error-page h1 {
|
.error-page h1 {
|
||||||
font-weight: 700;
|
|
||||||
font-size: 3em;
|
|
||||||
color: #291434;
|
|
||||||
margin: 0 0 0.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-page h2 {
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 10em;
|
font-size: 10em;
|
||||||
color: #FABE22;
|
color: #FABE22;
|
||||||
margin: 0 0 0.1em;
|
margin: 0 0 0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-page h3 {
|
.error-page h2 {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 1.75em;
|
font-size: 1.75em;
|
||||||
color: #291434;
|
color: #291434;
|
||||||
@@ -56,9 +49,8 @@
|
|||||||
<body class="error-page">
|
<body class="error-page">
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
<div>
|
<div>
|
||||||
<h1>DocuSeal</h1>
|
<h1>422</h1>
|
||||||
<h2>422</h2>
|
<h2>You're not allowed to access this page</h2>
|
||||||
<h3>You're not allowed to access this page</h3>
|
|
||||||
</div>
|
</div>
|
||||||
<a rel="noopener noreferrer" href="/" class="btn">Back to homepage</a>
|
<a rel="noopener noreferrer" href="/" class="btn">Back to homepage</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,20 +13,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.error-page h1 {
|
.error-page h1 {
|
||||||
font-weight: 700;
|
|
||||||
font-size: 3em;
|
|
||||||
color: #291434;
|
|
||||||
margin: 0 0 0.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-page h2 {
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 10em;
|
font-size: 10em;
|
||||||
color: #F97272;
|
color: #F97272;
|
||||||
margin: 0 0 0.1em;
|
margin: 0 0 0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-page h3 {
|
.error-page h2 {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 1.75em;
|
font-size: 1.75em;
|
||||||
color: #291434;
|
color: #291434;
|
||||||
@@ -56,9 +49,8 @@
|
|||||||
<body class="error-page">
|
<body class="error-page">
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
<div>
|
<div>
|
||||||
<h1>DocuSeal</h1>
|
<h1>500</h1>
|
||||||
<h2>500</h2>
|
<h2>We're sorry, but something went wrong</h2>
|
||||||
<h3>We're sorry, but something went wrong</h3>
|
|
||||||
</div>
|
</div>
|
||||||
<a rel="noopener noreferrer" href="/" class="btn">Back to homepage</a>
|
<a rel="noopener noreferrer" href="/" class="btn">Back to homepage</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<% uuid = SecureRandom.uuid %>
|
||||||
|
<label id="<%= local_assigns[:button_id] %>" for="<%= uuid %>" class="<%= local_assigns[:btn_class] %>"><%= local_assigns[:btn_text] %></label>
|
||||||
|
<input type="checkbox" id="<%= uuid %>" class="modal-toggle">
|
||||||
|
<div id="<%= local_assigns[:id] %>" class="modal items-start !animate-none overflow-y-auto">
|
||||||
|
<div class="modal-box pt-4 pb-6 px-6 mt-20 max-h-none">
|
||||||
|
<% if local_assigns[:title] %>
|
||||||
|
<div class="flex justify-between items-center border-b pb-2 mb-2 font-medium">
|
||||||
|
<span>
|
||||||
|
<%= local_assigns[:title] %>
|
||||||
|
</span>
|
||||||
|
<label for="<%= uuid %>" class="text-xl">×</label>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<div>
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label class="modal-backdrop" for="<%= uuid %>">Close</label>
|
||||||
|
</div>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<%= 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: { submitter_slug: @submitter.slug }, class: 'base-button w-full' %>
|
<%= 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: { submitter_slug: @submitter.slug }, class: 'base-button w-full' %>
|
||||||
</toggle-submit>
|
</toggle-submit>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @template.submitters.to_a.size == 1 && %w[api embed].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false %>
|
<% if Templates.filter_undefined_submitters(@template).size == 1 && %w[api embed].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false %>
|
||||||
<toggle-submit class="block">
|
<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: { email: params[:email] }, resubmit: @submitter.slug }, method: :put, class: 'white-button w-full' %>
|
<%= 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: { email: params[:email] }, resubmit: @submitter.slug }, method: :put, class: 'white-button w-full' %>
|
||||||
</toggle-submit>
|
</toggle-submit>
|
||||||
|
|||||||
@@ -1,31 +1,38 @@
|
|||||||
<%= form_for '', url: template_submissions_path(template), html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
<%= form_for '', url: template_submissions_path(template), html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
||||||
|
<% submitters = template.submitters.reject { |e| e['invite_by_uuid'].present? } %>
|
||||||
<dynamic-list class="space-y-4">
|
<dynamic-list class="space-y-4">
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="card card-compact bg-base-200" data-targets="dynamic-list.items">
|
<div class="card card-compact bg-base-300/40" data-targets="dynamic-list.items">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="absolute right-4 top-5">
|
<div class="absolute right-4 top-5">
|
||||||
<a href="#" data-action="click:dynamic-list#removeItem" class="<%= template.submitters.size == 1 ? 'right-2' : '-top-3' %> relative block w-6 h-6 rounded-lg text-neutral-700 text-center bg-base-300 p-1 hidden hover:bg-neutral hover:text-white">
|
<a href="#" data-action="click:dynamic-list#removeItem" class="<%= submitters.size == 1 ? 'right-2 top-1' : '-top-3' %> relative block w-6 h-6 rounded-lg text-neutral-700 text-center bg-base-300 p-1 hidden hover:bg-neutral hover:text-white">
|
||||||
<%= svg_icon('trash', class: 'w-4 h-4') %>
|
<%= svg_icon('trash', class: 'w-4 h-4') %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid <%= 'md:grid-cols-2' if template.submitters.size > 1 %> gap-4">
|
<div class="grid <%= 'md:grid-cols-2' if submitters.size > 1 %> gap-4">
|
||||||
<% template.submitters.each_with_index do |item, index| %>
|
<% submitters.each_with_index do |item, index| %>
|
||||||
<submitter-item class="form-control">
|
<submitter-item class="form-control">
|
||||||
<% if template.submitters.size > 1 %>
|
<% if submitters.size > 1 %>
|
||||||
<label class="label pt-0 pb-1 text-xs">
|
<label class="label pt-0 pb-1">
|
||||||
<span class="label-text"> <%= item['name'] %></span>
|
<span class="label-text"> <%= item['name'] %></span>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<% end %>
|
||||||
<input type="hidden" name="submission[1][submitters][][uuid]" value="<%= item['uuid'] %>">
|
<input type="hidden" name="submission[1][submitters][][uuid]" value="<%= item['uuid'] %>">
|
||||||
<submitters-autocomplete data-field="name">
|
<submitters-autocomplete data-field="name">
|
||||||
<%= tag.input type: 'text', name: 'submission[1][submitters][][name]', autocomplete: 'off', class: 'input input-sm input-bordered w-full', placeholder: 'Name', required: index.zero?, value: params[:selfsign] && index.zero? ? current_user.full_name : '', dir: 'auto' %>
|
<linked-input data-target-id="<%= "detailed_name_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<%= tag.input type: 'text', name: 'submission[1][submitters][][name]', autocomplete: 'off', class: 'base-input-slim w-full', placeholder: 'Name', required: index.zero?, value: (params[:selfsign] && index.zero?) || item['is_requester'] ? current_user.full_name : '', dir: 'auto', id: "detailed_name_#{item['uuid']}" %>
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
<div class="grid <%= 'md:grid-cols-2 gap-1' if template.submitters.size == 1 %>">
|
<div class="grid <%= 'md:grid-cols-2 gap-1' if submitters.size == 1 %>">
|
||||||
<submitters-autocomplete data-field="email">
|
<submitters-autocomplete data-field="email">
|
||||||
<input type="email" multiple name="submission[1][submitters][][email]" autocomplete="off" class="input input-sm input-bordered mt-1.5 w-full" placeholder="Email (optional)" value="<%= params[:selfsign] && index.zero? ? current_user.email : '' %>">
|
<linked-input data-target-id="<%= "detailed_email_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<input type="email" multiple name="submission[1][submitters][][email]" autocomplete="off" class="base-input-slim mt-1.5 w-full" placeholder="Email (optional)" value="<%= item['email'].presence || ((params[:selfsign] && index.zero?) || item['is_requester'] ? current_user.email : '') %>" id="detailed_email_<%= item['uuid'] %>">
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
<submitters-autocomplete data-field="phone">
|
<submitters-autocomplete data-field="phone">
|
||||||
<input type="tel" pattern="^\+[0-9\s\-]+$" oninvalid="this.value ? this.setCustomValidity('Use internatioanl format: +1xxx...') : ''" oninput="this.setCustomValidity('')" name="submission[1][submitters][][phone]" autocomplete="off" class="input input-sm input-bordered mt-1.5 w-full" placeholder="Phone (optional)">
|
<linked-input data-target-id="<%= "detailed_phone_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<input type="tel" pattern="^\+[0-9\s\-]+$" oninvalid="this.value ? this.setCustomValidity('Use internatioanl format: +1xxx...') : ''" oninput="this.setCustomValidity('')" name="submission[1][submitters][][phone]" autocomplete="off" class="base-input-slim mt-1.5 w-full" placeholder="Phone (optional)" id="detailed_phone_<%= item['uuid'] %>">
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
</submitter-item>
|
</submitter-item>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<%= form_for '', url: template_submissions_path(template), html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
<%= form_for '', url: template_submissions_path(template), html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
||||||
<% if template.submitters.size == 1 %>
|
<% submitters = template.submitters.reject { |e| e['invite_by_uuid'].present? } %>
|
||||||
|
<% if submitters.size == 1 %>
|
||||||
<submitter-item class="form-control">
|
<submitter-item class="form-control">
|
||||||
<emails-textarea data-bulk-enabled="<%= Docuseal.demo? || !Docuseal.multitenant? || can?(:manage, :bulk_send) %>" data-limit="<%= Docuseal.multitenant? ? (can?(:manage, :bulk_send) ? 40 : 1) : nil %>">
|
<emails-textarea data-bulk-enabled="<%= Docuseal.demo? || !Docuseal.multitenant? || can?(:manage, :bulk_send) %>" data-limit="<%= Docuseal.multitenant? ? (can?(:manage, :bulk_send) ? 40 : 1) : nil %>">
|
||||||
<submitters-autocomplete data-field="email" class="block relative">
|
<submitters-autocomplete data-field="email" class="block relative">
|
||||||
<autoresize-textarea>
|
<autoresize-textarea>
|
||||||
<%= f.text_area :emails, required: true, class: 'base-textarea w-full', placeholder: 'Type emails here...' %>
|
<%= f.text_area :emails, required: true, class: 'base-textarea w-full !text-lg', placeholder: 'Type emails here...', rows: 2 %>
|
||||||
</autoresize-textarea>
|
</autoresize-textarea>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
</emails-textarea>
|
</emails-textarea>
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<dynamic-list class="space-y-4">
|
<dynamic-list class="space-y-4">
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="card card-compact bg-base-200" data-targets="dynamic-list.items">
|
<div class="card card-compact bg-base-300/40" data-targets="dynamic-list.items">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="absolute right-4 top-5">
|
<div class="absolute right-4 top-5">
|
||||||
<a href="#" data-action="click:dynamic-list#removeItem" class="-top-3 relative block w-6 h-6 rounded-lg text-neutral-700 text-center bg-base-300 p-1 hidden hover:bg-neutral hover:text-white">
|
<a href="#" data-action="click:dynamic-list#removeItem" class="-top-3 relative block w-6 h-6 rounded-lg text-neutral-700 text-center bg-base-300 p-1 hidden hover:bg-neutral hover:text-white">
|
||||||
@@ -20,14 +21,16 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid md:grid-cols-2 gap-4">
|
<div class="grid md:grid-cols-2 gap-4">
|
||||||
<% template.submitters.each_with_index do |item, index| %>
|
<% submitters.each_with_index do |item, index| %>
|
||||||
<submitter-item class="form-control">
|
<submitter-item class="form-control">
|
||||||
<label class="label pt-0 pb-1 text-xs">
|
<label class="label pt-0 pb-1">
|
||||||
<span class="label-text"> <%= item['name'] %></span>
|
<span class="label-text"> <%= item['name'] %></span>
|
||||||
</label>
|
</label>
|
||||||
<input type="hidden" name="submission[1][submitters][][uuid]" value="<%= item['uuid'] %>">
|
<input type="hidden" name="submission[1][submitters][][uuid]" value="<%= item['uuid'] %>">
|
||||||
<submitters-autocomplete data-field="email">
|
<submitters-autocomplete data-field="email">
|
||||||
<%= tag.input type: 'email', multiple: true, name: 'submission[1][submitters][][email]', autocomplete: 'off', class: 'input input-sm input-bordered w-full', placeholder: 'Email', required: index.zero?, value: params[:selfsign] && index.zero? ? current_user.email : '' %>
|
<linked-input data-target-id="<%= "email_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<%= tag.input type: 'email', multiple: true, name: 'submission[1][submitters][][email]', autocomplete: 'off', class: 'base-input-slim w-full', placeholder: 'Email', required: index.zero?, value: item['email'].presence || ((params[:selfsign] && index.zero?) || item['is_requester'] ? current_user.email : ''), id: "email_#{item['uuid']}" %>
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
</submitter-item>
|
</submitter-item>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,36 +1,43 @@
|
|||||||
<%= form_for '', url: template_submissions_path(template), html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
<%= form_for '', url: template_submissions_path(template), html: { class: 'space-y-4', autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %>
|
||||||
|
<% submitters = template.submitters.reject { |e| e['invite_by_uuid'].present? } %>
|
||||||
<dynamic-list class="space-y-4">
|
<dynamic-list class="space-y-4">
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="card card-compact bg-base-200" data-targets="dynamic-list.items">
|
<div class="card card-compact bg-base-300/40" data-targets="dynamic-list.items">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="absolute right-4 top-5">
|
<div class="absolute right-4 top-5">
|
||||||
<a href="#" data-action="click:dynamic-list#removeItem" class="<%= template.submitters.size == 1 ? 'right-2' : '-top-3' %> relative block w-6 h-6 rounded-lg text-neutral-700 text-center bg-base-300 p-1 hidden hover:bg-neutral hover:text-white">
|
<a href="#" data-action="click:dynamic-list#removeItem" class="<%= submitters.size == 1 ? 'right-2 top-1' : '-top-3' %> relative block w-6 h-6 rounded-lg text-neutral-700 text-center bg-base-300 p-1 hidden hover:bg-neutral hover:text-white">
|
||||||
<%= svg_icon('trash', class: 'w-4 h-4') %>
|
<%= svg_icon('trash', class: 'w-4 h-4') %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid <%= template.submitters.size > 1 ? 'md:grid-cols-2 gap-4' : 'gap-1' %>">
|
<div class="grid <%= submitters.size > 1 ? 'md:grid-cols-2 gap-4' : 'gap-1' %>">
|
||||||
<% template.submitters.each_with_index do |item, index| %>
|
<% submitters.each_with_index do |item, index| %>
|
||||||
<submitter-item class="grid <%= template.submitters.size > 1 ? 'gap-4' : 'md:grid-cols-2 gap-1' %>">
|
<submitter-item class="grid <%= submitters.size > 1 ? 'gap-4' : 'md:grid-cols-2 gap-1' %>">
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<% if template.submitters.size > 1 %>
|
<% if submitters.size > 1 %>
|
||||||
<label class="label pt-0 pb-1 text-xs">
|
<label class="label pt-0 pb-1">
|
||||||
<span class="label-text"> <%= item['name'] %></span>
|
<span class="label-text"> <%= item['name'] %></span>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<% end %>
|
||||||
<input type="hidden" name="submission[1][submitters][][uuid]" value="<%= item['uuid'] %>">
|
<input type="hidden" name="submission[1][submitters][][uuid]" value="<%= item['uuid'] %>">
|
||||||
<submitters-autocomplete data-field="phone">
|
<submitters-autocomplete data-field="phone">
|
||||||
<%= tag.input type: 'tel', pattern: '^\+[0-9\s\-]+$', oninvalid: "this.value ? this.setCustomValidity('Use internatioanl format: +1xxx...') : ''", oninput: "this.setCustomValidity('')", name: 'submission[1][submitters][][phone]', autocomplete: 'off', class: 'input input-sm input-bordered w-full', placeholder: 'Phone', required: index.zero? %>
|
<linked-input data-target-id="<%= "phone_phone_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<%= tag.input type: 'tel', pattern: '^\+[0-9\s\-]+$', oninvalid: "this.value ? this.setCustomValidity('Use internatioanl format: +1xxx...') : ''", oninput: "this.setCustomValidity('')", name: 'submission[1][submitters][][phone]', autocomplete: 'off', class: 'base-input-slim w-full', placeholder: 'Phone', required: index.zero?, id: "phone_phone_#{item['uuid']}" %>
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
<% if template.submitters.size > 1 %>
|
<% if submitters.size > 1 %>
|
||||||
<submitters-autocomplete data-field="name">
|
<submitters-autocomplete data-field="name">
|
||||||
<input type="text" name="submission[1][submitters][][name]" autocomplete="off" class="input input-sm input-bordered mt-1.5 w-full" placeholder="Name (optional)" value="<%= params[:selfsign] && index.zero? ? current_user.full_name : '' %>" dir="auto">
|
<linked-input data-target-id="<%= "phone_name_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<input type="text" name="submission[1][submitters][][name]" autocomplete="off" class="base-input-slim mt-1.5 w-full" placeholder="Name (optional)" value="<%= (params[:selfsign] && index.zero?) || item['is_requester'] ? current_user.full_name : '' %>" dir="auto" id="phone_name_<%= item['uuid'] %>">
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if template.submitters.size == 1 %>
|
<% if submitters.size == 1 %>
|
||||||
<div class="form-control flex">
|
<div class="form-control flex">
|
||||||
<submitters-autocomplete data-field="name">
|
<submitters-autocomplete data-field="name">
|
||||||
<input type="text" name="submission[1][submitters][][name]" autocomplete="off" class="input input-sm input-bordered w-full" placeholder="Name (optional)" value="<%= params[:selfsign] && index.zero? ? current_user.full_name : '' %>" dir="auto">
|
<linked-input data-target-id="<%= "phone_name_#{item['linked_to_uuid']}" if item['linked_to_uuid'].present? %>">
|
||||||
|
<input type="text" name="submission[1][submitters][][name]" autocomplete="off" class="base-input-slim w-full" placeholder="Name (optional)" value="<%= (params[:selfsign] && index.zero?) || item['is_requester'] ? current_user.full_name : '' %>" dir="auto" id="phone_name_<%= item['uuid'] %>">
|
||||||
|
</linked-input>
|
||||||
</submitters-autocomplete>
|
</submitters-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% config = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_INVITATION_EMAIL_KEY) %>
|
<% config = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_INVITATION_EMAIL_KEY) %>
|
||||||
<div id="message_field" class="card card-compact bg-base-200 hidden">
|
<div id="message_field" class="card card-compact bg-base-300/40 hidden">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="form-control space-y-2">
|
<div class="form-control space-y-2">
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%= render 'shared/turbo_modal', title: params[:selfsign] ? 'Add Recipients' : 'Add New Recipients' do %>
|
<%= render 'shared/turbo_modal_large', title: params[:selfsign] ? 'Add Recipients' : 'Add New Recipients' do %>
|
||||||
<% options = [['via Email', 'email'], ['via Phone', 'phone'], %w[Detailed detailed], ['Upload List', 'list']].compact %>
|
<% options = [['via Email', 'email'], ['via Phone', 'phone'], %w[Detailed detailed], ['Upload List', 'list']].compact %>
|
||||||
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center mt-4 block">
|
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center px-2 mt-4 block">
|
||||||
<div class="join">
|
<div class="join">
|
||||||
<% options.each_with_index do |(label, value), index| %>
|
<% options.each_with_index do |(label, value), index| %>
|
||||||
<span>
|
<span>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</toggle-visible>
|
</toggle-visible>
|
||||||
<div class="mt-4">
|
<div class="px-5 mb-5 mt-4">
|
||||||
<div id="email">
|
<div id="email">
|
||||||
<%= render 'email_form', template: @template %>
|
<%= render 'email_form', template: @template %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% if params[:controller] == 'submissions_preview' %>
|
<% if params[:controller] == 'submissions_preview' %>
|
||||||
<%= render 'submissions/preview_tags' %>
|
<%= render 'submissions/preview_tags' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% with_signature_id = @submission.account.account_configs.exists?(key: AccountConfig::WITH_SIGNATURE_ID, value: true) %>
|
<% with_signature_id, is_combined_enabled = AccountConfig.where(account_id: @submission.account_id, key: [AccountConfig::COMBINE_PDF_RESULT_KEY, AccountConfig::WITH_SIGNATURE_ID], value: true).then { |configs| [configs.any? { |e| e.key == AccountConfig::WITH_SIGNATURE_ID }, configs.any? { |e| e.key == AccountConfig::COMBINE_PDF_RESULT_KEY }] } %>
|
||||||
<div style="max-width: 1600px" class="mx-auto pl-4">
|
<div style="max-width: 1600px" class="mx-auto pl-4">
|
||||||
<div class="flex justify-between py-1.5 items-center pr-4 sticky top-0 md:relative z-10 bg-base-100">
|
<div class="flex justify-between py-1.5 items-center pr-4 sticky top-0 md:relative z-10 bg-base-100">
|
||||||
<a href="<%= signed_in? && @submission.account_id == current_account&.id ? template_path(@submission.template) : '/' %>" class="flex items-center space-x-3 py-1">
|
<a href="<%= signed_in? && @submission.account_id == current_account&.id ? template_path(@submission.template) : '/' %>" class="flex items-center space-x-3 py-1">
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<% if last_submitter = @submission.submitters.to_a.select(&:completed_at?).max_by(&:completed_at) %>
|
<% if last_submitter = @submission.submitters.to_a.select(&:completed_at?).max_by(&:completed_at) %>
|
||||||
<% is_all_completed = @submission.submitters.to_a.all?(&:completed_at?) %>
|
<% is_all_completed = @submission.submitters.to_a.all?(&:completed_at?) %>
|
||||||
<div class="join relative">
|
<div class="join relative">
|
||||||
<download-button data-src="<%= submitter_download_index_path(last_submitter.slug, { sig: params[:sig] }.compact) %>" class="base-button <%= '!rounded-r-none !pr-2' if is_all_completed %>">
|
<download-button data-src="<%= submitter_download_index_path(last_submitter.slug, { sig: params[:sig], combined: is_combined_enabled }.compact) %>" class="base-button <%= '!rounded-r-none !pr-2' if is_all_completed && !is_combined_enabled %>">
|
||||||
<span class="flex items-center justify-center space-x-2" data-target="download-button.defaultButton">
|
<span class="flex items-center justify-center space-x-2" data-target="download-button.defaultButton">
|
||||||
<%= svg_icon('download', class: 'w-6 h-6') %>
|
<%= svg_icon('download', class: 'w-6 h-6') %>
|
||||||
<span class="hidden md:inline">Download</span>
|
<span class="hidden md:inline">Download</span>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<span class="hidden md:inline">Downloading</span>
|
<span class="hidden md:inline">Downloading</span>
|
||||||
</span>
|
</span>
|
||||||
</download-button>
|
</download-button>
|
||||||
<% if is_all_completed %>
|
<% if is_all_completed && !is_combined_enabled %>
|
||||||
<div class="dropdown dropdown-end">
|
<div class="dropdown dropdown-end">
|
||||||
<label tabindex="0" class="base-button !rounded-l-none !pl-1 !pr-2 !border-l-neutral-500">
|
<label tabindex="0" class="base-button !rounded-l-none !pl-1 !pr-2 !border-l-neutral-500">
|
||||||
<span class="text-sm align-text-top">
|
<span class="text-sm align-text-top">
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% elsif @submission.submitters.to_a.size == 1 && !@submission.expired? %>
|
<% elsif @submission.submitters.to_a.size == 1 && !@submission.expired? && !@submission.submitters.to_a.first.declined_at? %>
|
||||||
<%= render 'shared/clipboard_copy', text: start_form_url(slug: @submission.template.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Share Link', copied_title: 'Copied to Clipboard' %>
|
<%= render 'shared/clipboard_copy', text: submit_form_url(slug: @submission.submitters.to_a.first.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Share Link', copied_title: 'Copied to Clipboard' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -143,18 +143,32 @@
|
|||||||
<div class="flex items-center space-x-1 mt-1">
|
<div class="flex items-center space-x-1 mt-1">
|
||||||
<%= svg_icon('writing', class: 'w-5 h-5') %>
|
<%= svg_icon('writing', class: 'w-5 h-5') %>
|
||||||
<span>
|
<span>
|
||||||
<%= submitter&.completed_at? ? l(submitter.completed_at.in_time_zone(@submission.account.timezone), format: :long, locale: @submission.account.locale) : 'Not completed yet' %>
|
<% if submitter&.declined_at? %>
|
||||||
|
Declined on <%= l(submitter.declined_at.in_time_zone(@submission.account.timezone), format: :short, locale: @submission.account.locale) %>
|
||||||
|
<% elsif submitter %>
|
||||||
|
<%= submitter.completed_at? ? l(submitter.completed_at.in_time_zone(@submission.account.timezone), format: :long, locale: @submission.account.locale) : 'Not completed yet' %>
|
||||||
|
<% else %>
|
||||||
|
Not invited yet
|
||||||
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% if signed_in? && submitter && submitter.email && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && Accounts.can_send_emails?(current_account) && !@submission.expired? %>
|
<% if submitter&.declined_at? %>
|
||||||
|
<div class="flex items-center space-x-1 mt-1">
|
||||||
|
<span>
|
||||||
|
Reason:
|
||||||
|
<%= simple_format(h(submitter.submission_events.find_by(event_type: :decline_form).data['reason'])) %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if signed_in? && submitter && submitter.email && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && Accounts.can_send_emails?(current_account) && !@submission.expired? && !submitter.declined_at? %>
|
||||||
<div class="mt-2 mb-1">
|
<div class="mt-2 mb-1">
|
||||||
<%= button_to button_title(title: submitter.sent_at? ? 'Re-send Email' : 'Send Email', disabled_with: 'Sending'), submitter_send_email_index_path(submitter_slug: submitter.slug), class: 'btn btn-sm btn-primary w-full' %>
|
<%= button_to button_title(title: submitter.sent_at? ? 'Re-send Email' : 'Send Email', disabled_with: 'Sending'), submitter_send_email_index_path(submitter_slug: submitter.slug), class: 'btn btn-sm btn-primary w-full' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if signed_in? && submitter && submitter.phone && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && !@submission.expired? %>
|
<% if signed_in? && submitter && submitter.phone && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && !@submission.expired? && !submitter.declined_at? %>
|
||||||
<%= render 'submissions/send_sms_button', submitter: %>
|
<%= render 'submissions/send_sms_button', submitter: %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if signed_in? && submitter && !submitter.completed_at? && !@submission.archived_at? && can?(:create, submitter) && !@submission.expired? %>
|
<% if signed_in? && submitter && !submitter.completed_at? && !@submission.archived_at? && can?(:create, submitter) && !@submission.expired? && !submitter.declined_at? %>
|
||||||
<div class="mt-2 mb-1">
|
<div class="mt-2 mb-1">
|
||||||
<a class="btn btn-sm btn-primary w-full" target="_blank" href="<%= submit_form_path(slug: submitter.slug) %>">
|
<a class="btn btn-sm btn-primary w-full" target="_blank" href="<%= submit_form_path(slug: submitter.slug) %>">
|
||||||
Sign In-person
|
Sign In-person
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<%= form_for '', url: submit_form_decline_index_path(submitter.slug), method: :post do |f| %>
|
||||||
|
<div class="mt-4 text-center">
|
||||||
|
<%= t(:notify_the_sender_with_the_reason_you_declined) %>
|
||||||
|
</div>
|
||||||
|
<div class="form-control mt-2">
|
||||||
|
<%= f.text_area :reason, required: true, class: 'base-input w-full py-2 h-40', dir: 'auto', placeholder: t('provide_a_reason'), style: 'height: 200px', rows: '10' %>
|
||||||
|
</div>
|
||||||
|
<toggle-submit dir="auto" class="form-control mt-4">
|
||||||
|
<%= f.button button_title(title: t(:decline)), class: 'base-button' %>
|
||||||
|
</toggle-submit>
|
||||||
|
<% end %>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
<% data_attachments = attachments_index.values.select { |e| e.record_id == submitter.id }.to_json(only: %i[uuid created_at], methods: %i[url filename content_type]) %>
|
<% data_attachments = attachments_index.values.select { |e| e.record_id == submitter.id }.to_json(only: %i[uuid created_at], methods: %i[url filename content_type]) %>
|
||||||
<% data_fields = (submitter.submission.template_fields || submitter.submission.template.fields).select { |f| f['submitter_uuid'] == submitter.uuid }.to_json %>
|
<% data_fields = (submitter.submission.template_fields || submitter.submission.template.fields).select { |f| f['submitter_uuid'] == submitter.uuid }.to_json %>
|
||||||
<submission-form data-is-demo="<%= Docuseal.demo? %>" data-require-signing-reason="<%= configs[:require_signing_reason] %>" data-with-signature-id="<%= configs[:with_signature_id] %>" data-with-confetti="<%= configs[:with_confetti] %>" data-completed-redirect-url="<%= submitter.preferences['completed_redirect_url'] %>" data-completed-message="<%= configs[:completed_message].to_json %>" data-completed-button="<%= configs[:completed_button].to_json %>" data-go-to-last="<%= submitter.preferences.key?('go_to_last') ? submitter.preferences['go_to_last'] : submitter.opened_at? %>" data-submitter="<%= submitter.to_json(only: %i[uuid slug name phone email]) %>" data-can-send-email="<%= Accounts.can_send_emails?(submitter.submission.account) %>" data-attachments="<%= data_attachments %>" data-fields="<%= data_fields %>" data-values="<%= submitter.values.to_json %>" data-with-typed-signature="<%= configs[:with_typed_signature] %>" data-previous-signature-value="<%= local_assigns[:signature_attachment]&.uuid %>" data-remember-signature="<%= configs[:prefill_signature] %>" data-dry-run="<%= local_assigns[:dry_run] %>" data-expand="<%= local_assigns[:expand] %>" data-scroll-padding="<%= local_assigns[:scroll_padding] %>"></submission-form>
|
<% invite_submitters = (submitter.submission.template_submitters || submitter.submission.template.submitters).select { |s| s['invite_by_uuid'] == submitter.uuid && submitter.submission.submitters.none? { |e| e.uuid == s['uuid'] } }.to_json %>
|
||||||
|
<submission-form data-is-demo="<%= Docuseal.demo? %>" data-require-signing-reason="<%= configs[:require_signing_reason] %>" data-with-signature-id="<%= configs[:with_signature_id] %>" data-with-confetti="<%= configs[:with_confetti] %>" data-completed-redirect-url="<%= submitter.preferences['completed_redirect_url'].presence || submitter.submission.template.preferences['completed_redirect_url'] %>" data-completed-message="<%= (configs[:completed_message]&.compact_blank.presence || submitter.submission.template.preferences['completed_message'] || {}).to_json %>" data-completed-button="<%= configs[:completed_button].to_json %>" data-go-to-last="<%= submitter.preferences.key?('go_to_last') ? submitter.preferences['go_to_last'] : submitter.opened_at? %>" data-submitter="<%= submitter.to_json(only: %i[uuid slug name phone email]) %>" data-can-send-email="<%= Accounts.can_send_emails?(submitter.submission.account) %>" data-invite-submitters="<%= invite_submitters %>" data-attachments="<%= data_attachments %>" data-fields="<%= data_fields %>" data-values="<%= submitter.values.to_json %>" data-with-typed-signature="<%= configs[:with_typed_signature] %>" data-previous-signature-value="<%= local_assigns[:signature_attachment]&.uuid %>" data-remember-signature="<%= configs[:prefill_signature] %>" data-dry-run="<%= local_assigns[:dry_run] %>" data-expand="<%= local_assigns[:expand] %>" data-scroll-padding="<%= local_assigns[:scroll_padding] %>"></submission-form>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<toggle-submit>
|
<toggle-submit>
|
||||||
<%= 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: { submitter_slug: @submitter.slug }, class: 'white-button w-full' %>
|
<%= 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: { submitter_slug: @submitter.slug }, class: 'white-button w-full' %>
|
||||||
</toggle-submit>
|
</toggle-submit>
|
||||||
<% if @submitter.submission.template.submitters.size != 1 %>
|
<% if Templates.filter_undefined_submitters(@submitter.submission.template).size != 1 %>
|
||||||
<div class="divider uppercase"><%= t('or') %></div>
|
<div class="divider uppercase"><%= t('or') %></div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="py-2"></div>
|
<div class="py-2"></div>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</download-button>
|
</download-button>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if @submitter.submission.template.submitters.size == 1 && %w[api embed].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false && !@submitter.template.archived_at? %>
|
<% if Templates.filter_undefined_submitters(@submitter.submission.template).size == 1 && %w[api embed].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false && !@submitter.template.archived_at? %>
|
||||||
<div class="divider uppercase"><%= t('or') %></div>
|
<div class="divider uppercase"><%= t('or') %></div>
|
||||||
<toggle-submit class="block">
|
<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(@submitter.submission.template.slug), params: { submitter: { email: @submitter.email, phone: @submitter.phone, name: @submitter.name }, resubmit: @submitter.slug }, method: :put, class: 'white-button w-full' %>
|
<%= button_to button_title(title: t('resubmit'), disabled_with: t('resubmit'), icon: svg_icon('reload', class: 'w-6 h-6')), start_form_path(@submitter.submission.template.slug), params: { submitter: { email: @submitter.email, phone: @submitter.phone, name: @submitter.name }, resubmit: @submitter.slug }, method: :put, class: 'white-button w-full' %>
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<div 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 'start_form/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 dir="auto">
|
||||||
|
<p class="text-lg font-bold mb-1"><%= @submitter.submission.template.name %></p>
|
||||||
|
<p class="text-sm"><%= t('form_has_been_declined_on_html', time: l(@submitter.declined_at, format: :long)) %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= render 'shared/attribution', link_path: '/start', account: @submitter.account %>
|
||||||
@@ -8,7 +8,30 @@
|
|||||||
<div id="scrollbox">
|
<div id="scrollbox">
|
||||||
<div class="mx-auto block pb-72" style="max-width: 1000px">
|
<div class="mx-auto block pb-72" style="max-width: 1000px">
|
||||||
<%# flex block w-full sticky top-0 z-50 space-x-2 items-center bg-yellow-100 p-2 border-y border-yellow-200 %>
|
<%# flex block w-full sticky top-0 z-50 space-x-2 items-center bg-yellow-100 p-2 border-y border-yellow-200 %>
|
||||||
<%= local_assigns[:banner_html] || render('submit_form/banner') %>
|
<%= local_assigns[:banner_html] || capture do %>
|
||||||
|
<%= render('submit_form/banner') %>
|
||||||
|
<div class="sticky top-0 z-50 bg-base-100 py-2 px-2 flex items-center md:-mx-[8px]" style="margin-bottom: -16px">
|
||||||
|
<div class="text-xl md:text-2xl font-medium focus:text-clip" style="width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
||||||
|
<%= @submitter.submission.template.name %>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center space-x-2" style="margin-left: 20px; flex-shrink: 0">
|
||||||
|
<div>
|
||||||
|
<%= render 'shared/html_modal', title: t(:decline), btn_text: t(:decline), btn_class: 'btn btn-sm !px-5', button_id: 'decline_button' do %>
|
||||||
|
<%= render 'submit_form/decline_form', submitter: @submitter %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<download-button data-src="<%= submit_form_download_index_path(@submitter.slug) %>" class="btn btn-neutral text-white btn-sm !px-4">
|
||||||
|
<span class="flex items-center justify-center space-x-2" data-target="download-button.defaultButton">
|
||||||
|
<span><%= t('download') %></span>
|
||||||
|
</span>
|
||||||
|
<span class="flex items-center justify-center space-x-2 hidden" data-target="download-button.loadingButton">
|
||||||
|
<%= svg_icon('loader', class: 'w-6 h-6 animate-spin') %>
|
||||||
|
<span><%= t('downloading') %></span>
|
||||||
|
</span>
|
||||||
|
</download-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<% (@submitter.submission.template_schema || @submitter.submission.template.schema).each do |item| %>
|
<% (@submitter.submission.template_schema || @submitter.submission.template.schema).each do |item| %>
|
||||||
<% document = @submitter.submission.template_schema_documents.find { |a| a.uuid == item['attachment_uuid'] } %>
|
<% document = @submitter.submission.template_schema_documents.find { |a| a.uuid == item['attachment_uuid'] } %>
|
||||||
<% document_annots_index = document.metadata.dig('pdf', 'annotations')&.group_by { |e| e['page'] } || {} %>
|
<% document_annots_index = document.metadata.dig('pdf', 'annotations')&.group_by { |e| e['page'] } || {} %>
|
||||||
@@ -26,8 +49,9 @@
|
|||||||
<% value = values[field['uuid']].presence || (field['default_value'].present? ? Submitters::SubmitValues.template_default_value_for_submitter(field['default_value'], @submitter.submission.submitters.find { |e| e.uuid == field['submitter_uuid'] }, with_time: false) : nil) %>
|
<% value = values[field['uuid']].presence || (field['default_value'].present? ? Submitters::SubmitValues.template_default_value_for_submitter(field['default_value'], @submitter.submission.submitters.find { |e| e.uuid == field['submitter_uuid'] }, with_time: false) : nil) %>
|
||||||
<% next if value.blank? %>
|
<% next if value.blank? %>
|
||||||
<% next if !field['readonly'] && field['submitter_uuid'] == @submitter.uuid %>
|
<% next if !field['readonly'] && field['submitter_uuid'] == @submitter.uuid %>
|
||||||
<% next if field['redacted'] && field['submitter_uuid'] != @submitter.uuid %>
|
|
||||||
<% next if value == '{{date}}' && field['submitter_uuid'] != @submitter.uuid %>
|
<% next if value == '{{date}}' && field['submitter_uuid'] != @submitter.uuid %>
|
||||||
|
<% next if field['conditions'].present? && values[field['uuid']].blank? && field['submitter_uuid'] != @submitter.uuid %>
|
||||||
|
<% next if field['conditions'].present? && field['submitter_uuid'] == @submitter.uuid %>
|
||||||
<% next if field.dig('preferences', 'formula').present? && field['submitter_uuid'] == @submitter.uuid %>
|
<% next if field.dig('preferences', 'formula').present? && field['submitter_uuid'] == @submitter.uuid %>
|
||||||
<%= render 'submissions/value', area:, field:, attachments_index: @attachments_index, value:, locale: @submitter.account.locale, timezone: @submitter.account.timezone, submitter: submitters_index[field['submitter_uuid']], with_signature_id: @form_configs[:with_signature_id] %>
|
<%= render 'submissions/value', area:, field:, attachments_index: @attachments_index, value:, locale: @submitter.account.locale, timezone: @submitter.account.timezone, submitter: submitters_index[field['submitter_uuid']], with_signature_id: @form_configs[:with_signature_id] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -42,7 +66,7 @@
|
|||||||
<div class="fixed bottom-0 w-full h-0 z-20">
|
<div class="fixed bottom-0 w-full h-0 z-20">
|
||||||
<div class="mx-auto" style="max-width: 1000px">
|
<div class="mx-auto" style="max-width: 1000px">
|
||||||
<div class="relative md:mx-32">
|
<div class="relative md:mx-32">
|
||||||
<%= render 'submit_form/submission_form', attachments_index: @attachments_index, submitter: @submitter, signature_attachment: @signature_attachment, configs: @form_configs, dry_run: local_assigns[:dry_run], expand: local_assigns[:expand], scroll_padding: local_assigns[:scroll_padding] %>
|
<%= render 'submit_form/submission_form', attachments_index: @attachments_index, submitter: @submitter, signature_attachment: @signature_attachment, configs: @form_configs, dry_run: local_assigns[:dry_run], expand: local_assigns[:expand], scroll_padding: local_assigns.fetch(:scroll_padding, '-110px') %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<p><%= t('hi_there') %>,</p>
|
||||||
|
<p><%= t('name_declined_by_submitter_with_the_following_reason', name: @submitter.submission.template.name, submitter: @submitter.name || @submitter.email || @submitter.phone) %></p>
|
||||||
|
<%= simple_format(h(@submitter.submission_events.find_by(event_type: :decline_form).data['reason'])) %>
|
||||||
|
<p><%= link_to t('view'), submission_url(@submitter.submission) %></p>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<% status_badges = { 'awaiting' => 'badge-info', 'sent' => 'badge-info', 'completed' => 'badge-success', 'opened' => 'badge-warning' } %>
|
<% status_badges = { 'awaiting' => 'badge-info', 'sent' => 'badge-info', 'completed' => 'badge-success', 'opened' => 'badge-warning', 'declined' => 'badge-error' } %>
|
||||||
<div class="bg-base-200 rounded-2xl flex flex-col sm:flex-row items-strech">
|
<div class="bg-base-200 rounded-2xl flex flex-col sm:flex-row items-strech">
|
||||||
<% if local_assigns[:with_template] %>
|
<% if local_assigns[:with_template] %>
|
||||||
<% template = submission.template %>
|
<% template = submission.template %>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
</download-button>
|
</download-button>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<% elsif !submission.archived_at? && !template.archived_at? && !submission.expired? %>
|
<% elsif !submission.archived_at? && !template.archived_at? && !submission.expired? && !submitter.declined_at? %>
|
||||||
<% 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) %>" class="flex-1 md:flex-none">
|
<form data-turbo="false" method="get" action="<%= submit_form_url(slug: submitter.slug) %>" class="flex-1 md:flex-none">
|
||||||
<button onclick="event.stopPropagation()" class="btn btn-sm btn-neutral btn-outline bg-white w-full md:w-36 flex">
|
<button onclick="event.stopPropagation()" class="btn btn-sm btn-neutral btn-outline bg-white w-full md:w-36 flex">
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
</download-button>
|
</download-button>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed && !submission.expired? %>
|
<% 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) %>">
|
<form data-turbo="false" method="get" action="<%= submit_form_url(slug: submitter.slug) %>">
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
<span>Edit</span>
|
<span>Edit</span>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif can?(:read, template) %>
|
<% elsif can?(:read, template) && !template.archived_at? %>
|
||||||
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm flex-1' do %>
|
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm flex-1' do %>
|
||||||
<span class="flex items-center justify-center space-x-2">
|
<span class="flex items-center justify-center space-x-2">
|
||||||
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
||||||
@@ -79,8 +79,16 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if template.archived_at? && can?(:create, template) %>
|
<% if template.archived_at? %>
|
||||||
<%= button_to button_title(title: 'Restore', disabled_with: 'Restoring', icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm flex-1' %>
|
<% if can?(:create, template) %>
|
||||||
|
<%= button_to button_title(title: 'Restore', disabled_with: 'Restoring', icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm flex-1' %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm flex-1' do %>
|
||||||
|
<span class="flex items-center justify-center space-x-2">
|
||||||
|
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
||||||
|
<span>Preview</span>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1 +1 @@
|
|||||||
<template-builder class="grid" data-template="<%= @template_data %>" data-locale="<%= current_account.locale %>"></template-builder>
|
<template-builder class="grid" data-template="<%= @template_data %>" data-with-sign-yourself-button="<%= !@template.archived_at? %>" data-with-send-button="<%= !@template.archived_at? && can?(:create, @template.submissions.new(account: current_account)) %>" data-locale="<%= current_account.locale %>"></template-builder>
|
||||||
@@ -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">
|
||||||
@@ -39,6 +41,38 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render 'templates_code_modal/preferences' %>
|
<%= render 'templates_code_modal/preferences' %>
|
||||||
|
<div class="collapse collapse-arrow join-item border border-base-300 mb-2">
|
||||||
|
<input type="checkbox" name="accordion">
|
||||||
|
<div class="collapse-title text-xl font-medium">
|
||||||
|
Form preferences
|
||||||
|
</div>
|
||||||
|
<div class="collapse-content">
|
||||||
|
<%= 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="form_saved_alert"></toggle-on-submit>
|
||||||
|
<% configs = AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY).value %>
|
||||||
|
<%= f.fields_for :preferences, Struct.new(:completed_redirect_url, :completed_message).new(@template.preferences['completed_redirect_url'].presence, Struct.new(:title, :body).new(*(@template.preferences['completed_message'] || {}).values_at('title', 'body'))) do |ff| %>
|
||||||
|
<div class="form-control mb-2">
|
||||||
|
<%= ff.label :completed_redirect_url, 'Redirect on completion URL', class: 'label' %>
|
||||||
|
<%= ff.url_field :completed_redirect_url, required: false, class: 'base-input', dir: 'auto' %>
|
||||||
|
</div>
|
||||||
|
<%= ff.fields_for :completed_message, ff.object.completed_message do |fff| %>
|
||||||
|
<div class="form-control mb-2 border-t mt-4">
|
||||||
|
<%= fff.label :body, 'Completion message', class: 'label' %>
|
||||||
|
<autoresize-textarea>
|
||||||
|
<%= fff.text_area :body, required: false, class: 'base-input w-full py-2', dir: 'auto' %>
|
||||||
|
</autoresize-textarea>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<div class="form-control pt-2">
|
||||||
|
<%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button' %>
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<span id="form_saved_alert" class="text-sm invisible font-normal mt-0.5">Changes have been saved</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="join join-vertical w-full !rounded-2xl mb-1.5 mt-2.5">
|
<div class="join join-vertical w-full !rounded-2xl mb-1.5 mt-2.5">
|
||||||
<div class="collapse collapse-arrow join-item border border-base-300">
|
<div class="collapse collapse-arrow join-item border border-base-300">
|
||||||
<input type="checkbox" name="accordion">
|
<input type="checkbox" name="accordion">
|
||||||
@@ -46,7 +80,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 +114,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 +161,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 +210,58 @@
|
|||||||
</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, :invite_by_uuid, :linked_to_uuid, :option).new(*submitter.values_at('name', 'uuid', 'is_requester', 'email', 'invite_by_uuid', '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}" : (item.invite_by_uuid.present? ? "invite_by_#{item.invite_by_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 || ff.object.invite_by_uuid.present?, 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| ["Invite by #{e['name']}", "invite_by_#{e['uuid']}"] }, *(@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 %>
|
||||||
|
<checkbox-group class="mt-3 flex items-center space-x-4">
|
||||||
|
<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>
|
||||||
|
<% if index == 1 %>
|
||||||
|
<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 :invite_by_uuid, { class: 'base-checkbox' }, @template.submitters.first['uuid'], '' %>
|
||||||
|
</toggle-attribute>
|
||||||
|
<span class="select-none">
|
||||||
|
Invite by <%= @template.submitters.first['name'] %>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
</checkbox-group>
|
||||||
|
<% 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>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<template-builder class="grid" data-editable="false" data-template="<%= @template_data %>"></template-builder>
|
<template-builder class="grid" data-editable="false" data-with-sign-yourself-button="<%= !@template.archived_at? %>" data-with-send-button="<%= !@template.archived_at? && can?(:create, @template.submissions.new(account: current_account)) %>" data-template="<%= @template_data %>"></template-builder>
|
||||||
+146
-5
@@ -18,6 +18,8 @@ en: &en
|
|||||||
language_nl: Nederlands
|
language_nl: Nederlands
|
||||||
language_ar: العربية
|
language_ar: العربية
|
||||||
language_ko: 한국어
|
language_ko: 한국어
|
||||||
|
view: View
|
||||||
|
hi_there: Hi there
|
||||||
email: Email
|
email: Email
|
||||||
form_expired_at_html: 'Form expired on <span class="font-semibold">%{time}</span>'
|
form_expired_at_html: 'Form expired on <span class="font-semibold">%{time}</span>'
|
||||||
verification_code_code: 'Verification code: %{code}'
|
verification_code_code: 'Verification code: %{code}'
|
||||||
@@ -39,6 +41,15 @@ en: &en
|
|||||||
or: or
|
or: or
|
||||||
download_documents: Download documents
|
download_documents: Download documents
|
||||||
downloading: Downloading
|
downloading: Downloading
|
||||||
|
download: Download
|
||||||
|
decline: Decline
|
||||||
|
declined: Declined
|
||||||
|
decline_reason: Decline reason
|
||||||
|
provide_a_reason: Provide a reason
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Notify the sender with the reason you declined
|
||||||
|
form_has_been_declined_on_html: 'Form has been declined on <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" declined by %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" has been declined by %{submitter} with the following reason:'
|
||||||
completed_successfully: Completed Successfully
|
completed_successfully: Completed Successfully
|
||||||
password: Password
|
password: Password
|
||||||
sign_in: Sign In
|
sign_in: Sign In
|
||||||
@@ -65,6 +76,17 @@ en: &en
|
|||||||
read: Read your data
|
read: Read your data
|
||||||
|
|
||||||
es: &es
|
es: &es
|
||||||
|
view: Vista
|
||||||
|
hi_there: Hola
|
||||||
|
download: Descargar
|
||||||
|
decline: Rechazar
|
||||||
|
declined: Rechazado
|
||||||
|
decline_reason: Motivo de rechazo
|
||||||
|
provide_a_reason: Proporcione un motivo
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Notifique al remitente con el motivo por el que rechazó
|
||||||
|
form_has_been_declined_on_html: 'El formulario ha sido rechazado el <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" rechazado por %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" ha sido rechazado por %{submitter} con el siguiente motivo:'
|
||||||
role: Rol
|
role: Rol
|
||||||
reason: Razón
|
reason: Razón
|
||||||
form_expired_at_html: 'El formulario expiró el <span class="font-semibold">%{time}</span>'
|
form_expired_at_html: 'El formulario expiró el <span class="font-semibold">%{time}</span>'
|
||||||
@@ -109,6 +131,17 @@ es: &es
|
|||||||
enter_email_to_continue: Ingresa tu correo electrónico para continuar
|
enter_email_to_continue: Ingresa tu correo electrónico para continuar
|
||||||
|
|
||||||
it: &it
|
it: &it
|
||||||
|
view: View
|
||||||
|
hi_there: Bonjour,
|
||||||
|
download: Télécharger
|
||||||
|
decline: Refuser
|
||||||
|
declined: Refusé
|
||||||
|
decline_reason: Raison du refus
|
||||||
|
provide_a_reason: Fournir une raison
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Informer l'expéditeur de la raison pour laquelle vous avez refusé
|
||||||
|
form_has_been_declined_on_html: 'Le formulaire a été refusé le <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" refusé par %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" a été refusé par %{submitter} pour la raison suivante :'
|
||||||
role: Rôle
|
role: Rôle
|
||||||
reason: Ragione
|
reason: Ragione
|
||||||
verification_code_code: 'Codice di verifica: %{code}'
|
verification_code_code: 'Codice di verifica: %{code}'
|
||||||
@@ -152,6 +185,17 @@ it: &it
|
|||||||
enter_email_to_continue: Inserisci l'email per continuare
|
enter_email_to_continue: Inserisci l'email per continuare
|
||||||
|
|
||||||
fr: &fr
|
fr: &fr
|
||||||
|
view: Vue
|
||||||
|
hi_there: Salut,
|
||||||
|
download: Télécharger
|
||||||
|
decline: Refuser
|
||||||
|
declined: Refusé
|
||||||
|
decline_reason: Raison du refus
|
||||||
|
provide_a_reason: Fournir une raison
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Informer l'expéditeur de la raison pour laquelle vous avez refusé
|
||||||
|
form_has_been_declined_on_html: 'Le formulaire a été refusé le <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" a été refusé par %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" a été refusé par %{submitter} avec la raison suivante :'
|
||||||
email: Email
|
email: Email
|
||||||
verification_code_code: 'Code de vérification: %{code}'
|
verification_code_code: 'Code de vérification: %{code}'
|
||||||
digitally_signed_by: Signé numériquement par
|
digitally_signed_by: Signé numériquement par
|
||||||
@@ -195,13 +239,23 @@ fr: &fr
|
|||||||
enter_email_to_continue: Entrez votre e-mail pour continuer
|
enter_email_to_continue: Entrez votre e-mail pour continuer
|
||||||
|
|
||||||
pt: &pt
|
pt: &pt
|
||||||
|
view: Visualizar
|
||||||
|
hi_there: Olá,
|
||||||
|
download: Baixar
|
||||||
|
decline: Recusar
|
||||||
|
declined: Recusado
|
||||||
|
decline_reason: Motivo da recusa
|
||||||
|
provide_a_reason: Forneça um motivo
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Notifique o remetente com o motivo que você recusou
|
||||||
|
form_has_been_declined_on_html: 'O formulário foi recusado em <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" foi recusado por %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" foi recusado por %{submitter} com o seguinte motivo:'
|
||||||
role: Função
|
role: Função
|
||||||
email: Email
|
email: Email
|
||||||
reason: Razão
|
reason: Razão
|
||||||
verification_code_code: 'Código de verificação: %{code}'
|
verification_code_code: 'Código de verificação: %{code}'
|
||||||
digitally_signed_by: Assinado digitalmente por
|
digitally_signed_by: Assinado digitalmente por
|
||||||
form_expired_at_html: 'O formulário expirou em <span class="font-semibold">%{time}</span>'
|
form_expired_at_html: 'O formulário expirou em <span class="font-semibold">%{time}</span>'
|
||||||
role: Função
|
|
||||||
provide_your_email_to_start: Forneça o seu email para começar
|
provide_your_email_to_start: Forneça o seu email para começar
|
||||||
start: Iniciar
|
start: Iniciar
|
||||||
starting: Iniciando
|
starting: Iniciando
|
||||||
@@ -238,13 +292,23 @@ pt: &pt
|
|||||||
enter_email_to_continue: Insira o e-mail para continuar
|
enter_email_to_continue: Insira o e-mail para continuar
|
||||||
|
|
||||||
de: &de
|
de: &de
|
||||||
|
view: Ansicht
|
||||||
|
hi_there: Hallo,
|
||||||
|
download: Herunterladen
|
||||||
|
decline: Ablehnen
|
||||||
|
declined: Abgelehnt
|
||||||
|
decline_reason: Ablehnungsgrund
|
||||||
|
provide_a_reason: Geben Sie einen Grund an
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Benachrichtigen Sie den Absender über den Grund für Ihre Ablehnung
|
||||||
|
form_has_been_declined_on_html: 'Das Formular wurde am <span class="font-semibold">%{time}</span> abgelehnt'
|
||||||
|
name_declined_by_submitter: '"%{name}" wurde von %{submitter} abgelehnt'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" wurde von %{submitter} mit folgendem Grund abgelehnt:'
|
||||||
role: Rolle
|
role: Rolle
|
||||||
verification_code_code: 'Verifizierungscode: %{code}'
|
verification_code_code: 'Verifizierungscode: %{code}'
|
||||||
reason: Grund
|
reason: Grund
|
||||||
email: E-Mail
|
email: E-Mail
|
||||||
form_expired_at_html: 'Das Formular ist am <span class="font-semibold">%{time}</span> abgelaufen'
|
form_expired_at_html: 'Das Formular ist am <span class="font-semibold">%{time}</span> abgelaufen'
|
||||||
digitally_signed_by: Digital signiert von
|
digitally_signed_by: Digital signiert von
|
||||||
role: Rolle
|
|
||||||
provide_your_email_to_start: Gib deine E-Mail-Adresse ein, um zu starten
|
provide_your_email_to_start: Gib deine E-Mail-Adresse ein, um zu starten
|
||||||
start: Starten
|
start: Starten
|
||||||
starting: Starten
|
starting: Starten
|
||||||
@@ -281,7 +345,18 @@ de: &de
|
|||||||
enter_email_to_continue: E-Mail eingeben, um fortzufahren
|
enter_email_to_continue: E-Mail eingeben, um fortzufahren
|
||||||
|
|
||||||
pl:
|
pl:
|
||||||
email: Email
|
view: Widok
|
||||||
|
hi_there: Cześć,
|
||||||
|
download: Pobierz
|
||||||
|
decline: Odrzuć
|
||||||
|
declined: Odrzucono
|
||||||
|
decline_reason: Powód odrzucenia
|
||||||
|
provide_a_reason: Podaj powód
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Powiadom nadawcę o powodzie, dla którego odrzuciłeś
|
||||||
|
form_has_been_declined_on_html: 'Formularz został odrzucony o <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" odrzucono przez %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" został odrzucony przez %{submitter} z następującym powodem:'
|
||||||
|
email: E-mail
|
||||||
verification_code_code: 'Kod weryfikacyjny: %{code}'
|
verification_code_code: 'Kod weryfikacyjny: %{code}'
|
||||||
digitally_signed_by: Podpis cyfrowy przez
|
digitally_signed_by: Podpis cyfrowy przez
|
||||||
form_expired_at_html: 'Formularz wygasł o <span class="font-semibold">%{time}</span>'
|
form_expired_at_html: 'Formularz wygasł o <span class="font-semibold">%{time}</span>'
|
||||||
@@ -323,7 +398,18 @@ pl:
|
|||||||
enter_email_to_continue: Wprowadź e-mail, aby kontynuować
|
enter_email_to_continue: Wprowadź e-mail, aby kontynuować
|
||||||
|
|
||||||
uk:
|
uk:
|
||||||
email: Email
|
view: Переглянути
|
||||||
|
hi_there: Привіт,
|
||||||
|
download: Завантажити
|
||||||
|
decline: Відхилити
|
||||||
|
declined: Відхилено
|
||||||
|
decline_reason: Причина відхилення
|
||||||
|
provide_a_reason: Надайте причину
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Повідомте відправника про причину, з якої ви відхилили
|
||||||
|
form_has_been_declined_on_html: 'Форму було відхилено о <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" відхилено %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" було відхилено %{submitter} з такою причиною:'
|
||||||
|
email: E-mail
|
||||||
digitally_signed_by: Цифровий підпис від
|
digitally_signed_by: Цифровий підпис від
|
||||||
verification_code_code: 'Код підтвердження: %{code}'
|
verification_code_code: 'Код підтвердження: %{code}'
|
||||||
role: Роль
|
role: Роль
|
||||||
@@ -365,7 +451,18 @@ uk:
|
|||||||
enter_email_to_continue: Введіть електронну пошту, щоб продовжити
|
enter_email_to_continue: Введіть електронну пошту, щоб продовжити
|
||||||
|
|
||||||
cs:
|
cs:
|
||||||
email: Email
|
view: Zobrazit
|
||||||
|
hi_there: Ahoj,
|
||||||
|
download: Stáhnout
|
||||||
|
decline: Odmítnout
|
||||||
|
declined: Odmítnuto
|
||||||
|
decline_reason: Důvod odmítnutí
|
||||||
|
provide_a_reason: Uveďte důvod
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Informujte odesílatele o důvodu odmítnutí
|
||||||
|
form_has_been_declined_on_html: 'Formulář byl odmítnut dne <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" odmítnuto %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" bylo odmítnuto %{submitter} s následujícím důvodem:'
|
||||||
|
email: E-mail
|
||||||
digitally_signed_by: Digitálně podepsáno uživatelem
|
digitally_signed_by: Digitálně podepsáno uživatelem
|
||||||
verification_code_code: 'Ověřovací kód: %{code}'
|
verification_code_code: 'Ověřovací kód: %{code}'
|
||||||
role: Role
|
role: Role
|
||||||
@@ -407,6 +504,17 @@ cs:
|
|||||||
enter_email_to_continue: Zadejte e-mail pro pokračování
|
enter_email_to_continue: Zadejte e-mail pro pokračování
|
||||||
|
|
||||||
he:
|
he:
|
||||||
|
view: תצוגה
|
||||||
|
hi_there: שלום,
|
||||||
|
download: הורד
|
||||||
|
decline: דחייה
|
||||||
|
declined: דחוי
|
||||||
|
decline_reason: סיבת דחייה
|
||||||
|
provide_a_reason: אנא ספק סיבה
|
||||||
|
notify_the_sender_with_the_reason_you_declined: הודע לשולח על הסיבה לדחייה
|
||||||
|
form_has_been_declined_on_html: 'הטופס נדחה בתאריך <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" נדחה על ידי %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" נדחה על ידי %{submitter} עם הסיבה הבאה:'
|
||||||
email: דוא"ל
|
email: דוא"ל
|
||||||
digitally_signed_by: חתום דיגיטלית על ידי
|
digitally_signed_by: חתום דיגיטלית על ידי
|
||||||
role: תפקיד
|
role: תפקיד
|
||||||
@@ -449,6 +557,17 @@ he:
|
|||||||
enter_email_to_continue: הכנס דוא"ל כדי להמשיך
|
enter_email_to_continue: הכנס דוא"ל כדי להמשיך
|
||||||
|
|
||||||
nl:
|
nl:
|
||||||
|
view: Bekijken
|
||||||
|
hi_there: Hallo,
|
||||||
|
download: Downloaden
|
||||||
|
decline: Weigeren
|
||||||
|
declined: Geweigerd
|
||||||
|
decline_reason: Weigeringsreden
|
||||||
|
provide_a_reason: Geef een reden op
|
||||||
|
notify_the_sender_with_the_reason_you_declined: Informeer de afzender over de reden waarom je hebt geweigerd
|
||||||
|
form_has_been_declined_on_html: 'Formulier is afgewezen op <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" is geweigerd door %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" is geweigerd door %{submitter} met de volgende reden:'
|
||||||
email: E-mail
|
email: E-mail
|
||||||
digitally_signed_by: Digitaal ondertekend door
|
digitally_signed_by: Digitaal ondertekend door
|
||||||
role: Rol
|
role: Rol
|
||||||
@@ -492,6 +611,17 @@ nl:
|
|||||||
enter_email_to_continue: Voer e-mail in om door te gaan
|
enter_email_to_continue: Voer e-mail in om door te gaan
|
||||||
|
|
||||||
ar:
|
ar:
|
||||||
|
view: عرض
|
||||||
|
hi_there: مرحبا,
|
||||||
|
download: تحميل
|
||||||
|
decline: رفض
|
||||||
|
declined: مرفوض
|
||||||
|
decline_reason: سبب الرفض
|
||||||
|
provide_a_reason: قدم سببًا
|
||||||
|
notify_the_sender_with_the_reason_you_declined: أخطر المرسل بسبب الرفض
|
||||||
|
form_has_been_declined_on_html: 'تم رفض النموذج في <span class="font-semibold">%{time}</span>'
|
||||||
|
name_declined_by_submitter: '"%{name}" مرفوض بواسطة %{submitter}'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}" تم رفضه بواسطة %{submitter} مع السبب التالي:'
|
||||||
email: البريد الإلكتروني
|
email: البريد الإلكتروني
|
||||||
digitally_signed_by: تم التوقيع الرقمي بواسطة
|
digitally_signed_by: تم التوقيع الرقمي بواسطة
|
||||||
role: الدور
|
role: الدور
|
||||||
@@ -535,6 +665,17 @@ ar:
|
|||||||
enter_email_to_continue: أدخل البريد الإلكتروني للمتابعة
|
enter_email_to_continue: أدخل البريد الإلكتروني للمتابعة
|
||||||
|
|
||||||
ko:
|
ko:
|
||||||
|
view: 보기
|
||||||
|
hi_there: 안녕하세요,
|
||||||
|
download: 다운로드
|
||||||
|
decline: 거절
|
||||||
|
declined: 거절됨
|
||||||
|
decline_reason: 거절 사유
|
||||||
|
provide_a_reason: 사유를 제공하세요
|
||||||
|
notify_the_sender_with_the_reason_you_declined: 거절한 이유로 발신자에게 알리기
|
||||||
|
form_has_been_declined_on_html: '양식이 <span class="font-semibold">%{time}</span>에 거절되었습니다.'
|
||||||
|
name_declined_by_submitter: '"%{name}"이(가) %{submitter}에 의해 거절되었습니다.'
|
||||||
|
name_declined_by_submitter_with_the_following_reason: '"%{name}"이(가) %{submitter}에 의해 다음과 같은 사유로 거절되었습니다:'
|
||||||
email: 이메일
|
email: 이메일
|
||||||
digitally_signed_by: 디지털로 서명됨
|
digitally_signed_by: 디지털로 서명됨
|
||||||
role: 역할
|
role: 역할
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ Rails.application.routes.draw do
|
|||||||
resource :form, only: %i[show], controller: 'templates_form_preview'
|
resource :form, only: %i[show], controller: 'templates_form_preview'
|
||||||
resource :code_modal, only: %i[show], controller: 'templates_code_modal'
|
resource :code_modal, only: %i[show], controller: 'templates_code_modal'
|
||||||
resource :preferences, only: %i[show create], controller: 'templates_preferences'
|
resource :preferences, only: %i[show create], controller: 'templates_preferences'
|
||||||
|
resources :recipients, only: %i[create], controller: 'templates_recipients'
|
||||||
resources :submissions_export, only: %i[index new]
|
resources :submissions_export, only: %i[index new]
|
||||||
end
|
end
|
||||||
resources :preview_document_page, only: %i[show], path: '/preview/:signed_uuid'
|
resources :preview_document_page, only: %i[show], path: '/preview/:signed_uuid'
|
||||||
@@ -125,6 +126,9 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :submit_form, only: %i[show update], path: 's', param: 'slug' do
|
resources :submit_form, only: %i[show update], path: 's', param: 'slug' do
|
||||||
resources :values, only: %i[index], controller: 'submit_form_values'
|
resources :values, only: %i[index], controller: 'submit_form_values'
|
||||||
|
resources :download, only: %i[index], controller: 'submit_form_download'
|
||||||
|
resources :decline, only: %i[create], controller: 'submit_form_decline'
|
||||||
|
resources :invite, only: %i[create], controller: 'submit_form_invite'
|
||||||
get :completed
|
get :completed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddDeclinedAtToSubmitters < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
add_column :submitters, :declined_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
+2
-1
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2024_08_16_121641) do
|
ActiveRecord::Schema[7.1].define(version: 2024_08_20_180922) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
@@ -244,6 +244,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_08_16_121641) do
|
|||||||
t.text "preferences", null: false
|
t.text "preferences", null: false
|
||||||
t.text "metadata", null: false
|
t.text "metadata", null: false
|
||||||
t.bigint "account_id", null: false
|
t.bigint "account_id", null: false
|
||||||
|
t.datetime "declined_at"
|
||||||
t.index ["account_id", "id"], name: "index_submitters_on_account_id_and_id"
|
t.index ["account_id", "id"], name: "index_submitters_on_account_id_and_id"
|
||||||
t.index ["email"], name: "index_submitters_on_email"
|
t.index ["email"], name: "index_submitters_on_email"
|
||||||
t.index ["external_id"], name: "index_submitters_on_external_id"
|
t.index ["external_id"], name: "index_submitters_on_external_id"
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ module Accounts
|
|||||||
|
|
||||||
data
|
data
|
||||||
else
|
else
|
||||||
|
return Docuseal.default_pkcs if Docuseal::CERTS.present?
|
||||||
|
|
||||||
EncryptedConfig.find_by(account:, key: EncryptedConfig::ESIGN_CERTS_KEY)&.value ||
|
EncryptedConfig.find_by(account:, key: EncryptedConfig::ESIGN_CERTS_KEY)&.value ||
|
||||||
EncryptedConfig.find_by(key: EncryptedConfig::ESIGN_CERTS_KEY).value
|
EncryptedConfig.find_by(key: EncryptedConfig::ESIGN_CERTS_KEY).value
|
||||||
end
|
end
|
||||||
@@ -143,6 +145,8 @@ module Accounts
|
|||||||
value = EncryptedConfig.find_by(account:, key: EncryptedConfig::ESIGN_CERTS_KEY)&.value || {}
|
value = EncryptedConfig.find_by(account:, key: EncryptedConfig::ESIGN_CERTS_KEY)&.value || {}
|
||||||
|
|
||||||
Docuseal::CERTS.merge(value)
|
Docuseal::CERTS.merge(value)
|
||||||
|
elsif Docuseal::CERTS.present?
|
||||||
|
Docuseal::CERTS
|
||||||
else
|
else
|
||||||
EncryptedConfig.find_by(key: EncryptedConfig::ESIGN_CERTS_KEY)&.value || {}
|
EncryptedConfig.find_by(key: EncryptedConfig::ESIGN_CERTS_KEY)&.value || {}
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ module Docuseal
|
|||||||
NEWSLETTER_URL = "#{PRODUCT_URL}/newsletters".freeze
|
NEWSLETTER_URL = "#{PRODUCT_URL}/newsletters".freeze
|
||||||
ENQUIRIES_URL = "#{PRODUCT_URL}/enquiries".freeze
|
ENQUIRIES_URL = "#{PRODUCT_URL}/enquiries".freeze
|
||||||
PRODUCT_NAME = 'DocuSeal'
|
PRODUCT_NAME = 'DocuSeal'
|
||||||
DEFAULT_APP_URL = 'http://localhost:3000'
|
DEFAULT_APP_URL = ENV.fetch('APP_URL', 'http://localhost:3000')
|
||||||
GITHUB_URL = 'https://github.com/docusealco/docuseal'
|
GITHUB_URL = 'https://github.com/docusealco/docuseal'
|
||||||
DISCORD_URL = 'https://discord.gg/qygYCDGck9'
|
DISCORD_URL = 'https://discord.gg/qygYCDGck9'
|
||||||
TWITTER_URL = 'https://twitter.com/docusealco'
|
TWITTER_URL = 'https://twitter.com/docusealco'
|
||||||
@@ -76,7 +76,7 @@ module Docuseal
|
|||||||
return DEFAULT_URL_OPTIONS if multitenant?
|
return DEFAULT_URL_OPTIONS if multitenant?
|
||||||
|
|
||||||
@default_url_options ||= begin
|
@default_url_options ||= begin
|
||||||
value = EncryptedConfig.find_by(key: EncryptedConfig::APP_URL_KEY)&.value
|
value = EncryptedConfig.find_by(key: EncryptedConfig::APP_URL_KEY)&.value if ENV['APP_URL'].blank?
|
||||||
value ||= DEFAULT_APP_URL
|
value ||= DEFAULT_APP_URL
|
||||||
url = Addressable::URI.parse(value)
|
url = Addressable::URI.parse(value)
|
||||||
{ host: url.host, port: url.port, protocol: url.scheme }
|
{ host: url.host, port: url.port, protocol: url.scheme }
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module DownloadUtils
|
||||||
|
LOCALHOSTS = %w[0.0.0.0 127.0.0.1 localhost].freeze
|
||||||
|
|
||||||
|
UnableToDownload = Class.new(StandardError)
|
||||||
|
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def call(url)
|
||||||
|
uri = Addressable::URI.parse(url)
|
||||||
|
|
||||||
|
if Docuseal.multitenant?
|
||||||
|
raise UnableToDownload, "Error loading: #{uri.display_uri}. Only HTTPS is allowed." if uri.scheme != 'https'
|
||||||
|
|
||||||
|
if uri.host.in?(LOCALHOSTS)
|
||||||
|
raise UnableToDownload, "Error loading: #{uri.display_uri}. Can't download from localhost."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resp = conn.get(uri.display_uri.to_s)
|
||||||
|
|
||||||
|
raise UnableToDownload, "Error loading: #{uri.display_uri}" if resp.status >= 400
|
||||||
|
|
||||||
|
resp
|
||||||
|
end
|
||||||
|
|
||||||
|
def conn
|
||||||
|
Faraday.new do |faraday|
|
||||||
|
faraday.response :follow_redirects
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -6,9 +6,11 @@ module ReplaceEmailVariables
|
|||||||
SUBMITTER_LINK = /\{+submitter\.link\}+/i
|
SUBMITTER_LINK = /\{+submitter\.link\}+/i
|
||||||
ACCOUNT_NAME = /\{+account\.name\}+/i
|
ACCOUNT_NAME = /\{+account\.name\}+/i
|
||||||
SENDER_NAME = /\{+sender\.name\}+/i
|
SENDER_NAME = /\{+sender\.name\}+/i
|
||||||
|
SENDER_FIRST_NAME = /\{+sender\.first_name\}+/i
|
||||||
SENDER_EMAIL = /\{+sender\.email\}+/i
|
SENDER_EMAIL = /\{+sender\.email\}+/i
|
||||||
SUBMITTER_EMAIL = /\{+submitter\.email\}+/i
|
SUBMITTER_EMAIL = /\{+submitter\.email\}+/i
|
||||||
SUBMITTER_NAME = /\{+submitter\.name\}+/i
|
SUBMITTER_NAME = /\{+submitter\.name\}+/i
|
||||||
|
SUBMITTER_FIRST_NAME = /\{+submitter\.first_name\}+/i
|
||||||
SUBMITTER_ID = /\{+submitter\.id\}+/i
|
SUBMITTER_ID = /\{+submitter\.id\}+/i
|
||||||
SUBMITTER_SLUG = /\{+submitter\.slug\}+/i
|
SUBMITTER_SLUG = /\{+submitter\.slug\}+/i
|
||||||
SUBMISSION_LINK = /\{+submission\.link\}+/i
|
SUBMISSION_LINK = /\{+submission\.link\}+/i
|
||||||
@@ -28,6 +30,7 @@ module ReplaceEmailVariables
|
|||||||
text = replace(text, SUBMISSION_ID, html_escape:) { submitter.submission.id }
|
text = replace(text, SUBMISSION_ID, html_escape:) { submitter.submission.id }
|
||||||
text = replace(text, SUBMITTER_EMAIL, html_escape:) { submitter.email }
|
text = replace(text, SUBMITTER_EMAIL, html_escape:) { submitter.email }
|
||||||
text = replace(text, SUBMITTER_NAME, html_escape:) { submitter.name || submitter.email || submitter.phone }
|
text = replace(text, SUBMITTER_NAME, html_escape:) { submitter.name || submitter.email || submitter.phone }
|
||||||
|
text = replace(text, SUBMITTER_FIRST_NAME, html_escape:) { submitter.first_name }
|
||||||
text = replace(text, SUBMITTER_LINK, html_escape:) { build_submitter_link(submitter, tracking_event_type) }
|
text = replace(text, SUBMITTER_LINK, html_escape:) { build_submitter_link(submitter, tracking_event_type) }
|
||||||
text = replace(text, SUBMISSION_LINK, html_escape:) do
|
text = replace(text, SUBMISSION_LINK, html_escape:) do
|
||||||
submitter.submission ? build_submission_link(submitter.submission) : ''
|
submitter.submission ? build_submission_link(submitter.submission) : ''
|
||||||
@@ -37,6 +40,7 @@ module ReplaceEmailVariables
|
|||||||
text = replace(text, DOCUMENTS_LINK, html_escape:) { build_documents_links_text(submitter, sig) }
|
text = replace(text, DOCUMENTS_LINK, html_escape:) { build_documents_links_text(submitter, sig) }
|
||||||
text = replace(text, ACCOUNT_NAME, html_escape:) { submitter.submission.account.name }
|
text = replace(text, ACCOUNT_NAME, html_escape:) { submitter.submission.account.name }
|
||||||
text = replace(text, SENDER_NAME, html_escape:) { submitter.submission.created_by_user&.full_name }
|
text = replace(text, SENDER_NAME, html_escape:) { submitter.submission.created_by_user&.full_name }
|
||||||
|
text = replace(text, SENDER_FIRST_NAME, html_escape:) { submitter.submission.created_by_user&.first_name }
|
||||||
|
|
||||||
replace(text, SENDER_EMAIL, html_escape:) { submitter.submission.created_by_user&.email.to_s.sub(/\+\w+@/, '@') }
|
replace(text, SENDER_EMAIL, html_escape:) { submitter.submission.created_by_user&.email.to_s.sub(/\+\w+@/, '@') }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ module SubmissionEvents
|
|||||||
phone_verified: 'Phone verified',
|
phone_verified: 'Phone verified',
|
||||||
start_form: 'Submission started',
|
start_form: 'Submission started',
|
||||||
view_form: 'Form viewed',
|
view_form: 'Form viewed',
|
||||||
|
invite_party: 'Invited',
|
||||||
complete_form: 'Submission completed',
|
complete_form: 'Submission completed',
|
||||||
api_complete_form: 'Submission completed via API'
|
api_complete_form: 'Submission completed via API'
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|||||||
+2
-3
@@ -110,13 +110,12 @@ module Submissions
|
|||||||
return email.downcase if email.to_s.include?('.om')
|
return email.downcase if email.to_s.include?('.om')
|
||||||
return email.downcase if email.to_s.include?('.mm')
|
return email.downcase if email.to_s.include?('.mm')
|
||||||
return email.downcase if email.to_s.include?('.cm')
|
return email.downcase if email.to_s.include?('.cm')
|
||||||
|
return email.downcase if email.to_s.include?('.et')
|
||||||
return email.downcase unless email.to_s.include?('.')
|
return email.downcase unless email.to_s.include?('.')
|
||||||
|
|
||||||
fixed_email = EmailTypo.call(email.delete_prefix('<'))
|
fixed_email = EmailTypo.call(email.delete_prefix('<'))
|
||||||
|
|
||||||
if defined?(Rollbar) && fixed_email != email.downcase.delete_prefix('<').strip
|
Rails.logger.info("Fixed email #{email.split('@').last}") if fixed_email != email.downcase.delete_prefix('<').strip
|
||||||
Rollbar.warning("Fixed email #{email}")
|
|
||||||
end
|
|
||||||
|
|
||||||
fixed_email
|
fixed_email
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Submissions
|
||||||
|
module AssignDefinedSubmitters
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def call(submission)
|
||||||
|
submission.submitters_order = 'preserved'
|
||||||
|
|
||||||
|
assign_defined_submitters(submission)
|
||||||
|
assign_linked_submitters(submission)
|
||||||
|
|
||||||
|
submission
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_defined_submitters(submission)
|
||||||
|
submission.template.submitters.to_a.select do |item|
|
||||||
|
next if item['email'].blank? && item['is_requester'].blank?
|
||||||
|
next if submission.submitters.any? { |e| e.uuid == item['uuid'] }
|
||||||
|
|
||||||
|
submission.submitters.new(
|
||||||
|
account_id: submission.account_id,
|
||||||
|
uuid: item['uuid'],
|
||||||
|
email: item['is_requester'] ? submission.template.author.email : item['email']
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_linked_submitters(submission)
|
||||||
|
submission.template.submitters.to_a.select do |item|
|
||||||
|
next if item['linked_to_uuid'].blank?
|
||||||
|
next if submission.submitters.any? { |e| e.uuid == item['uuid'] }
|
||||||
|
|
||||||
|
email = submission.submitters.find { |s| s.uuid == item['linked_to_uuid'] }&.email
|
||||||
|
|
||||||
|
next unless email
|
||||||
|
|
||||||
|
submission.submitters.new(
|
||||||
|
account_id: submission.account_id,
|
||||||
|
uuid: item['uuid'],
|
||||||
|
email:
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -39,10 +39,21 @@ module Submissions
|
|||||||
|
|
||||||
next if submission.submitters.blank?
|
next if submission.submitters.blank?
|
||||||
|
|
||||||
|
maybe_add_invite_submitters(submission, template)
|
||||||
|
|
||||||
submission.tap(&:save!)
|
submission.tap(&:save!)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def maybe_add_invite_submitters(submission, template)
|
||||||
|
template.submitters.each do |item|
|
||||||
|
next if item['invite_by_uuid'].blank? ||
|
||||||
|
submission.template_submitters.any? { |e| e['uuid'] == item['uuid'] }
|
||||||
|
|
||||||
|
submission.template_submitters << item
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def maybe_set_template_fields(submission, submitters_attrs, default_submitter_uuid: nil)
|
def maybe_set_template_fields(submission, submitters_attrs, default_submitter_uuid: nil)
|
||||||
template_fields = (submission.template_fields || submission.template.fields).deep_dup
|
template_fields = (submission.template_fields || submission.template.fields).deep_dup
|
||||||
|
|
||||||
@@ -120,7 +131,6 @@ module Submissions
|
|||||||
field['title'] = attrs['title'] if attrs['title'].present?
|
field['title'] = attrs['title'] if attrs['title'].present?
|
||||||
field['description'] = attrs['description'] if attrs['description'].present?
|
field['description'] = attrs['description'] if attrs['description'].present?
|
||||||
field['readonly'] = attrs['readonly'] if attrs.key?('readonly')
|
field['readonly'] = attrs['readonly'] if attrs.key?('readonly')
|
||||||
field['redacted'] = attrs['redacted'] if attrs.key?('redacted')
|
|
||||||
field['required'] = attrs['required'] if attrs.key?('required')
|
field['required'] = attrs['required'] if attrs.key?('required')
|
||||||
|
|
||||||
if attrs.key?('default_value') && !field['type'].in?(%w[signature image initials file])
|
if attrs.key?('default_value') && !field['type'].in?(%w[signature image initials file])
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ module Submissions
|
|||||||
'GBP' => '£'
|
'GBP' => '£'
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
TESTING_FOOTER = GenerateResultAttachments::TESTING_FOOTER
|
||||||
|
|
||||||
RTL_REGEXP = TextUtils::RTL_REGEXP
|
RTL_REGEXP = TextUtils::RTL_REGEXP
|
||||||
MAX_IMAGE_HEIGHT = 100
|
MAX_IMAGE_HEIGHT = 100
|
||||||
|
|
||||||
@@ -105,6 +107,41 @@ module Submissions
|
|||||||
|
|
||||||
maybe_add_background(canvas, submission, page_size)
|
maybe_add_background(canvas, submission, page_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
with_signature_id = submission.account.account_configs
|
||||||
|
.exists?(key: AccountConfig::WITH_SIGNATURE_ID, value: true)
|
||||||
|
|
||||||
|
if with_signature_id || submission.account.testing?
|
||||||
|
canvas.save_graphics_state do
|
||||||
|
document_id = Digest::MD5.hexdigest(submission.slug).upcase
|
||||||
|
|
||||||
|
font = composer.document.fonts.add(FONT_NAME)
|
||||||
|
|
||||||
|
text =
|
||||||
|
if submission.account.testing?
|
||||||
|
if with_signature_id
|
||||||
|
"#{TESTING_FOOTER} | ID: #{document_id}"
|
||||||
|
else
|
||||||
|
TESTING_FOOTER
|
||||||
|
end
|
||||||
|
else
|
||||||
|
"Document ID: #{document_id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
text = HexaPDF::Layout::TextFragment.create(
|
||||||
|
text, font:, font_size: FONT_SIZE, underlays: [
|
||||||
|
lambda do |canv, box|
|
||||||
|
canv.fill_color('white').rectangle(-1, 0, box.width + 2, box.height).fill
|
||||||
|
end
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
HexaPDF::Layout::TextLayouter.new(font:, font_size: FONT_SIZE)
|
||||||
|
.fit([text], 1000, 1000)
|
||||||
|
.draw(canvas, 1, FONT_SIZE * 1.37)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
style.frame = style.create_frame(canvas.context, 50)
|
style.frame = style.create_frame(canvas.context, 50)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -311,13 +348,21 @@ module Submissions
|
|||||||
|
|
||||||
events_data = submission.submission_events.sort_by(&:event_timestamp).map do |event|
|
events_data = submission.submission_events.sort_by(&:event_timestamp).map do |event|
|
||||||
submitter = submission.submitters.find { |e| e.id == event.submitter_id }
|
submitter = submission.submitters.find { |e| e.id == event.submitter_id }
|
||||||
|
|
||||||
|
text = SubmissionEvents::EVENT_NAMES[event.event_type.to_sym]
|
||||||
|
|
||||||
|
if event.event_type == 'invite_party' &&
|
||||||
|
(invited_submitter = submission.submitters.find { |e| e.uuid == event.data['uuid'] }) &&
|
||||||
|
(name = submission.template_submitters.find { |e| e['uuid'] == event.data['uuid'] }&.dig('name'))
|
||||||
|
text += ['', invited_submitter.name || invited_submitter.email || invited_submitter.phone, name].join(' ')
|
||||||
|
end
|
||||||
|
|
||||||
[
|
[
|
||||||
"#{I18n.l(event.event_timestamp.in_time_zone(account.timezone), format: :long, locale: account.locale)} " \
|
"#{I18n.l(event.event_timestamp.in_time_zone(account.timezone), format: :long, locale: account.locale)} " \
|
||||||
"#{TimeUtils.timezone_abbr(account.timezone, event.event_timestamp)}",
|
"#{TimeUtils.timezone_abbr(account.timezone, event.event_timestamp)}",
|
||||||
composer.document.layout.formatted_text_box(
|
composer.document.layout.formatted_text_box(
|
||||||
[
|
[
|
||||||
{ text: SubmissionEvents::EVENT_NAMES[event.event_type.to_sym],
|
{ text:, font: [FONT_NAME, { variant: :bold }] },
|
||||||
font: [FONT_NAME, { variant: :bold }] },
|
|
||||||
event.event_type.include?('send_') ? ' to ' : ' by ',
|
event.event_type.include?('send_') ? ' to ' : ' by ',
|
||||||
if event.event_type.include?('sms') || event.event_type.include?('phone')
|
if event.event_type.include?('sms') || event.event_type.include?('phone')
|
||||||
event.data['phone'] || submitter.phone
|
event.data['phone'] || submitter.phone
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ module Submissions
|
|||||||
pdfs_index.each_value do |pdf|
|
pdfs_index.each_value do |pdf|
|
||||||
next if pdf.trailer.info[:DocumentID].present?
|
next if pdf.trailer.info[:DocumentID].present?
|
||||||
|
|
||||||
|
font = pdf.fonts.add(FONT_NAME)
|
||||||
|
|
||||||
document_id = Digest::MD5.hexdigest(submitter.submission.slug).upcase
|
document_id = Digest::MD5.hexdigest(submitter.submission.slug).upcase
|
||||||
|
|
||||||
pdf.trailer.info[:DocumentID] = document_id
|
pdf.trailer.info[:DocumentID] = document_id
|
||||||
@@ -117,8 +119,6 @@ module Submissions
|
|||||||
font_size = (([page.box.width, page.box.height].min / A4_SIZE[0].to_f) * 9).to_i
|
font_size = (([page.box.width, page.box.height].min / A4_SIZE[0].to_f) * 9).to_i
|
||||||
cnv = page.canvas(type: :overlay)
|
cnv = page.canvas(type: :overlay)
|
||||||
|
|
||||||
cnv.font(FONT_NAME, size: font_size)
|
|
||||||
|
|
||||||
text =
|
text =
|
||||||
if submitter.account.testing?
|
if submitter.account.testing?
|
||||||
if with_signature_id
|
if with_signature_id
|
||||||
@@ -130,7 +130,17 @@ module Submissions
|
|||||||
"Document ID: #{document_id}"
|
"Document ID: #{document_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
cnv.text(text, at: [2, 4])
|
text = HexaPDF::Layout::TextFragment.create(
|
||||||
|
text, font:, font_size:, underlays: [
|
||||||
|
lambda do |canv, box|
|
||||||
|
canv.fill_color('white').rectangle(-1, 0, box.width + 2, box.height).fill
|
||||||
|
end
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
HexaPDF::Layout::TextLayouter.new(font:, font_size:)
|
||||||
|
.fit([text], page.box.width, page.box.height)
|
||||||
|
.draw(cnv, 1, font_size * 1.37)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -522,6 +532,8 @@ module Submissions
|
|||||||
begin
|
begin
|
||||||
pdf.acro_form.create_appearances(force: true) if pdf.acro_form && pdf.acro_form[:NeedAppearances]
|
pdf.acro_form.create_appearances(force: true) if pdf.acro_form && pdf.acro_form[:NeedAppearances]
|
||||||
pdf.acro_form&.flatten
|
pdf.acro_form&.flatten
|
||||||
|
rescue HexaPDF::MissingGlyphError
|
||||||
|
nil
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
Rollbar.error(e) if defined?(Rollbar)
|
Rollbar.error(e) if defined?(Rollbar)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,13 +48,15 @@ module Submissions
|
|||||||
|
|
||||||
submitters.each do |submitter|
|
submitters.each do |submitter|
|
||||||
submitter.values.each_value do |value|
|
submitter.values.each_value do |value|
|
||||||
attachment = attachments_index[value]
|
Array.wrap(value).each do |v|
|
||||||
|
attachment = attachments_index[v]
|
||||||
|
|
||||||
next unless attachment
|
next unless attachment
|
||||||
|
|
||||||
attachment.record = submitter
|
attachment.record = submitter
|
||||||
|
|
||||||
attachment.save!
|
attachment.save!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,12 +4,9 @@ module Submissions
|
|||||||
module SerializeForApi
|
module SerializeForApi
|
||||||
SERIALIZE_PARAMS = {
|
SERIALIZE_PARAMS = {
|
||||||
only: %i[id slug source submitters_order expire_at created_at updated_at archived_at],
|
only: %i[id slug source submitters_order expire_at created_at updated_at archived_at],
|
||||||
methods: %i[audit_log_url],
|
methods: %i[audit_log_url combined_document_url],
|
||||||
include: {
|
include: {
|
||||||
submitters: { only: %i[id slug uuid name email phone
|
submitters: { only: %i[id] },
|
||||||
completed_at opened_at sent_at
|
|
||||||
created_at updated_at external_id metadata],
|
|
||||||
methods: %i[status application_key] },
|
|
||||||
template: { only: %i[id name external_id created_at updated_at],
|
template: { only: %i[id name external_id created_at updated_at],
|
||||||
methods: %i[folder_name] },
|
methods: %i[folder_name] },
|
||||||
created_by_user: { only: %i[id email first_name last_name] }
|
created_by_user: { only: %i[id email first_name last_name] }
|
||||||
@@ -18,30 +15,35 @@ module Submissions
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def call(submission, submitters = nil, params = {})
|
def call(submission, submitters = nil, params = {}, with_events: true, with_documents: true, with_values: true)
|
||||||
submitters ||= submission.submitters.preload(documents_attachments: :blob, attachments_attachments: :blob)
|
submitters ||= submission.submitters.preload(documents_attachments: :blob, attachments_attachments: :blob)
|
||||||
|
|
||||||
serialized_submitters = submitters.map { |submitter| Submitters::SerializeForApi.call(submitter, params:) }
|
serialized_submitters = submitters.map do |submitter|
|
||||||
|
Submitters::SerializeForApi.call(submitter, with_documents:, with_events: false, with_values:, params:)
|
||||||
|
end
|
||||||
|
|
||||||
json = submission.as_json(
|
json = submission.as_json(SERIALIZE_PARAMS)
|
||||||
SERIALIZE_PARAMS.deep_merge(
|
|
||||||
include: { submission_events: { only: %i[id submitter_id event_type event_timestamp] } }
|
json['created_by_user'] ||= nil
|
||||||
)
|
|
||||||
)
|
if with_events
|
||||||
|
json['submission_events'] = Submitters::SerializeForApi.serialize_events(submission.submission_events)
|
||||||
|
end
|
||||||
|
|
||||||
|
json['combined_document_url'] ||= maybe_build_combined_url(submitters, submission, params)
|
||||||
|
|
||||||
if submitters.all?(&:completed_at?)
|
if submitters.all?(&:completed_at?)
|
||||||
last_submitter = submitters.max_by(&:completed_at)
|
last_submitter = submitters.max_by(&:completed_at)
|
||||||
|
|
||||||
if params[:include].to_s.include?('combined_document_url')
|
if with_documents
|
||||||
json[:combined_document_url] = build_combined_url(submitters.max_by(&:completed_at), submission)
|
json[:documents] = serialized_submitters.find { |e| e['id'] == last_submitter.id }['documents']
|
||||||
end
|
end
|
||||||
|
|
||||||
json[:documents] = serialized_submitters.find { |e| e['id'] == last_submitter.id }['documents']
|
|
||||||
json[:status] = 'completed'
|
json[:status] = 'completed'
|
||||||
json[:completed_at] = last_submitter.completed_at
|
json[:completed_at] = last_submitter.completed_at
|
||||||
else
|
else
|
||||||
json[:documents] = []
|
json[:documents] = [] if with_documents
|
||||||
json[:status] = submission.expired? ? 'expired' : 'pending'
|
json[:status] = build_status(submission, submitters)
|
||||||
json[:completed_at] = nil
|
json[:completed_at] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -50,13 +52,26 @@ module Submissions
|
|||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_combined_url(submitter, submission)
|
def build_status(submission, submitters)
|
||||||
return unless submitter.completed_at?
|
if submitters.any?(&:declined_at?)
|
||||||
|
'declined'
|
||||||
|
else
|
||||||
|
submission.expired? ? 'expired' : 'pending'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def maybe_build_combined_url(submitters, submission, params)
|
||||||
|
return unless submitters.all?(&:completed_at?)
|
||||||
|
|
||||||
attachment = submission.combined_document_attachment
|
attachment = submission.combined_document_attachment
|
||||||
attachment ||= Submissions::GenerateCombinedAttachment.call(submitter)
|
|
||||||
|
|
||||||
ActiveStorage::Blob.proxy_url(attachment.blob)
|
if !attachment && params[:include].to_s.include?('combined_document_url')
|
||||||
|
submitter = submitters.max_by(&:completed_at)
|
||||||
|
|
||||||
|
attachment = Submissions::GenerateCombinedAttachment.call(submitter)
|
||||||
|
end
|
||||||
|
|
||||||
|
ActiveStorage::Blob.proxy_url(attachment.blob) if attachment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -21,6 +21,12 @@ module Submitters
|
|||||||
end
|
end
|
||||||
|
|
||||||
def select_attachments_for_download(submitter)
|
def select_attachments_for_download(submitter)
|
||||||
|
if AccountConfig.exists?(account_id: submitter.submission.account_id,
|
||||||
|
key: AccountConfig::COMBINE_PDF_RESULT_KEY,
|
||||||
|
value: true) && submitter.submission.combined_document_attachment
|
||||||
|
return [submitter.submission.combined_document_attachment]
|
||||||
|
end
|
||||||
|
|
||||||
original_documents = submitter.submission.template.documents.preload(:blob)
|
original_documents = submitter.submission.template.documents.preload(:blob)
|
||||||
is_more_than_two_images = original_documents.count(&:image?) > 1
|
is_more_than_two_images = original_documents.count(&:image?) > 1
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ module Submitters
|
|||||||
module NormalizeValues
|
module NormalizeValues
|
||||||
CHECKSUM_CACHE_STORE = ActiveSupport::Cache::MemoryStore.new
|
CHECKSUM_CACHE_STORE = ActiveSupport::Cache::MemoryStore.new
|
||||||
|
|
||||||
|
BASE64_PREFIX_REGEXP = %r{\Adata:image/\w+;base64,}
|
||||||
|
|
||||||
BaseError = Class.new(StandardError)
|
BaseError = Class.new(StandardError)
|
||||||
|
|
||||||
UnknownFieldName = Class.new(BaseError)
|
UnknownFieldName = Class.new(BaseError)
|
||||||
InvalidDefaultValue = Class.new(BaseError)
|
InvalidDefaultValue = Class.new(BaseError)
|
||||||
UnknownSubmitterName = Class.new(BaseError)
|
UnknownSubmitterName = Class.new(BaseError)
|
||||||
UnableToDownload = Class.new(BaseError)
|
|
||||||
|
|
||||||
TRUE_VALUES = ['1', 'true', true, 'TRUE', 'True', 'yes', 'YES', 'Yes'].freeze
|
TRUE_VALUES = ['1', 'true', true, 'TRUE', 'True', 'yes', 'YES', 'Yes'].freeze
|
||||||
FALSE_VALUES = ['0', 'false', false, 'FALSE', 'False', 'no', 'NO', 'No'].freeze
|
FALSE_VALUES = ['0', 'false', false, 'FALSE', 'False', 'no', 'NO', 'No'].freeze
|
||||||
@@ -134,7 +135,8 @@ module Submitters
|
|||||||
find_or_create_blob_from_url(account, value)
|
find_or_create_blob_from_url(account, value)
|
||||||
elsif type.in?(%w[signature initials]) && value.length < 60
|
elsif type.in?(%w[signature initials]) && value.length < 60
|
||||||
find_or_create_blob_from_text(account, value, type)
|
find_or_create_blob_from_text(account, value, type)
|
||||||
elsif (data = Base64.decode64(value)) && Marcel::MimeType.for(data).include?('image')
|
elsif (data = Base64.decode64(value.sub(BASE64_PREFIX_REGEXP, ''))) &&
|
||||||
|
Marcel::MimeType.for(data).exclude?('octet-stream')
|
||||||
find_or_create_blob_from_base64(account, data, type)
|
find_or_create_blob_from_base64(account, data, type)
|
||||||
else
|
else
|
||||||
raise InvalidDefaultValue, "Invalid value, url, base64 or text < 60 chars is expected: #{value.first(200)}..."
|
raise InvalidDefaultValue, "Invalid value, url, base64 or text < 60 chars is expected: #{value.first(200)}..."
|
||||||
@@ -182,12 +184,7 @@ module Submitters
|
|||||||
|
|
||||||
return blob if blob
|
return blob if blob
|
||||||
|
|
||||||
uri = Addressable::URI.parse(url)
|
data = DownloadUtils.call(url).body
|
||||||
resp = conn.get(uri.display_uri.to_s)
|
|
||||||
|
|
||||||
raise UnableToDownload, "Error loading: #{uri.display_uri}" if resp.status >= 400
|
|
||||||
|
|
||||||
data = resp.body
|
|
||||||
|
|
||||||
checksum = Digest::MD5.base64digest(data)
|
checksum = Digest::MD5.base64digest(data)
|
||||||
|
|
||||||
@@ -212,11 +209,5 @@ module Submitters
|
|||||||
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def conn
|
|
||||||
Faraday.new do |faraday|
|
|
||||||
faraday.response :follow_redirects
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -3,19 +3,20 @@
|
|||||||
module Submitters
|
module Submitters
|
||||||
module SerializeForApi
|
module SerializeForApi
|
||||||
SERIALIZE_PARAMS = {
|
SERIALIZE_PARAMS = {
|
||||||
only: %i[id slug uuid name email phone completed_at external_id
|
only: %i[id slug uuid name email phone completed_at declined_at external_id
|
||||||
submission_id metadata opened_at sent_at created_at updated_at],
|
submission_id metadata opened_at sent_at created_at updated_at],
|
||||||
methods: %i[status application_key]
|
methods: %i[status application_key]
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def call(submitter, with_template: false, with_events: false, with_documents: true, with_urls: false, params: {})
|
def call(submitter, with_template: false, with_events: false, with_documents: true, with_urls: false,
|
||||||
|
with_values: true, params: {})
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [submitter],
|
records: [submitter],
|
||||||
associations: if with_documents
|
associations: if with_documents
|
||||||
[documents_attachments: :blob, attachments_attachments: :blob]
|
[documents_attachments: :blob, attachments_attachments: :blob]
|
||||||
else
|
elsif with_values
|
||||||
[attachments_attachments: :blob]
|
[attachments_attachments: :blob]
|
||||||
end
|
end
|
||||||
).call
|
).call
|
||||||
@@ -26,9 +27,10 @@ module Submitters
|
|||||||
additional_attrs['fields'] = SerializeForWebhook.build_fields_array(submitter)
|
additional_attrs['fields'] = SerializeForWebhook.build_fields_array(submitter)
|
||||||
end
|
end
|
||||||
|
|
||||||
additional_attrs['values'] = SerializeForWebhook.build_values_array(submitter)
|
additional_attrs['values'] = SerializeForWebhook.build_values_array(submitter) if with_values
|
||||||
additional_attrs['documents'] = SerializeForWebhook.build_documents_array(submitter) if with_documents
|
additional_attrs['documents'] = SerializeForWebhook.build_documents_array(submitter) if with_documents
|
||||||
additional_attrs['preferences'] = submitter.preferences.except('default_values')
|
additional_attrs['preferences'] = submitter.preferences.except('default_values')
|
||||||
|
additional_attrs['submission_events'] = serialize_events(submitter.submission_events) if with_events
|
||||||
|
|
||||||
additional_attrs['role'] =
|
additional_attrs['role'] =
|
||||||
(submitter.submission.template_submitters ||
|
(submitter.submission.template_submitters ||
|
||||||
@@ -41,9 +43,14 @@ module Submitters
|
|||||||
|
|
||||||
include_params = {}
|
include_params = {}
|
||||||
include_params[:template] = { only: %i[id name created_at updated_at] } if with_template
|
include_params[:template] = { only: %i[id name created_at updated_at] } if with_template
|
||||||
include_params[:submission_events] = { only: %i[id submitter_id event_type event_timestamp] } if with_events
|
|
||||||
|
|
||||||
submitter.as_json(SERIALIZE_PARAMS.merge(include: include_params)).merge(additional_attrs)
|
submitter.as_json(SERIALIZE_PARAMS.merge(include: include_params)).merge(additional_attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def serialize_events(events)
|
||||||
|
events.map do |event|
|
||||||
|
event.as_json(only: %i[id submitter_id event_type event_timestamp]).merge('data' => event.data.slice('reason'))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -5,7 +5,7 @@ module Submitters
|
|||||||
SERIALIZE_PARAMS = {
|
SERIALIZE_PARAMS = {
|
||||||
methods: %i[status application_key],
|
methods: %i[status application_key],
|
||||||
only: %i[id submission_id email phone name ua ip sent_at opened_at
|
only: %i[id submission_id email phone name ua ip sent_at opened_at
|
||||||
completed_at created_at updated_at external_id metadata]
|
completed_at declined_at created_at updated_at external_id metadata]
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
@@ -22,8 +22,12 @@ module Submitters
|
|||||||
submitter_name = (submitter.submission.template_submitters ||
|
submitter_name = (submitter.submission.template_submitters ||
|
||||||
submitter.submission.template.submitters).find { |e| e['uuid'] == submitter.uuid }['name']
|
submitter.submission.template.submitters).find { |e| e['uuid'] == submitter.uuid }['name']
|
||||||
|
|
||||||
|
decline_reason =
|
||||||
|
submitter.declined_at? ? submitter.submission_events.find_by(event_type: :decline_form).data['reason'] : nil
|
||||||
|
|
||||||
submitter.as_json(SERIALIZE_PARAMS)
|
submitter.as_json(SERIALIZE_PARAMS)
|
||||||
.merge('role' => submitter_name,
|
.merge('decline_reason' => decline_reason,
|
||||||
|
'role' => submitter_name,
|
||||||
'preferences' => submitter.preferences.except('default_values'),
|
'preferences' => submitter.preferences.except('default_values'),
|
||||||
'values' => values,
|
'values' => values,
|
||||||
'documents' => documents,
|
'documents' => documents,
|
||||||
@@ -33,8 +37,8 @@ module Submitters
|
|||||||
'template' => submitter.template.as_json(only: %i[id name external_id created_at updated_at],
|
'template' => submitter.template.as_json(only: %i[id name external_id created_at updated_at],
|
||||||
methods: %i[folder_name]),
|
methods: %i[folder_name]),
|
||||||
'submission' => {
|
'submission' => {
|
||||||
**submitter.submission.slice(:id, :audit_log_url, :created_at),
|
**submitter.submission.slice(:id, :audit_log_url, :combined_document_url, :created_at),
|
||||||
status: submitter.submission.submitters.all?(&:completed_at?) ? 'completed' : 'pending',
|
status: build_submission_status(submitter.submission),
|
||||||
url: r.submissions_preview_url(submitter.submission.slug, **Docuseal.default_url_options)
|
url: r.submissions_preview_url(submitter.submission.slug, **Docuseal.default_url_options)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -79,7 +83,19 @@ module Submitters
|
|||||||
|
|
||||||
value = fetch_field_value(field, submitter.values[field['uuid']], attachments_index)
|
value = fetch_field_value(field, submitter.values[field['uuid']], attachments_index)
|
||||||
|
|
||||||
{ name: field_name, uuid: field['uuid'], value: }
|
{ name: field_name, uuid: field['uuid'], value:, readonly: field['readonly'] == true }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_submission_status(submission)
|
||||||
|
submitters = submission.submitters
|
||||||
|
|
||||||
|
if submitters.all?(&:completed_at?)
|
||||||
|
'completed'
|
||||||
|
elsif submitters.any?(&:declined_at?)
|
||||||
|
'declined'
|
||||||
|
else
|
||||||
|
submission.expired? ? 'expired' : 'pending'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -23,4 +23,11 @@ module Templates
|
|||||||
|
|
||||||
templates.where(Template.arel_table[:name].lower.matches("%#{keyword.downcase}%"))
|
templates.where(Template.arel_table[:name].lower.matches("%#{keyword.downcase}%"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filter_undefined_submitters(template)
|
||||||
|
template.submitters.to_a.select do |item|
|
||||||
|
item['invite_by_uuid'].blank? && item['linked_to_uuid'].blank? &&
|
||||||
|
item['is_requester'].blank? && item['email'].blank?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -3,11 +3,13 @@
|
|||||||
module Templates
|
module Templates
|
||||||
module ProcessDocument
|
module ProcessDocument
|
||||||
DPI = 200
|
DPI = 200
|
||||||
FORMAT = '.jpg'
|
FORMAT = '.png'
|
||||||
ATTACHMENT_NAME = 'preview_images'
|
ATTACHMENT_NAME = 'preview_images'
|
||||||
|
|
||||||
PDF_CONTENT_TYPE = 'application/pdf'
|
PDF_CONTENT_TYPE = 'application/pdf'
|
||||||
Q = ENV.fetch('PAGE_QUALITY', '35').to_i
|
CONCURRENCY = 2
|
||||||
|
Q = 95
|
||||||
|
JPEG_Q = ENV.fetch('PAGE_QUALITY', '35').to_i
|
||||||
MAX_WIDTH = 1400
|
MAX_WIDTH = 1400
|
||||||
MAX_NUMBER_OF_PAGES_PROCESSED = 15
|
MAX_NUMBER_OF_PAGES_PROCESSED = 15
|
||||||
MAX_FLATTEN_FILE_SIZE = 20.megabytes
|
MAX_FLATTEN_FILE_SIZE = 20.megabytes
|
||||||
@@ -39,7 +41,10 @@ module Templates
|
|||||||
image = Vips::Image.new_from_buffer(data, '')
|
image = Vips::Image.new_from_buffer(data, '')
|
||||||
image = image.autorot.resize(MAX_WIDTH / image.width.to_f)
|
image = image.autorot.resize(MAX_WIDTH / image.width.to_f)
|
||||||
|
|
||||||
io = StringIO.new(image.write_to_buffer(FORMAT, Q: Q, interlace: true))
|
bitdepth = 2**image.stats.to_a[1..3].pluck(2).uniq.size
|
||||||
|
|
||||||
|
io = StringIO.new(image.write_to_buffer(FORMAT, compression: 7, filter: 0, bitdepth:,
|
||||||
|
palette: true, Q: Q, dither: 0))
|
||||||
|
|
||||||
ActiveStorage::Attachment.create!(
|
ActiveStorage::Attachment.create!(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(
|
blob: ActiveStorage::Blob.create_and_upload!(
|
||||||
@@ -62,27 +67,49 @@ module Templates
|
|||||||
attachment.metadata['pdf'] ||= {}
|
attachment.metadata['pdf'] ||= {}
|
||||||
attachment.metadata['pdf']['number_of_pages'] = number_of_pages
|
attachment.metadata['pdf']['number_of_pages'] = number_of_pages
|
||||||
|
|
||||||
attachment.save!
|
ApplicationRecord.no_touching do
|
||||||
|
attachment.save!
|
||||||
|
end
|
||||||
|
|
||||||
max_pages_to_process = data.size < GENERATE_PREVIEW_SIZE_LIMIT ? MAX_NUMBER_OF_PAGES_PROCESSED : 1
|
max_pages_to_process = data.size < GENERATE_PREVIEW_SIZE_LIMIT ? MAX_NUMBER_OF_PAGES_PROCESSED : 1
|
||||||
|
|
||||||
(0..[number_of_pages - 1, max_pages_to_process].min).each do |page_number|
|
pool = Concurrent::FixedThreadPool.new(CONCURRENCY)
|
||||||
page = Vips::Image.new_from_buffer(data, '', dpi: DPI, page: page_number)
|
|
||||||
page = page.resize(MAX_WIDTH / page.width.to_f)
|
|
||||||
|
|
||||||
io = StringIO.new(page.write_to_buffer(FORMAT, Q: Q, interlace: true))
|
promises =
|
||||||
|
(0..[number_of_pages - 1, max_pages_to_process].min).map do |page_number|
|
||||||
|
Concurrent::Promise.execute(executor: pool) { build_and_upload_blob(data, page_number) }
|
||||||
|
end
|
||||||
|
|
||||||
|
Concurrent::Promise.zip(*promises).value!.each do |blob|
|
||||||
ApplicationRecord.no_touching do
|
ApplicationRecord.no_touching do
|
||||||
ActiveStorage::Attachment.create!(
|
ActiveStorage::Attachment.create!(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(
|
blob:,
|
||||||
io:, filename: "#{page_number}#{FORMAT}",
|
|
||||||
metadata: { analyzed: true, identified: true, width: page.width, height: page.height }
|
|
||||||
),
|
|
||||||
name: ATTACHMENT_NAME,
|
name: ATTACHMENT_NAME,
|
||||||
record: attachment
|
record: attachment
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pool.kill
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_and_upload_blob(data, page_number)
|
||||||
|
page = Vips::Image.new_from_buffer(data, '', dpi: DPI, page: page_number)
|
||||||
|
page = page.resize(MAX_WIDTH / page.width.to_f)
|
||||||
|
|
||||||
|
bitdepth = 2**page.stats.to_a[1..3].pluck(2).uniq.size
|
||||||
|
|
||||||
|
io = StringIO.new(page.write_to_buffer(FORMAT, compression: 7, filter: 0, bitdepth:,
|
||||||
|
palette: true, Q: Q, dither: 0))
|
||||||
|
|
||||||
|
blob = ActiveStorage::Blob.new(
|
||||||
|
filename: "#{page_number}#{FORMAT}",
|
||||||
|
metadata: { analyzed: true, identified: true, width: page.width, height: page.height }
|
||||||
|
)
|
||||||
|
|
||||||
|
blob.upload(io)
|
||||||
|
|
||||||
|
blob
|
||||||
end
|
end
|
||||||
|
|
||||||
def maybe_flatten_form(data, pdf)
|
def maybe_flatten_form(data, pdf)
|
||||||
@@ -97,11 +124,9 @@ module Templates
|
|||||||
pdf.write(io, incremental: false, validate: false)
|
pdf.write(io, incremental: false, validate: false)
|
||||||
|
|
||||||
io.string
|
io.string
|
||||||
rescue StandardError => e
|
rescue StandardError
|
||||||
raise if Rails.env.development?
|
raise if Rails.env.development?
|
||||||
|
|
||||||
Rollbar.error(e) if defined?(Rollbar)
|
|
||||||
|
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -121,7 +146,7 @@ module Templates
|
|||||||
io = StringIO.new
|
io = StringIO.new
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
'pdftocairo', '-jpeg', '-jpegopt', "progressive=y,quality=#{Q},optimize=y",
|
'pdftocairo', '-jpeg', '-jpegopt', "progressive=y,quality=#{JPEG_Q},optimize=y",
|
||||||
'-scale-to-x', MAX_WIDTH, '-scale-to-y', '-1',
|
'-scale-to-x', MAX_WIDTH, '-scale-to-y', '-1',
|
||||||
'-r', DPI, '-f', page_number + 1, '-l', page_number + 1,
|
'-r', DPI, '-f', page_number + 1, '-l', page_number + 1,
|
||||||
'-singlefile', Shellwords.escape(file_path), '-'
|
'-singlefile', Shellwords.escape(file_path), '-'
|
||||||
@@ -140,7 +165,7 @@ module Templates
|
|||||||
ApplicationRecord.no_touching do
|
ApplicationRecord.no_touching do
|
||||||
ActiveStorage::Attachment.create!(
|
ActiveStorage::Attachment.create!(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(
|
blob: ActiveStorage::Blob.create_and_upload!(
|
||||||
io:, filename: "#{page_number}#{FORMAT}",
|
io:, filename: "#{page_number}.jpg",
|
||||||
metadata: { analyzed: true, identified: true, width: page.width, height: page.height }
|
metadata: { analyzed: true, identified: true, width: page.width, height: page.height }
|
||||||
),
|
),
|
||||||
name: ATTACHMENT_NAME,
|
name: ATTACHMENT_NAME,
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
module Templates
|
module Templates
|
||||||
module SerializeForApi
|
module SerializeForApi
|
||||||
SERIALIZE_PARAMS = {
|
SERIALIZE_PARAMS = {
|
||||||
|
only: %w[
|
||||||
|
id archived_at fields name preferences schema
|
||||||
|
slug source submitters created_at updated_at
|
||||||
|
author_id external_id folder_id
|
||||||
|
],
|
||||||
methods: %i[application_key folder_name],
|
methods: %i[application_key folder_name],
|
||||||
include: { author: { only: %i[id email first_name last_name] } }
|
include: { author: { only: %i[id email first_name last_name] } }
|
||||||
}.freeze
|
}.freeze
|
||||||
@@ -14,7 +19,7 @@ module Templates
|
|||||||
|
|
||||||
preview_image_attachments ||=
|
preview_image_attachments ||=
|
||||||
ActiveStorage::Attachment.joins(:blob)
|
ActiveStorage::Attachment.joins(:blob)
|
||||||
.where(blob: { filename: '0.jpg' })
|
.where(blob: { filename: ['0.jpg', '0.png'] })
|
||||||
.where(record_id: schema_documents.map(&:id),
|
.where(record_id: schema_documents.map(&:id),
|
||||||
record_type: 'ActiveStorage::Attachment',
|
record_type: 'ActiveStorage::Attachment',
|
||||||
name: :preview_images)
|
name: :preview_images)
|
||||||
@@ -24,7 +29,7 @@ module Templates
|
|||||||
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }
|
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }
|
||||||
|
|
||||||
first_page_blob = preview_image_attachments.find { |e| e.record_id == attachment.id }&.blob
|
first_page_blob = preview_image_attachments.find { |e| e.record_id == attachment.id }&.blob
|
||||||
first_page_blob ||= attachment.preview_images.joins(:blob).find_by(blob: { filename: '0.jpg' })&.blob
|
first_page_blob ||= attachment.preview_images.joins(:blob).find_by(blob: { filename: ['0.jpg', '0.png'] })&.blob
|
||||||
|
|
||||||
{
|
{
|
||||||
id: attachment.id,
|
id: attachment.id,
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@
|
|||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"vue": "^3.3.2",
|
"vue": "^3.3.2",
|
||||||
"vue-loader": "^17.1.1",
|
"vue-loader": "^17.1.1",
|
||||||
"webpack": "5.82.1",
|
"webpack": "5.94.0",
|
||||||
"webpack-assets-manifest": "5",
|
"webpack-assets-manifest": "5",
|
||||||
"webpack-bundle-analyzer": "^4.7.0",
|
"webpack-bundle-analyzer": "^4.7.0",
|
||||||
"webpack-cli": "5.1.1",
|
"webpack-cli": "5.1.1",
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :submission_event do
|
||||||
|
submission
|
||||||
|
submitter
|
||||||
|
event_type { 'view_form' }
|
||||||
|
event_timestamp { Time.zone.now }
|
||||||
|
data do
|
||||||
|
{
|
||||||
|
ip: Faker::Internet.ip_v4_address,
|
||||||
|
ua: Faker::Internet.user_agent,
|
||||||
|
sid: SecureRandom.base58(10),
|
||||||
|
uid: Faker::Number.number(digits: 4)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,5 +11,23 @@ FactoryBot.define do
|
|||||||
submission.template_schema = submission.template.schema
|
submission.template_schema = submission.template.schema
|
||||||
submission.template_submitters = submission.template.submitters
|
submission.template_submitters = submission.template.submitters
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trait :with_submitters do
|
||||||
|
after(:create) do |submission, _|
|
||||||
|
submission.template_submitters.each do |template_submitter|
|
||||||
|
create(:submitter, submission:,
|
||||||
|
account_id: submission.account_id,
|
||||||
|
uuid: template_submitter['uuid'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
trait :with_events do
|
||||||
|
after(:create) do |submission, _|
|
||||||
|
submission.submitters.each do |submitter|
|
||||||
|
create(:submission_event, submission:, submitter:)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -4,6 +4,8 @@ FactoryBot.define do
|
|||||||
factory :submitter do
|
factory :submitter do
|
||||||
submission
|
submission
|
||||||
email { Faker::Internet.email }
|
email { Faker::Internet.email }
|
||||||
|
name { Faker::Name.name }
|
||||||
|
phone { Faker::PhoneNumber.phone_number }
|
||||||
|
|
||||||
before(:create) do |submitter, _|
|
before(:create) do |submitter, _|
|
||||||
submitter.account_id = submitter.submission.account_id
|
submitter.account_id = submitter.submission.account_id
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ class SubmitterMailerPreview < ActionMailer::Preview
|
|||||||
SubmitterMailer.completed_email(submitter, User.last)
|
SubmitterMailer.completed_email(submitter, User.last)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def declined_email
|
||||||
|
submitter = Submitter.where.not(declined_at: nil).last
|
||||||
|
|
||||||
|
SubmitterMailer.declined_email(submitter, User.last)
|
||||||
|
end
|
||||||
|
|
||||||
def documents_copy_email
|
def documents_copy_email
|
||||||
submitter = Submitter.where.not(completed_at: nil).joins(:documents_attachments).last
|
submitter = Submitter.where.not(completed_at: nil).joins(:documents_attachments).last
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,247 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe 'Submission API', type: :request do
|
||||||
|
let!(:account) { create(:account) }
|
||||||
|
let!(:author) { create(:user, account:) }
|
||||||
|
let!(:folder) { create(:template_folder, account:) }
|
||||||
|
let!(:templates) { create_list(:template, 2, account:, author:, folder:) }
|
||||||
|
|
||||||
|
describe 'GET /api/submissions' do
|
||||||
|
it 'returns a list of submissions' do
|
||||||
|
submissions = [
|
||||||
|
create(:submission, :with_submitters,
|
||||||
|
template: templates[0],
|
||||||
|
created_by_user: author),
|
||||||
|
create(:submission, :with_submitters,
|
||||||
|
template: templates[1],
|
||||||
|
created_by_user: author)
|
||||||
|
].reverse
|
||||||
|
|
||||||
|
get '/api/submissions', headers: { 'x-auth-token': author.access_token.token }
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
expect(response.parsed_body['pagination']).to eq(JSON.parse({
|
||||||
|
count: submissions.size,
|
||||||
|
next: submissions.last.id,
|
||||||
|
prev: submissions.first.id
|
||||||
|
}.to_json))
|
||||||
|
expect(response.parsed_body['data']).to eq(JSON.parse(submissions.map { |t| index_submission_body(t) }.to_json))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET /api/submissions/:id' do
|
||||||
|
it 'returns a submission' do
|
||||||
|
submission = create(:submission, :with_submitters, :with_events, template: templates[0], created_by_user: author)
|
||||||
|
|
||||||
|
get "/api/submissions/#{submission.id}", headers: { 'x-auth-token': author.access_token.token }
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
expect(response.parsed_body).to eq(JSON.parse(show_submission_body(submission).to_json))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'POST /api/submissions' do
|
||||||
|
it 'creates a submission' do
|
||||||
|
post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: {
|
||||||
|
template_id: templates[0].id,
|
||||||
|
send_email: true,
|
||||||
|
submitters: [{ role: 'First Role', email: 'john.doe@example.com' }]
|
||||||
|
}.to_json
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
submission = Submission.last
|
||||||
|
|
||||||
|
expect(response.parsed_body).to eq(JSON.parse(create_submission_body(submission).to_json))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'POST /api/submissions/emails' do
|
||||||
|
it 'creates a submission using email' do
|
||||||
|
post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: {
|
||||||
|
template_id: templates[0].id,
|
||||||
|
emails: 'john.doe@example.com'
|
||||||
|
}.to_json
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
submission = Submission.last
|
||||||
|
|
||||||
|
expect(response.parsed_body).to eq(JSON.parse(create_submission_body(submission).to_json))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'DELETE /api/submissions/:id' do
|
||||||
|
it 'archives a submission' do
|
||||||
|
submission = create(:submission, :with_submitters, template: templates[0], created_by_user: author)
|
||||||
|
|
||||||
|
delete "/api/submissions/#{submission.id}", headers: { 'x-auth-token': author.access_token.token }
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
submission.reload
|
||||||
|
|
||||||
|
expect(submission.archived_at).not_to be_nil
|
||||||
|
expect(response.parsed_body).to eq(JSON.parse({
|
||||||
|
id: submission.id,
|
||||||
|
archived_at: submission.archived_at
|
||||||
|
}.to_json))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def index_submission_body(submission)
|
||||||
|
submitters = submission.submitters.map do |submitter|
|
||||||
|
{
|
||||||
|
id: submitter.id,
|
||||||
|
submission_id: submission.id,
|
||||||
|
uuid: submitter.uuid,
|
||||||
|
email: submitter.email,
|
||||||
|
slug: submitter.slug,
|
||||||
|
sent_at: submitter.sent_at,
|
||||||
|
opened_at: submitter.opened_at,
|
||||||
|
completed_at: submitter.completed_at,
|
||||||
|
declined_at: nil,
|
||||||
|
created_at: submitter.created_at,
|
||||||
|
updated_at: submitter.updated_at,
|
||||||
|
name: submitter.name,
|
||||||
|
phone: submitter.phone,
|
||||||
|
status: submitter.status,
|
||||||
|
role: submitter.template.submitters.find { |s| s['uuid'] == submitter.uuid }['name'],
|
||||||
|
external_id: nil,
|
||||||
|
application_key: nil, # Backward compatibility
|
||||||
|
metadata: {},
|
||||||
|
preferences: {}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
{
|
||||||
|
id: submission.id,
|
||||||
|
source: 'link',
|
||||||
|
submitters_order: 'random',
|
||||||
|
slug: submission.slug,
|
||||||
|
audit_log_url: nil,
|
||||||
|
combined_document_url: nil,
|
||||||
|
expire_at: nil,
|
||||||
|
completed_at: nil,
|
||||||
|
created_at: submission.created_at,
|
||||||
|
updated_at: submission.updated_at,
|
||||||
|
archived_at: nil,
|
||||||
|
status: 'pending',
|
||||||
|
submitters:,
|
||||||
|
template: {
|
||||||
|
id: submission.template.id,
|
||||||
|
name: submission.template.name,
|
||||||
|
external_id: nil,
|
||||||
|
folder_name: folder.name,
|
||||||
|
created_at: submission.template.created_at,
|
||||||
|
updated_at: submission.template.updated_at
|
||||||
|
},
|
||||||
|
created_by_user: {
|
||||||
|
id: author.id,
|
||||||
|
first_name: author.first_name,
|
||||||
|
last_name: author.last_name,
|
||||||
|
email: author.email
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_submission_body(submission)
|
||||||
|
submitters = submission.submitters.map do |submitter|
|
||||||
|
{
|
||||||
|
id: submitter.id,
|
||||||
|
submission_id: submission.id,
|
||||||
|
uuid: submitter.uuid,
|
||||||
|
email: submitter.email,
|
||||||
|
slug: submitter.slug,
|
||||||
|
sent_at: submitter.sent_at,
|
||||||
|
opened_at: submitter.opened_at,
|
||||||
|
completed_at: submitter.completed_at,
|
||||||
|
declined_at: nil,
|
||||||
|
created_at: submitter.created_at,
|
||||||
|
updated_at: submitter.updated_at,
|
||||||
|
name: submitter.name,
|
||||||
|
phone: submitter.phone,
|
||||||
|
status: submitter.status,
|
||||||
|
external_id: nil,
|
||||||
|
application_key: nil, # Backward compatibility
|
||||||
|
metadata: {},
|
||||||
|
preferences: {},
|
||||||
|
role: submitter.template.submitters.find { |s| s['uuid'] == submitter.uuid }['name'],
|
||||||
|
documents: [],
|
||||||
|
values: []
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
{
|
||||||
|
id: submission.id,
|
||||||
|
source: 'link',
|
||||||
|
status: 'pending',
|
||||||
|
submitters_order: 'random',
|
||||||
|
slug: submission.slug,
|
||||||
|
audit_log_url: nil,
|
||||||
|
combined_document_url: nil,
|
||||||
|
expire_at: nil,
|
||||||
|
completed_at: nil,
|
||||||
|
created_at: submission.created_at,
|
||||||
|
updated_at: submission.updated_at,
|
||||||
|
archived_at: nil,
|
||||||
|
submitters:,
|
||||||
|
template: {
|
||||||
|
id: submission.template.id,
|
||||||
|
name: submission.template.name,
|
||||||
|
external_id: nil,
|
||||||
|
folder_name: folder.name,
|
||||||
|
created_at: submission.template.created_at,
|
||||||
|
updated_at: submission.template.updated_at
|
||||||
|
},
|
||||||
|
created_by_user: {
|
||||||
|
id: author.id,
|
||||||
|
first_name: author.first_name,
|
||||||
|
last_name: author.last_name,
|
||||||
|
email: author.email
|
||||||
|
},
|
||||||
|
documents: [],
|
||||||
|
submission_events: submission.submission_events.map do |event|
|
||||||
|
{
|
||||||
|
id: event.id,
|
||||||
|
submitter_id: event.submitter_id,
|
||||||
|
event_type: event.event_type,
|
||||||
|
event_timestamp: event.event_timestamp,
|
||||||
|
data: event.data.slice(:reason)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_submission_body(submission)
|
||||||
|
submission.submitters.map do |submitter|
|
||||||
|
{
|
||||||
|
id: submitter.id,
|
||||||
|
submission_id: submission.id,
|
||||||
|
uuid: submitter.uuid,
|
||||||
|
email: submitter.email,
|
||||||
|
slug: submitter.slug,
|
||||||
|
sent_at: submitter.sent_at,
|
||||||
|
opened_at: submitter.opened_at,
|
||||||
|
completed_at: submitter.completed_at,
|
||||||
|
declined_at: nil,
|
||||||
|
created_at: submitter.created_at,
|
||||||
|
updated_at: submitter.updated_at,
|
||||||
|
name: submitter.name,
|
||||||
|
phone: submitter.phone,
|
||||||
|
status: submitter.status,
|
||||||
|
external_id: nil,
|
||||||
|
application_key: nil, # Backward compatibility
|
||||||
|
metadata: {},
|
||||||
|
preferences: { send_email: true, send_sms: false },
|
||||||
|
role: submitter.template.submitters.find { |s| s['uuid'] == submitter.uuid }['name'],
|
||||||
|
embed_src: "#{Docuseal::DEFAULT_APP_URL}/s/#{submitter.slug}",
|
||||||
|
values: []
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user