mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 22:42:32 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
478167ea4f | ||
|
|
6b1c3bba19 | ||
|
|
73841f751c | ||
|
|
22dbe3291f | ||
|
|
1dac3fe434 | ||
|
|
d0c49ac04c | ||
|
|
3877dbf83f | ||
|
|
d15fd1fb84 | ||
|
|
0a105490fe | ||
|
|
0bd35b526c | ||
|
|
3a2910f717 | ||
|
|
c4a91c2b34 | ||
|
|
5643380916 | ||
|
|
cf6b378ccb | ||
|
|
66bc8cfb5f | ||
|
|
994bd1fe5c | ||
|
|
12528b6527 | ||
|
|
d135c93939 | ||
|
|
637011d55a | ||
|
|
b94e6bf54a | ||
|
|
8f975c2898 | ||
|
|
d25c4fa766 | ||
|
|
43db15b350 | ||
|
|
09074e2ac0 | ||
|
|
04295f4540 | ||
|
|
11c48a495f | ||
|
|
942c961cd1 | ||
|
|
9193511d5f |
No files matched your search
@@ -79,6 +79,3 @@ Rails/ApplicationController:
|
|||||||
|
|
||||||
Rails/Output:
|
Rails/Output:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Capybara/ClickLinkOrButtonStyle:
|
|
||||||
Enabled: false
|
|
||||||
+2
-11
@@ -469,10 +469,6 @@ GEM
|
|||||||
unicode-display_width (>= 2.4.0, < 3.0)
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
rubocop-ast (1.31.3)
|
rubocop-ast (1.31.3)
|
||||||
parser (>= 3.3.1.0)
|
parser (>= 3.3.1.0)
|
||||||
rubocop-capybara (2.20.0)
|
|
||||||
rubocop (~> 1.41)
|
|
||||||
rubocop-factory_bot (2.25.1)
|
|
||||||
rubocop (~> 1.41)
|
|
||||||
rubocop-performance (1.21.0)
|
rubocop-performance (1.21.0)
|
||||||
rubocop (>= 1.48.1, < 2.0)
|
rubocop (>= 1.48.1, < 2.0)
|
||||||
rubocop-ast (>= 1.31.1, < 2.0)
|
rubocop-ast (>= 1.31.1, < 2.0)
|
||||||
@@ -481,13 +477,8 @@ GEM
|
|||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.33.0, < 2.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
rubocop-ast (>= 1.31.1, < 2.0)
|
rubocop-ast (>= 1.31.1, < 2.0)
|
||||||
rubocop-rspec (2.29.1)
|
rubocop-rspec (3.0.3)
|
||||||
rubocop (~> 1.40)
|
rubocop (~> 1.61)
|
||||||
rubocop-capybara (~> 2.17)
|
|
||||||
rubocop-factory_bot (~> 2.22)
|
|
||||||
rubocop-rspec_rails (~> 2.28)
|
|
||||||
rubocop-rspec_rails (2.28.3)
|
|
||||||
rubocop (~> 1.40)
|
|
||||||
ruby-progressbar (1.13.0)
|
ruby-progressbar (1.13.0)
|
||||||
ruby-vips (2.2.1)
|
ruby-vips (2.2.1)
|
||||||
ffi (~> 1.12)
|
ffi (~> 1.12)
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class AccountConfigsController < ApplicationController
|
|||||||
AccountConfig::FORM_WITH_CONFETTI_KEY,
|
AccountConfig::FORM_WITH_CONFETTI_KEY,
|
||||||
AccountConfig::DOWNLOAD_LINKS_AUTH_KEY,
|
AccountConfig::DOWNLOAD_LINKS_AUTH_KEY,
|
||||||
AccountConfig::FORCE_SSO_AUTH_KEY,
|
AccountConfig::FORCE_SSO_AUTH_KEY,
|
||||||
AccountConfig::FLATTEN_RESULT_PDF_KEY
|
AccountConfig::FLATTEN_RESULT_PDF_KEY,
|
||||||
|
AccountConfig::WITH_SIGNATURE_ID
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
InvalidKey = Class.new(StandardError)
|
InvalidKey = Class.new(StandardError)
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ class AccountsController < ApplicationController
|
|||||||
'fr-FR' => 'French (France)',
|
'fr-FR' => 'French (France)',
|
||||||
'es-ES' => 'Spanish (Spain)',
|
'es-ES' => 'Spanish (Spain)',
|
||||||
'pt-PT' => 'Portuguese (Portugal)',
|
'pt-PT' => 'Portuguese (Portugal)',
|
||||||
'de-DE' => 'German (Germany)'
|
'de-DE' => 'German (Germany)',
|
||||||
|
'it-IT' => 'Italian (Italy)'
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
before_action :load_account
|
before_action :load_account
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module Api
|
|||||||
cookies.encrypted[:signature_uuids] = build_new_cookie_signatures_json(submitter, attachment)
|
cookies.encrypted[:signature_uuids] = build_new_cookie_signatures_json(submitter, attachment)
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: attachment.as_json(only: %i[uuid], methods: %i[url filename content_type])
|
render json: attachment.as_json(only: %i[uuid created_at], methods: %i[url filename content_type])
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_new_cookie_signatures_json(submitter, attachment)
|
def build_new_cookie_signatures_json(submitter, attachment)
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ module Api
|
|||||||
def submissions_params
|
def submissions_params
|
||||||
permitted_attrs = [
|
permitted_attrs = [
|
||||||
:send_email, :send_sms, :bcc_completed, :completed_redirect_url, :reply_to, :go_to_last,
|
:send_email, :send_sms, :bcc_completed, :completed_redirect_url, :reply_to, :go_to_last,
|
||||||
|
:expire_at,
|
||||||
{
|
{
|
||||||
message: %i[subject body],
|
message: %i[subject body],
|
||||||
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
|
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class EmbedScriptsController < ActionController::Metal
|
||||||
|
DUMMY_SCRIPT = <<~JAVASCRIPT.freeze
|
||||||
|
const DummyBuilder = class extends HTMLElement {
|
||||||
|
connectedCallback() {
|
||||||
|
this.innerHTML = `
|
||||||
|
<div style="text-align: center; padding: 20px; font-family: Arial, sans-serif;">
|
||||||
|
<h2>Upgrade to Pro</h2>
|
||||||
|
<p>Unlock embedded components by upgrading to Pro</p>
|
||||||
|
<div style="margin-top: 40px;">
|
||||||
|
<a href="#{Docuseal::CONSOLE_URL}/on_premise" target="_blank" style="padding: 15px 25px; background-color: #222; color: white; text-decoration: none; border-radius: 5px; font-size: 16px; cursor: pointer;">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const DummyForm = class extends DummyBuilder {};
|
||||||
|
|
||||||
|
if (!window.customElements.get('docuseal-builder')) {
|
||||||
|
window.customElements.define('docuseal-builder', DummyBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window.customElements.get('docuseal-form')) {
|
||||||
|
window.customElements.define('docuseal-form', DummyForm);
|
||||||
|
}
|
||||||
|
JAVASCRIPT
|
||||||
|
|
||||||
|
def show
|
||||||
|
headers['Content-Type'] = 'application/javascript'
|
||||||
|
|
||||||
|
self.response_body = DUMMY_SCRIPT
|
||||||
|
|
||||||
|
self.status = 200
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -17,7 +17,8 @@ class StartFormController < ApplicationController
|
|||||||
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(archived_at: nil))
|
@submitter = Submitter.where(submission: @template.submissions.where(expire_at: Time.current..)
|
||||||
|
.or(@template.submissions.where(expire_at: nil)).where(archived_at: nil))
|
||||||
.order(id: :desc)
|
.order(id: :desc)
|
||||||
.then { |rel| params[:resubmit].present? ? rel.where(completed_at: nil) : rel }
|
.then { |rel| params[:resubmit].present? ? rel.where(completed_at: nil) : rel }
|
||||||
.find_or_initialize_by(**submitter_params.compact_blank)
|
.find_or_initialize_by(**submitter_params.compact_blank)
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ class SubmissionsController < ApplicationController
|
|||||||
if params[:permanently].present?
|
if params[:permanently].present?
|
||||||
@submission.destroy!
|
@submission.destroy!
|
||||||
|
|
||||||
Rollbar.info("Remove submission: #{@submission.id}") if defined?(Rollbar)
|
|
||||||
|
|
||||||
'Submission has been removed'
|
'Submission has been removed'
|
||||||
else
|
else
|
||||||
@submission.update!(archived_at: Time.current)
|
@submission.update!(archived_at: Time.current)
|
||||||
|
|||||||
@@ -8,28 +8,15 @@ class SubmitFormController < ApplicationController
|
|||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
CONFIG_KEYS = [].freeze
|
CONFIG_KEYS = [].freeze
|
||||||
PRELOAD_ALL_PAGES_AMOUNT = 200
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@submitter = Submitter.find_by!(slug: params[:slug])
|
@submitter = Submitter.find_by!(slug: params[:slug])
|
||||||
|
|
||||||
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?
|
||||||
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
Submitters.preload_with_pages(@submitter)
|
||||||
records: [@submitter],
|
|
||||||
associations: [submission: [:template, { template_schema_documents: :blob }]]
|
|
||||||
).call
|
|
||||||
|
|
||||||
total_pages =
|
|
||||||
@submitter.submission.template_schema_documents.sum { |e| e.metadata.dig('pdf', 'number_of_pages').to_i }
|
|
||||||
|
|
||||||
if total_pages < PRELOAD_ALL_PAGES_AMOUNT
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
|
||||||
records: @submitter.submission.template_schema_documents,
|
|
||||||
associations: [:blob, { preview_images_attachments: :blob }]
|
|
||||||
).call
|
|
||||||
end
|
|
||||||
|
|
||||||
Submitters::MaybeUpdateDefaultValues.call(@submitter, current_user)
|
Submitters::MaybeUpdateDefaultValues.call(@submitter, current_user)
|
||||||
|
|
||||||
@@ -40,7 +27,15 @@ class SubmitFormController < ApplicationController
|
|||||||
|
|
||||||
return unless @form_configs[:prefill_signature]
|
return unless @form_configs[:prefill_signature]
|
||||||
|
|
||||||
@signature_attachment =
|
if (user_signature = UserConfigs.load_signature(current_user))
|
||||||
|
@signature_attachment = ActiveStorage::Attachment.find_or_create_by!(
|
||||||
|
blob_id: user_signature.blob_id,
|
||||||
|
name: 'attachments',
|
||||||
|
record: @submitter
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
@signature_attachment ||=
|
||||||
Submitters::MaybeAssignDefaultBrowserSignature.call(@submitter, params, cookies, @attachments_index.values)
|
Submitters::MaybeAssignDefaultBrowserSignature.call(@submitter, params, cookies, @attachments_index.values)
|
||||||
|
|
||||||
@attachments_index[@signature_attachment.uuid] = @signature_attachment if @signature_attachment
|
@attachments_index[@signature_attachment.uuid] = @signature_attachment if @signature_attachment
|
||||||
@@ -54,11 +49,13 @@ class SubmitFormController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
if submitter.template.archived_at? || submitter.submission.archived_at?
|
if submitter.template.archived_at? || submitter.submission.archived_at?
|
||||||
Rollbar.info("Archived template: #{submitter.template.id}") if defined?(Rollbar)
|
|
||||||
|
|
||||||
return render json: { error: 'Form has been archived.' }, status: :unprocessable_entity
|
return render json: { error: 'Form has been archived.' }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if submitter.submission.expired?
|
||||||
|
return render json: { error: 'Form has been expired.' }, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
|
||||||
Submitters::SubmitValues.call(submitter, params, request)
|
Submitters::SubmitValues.call(submitter, params, request)
|
||||||
|
|
||||||
head :ok
|
head :ok
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class SubmitFormValuesController < ApplicationController
|
|||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
value:,
|
value:,
|
||||||
attachment: attachment&.as_json(only: %i[uuid], methods: %i[url filename content_type])
|
attachment: attachment&.as_json(only: %i[uuid created_at], methods: %i[url filename content_type])
|
||||||
}, head: :ok
|
}, head: :ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -87,8 +87,6 @@ class TemplatesController < ApplicationController
|
|||||||
if params[:permanently].present?
|
if params[:permanently].present?
|
||||||
@template.destroy!
|
@template.destroy!
|
||||||
|
|
||||||
Rollbar.info("Remove template: #{@template.id}") if defined?(Rollbar)
|
|
||||||
|
|
||||||
'Template has been removed.'
|
'Template has been removed.'
|
||||||
else
|
else
|
||||||
@template.update!(archived_at: Time.current)
|
@template.update!(archived_at: Time.current)
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TemplatesFormPreviewController < ApplicationController
|
class TemplatesFormPreviewController < ApplicationController
|
||||||
PRELOAD_ALL_PAGES_AMOUNT = 200
|
|
||||||
|
|
||||||
layout 'form'
|
layout 'form'
|
||||||
|
|
||||||
load_and_authorize_resource :template
|
load_and_authorize_resource :template
|
||||||
@@ -15,20 +13,7 @@ class TemplatesFormPreviewController < ApplicationController
|
|||||||
|
|
||||||
@submitter.submission.submitters = @template.submitters.map { |item| Submitter.new(uuid: item['uuid']) }
|
@submitter.submission.submitters = @template.submitters.map { |item| Submitter.new(uuid: item['uuid']) }
|
||||||
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
Submitters.preload_with_pages(@submitter)
|
||||||
records: [@submitter],
|
|
||||||
associations: [submission: [:template, { template_schema_documents: :blob }]]
|
|
||||||
).call
|
|
||||||
|
|
||||||
total_pages =
|
|
||||||
@submitter.submission.template_schema_documents.sum { |e| e.metadata.dig('pdf', 'number_of_pages').to_i }
|
|
||||||
|
|
||||||
if total_pages < PRELOAD_ALL_PAGES_AMOUNT
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
|
||||||
records: @submitter.submission.template_schema_documents,
|
|
||||||
associations: [:blob, { preview_images_attachments: :blob }]
|
|
||||||
).call
|
|
||||||
end
|
|
||||||
|
|
||||||
@attachments_index = ActiveStorage::Attachment.where(record: @submitter.submission.submitters, name: :attachments)
|
@attachments_index = ActiveStorage::Attachment.where(record: @submitter.submission.submitters, name: :attachments)
|
||||||
.preload(:blob).index_by(&:uuid)
|
.preload(:blob).index_by(&:uuid)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WebhookSecretController < ApplicationController
|
||||||
|
before_action :load_encrypted_config
|
||||||
|
authorize_resource :encrypted_config, parent: false
|
||||||
|
|
||||||
|
def index; end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@encrypted_config.assign_attributes(value: {
|
||||||
|
encrypted_config_params[:key] => encrypted_config_params[:value]
|
||||||
|
}.compact_blank)
|
||||||
|
|
||||||
|
@encrypted_config.value.present? ? @encrypted_config.save! : @encrypted_config.delete
|
||||||
|
|
||||||
|
redirect_back(fallback_location: settings_webhooks_path, notice: 'Webhook Secret has been saved.')
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def load_encrypted_config
|
||||||
|
@encrypted_config =
|
||||||
|
current_account.encrypted_configs.find_or_initialize_by(key: EncryptedConfig::WEBHOOK_SECRET_KEY)
|
||||||
|
end
|
||||||
|
|
||||||
|
def encrypted_config_params
|
||||||
|
params.require(:encrypted_config).permit(value: %i[key value]).fetch(:value, {})
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -24,6 +24,7 @@ import SubmitForm from './elements/submit_form'
|
|||||||
import PromptPassword from './elements/prompt_password'
|
import PromptPassword from './elements/prompt_password'
|
||||||
import EmailsTextarea from './elements/emails_textarea'
|
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 * as TurboInstantClick from './lib/turbo_instant_click'
|
import * as TurboInstantClick from './lib/turbo_instant_click'
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ safeRegisterElement('prompt-password', PromptPassword)
|
|||||||
safeRegisterElement('emails-textarea', EmailsTextarea)
|
safeRegisterElement('emails-textarea', EmailsTextarea)
|
||||||
safeRegisterElement('toggle-cookies', ToggleCookies)
|
safeRegisterElement('toggle-cookies', ToggleCookies)
|
||||||
safeRegisterElement('toggle-on-submit', ToggleOnSubmit)
|
safeRegisterElement('toggle-on-submit', ToggleOnSubmit)
|
||||||
|
safeRegisterElement('password-input', PasswordInput)
|
||||||
|
|
||||||
safeRegisterElement('template-builder', class extends HTMLElement {
|
safeRegisterElement('template-builder', class extends HTMLElement {
|
||||||
connectedCallback () {
|
connectedCallback () {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { target, targetable } from '@github/catalyst/lib/targetable'
|
||||||
|
|
||||||
|
export default targetable(class extends HTMLElement {
|
||||||
|
static [target.static] = [
|
||||||
|
'visiblePasswordIcon',
|
||||||
|
'hiddenPasswordIcon',
|
||||||
|
'passwordInput',
|
||||||
|
'togglePasswordVisibility'
|
||||||
|
]
|
||||||
|
|
||||||
|
connectedCallback () {
|
||||||
|
this.togglePasswordVisibility.addEventListener('click', this.handleTogglePasswordVisibility)
|
||||||
|
document.addEventListener('turbo:submit-start', this.setInitialPasswordType)
|
||||||
|
}
|
||||||
|
|
||||||
|
disconnectedCallback () {
|
||||||
|
this.togglePasswordVisibility.removeEventListener('click', this.handleTogglePasswordVisibility)
|
||||||
|
document.removeEventListener('turbo:submit-start', this.setInitialPasswordType)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleTogglePasswordVisibility = () => {
|
||||||
|
this.passwordInput.type = this.passwordInput.type === 'password' ? 'text' : 'password'
|
||||||
|
this.toggleIcon()
|
||||||
|
}
|
||||||
|
|
||||||
|
setInitialPasswordType = () => {
|
||||||
|
this.passwordInput.type = 'password'
|
||||||
|
this.toggleIcon()
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleIcon = () => {
|
||||||
|
this.visiblePasswordIcon.classList.toggle('hidden', this.passwordInput.type === 'password')
|
||||||
|
this.hiddenPasswordIcon.classList.toggle('hidden', this.passwordInput.type === 'text')
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -22,6 +22,7 @@ safeRegisterElement('submission-form', class extends HTMLElement {
|
|||||||
scrollPadding: this.dataset.scrollPadding || '-80px',
|
scrollPadding: this.dataset.scrollPadding || '-80px',
|
||||||
dryRun: this.dataset.dryRun === 'true',
|
dryRun: this.dataset.dryRun === 'true',
|
||||||
expand: ['true', 'false'].includes(this.dataset.expand) ? this.dataset.expand === 'true' : null,
|
expand: ['true', 'false'].includes(this.dataset.expand) ? this.dataset.expand === 'true' : null,
|
||||||
|
withSignatureId: this.dataset.withSignatureId === 'true',
|
||||||
withConfetti: this.dataset.withConfetti !== 'false',
|
withConfetti: this.dataset.withConfetti !== 'false',
|
||||||
withDisclosure: this.dataset.withDisclosure === 'true',
|
withDisclosure: this.dataset.withDisclosure === 'true',
|
||||||
withTypedSignature: this.dataset.withTypedSignature !== 'false',
|
withTypedSignature: this.dataset.withTypedSignature !== 'false',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
class="field-area flex absolute lg:text-base -outline-offset-1"
|
class="field-area flex absolute lg:text-base -outline-offset-1"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
:style="computedStyle"
|
:style="computedStyle"
|
||||||
:class="{ 'text-[1.5vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars, 'cursor-default': !submittable, 'border border-red-100 bg-red-100 cursor-pointer': submittable, 'border border-red-100': !isActive && submittable, 'bg-opacity-80': !isActive && !isValueSet && submittable, 'field-area-active outline-red-500 outline-dashed outline-2 z-10': isActive && submittable, 'bg-opacity-40': (isActive || isValueSet) && submittable }"
|
:class="{ 'text-[1.6vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars, 'cursor-default': !submittable, 'border border-red-100 bg-red-100 cursor-pointer': submittable, 'border border-red-100': !isActive && submittable, 'bg-opacity-80': !isActive && !isValueSet && submittable, 'field-area-active outline-red-500 outline-dashed outline-2 z-10': isActive && submittable, 'bg-opacity-40': (isActive || isValueSet) && submittable }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="(!withFieldPlaceholder || !field.name || field.type === 'cells') && !isActive && !isValueSet && field.type !== 'checkbox' && submittable && !area.option_uuid"
|
v-if="(!withFieldPlaceholder || !field.name || field.type === 'cells') && !isActive && !isValueSet && field.type !== 'checkbox' && submittable && !area.option_uuid"
|
||||||
@@ -54,11 +54,37 @@
|
|||||||
class="object-contain mx-auto"
|
class="object-contain mx-auto"
|
||||||
:src="stamp.url"
|
:src="stamp.url"
|
||||||
>
|
>
|
||||||
<img
|
<div
|
||||||
v-else-if="field.type === 'signature' && signature"
|
v-else-if="field.type === 'signature' && signature"
|
||||||
class="object-contain mx-auto"
|
class="flex flex-col justify-between h-full overflow-hidden"
|
||||||
:src="signature.url"
|
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
class="flex-grow flex overflow-hidden"
|
||||||
|
style="min-height: 50%"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
class="object-contain mx-auto"
|
||||||
|
:src="signature.url"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="withSignatureId"
|
||||||
|
class="w-full mt-1 text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem]"
|
||||||
|
>
|
||||||
|
<div class="truncate uppercase">
|
||||||
|
ID: {{ signature.uuid }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ t('reason') }}: {{ t('digitally_signed_by') }} {{ submitter.name }}
|
||||||
|
<template v-if="submitter.email">
|
||||||
|
<{{ submitter.email }}>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ new Date(signature.created_at).toLocaleString(undefined, { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZoneName: 'short' }) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<img
|
<img
|
||||||
v-else-if="field.type === 'initials' && initials"
|
v-else-if="field.type === 'initials' && initials"
|
||||||
class="object-contain mx-auto"
|
class="object-contain mx-auto"
|
||||||
@@ -75,7 +101,7 @@
|
|||||||
:href="attachment.url"
|
:href="attachment.url"
|
||||||
>
|
>
|
||||||
<IconPaperclip
|
<IconPaperclip
|
||||||
class="inline w-[1.5vw] h-[1.5vw] lg:w-4 lg:h-4"
|
class="inline w-[1.6vw] h-[1.6vw] lg:w-4 lg:h-4"
|
||||||
/>
|
/>
|
||||||
{{ attachment.filename }}
|
{{ attachment.filename }}
|
||||||
</a>
|
</a>
|
||||||
@@ -198,6 +224,15 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
submitter: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
withSignatureId: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
isValueSet: {
|
isValueSet: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
:submittable="true"
|
:submittable="true"
|
||||||
:field-index="fieldIndex"
|
:field-index="fieldIndex"
|
||||||
:scroll-padding="scrollPadding"
|
:scroll-padding="scrollPadding"
|
||||||
|
:submitter="submitter"
|
||||||
:with-field-placeholder="withFieldPlaceholder"
|
:with-field-placeholder="withFieldPlaceholder"
|
||||||
|
:with-signature-id="withSignatureId"
|
||||||
:is-active="currentStep === step"
|
:is-active="currentStep === step"
|
||||||
:with-label="withLabel && !withFieldPlaceholder"
|
:with-label="withLabel && !withFieldPlaceholder"
|
||||||
:is-value-set="step.some((f) => f.uuid in values)"
|
:is-value-set="step.some((f) => f.uuid in values)"
|
||||||
@@ -50,6 +52,15 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
|
withSignatureId: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
submitter: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
values: {
|
values: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -75,6 +86,11 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
scrollEl: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
currentStep: {
|
currentStep: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -109,7 +125,12 @@ export default {
|
|||||||
if (container.style.overflow === 'hidden') {
|
if (container.style.overflow === 'hidden') {
|
||||||
this.scrollInContainer(areaRef.$el)
|
this.scrollInContainer(areaRef.$el)
|
||||||
} else {
|
} else {
|
||||||
areaRef.$refs.scrollToElem.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
const targetRect = areaRef.$refs.scrollToElem.getBoundingClientRect()
|
||||||
|
const root = this.$root.$el?.parentNode?.classList?.contains('ds') ? this.$root.$el : document.body
|
||||||
|
const rootRect = root.getBoundingClientRect()
|
||||||
|
const scrollEl = this.scrollEl || window
|
||||||
|
|
||||||
|
scrollEl.scrollTo({ top: targetRect.top - rootRect.top, behavior: 'smooth' })
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -128,7 +149,7 @@ export default {
|
|||||||
|
|
||||||
const targetTopRelativeToBox = targetRect.top - boxRect.top
|
const targetTopRelativeToBox = targetRect.top - boxRect.top
|
||||||
|
|
||||||
scrollbox.scrollTop = targetTopRelativeToBox - container.offsetHeight + formContainer.offsetHeight + target.offsetHeight + padding
|
scrollbox.scrollTo({ top: targetTopRelativeToBox - container.offsetHeight + formContainer.offsetHeight + target.offsetHeight + padding, behavior: 'smooth' })
|
||||||
},
|
},
|
||||||
setAreaRef (el) {
|
setAreaRef (el) {
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
:required="field.required"
|
:required="field.required"
|
||||||
type="date"
|
type="date"
|
||||||
:name="`values[${field.uuid}]`"
|
:name="`values[${field.uuid}]`"
|
||||||
|
@keydown.enter="onEnter"
|
||||||
@focus="$emit('focus')"
|
@focus="$emit('focus')"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -78,7 +79,7 @@ export default {
|
|||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['update:model-value', 'focus'],
|
emits: ['update:model-value', 'focus', 'submit'],
|
||||||
computed: {
|
computed: {
|
||||||
value: {
|
value: {
|
||||||
set (value) {
|
set (value) {
|
||||||
@@ -90,6 +91,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onEnter (e) {
|
||||||
|
if (this.modelValue) {
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
this.$emit('submit')
|
||||||
|
}
|
||||||
|
},
|
||||||
setCurrentDate () {
|
setCurrentDate () {
|
||||||
const inputEl = this.$refs.input
|
const inputEl = this.$refs.input
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
:steps="stepFields"
|
:steps="stepFields"
|
||||||
:values="values"
|
:values="values"
|
||||||
:with-field-placeholder="withFieldPlaceholder"
|
:with-field-placeholder="withFieldPlaceholder"
|
||||||
|
:submitter="submitter"
|
||||||
|
:scroll-el="scrollEl"
|
||||||
|
:with-signature-id="withSignatureId"
|
||||||
:attachments-index="attachmentsIndex"
|
:attachments-index="attachmentsIndex"
|
||||||
:with-label="!isAnonymousChecboxes && showFieldNames"
|
:with-label="!isAnonymousChecboxes && showFieldNames"
|
||||||
:current-step="currentStepFields"
|
:current-step="currentStepFields"
|
||||||
@@ -103,6 +106,7 @@
|
|||||||
v-model="values[currentField.uuid]"
|
v-model="values[currentField.uuid]"
|
||||||
:show-field-names="showFieldNames"
|
:show-field-names="showFieldNames"
|
||||||
:field="currentField"
|
:field="currentField"
|
||||||
|
@submit="submitStep"
|
||||||
@focus="scrollIntoField(currentField)"
|
@focus="scrollIntoField(currentField)"
|
||||||
/>
|
/>
|
||||||
<div v-else-if="currentField.type === 'select'">
|
<div v-else-if="currentField.type === 'select'">
|
||||||
@@ -385,6 +389,7 @@
|
|||||||
v-model="values[currentField.uuid]"
|
v-model="values[currentField.uuid]"
|
||||||
:field="currentField"
|
:field="currentField"
|
||||||
:submitter-slug="submitterSlug"
|
:submitter-slug="submitterSlug"
|
||||||
|
:values="values"
|
||||||
@attached="attachments.push($event)"
|
@attached="attachments.push($event)"
|
||||||
@focus="scrollIntoField(currentField)"
|
@focus="scrollIntoField(currentField)"
|
||||||
@submit="submitStep"
|
@submit="submitStep"
|
||||||
@@ -534,6 +539,11 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
withSignatureId: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
scrollPadding: {
|
scrollPadding: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -554,6 +564,11 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
scrollEl: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
onComplete: {
|
onComplete: {
|
||||||
type: Function,
|
type: Function,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -795,7 +810,7 @@ export default {
|
|||||||
}, [])
|
}, [])
|
||||||
},
|
},
|
||||||
formulaFields () {
|
formulaFields () {
|
||||||
return this.fields.filter((f) => f.preferences?.formula)
|
return this.fields.filter((f) => f.preferences?.formula && f.type !== 'payment')
|
||||||
},
|
},
|
||||||
attachmentsIndex () {
|
attachmentsIndex () {
|
||||||
return this.attachments.reduce((acc, a) => {
|
return this.attachments.reduce((acc, a) => {
|
||||||
@@ -1099,7 +1114,9 @@ export default {
|
|||||||
if (response.status === 422 || response.status === 500) {
|
if (response.status === 422 || response.status === 500) {
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
|
|
||||||
alert(data.error || 'Value is invalid')
|
const i18nError = data.error ? this.t(data.error.replace(/\s+/g, '_').toLowerCase()) : ''
|
||||||
|
|
||||||
|
alert(i18nError !== data.error ? i18nError : (data.error || this.t('value_is_invalid')))
|
||||||
|
|
||||||
return Promise.reject(new Error(data.error))
|
return Promise.reject(new Error(data.error))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,16 @@ const en = {
|
|||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan the QR code with the camera app to open the form on mobile and draw your signature',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan the QR code with the camera app to open the form on mobile and draw your signature',
|
||||||
date: 'Date',
|
date: 'Date',
|
||||||
number: 'Number',
|
number: 'Number',
|
||||||
|
value_is_invalid: 'Value is invalid',
|
||||||
|
verification_code_is_invalid: 'Verification code is invalid',
|
||||||
already_paid: 'Already paid',
|
already_paid: 'Already paid',
|
||||||
image: 'Image',
|
image: 'Image',
|
||||||
pay: 'Pay',
|
pay: 'Pay',
|
||||||
take_photo: 'Take photo',
|
take_photo: 'Take photo',
|
||||||
number_phone_is_invalid: '{number} phone is invalid',
|
number_phone_is_invalid: '{number} phone is invalid',
|
||||||
file: 'File',
|
file: 'File',
|
||||||
|
digitally_signed_by: 'Digitally signed by',
|
||||||
|
reason: 'Reason',
|
||||||
select: 'Select',
|
select: 'Select',
|
||||||
checkbox: 'Checkbox',
|
checkbox: 'Checkbox',
|
||||||
multiple: 'Multiple',
|
multiple: 'Multiple',
|
||||||
@@ -73,6 +77,8 @@ const en = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const es = {
|
const es = {
|
||||||
|
value_is_invalid: 'El valor no es válido',
|
||||||
|
verification_code_is_invalid: 'El código de verificación no es válido',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Firma dibujada en un dispositivo con pantalla táctil',
|
drawn_signature_on_a_touchscreen_device: 'Firma dibujada en un dispositivo con pantalla táctil',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escanea el código QR con la aplicación de la cámara para abrir el formulario en el móvil y dibujar tu firma',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escanea el código QR con la aplicación de la cámara para abrir el formulario en el móvil y dibujar tu firma',
|
||||||
by_clicking_you_agree_to_the: 'Al hacer clic en "{button}", usted acepta el',
|
by_clicking_you_agree_to_the: 'Al hacer clic en "{button}", usted acepta el',
|
||||||
@@ -83,6 +89,8 @@ const es = {
|
|||||||
text: 'Texto',
|
text: 'Texto',
|
||||||
signature: 'Firma',
|
signature: 'Firma',
|
||||||
pay: 'Pagar',
|
pay: 'Pagar',
|
||||||
|
digitally_signed_by: 'Firmado digitalmente por',
|
||||||
|
reason: 'Razón',
|
||||||
initials: 'Iniciales',
|
initials: 'Iniciales',
|
||||||
date: 'Fecha',
|
date: 'Fecha',
|
||||||
number: 'Número',
|
number: 'Número',
|
||||||
@@ -146,6 +154,8 @@ const es = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const it = {
|
const it = {
|
||||||
|
value_is_invalid: 'Il valore non è valido',
|
||||||
|
verification_code_is_invalid: 'Il codice di verifica non è valido',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Firma disegnata su un dispositivo con schermo tattile',
|
drawn_signature_on_a_touchscreen_device: 'Firma disegnata su un dispositivo con schermo tattile',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scansiona il codice QR con l\'app della fotocamera per aprire il modulo sul cellulare e disegnare la tua firma',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scansiona il codice QR con l\'app della fotocamera per aprire il modulo sul cellulare e disegnare la tua firma',
|
||||||
by_clicking_you_agree_to_the: 'Cliccando su "{button}", accetti il',
|
by_clicking_you_agree_to_the: 'Cliccando su "{button}", accetti il',
|
||||||
@@ -155,6 +165,8 @@ const it = {
|
|||||||
already_paid: 'Pagato',
|
already_paid: 'Pagato',
|
||||||
text: 'Testo',
|
text: 'Testo',
|
||||||
signature: 'Firma',
|
signature: 'Firma',
|
||||||
|
digitally_signed_by: 'Firmato digitalmente da',
|
||||||
|
reason: 'Motivo',
|
||||||
initials: 'Iniziali',
|
initials: 'Iniziali',
|
||||||
date: 'Data',
|
date: 'Data',
|
||||||
number: 'Numero',
|
number: 'Numero',
|
||||||
@@ -219,6 +231,8 @@ const it = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const de = {
|
const de = {
|
||||||
|
value_is_invalid: 'Wert ist ungültig',
|
||||||
|
verification_code_is_invalid: 'Bestätigungscode ist ungültig',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Gezeichnete Unterschrift auf einem Touchscreen-Gerät',
|
drawn_signature_on_a_touchscreen_device: 'Gezeichnete Unterschrift auf einem Touchscreen-Gerät',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scannen Sie den QR-Code mit der Kamera-App, um das Formular auf dem Handy zu öffnen und Ihre Unterschrift zu zeichnen',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scannen Sie den QR-Code mit der Kamera-App, um das Formular auf dem Handy zu öffnen und Ihre Unterschrift zu zeichnen',
|
||||||
by_clicking_you_agree_to_the: 'Durch Klicken auf "{button}" stimmen Sie zu, dass Sie die',
|
by_clicking_you_agree_to_the: 'Durch Klicken auf "{button}" stimmen Sie zu, dass Sie die',
|
||||||
@@ -228,6 +242,8 @@ const de = {
|
|||||||
minimize: 'Minimieren',
|
minimize: 'Minimieren',
|
||||||
text: 'Text',
|
text: 'Text',
|
||||||
signature: 'Unterschrift',
|
signature: 'Unterschrift',
|
||||||
|
digitally_signed_by: 'Digital unterschrieben von',
|
||||||
|
reason: 'Grund',
|
||||||
initials: 'Initialen',
|
initials: 'Initialen',
|
||||||
date: 'Datum',
|
date: 'Datum',
|
||||||
number: 'Nummer',
|
number: 'Nummer',
|
||||||
@@ -292,6 +308,8 @@ const de = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fr = {
|
const fr = {
|
||||||
|
value_is_invalid: 'La valeur est invalide',
|
||||||
|
verification_code_is_invalid: 'Le code de vérification est invalide',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Signature dessinée sur un appareil à écran tactile',
|
drawn_signature_on_a_touchscreen_device: 'Signature dessinée sur un appareil à écran tactile',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scannez le code QR avec l\'application de l\'appareil photo pour ouvrir le formulaire sur mobile et dessiner votre signature',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scannez le code QR avec l\'application de l\'appareil photo pour ouvrir le formulaire sur mobile et dessiner votre signature',
|
||||||
by_clicking_you_agree_to_the: 'En cliquant sur "{button}", vous acceptez la',
|
by_clicking_you_agree_to_the: 'En cliquant sur "{button}", vous acceptez la',
|
||||||
@@ -302,6 +320,8 @@ const fr = {
|
|||||||
already_paid: 'Déjà payé',
|
already_paid: 'Déjà payé',
|
||||||
signature: 'Signature',
|
signature: 'Signature',
|
||||||
initials: 'Initiales',
|
initials: 'Initiales',
|
||||||
|
digitally_signed_by: 'Signé numériquement par',
|
||||||
|
reason: 'Raison',
|
||||||
pay: 'Payer',
|
pay: 'Payer',
|
||||||
date: 'Date',
|
date: 'Date',
|
||||||
number: 'Numéro',
|
number: 'Numéro',
|
||||||
@@ -365,6 +385,8 @@ const fr = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pl = {
|
const pl = {
|
||||||
|
value_is_invalid: 'Wartość jest nieprawidłowa',
|
||||||
|
verification_code_is_invalid: 'Kod weryfikacyjny jest nieprawidłowy',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Podpis odręczny na urządzeniu z ekranem dotykowym',
|
drawn_signature_on_a_touchscreen_device: 'Podpis odręczny na urządzeniu z ekranem dotykowym',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Zeskanuj kod QR za pomocą aplikacji aparatu, aby otworzyć formularz na telefonie i narysować swój podpis',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Zeskanuj kod QR za pomocą aplikacji aparatu, aby otworzyć formularz na telefonie i narysować swój podpis',
|
||||||
by_clicking_you_agree_to_the: 'Klikając na "{button}", zgadzasz się na',
|
by_clicking_you_agree_to_the: 'Klikając na "{button}", zgadzasz się na',
|
||||||
@@ -373,6 +395,8 @@ const pl = {
|
|||||||
minimize: 'Zminimalizuj',
|
minimize: 'Zminimalizuj',
|
||||||
text: 'Tekst',
|
text: 'Tekst',
|
||||||
already_paid: 'Już zapłacono',
|
already_paid: 'Już zapłacono',
|
||||||
|
digitally_signed_by: 'Podpisano cyfrowo przez',
|
||||||
|
reason: 'Powód',
|
||||||
signature: 'Podpis',
|
signature: 'Podpis',
|
||||||
initials: 'Inicjały',
|
initials: 'Inicjały',
|
||||||
date: 'Data',
|
date: 'Data',
|
||||||
@@ -438,6 +462,8 @@ const pl = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uk = {
|
const uk = {
|
||||||
|
value_is_invalid: 'Значення є неправильним',
|
||||||
|
verification_code_is_invalid: 'Код підтвердження є неправильним',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Підпис на сенсорному пристрої',
|
drawn_signature_on_a_touchscreen_device: 'Підпис на сенсорному пристрої',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Скануйте QR-код за допомогою програми камери, щоб відкрити форму на мобільному пристрої та намалювати свій підпис',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Скануйте QR-код за допомогою програми камери, щоб відкрити форму на мобільному пристрої та намалювати свій підпис',
|
||||||
by_clicking_you_agree_to_the: 'Натиснувши на "{button}", ви погоджуєтеся з',
|
by_clicking_you_agree_to_the: 'Натиснувши на "{button}", ви погоджуєтеся з',
|
||||||
@@ -447,6 +473,8 @@ const uk = {
|
|||||||
text: 'Текст',
|
text: 'Текст',
|
||||||
already_paid: 'Вже оплачено',
|
already_paid: 'Вже оплачено',
|
||||||
signature: 'Підпис',
|
signature: 'Підпис',
|
||||||
|
digitally_signed_by: 'Підписано в електронному вигляді',
|
||||||
|
reason: 'Причина',
|
||||||
initials: 'Ініціали',
|
initials: 'Ініціали',
|
||||||
date: 'Дата',
|
date: 'Дата',
|
||||||
number: 'Число',
|
number: 'Число',
|
||||||
@@ -511,6 +539,8 @@ const uk = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cs = {
|
const cs = {
|
||||||
|
value_is_invalid: 'Hodnota je neplatná',
|
||||||
|
verification_code_is_invalid: 'Ověřovací kód je neplatný',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Namalovaný podpis na dotykovém zařízení',
|
drawn_signature_on_a_touchscreen_device: 'Namalovaný podpis na dotykovém zařízení',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Naskenujte QR kód pomocí aplikace fotoaparátu, abyste otevřeli formulář na mobilním zařízení a nakreslili svůj podpis',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Naskenujte QR kód pomocí aplikace fotoaparátu, abyste otevřeli formulář na mobilním zařízení a nakreslili svůj podpis',
|
||||||
by_clicking_you_agree_to_the: 'Kliknutím na "{button}" souhlasíte s',
|
by_clicking_you_agree_to_the: 'Kliknutím na "{button}" souhlasíte s',
|
||||||
@@ -523,6 +553,8 @@ const cs = {
|
|||||||
initials: 'Iniciály',
|
initials: 'Iniciály',
|
||||||
date: 'Datum',
|
date: 'Datum',
|
||||||
number: 'Číslo',
|
number: 'Číslo',
|
||||||
|
digitally_signed_by: 'Digitálně podepsáno',
|
||||||
|
reason: 'Důvod',
|
||||||
image: 'Obrázek',
|
image: 'Obrázek',
|
||||||
pay: 'Zaplatit',
|
pay: 'Zaplatit',
|
||||||
file: 'Soubor',
|
file: 'Soubor',
|
||||||
@@ -584,6 +616,8 @@ const cs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pt = {
|
const pt = {
|
||||||
|
value_is_invalid: 'Valor é inválido',
|
||||||
|
verification_code_is_invalid: 'Código de verificação é inválido',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Assinatura desenhada em um dispositivo com tela sensível ao toque',
|
drawn_signature_on_a_touchscreen_device: 'Assinatura desenhada em um dispositivo com tela sensível ao toque',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escaneie o código QR com o aplicativo da câmera para abrir o formulário no celular e desenhar sua assinatura',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escaneie o código QR com o aplicativo da câmera para abrir o formulário no celular e desenhar sua assinatura',
|
||||||
by_clicking_you_agree_to_the: 'Ao clicar em "{button}", você concorda com o',
|
by_clicking_you_agree_to_the: 'Ao clicar em "{button}", você concorda com o',
|
||||||
@@ -594,6 +628,8 @@ const pt = {
|
|||||||
text: 'Texto',
|
text: 'Texto',
|
||||||
signature: 'Assinatura',
|
signature: 'Assinatura',
|
||||||
initials: 'Iniciais',
|
initials: 'Iniciais',
|
||||||
|
digitally_signed_by: 'Assinado digitalmente por',
|
||||||
|
reason: 'Razão',
|
||||||
date: 'Data',
|
date: 'Data',
|
||||||
number: 'Número',
|
number: 'Número',
|
||||||
image: 'Imagem',
|
image: 'Imagem',
|
||||||
@@ -657,6 +693,8 @@ const pt = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const he = {
|
const he = {
|
||||||
|
value_is_invalid: 'ערך לא תקין',
|
||||||
|
verification_code_is_invalid: 'קוד האימות אינו תקין',
|
||||||
drawn_signature_on_a_touchscreen_device: 'חתימה שנוצרה במכשיר עם מסך מגע',
|
drawn_signature_on_a_touchscreen_device: 'חתימה שנוצרה במכשיר עם מסך מגע',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'סרוק את קוד ה-QR באמצעות אפליקציית המצלמה כדי לפתוח את הטופס במובייל ולצייר את החתימה שלך',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'סרוק את קוד ה-QR באמצעות אפליקציית המצלמה כדי לפתוח את הטופס במובייל ולצייר את החתימה שלך',
|
||||||
by_clicking_you_agree_to_the: 'על ידי לחיצה על "{button}", אתה מסכים ל',
|
by_clicking_you_agree_to_the: 'על ידי לחיצה על "{button}", אתה מסכים ל',
|
||||||
@@ -668,6 +706,8 @@ const he = {
|
|||||||
signature: 'חתימה',
|
signature: 'חתימה',
|
||||||
initials: 'ראשי תיבות',
|
initials: 'ראשי תיבות',
|
||||||
date: 'תאריך',
|
date: 'תאריך',
|
||||||
|
digitally_signed_by: 'חתום דיגיטלית על ידי',
|
||||||
|
reason: 'סיבה',
|
||||||
number: 'מספר',
|
number: 'מספר',
|
||||||
image: 'תמונה',
|
image: 'תמונה',
|
||||||
file: 'קובץ',
|
file: 'קובץ',
|
||||||
@@ -731,6 +771,8 @@ const he = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nl = {
|
const nl = {
|
||||||
|
value_is_invalid: 'Waarde is ongeldig',
|
||||||
|
verification_code_is_invalid: 'Verificatiecode is ongeldig',
|
||||||
drawn_signature_on_a_touchscreen_device: 'Getekende handtekening op een apparaat met een touchscreen',
|
drawn_signature_on_a_touchscreen_device: 'Getekende handtekening op een apparaat met een touchscreen',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan de QR-code met de camera-app om het formulier op mobiel te openen en uw handtekening te tekenen',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan de QR-code met de camera-app om het formulier op mobiel te openen en uw handtekening te tekenen',
|
||||||
by_clicking_you_agree_to_the: 'Door op "{button}" te klikken, gaat u akkoord met de',
|
by_clicking_you_agree_to_the: 'Door op "{button}" te klikken, gaat u akkoord met de',
|
||||||
@@ -740,6 +782,8 @@ const nl = {
|
|||||||
text: 'Tekst',
|
text: 'Tekst',
|
||||||
already_paid: 'Al betaald',
|
already_paid: 'Al betaald',
|
||||||
signature: 'Handtekening',
|
signature: 'Handtekening',
|
||||||
|
digitally_signed_by: 'Digitaal ondertekend door',
|
||||||
|
reason: 'Reden',
|
||||||
initials: 'Initialen',
|
initials: 'Initialen',
|
||||||
date: 'Datum',
|
date: 'Datum',
|
||||||
number: 'Nummer',
|
number: 'Nummer',
|
||||||
@@ -805,6 +849,8 @@ const nl = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ar = {
|
const ar = {
|
||||||
|
value_is_invalid: 'القيمة غير صالحة',
|
||||||
|
verification_code_is_invalid: 'رمز التحقق غير صالح',
|
||||||
drawn_signature_on_a_touchscreen_device: 'توقيع مرسوم على جهاز بشاشة تعمل باللمس',
|
drawn_signature_on_a_touchscreen_device: 'توقيع مرسوم على جهاز بشاشة تعمل باللمس',
|
||||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'امسح رمز الاستجابة السريعة باستخدام تطبيق الكاميرا لفتح النموذج على الهاتف المحمول ورسم توقيعك',
|
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'امسح رمز الاستجابة السريعة باستخدام تطبيق الكاميرا لفتح النموذج على الهاتف المحمول ورسم توقيعك',
|
||||||
by_clicking_you_agree_to_the: 'بالنقر فوق "{button}"، أنت توافق على',
|
by_clicking_you_agree_to_the: 'بالنقر فوق "{button}"، أنت توافق على',
|
||||||
@@ -815,6 +861,8 @@ const ar = {
|
|||||||
initials: 'الاختصارات',
|
initials: 'الاختصارات',
|
||||||
date: 'تاريخ',
|
date: 'تاريخ',
|
||||||
number: 'رقم',
|
number: 'رقم',
|
||||||
|
digitally_signed_by: 'تم التوقيع رقميًا بواسطة',
|
||||||
|
reason: 'السبب',
|
||||||
image: 'صورة',
|
image: 'صورة',
|
||||||
take_photo: 'التقاط صورة',
|
take_photo: 'التقاط صورة',
|
||||||
pay: 'دفع',
|
pay: 'دفع',
|
||||||
@@ -888,6 +936,8 @@ const ko = {
|
|||||||
signature: '서명',
|
signature: '서명',
|
||||||
initials: '이니셜',
|
initials: '이니셜',
|
||||||
date: '날짜',
|
date: '날짜',
|
||||||
|
digitally_signed_by: '디지털 서명이 완료되었습니다',
|
||||||
|
reason: '이유',
|
||||||
number: '숫자',
|
number: '숫자',
|
||||||
pay: '급여',
|
pay: '급여',
|
||||||
image: '이미지',
|
image: '이미지',
|
||||||
|
|||||||
@@ -51,7 +51,17 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
items () {
|
items () {
|
||||||
return snarkdown(this.string.replace(/\n/g, '<br>')).split(htmlSplitRegexp)
|
const linkParts = this.string.split(/(https?:\/\/[^\s)]+)/g)
|
||||||
|
|
||||||
|
const text = linkParts.map((part, index) => {
|
||||||
|
if (part.match(/^https?:\/\//) && !linkParts[index - 1]?.match(/\(\s*$/) && !linkParts[index + 1]?.match(/^\s*\)/)) {
|
||||||
|
return `[${part}](${part})`
|
||||||
|
} else {
|
||||||
|
return part
|
||||||
|
}
|
||||||
|
}).join('')
|
||||||
|
|
||||||
|
return snarkdown(text.replace(/\n/g, '<br>')).split(htmlSplitRegexp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -93,6 +93,10 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
values: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
submitterSlug: {
|
submitterSlug: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
@@ -101,7 +105,8 @@ export default {
|
|||||||
emits: ['focus', 'submit', 'update:model-value', 'attached'],
|
emits: ['focus', 'submit', 'update:model-value', 'attached'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isCreatingCheckout: false
|
isCreatingCheckout: false,
|
||||||
|
isMathLoaded: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -114,15 +119,23 @@ export default {
|
|||||||
defaultName () {
|
defaultName () {
|
||||||
const { price, currency } = this.field.preferences || {}
|
const { price, currency } = this.field.preferences || {}
|
||||||
|
|
||||||
const formattedPrice = new Intl.NumberFormat([], {
|
const formatter = new Intl.NumberFormat([], {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency
|
currency
|
||||||
}).format(price)
|
})
|
||||||
|
|
||||||
return this.t('pay') + ' ' + formattedPrice
|
if (this.field.preferences?.formula) {
|
||||||
|
if (this.isMathLoaded) {
|
||||||
|
return this.t('pay') + ' ' + formatter.format(this.calculateFormula())
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.t('pay') + ' ' + formatter.format(price)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
async mounted () {
|
||||||
if (this.sessionId) {
|
if (this.sessionId) {
|
||||||
this.$emit('submit')
|
this.$emit('submit')
|
||||||
}
|
}
|
||||||
@@ -130,8 +143,48 @@ export default {
|
|||||||
if (!this.sessionId) {
|
if (!this.sessionId) {
|
||||||
this.postCheckout({ checkStatus: true })
|
this.postCheckout({ checkStatus: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.field.preferences?.formula) {
|
||||||
|
const {
|
||||||
|
create,
|
||||||
|
evaluateDependencies,
|
||||||
|
addDependencies,
|
||||||
|
subtractDependencies,
|
||||||
|
divideDependencies,
|
||||||
|
multiplyDependencies,
|
||||||
|
powDependencies,
|
||||||
|
roundDependencies,
|
||||||
|
absDependencies,
|
||||||
|
sinDependencies,
|
||||||
|
tanDependencies,
|
||||||
|
cosDependencies
|
||||||
|
} = await import('mathjs')
|
||||||
|
|
||||||
|
this.math = create({
|
||||||
|
evaluateDependencies,
|
||||||
|
addDependencies,
|
||||||
|
subtractDependencies,
|
||||||
|
divideDependencies,
|
||||||
|
multiplyDependencies,
|
||||||
|
powDependencies,
|
||||||
|
roundDependencies,
|
||||||
|
absDependencies,
|
||||||
|
sinDependencies,
|
||||||
|
tanDependencies,
|
||||||
|
cosDependencies
|
||||||
|
})
|
||||||
|
|
||||||
|
this.isMathLoaded = true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
calculateFormula () {
|
||||||
|
const transformedFormula = this.field.preferences.formula.replace(/{{(.*?)}}/g, (match, uuid) => {
|
||||||
|
return this.values[uuid] || 0.0
|
||||||
|
})
|
||||||
|
|
||||||
|
return this.math.evaluate(transformedFormula.toLowerCase())
|
||||||
|
},
|
||||||
async submit () {
|
async submit () {
|
||||||
if (this.sessionId) {
|
if (this.sessionId) {
|
||||||
return fetch(this.baseUrl + '/api/stripe_payments/' + this.sessionId, {
|
return fetch(this.baseUrl + '/api/stripe_payments/' + this.sessionId, {
|
||||||
|
|||||||
@@ -170,7 +170,7 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="isDefaultValuePresent || isValueInput || (withFieldPlaceholder && field.areas && field.type !== 'checkbox')"
|
v-if="isDefaultValuePresent || isValueInput || (withFieldPlaceholder && field.areas && field.type !== 'checkbox')"
|
||||||
:class="{ 'w-full h-full': ['cells', 'checkbox'].includes(field.type), 'text-[1.5vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars }"
|
:class="{ 'w-full h-full': ['cells', 'checkbox'].includes(field.type), 'text-[1.6vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
ref="textContainer"
|
ref="textContainer"
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
:field="field"
|
:field="field"
|
||||||
@click-condition="isShowConditionsModal = true"
|
@click-condition="isShowConditionsModal = true"
|
||||||
@click-description="isShowDescriptionModal = true"
|
@click-description="isShowDescriptionModal = true"
|
||||||
|
@click-formula="isShowFormulaModal = true"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-else-if="field.type !== 'heading'"
|
v-else-if="field.type !== 'heading'"
|
||||||
@@ -345,7 +346,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
buildDefaultName (field, fields) {
|
buildDefaultName (field, fields) {
|
||||||
if (field.type === 'payment' && field.preferences?.price) {
|
if (field.type === 'payment' && field.preferences?.price && !field.preferences?.formula) {
|
||||||
const { price, currency } = field.preferences || {}
|
const { price, currency } = field.preferences || {}
|
||||||
|
|
||||||
const formattedPrice = new Intl.NumberFormat([], {
|
const formattedPrice = new Intl.NumberFormat([], {
|
||||||
|
|||||||
@@ -204,7 +204,10 @@ export default {
|
|||||||
alert('Some fields are missing in the formula.')
|
alert('Some fields are missing in the formula.')
|
||||||
} else {
|
} else {
|
||||||
this.field.preferences.formula = normalizedFormula
|
this.field.preferences.formula = normalizedFormula
|
||||||
this.field.readonly = !!normalizedFormula
|
|
||||||
|
if (this.field.type !== 'payment') {
|
||||||
|
this.field.readonly = !!normalizedFormula
|
||||||
|
}
|
||||||
|
|
||||||
this.save()
|
this.save()
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const en = {
|
|||||||
display_title: 'Display title',
|
display_title: 'Display title',
|
||||||
with_logo: 'With logo',
|
with_logo: 'With logo',
|
||||||
unchecked: 'Unchecked',
|
unchecked: 'Unchecked',
|
||||||
|
price: 'Price',
|
||||||
type_value: 'Type value',
|
type_value: 'Type value',
|
||||||
equal: 'Equal',
|
equal: 'Equal',
|
||||||
not_equal: 'Not equal',
|
not_equal: 'Not equal',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<span
|
<span
|
||||||
class="dropdown dropdown-end"
|
class="dropdown dropdown-end"
|
||||||
:class="{ 'dropdown-open': (!field.preferences?.price || !isConnected) && !isLoading }"
|
:class="{ 'dropdown-open': ((!field.preferences?.price && !field.preferences?.formula) || !isConnected) && !isLoading }"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
>
|
>
|
||||||
<select
|
<select
|
||||||
v-model="field.preferences.currency"
|
v-model="field.preferences.currency"
|
||||||
placeholder="Price"
|
:placeholder="t('price')"
|
||||||
class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0"
|
class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0"
|
||||||
@change="save"
|
@change="save"
|
||||||
>
|
>
|
||||||
@@ -51,14 +51,23 @@
|
|||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
v-if="field.preferences.formula"
|
||||||
|
type="number"
|
||||||
|
:placeholder="t('price')"
|
||||||
|
disabled="true"
|
||||||
|
class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0"
|
||||||
|
@blur="save"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-else
|
||||||
v-model="field.preferences.price"
|
v-model="field.preferences.price"
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="Price"
|
:placeholder="t('price')"
|
||||||
class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0"
|
class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0"
|
||||||
@blur="save"
|
@blur="save"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
v-if="field.preferences.price"
|
v-if="field.preferences.price && !field.preferences.formula"
|
||||||
:style="{ backgroundColor: backgroundColor }"
|
:style="{ backgroundColor: backgroundColor }"
|
||||||
class="absolute -top-1 left-2.5 px-1 h-4"
|
class="absolute -top-1 left-2.5 px-1 h-4"
|
||||||
style="font-size: 8px"
|
style="font-size: 8px"
|
||||||
@@ -149,8 +158,21 @@
|
|||||||
data-turbo="false"
|
data-turbo="false"
|
||||||
>Learn more</a>
|
>Learn more</a>
|
||||||
</div>
|
</div>
|
||||||
|
<li class="mb-1">
|
||||||
|
<label
|
||||||
|
class="label-text cursor-pointer text-center w-full flex items-center"
|
||||||
|
@click="$emit('click-formula')"
|
||||||
|
>
|
||||||
|
<IconMathFunction
|
||||||
|
width="18"
|
||||||
|
/>
|
||||||
|
<span class="text-sm">
|
||||||
|
{{ t('formula') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
<hr>
|
<hr>
|
||||||
<li class="mt-1">
|
<li>
|
||||||
<label
|
<label
|
||||||
class="label-text cursor-pointer text-center w-full flex items-center"
|
class="label-text cursor-pointer text-center w-full flex items-center"
|
||||||
@click="$emit('click-description')"
|
@click="$emit('click-description')"
|
||||||
@@ -181,7 +203,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { IconSettings, IconCircleCheck, IconInfoCircle, IconBrandStripe, IconInnerShadowTop, IconRouteAltLeft } from '@tabler/icons-vue'
|
import { IconMathFunction, IconSettings, IconCircleCheck, IconInfoCircle, IconBrandStripe, IconInnerShadowTop, IconRouteAltLeft } from '@tabler/icons-vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const isConnected = ref(false)
|
const isConnected = ref(false)
|
||||||
@@ -193,6 +215,7 @@ export default {
|
|||||||
IconCircleCheck,
|
IconCircleCheck,
|
||||||
IconRouteAltLeft,
|
IconRouteAltLeft,
|
||||||
IconInfoCircle,
|
IconInfoCircle,
|
||||||
|
IconMathFunction,
|
||||||
IconInnerShadowTop,
|
IconInnerShadowTop,
|
||||||
IconBrandStripe
|
IconBrandStripe
|
||||||
},
|
},
|
||||||
@@ -203,7 +226,7 @@ export default {
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['click-condition', 'click-description'],
|
emits: ['click-condition', 'click-description', 'click-formula'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false
|
isLoading: false
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class SendFormCompletedWebhookRequestJob
|
|||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
|
|
||||||
url = load_url(submitter, params)
|
url, secret = load_url_and_secret(submitter, params)
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ class SendFormCompletedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: Submitters::SerializeForWebhook.call(submitter)
|
data: Submitters::SerializeForWebhook.call(submitter)
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**secret.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
@@ -45,9 +46,11 @@ class SendFormCompletedWebhookRequestJob
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_url(submitter, params)
|
def load_url_and_secret(submitter, params)
|
||||||
if params['encrypted_config_id']
|
if params['encrypted_config_id']
|
||||||
url = EncryptedConfig.find(params['encrypted_config_id']).value
|
config = EncryptedConfig.find(params['encrypted_config_id'])
|
||||||
|
|
||||||
|
url = config.value
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -55,7 +58,10 @@ class SendFormCompletedWebhookRequestJob
|
|||||||
|
|
||||||
return if preferences['form.completed'] == false
|
return if preferences['form.completed'] == false
|
||||||
|
|
||||||
url
|
secret = EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h
|
||||||
|
|
||||||
|
[url, secret]
|
||||||
elsif params['webhook_url_id']
|
elsif params['webhook_url_id']
|
||||||
webhook_url = submitter.account.webhook_urls.find(params['webhook_url_id'])
|
webhook_url = submitter.account.webhook_urls.find(params['webhook_url_id'])
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class SendFormStartedWebhookRequestJob
|
|||||||
submitter = Submitter.find(params['submitter_id'])
|
submitter = Submitter.find(params['submitter_id'])
|
||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
url = Accounts.load_webhook_url(submitter.submission.account)
|
config = Accounts.load_webhook_config(submitter.submission.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -30,6 +31,8 @@ class SendFormStartedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: Submitters::SerializeForWebhook.call(submitter)
|
data: Submitters::SerializeForWebhook.call(submitter)
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class SendFormViewedWebhookRequestJob
|
|||||||
submitter = Submitter.find(params['submitter_id'])
|
submitter = Submitter.find(params['submitter_id'])
|
||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
url = Accounts.load_webhook_url(submitter.submission.account)
|
config = Accounts.load_webhook_config(submitter.submission.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -30,6 +31,8 @@ class SendFormViewedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: Submitters::SerializeForWebhook.call(submitter)
|
data: Submitters::SerializeForWebhook.call(submitter)
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ class SendSubmissionArchivedWebhookRequestJob
|
|||||||
submission = Submission.find(params['submission_id'])
|
submission = Submission.find(params['submission_id'])
|
||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
url = Accounts.load_webhook_url(submission.account)
|
|
||||||
|
config = Accounts.load_webhook_config(submission.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -28,6 +30,8 @@ class SendSubmissionArchivedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: submission.as_json(only: %i[id archived_at])
|
data: submission.as_json(only: %i[id archived_at])
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ class SendSubmissionCreatedWebhookRequestJob
|
|||||||
submission = Submission.find(params['submission_id'])
|
submission = Submission.find(params['submission_id'])
|
||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
url = Accounts.load_webhook_url(submission.account)
|
|
||||||
|
config = Accounts.load_webhook_config(submission.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -28,6 +30,8 @@ class SendSubmissionCreatedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: Submissions::SerializeForApi.call(submission)
|
data: Submissions::SerializeForApi.call(submission)
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
|
|||||||
@@ -6,11 +6,7 @@ class SendSubmitterInvitationEmailJob
|
|||||||
def perform(params = {})
|
def perform(params = {})
|
||||||
submitter = Submitter.find(params['submitter_id'])
|
submitter = Submitter.find(params['submitter_id'])
|
||||||
|
|
||||||
if submitter.submission.source == 'invite' && !Accounts.can_send_emails?(submitter.account, on_events: true)
|
return if submitter.submission.source == 'invite' && !Accounts.can_send_emails?(submitter.account, on_events: true)
|
||||||
Rollbar.error("Skip email: #{submitter.id}") if defined?(Rollbar)
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
mail = SubmitterMailer.invitation_email(submitter)
|
mail = SubmitterMailer.invitation_email(submitter)
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ class SendTemplateCreatedWebhookRequestJob
|
|||||||
template = Template.find(params['template_id'])
|
template = Template.find(params['template_id'])
|
||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
url = Accounts.load_webhook_url(template.account)
|
|
||||||
|
config = Accounts.load_webhook_config(template.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -28,6 +30,8 @@ class SendTemplateCreatedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: Templates::SerializeForApi.call(template)
|
data: Templates::SerializeForApi.call(template)
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ class SendTemplateUpdatedWebhookRequestJob
|
|||||||
template = Template.find(params['template_id'])
|
template = Template.find(params['template_id'])
|
||||||
|
|
||||||
attempt = params['attempt'].to_i
|
attempt = params['attempt'].to_i
|
||||||
url = Accounts.load_webhook_url(template.account)
|
|
||||||
|
config = Accounts.load_webhook_config(template.account)
|
||||||
|
url = config&.value.presence
|
||||||
|
|
||||||
return if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
@@ -28,6 +30,8 @@ class SendTemplateUpdatedWebhookRequestJob
|
|||||||
timestamp: Time.current,
|
timestamp: Time.current,
|
||||||
data: Templates::SerializeForApi.call(template)
|
data: Templates::SerializeForApi.call(template)
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||||
|
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => USER_AGENT)
|
'User-Agent' => USER_AGENT)
|
||||||
rescue Faraday::Error
|
rescue Faraday::Error
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ class SubmitterMailer < ApplicationMailer
|
|||||||
|
|
||||||
DEFAULT_INVITATION_SUBJECT = 'You are invited to submit a form'
|
DEFAULT_INVITATION_SUBJECT = 'You are invited to submit a form'
|
||||||
|
|
||||||
|
NO_REPLY_REGEXP = /no-?reply@/i
|
||||||
|
|
||||||
def invitation_email(submitter)
|
def invitation_email(submitter)
|
||||||
@current_account = submitter.submission.account
|
@current_account = submitter.submission.account
|
||||||
@submitter = submitter
|
@submitter = submitter
|
||||||
@@ -28,12 +30,13 @@ class SubmitterMailer < ApplicationMailer
|
|||||||
|
|
||||||
assign_message_metadata('submitter_invitation', @submitter)
|
assign_message_metadata('submitter_invitation', @submitter)
|
||||||
|
|
||||||
|
reply_to = build_submitter_reply_to(@submitter)
|
||||||
|
|
||||||
mail(
|
mail(
|
||||||
to: @submitter.friendly_name,
|
to: @submitter.friendly_name,
|
||||||
from: from_address_for_submitter(submitter),
|
from: from_address_for_submitter(submitter),
|
||||||
subject:,
|
subject:,
|
||||||
reply_to: submitter.preferences['reply_to'].presence ||
|
reply_to:
|
||||||
(submitter.submission.created_by_user || submitter.template.author)&.friendly_name&.sub(/\+\w+@/, '@')
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -104,16 +107,26 @@ class SubmitterMailer < ApplicationMailer
|
|||||||
|
|
||||||
assign_message_metadata('submitter_documents_copy', @submitter)
|
assign_message_metadata('submitter_documents_copy', @submitter)
|
||||||
|
|
||||||
|
reply_to = build_submitter_reply_to(submitter)
|
||||||
|
|
||||||
mail(from: from_address_for_submitter(submitter),
|
mail(from: from_address_for_submitter(submitter),
|
||||||
to: to || @submitter.friendly_name,
|
to: to || @submitter.friendly_name,
|
||||||
reply_to: @submitter.preferences['reply_to'].presence ||
|
reply_to:,
|
||||||
(@submitter.submission.created_by_user ||
|
|
||||||
@submitter.template.author)&.friendly_name&.sub(/\+\w+@/, '@'),
|
|
||||||
subject:)
|
subject:)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def build_submitter_reply_to(submitter)
|
||||||
|
reply_to =
|
||||||
|
submitter.preferences['reply_to'].presence ||
|
||||||
|
(submitter.submission.created_by_user || submitter.template.author)&.friendly_name&.sub(/\+\w+@/, '@')
|
||||||
|
|
||||||
|
return nil if reply_to.to_s.match?(NO_REPLY_REGEXP)
|
||||||
|
|
||||||
|
reply_to
|
||||||
|
end
|
||||||
|
|
||||||
def build_completed_subject(submitter)
|
def build_completed_subject(submitter)
|
||||||
submitters = submitter.submission.submitters.order(:completed_at)
|
submitters = submitter.submission.submitters.order(:completed_at)
|
||||||
.map { |e| e.name || e.email || e.phone }.join(', ')
|
.map { |e| e.name || e.email || e.phone }.join(', ')
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class AccountConfig < ApplicationRecord
|
|||||||
DOWNLOAD_LINKS_AUTH_KEY = 'download_links_auth'
|
DOWNLOAD_LINKS_AUTH_KEY = 'download_links_auth'
|
||||||
FORCE_SSO_AUTH_KEY = 'force_sso_auth'
|
FORCE_SSO_AUTH_KEY = 'force_sso_auth'
|
||||||
FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf'
|
FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf'
|
||||||
|
WITH_SIGNATURE_ID = 'with_signature_id'
|
||||||
|
|
||||||
DEFAULT_VALUES = {
|
DEFAULT_VALUES = {
|
||||||
SUBMITTER_INVITATION_EMAIL_KEY => {
|
SUBMITTER_INVITATION_EMAIL_KEY => {
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class EncryptedConfig < ApplicationRecord
|
|||||||
ESIGN_CERTS_KEY = 'esign_certs',
|
ESIGN_CERTS_KEY = 'esign_certs',
|
||||||
TIMESTAMP_SERVER_URL_KEY = 'timestamp_server_url',
|
TIMESTAMP_SERVER_URL_KEY = 'timestamp_server_url',
|
||||||
APP_URL_KEY = 'app_url',
|
APP_URL_KEY = 'app_url',
|
||||||
WEBHOOK_URL_KEY = 'webhook_url'
|
WEBHOOK_URL_KEY = 'webhook_url',
|
||||||
|
WEBHOOK_SECRET_KEY = 'webhook_secret'
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
# id :bigint not null, primary key
|
# id :bigint not null, primary key
|
||||||
# archived_at :datetime
|
# archived_at :datetime
|
||||||
|
# expire_at :datetime
|
||||||
# preferences :text not null
|
# preferences :text not null
|
||||||
# slug :string not null
|
# slug :string not null
|
||||||
# source :text not null
|
# source :text not null
|
||||||
@@ -75,6 +76,10 @@ class Submission < ApplicationRecord
|
|||||||
preserved: 'preserved'
|
preserved: 'preserved'
|
||||||
}, scope: false, prefix: true
|
}, scope: false, prefix: true
|
||||||
|
|
||||||
|
def expired?
|
||||||
|
expire_at && expire_at <= Time.current
|
||||||
|
end
|
||||||
|
|
||||||
def audit_trail_url
|
def audit_trail_url
|
||||||
return if audit_trail.blank?
|
return if audit_trail.blank?
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::WITH_SIGNATURE_ID) %>
|
||||||
|
<% 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>
|
||||||
|
Add signature ID to the documents
|
||||||
|
</span>
|
||||||
|
<%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::ALLOW_TYPED_SIGNATURE) %>
|
<% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::ALLOW_TYPED_SIGNATURE) %>
|
||||||
<% if can?(:manage, account_config) %>
|
<% if can?(:manage, account_config) %>
|
||||||
<%= form_for account_config, url: account_configs_path, method: :post do |f| %>
|
<%= form_for account_config, url: account_configs_path, method: :post do |f| %>
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
<% if params[:redir].present? %>
|
<% if params[:redir].present? %>
|
||||||
<%= hidden_field_tag :redir, params[:redir] %>
|
<%= hidden_field_tag :redir, params[:redir] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= select_tag :lang, options_for_select((I18n.available_locales - %i[en pt-PT de-DE fr-FR es-ES]).map { |code| [t("language_#{code}"), code] }, I18n.locale), onchange: 'this.form.requestSubmit();', class: 'select select-sm border-base-content/30 text-base' %>
|
<%= select_tag :lang, options_for_select((I18n.available_locales - %i[en pt-PT de-DE fr-FR it-IT es-ES]).map { |code| [t("language_#{code}"), code] }, I18n.locale), onchange: 'this.form.requestSubmit();', class: 'select select-sm border-base-content/30 text-base' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
|
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
|
||||||
|
<path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 431 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
|
<path d="M10.585 10.587a2 2 0 0 0 2.829 2.828" />
|
||||||
|
<path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87" />
|
||||||
|
<path d="M3 3l18 18" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 572 B |
@@ -3,7 +3,7 @@
|
|||||||
window.customElements.define('autosize-field', class extends HTMLElement {
|
window.customElements.define('autosize-field', class extends HTMLElement {
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
if (this.field.scrollHeight > this.field.clientHeight) {
|
if (this.field.scrollHeight > this.field.clientHeight) {
|
||||||
this.field.classList.remove('text-[1.5vw]', 'lg:text-base');
|
this.field.classList.remove('text-[1.6vw]', 'lg:text-base');
|
||||||
this.field.classList.add('text-[1.0vw]', 'lg:text-[0.70rem]');
|
this.field.classList.add('text-[1.0vw]', 'lg:text-[0.70rem]');
|
||||||
|
|
||||||
if (this.field.scrollHeight > this.field.clientHeight) {
|
if (this.field.scrollHeight > this.field.clientHeight) {
|
||||||
|
|||||||
@@ -34,7 +34,17 @@
|
|||||||
<%= fields_for @user do |ff| %>
|
<%= fields_for @user do |ff| %>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<%= ff.label :password, class: 'label' %>
|
<%= ff.label :password, class: 'label' %>
|
||||||
<%= ff.password_field :password, required: true, placeholder: '************', class: 'base-input' %>
|
<password-input class="block relative">
|
||||||
|
<%= ff.password_field :password, required: true, placeholder: '************', class: 'base-input w-full pr-10', data: { target: 'password-input.passwordInput' } %>
|
||||||
|
<button data-target="password-input.togglePasswordVisibility" type="button" class="absolute inset-y-0 h-12 right-0 pr-3 flex items-center">
|
||||||
|
<span data-target="password-input.hiddenPasswordIcon">
|
||||||
|
<%= svg_icon('eye', class: 'w-6 h-6 shrink-0 bg-white') %>
|
||||||
|
</span>
|
||||||
|
<span data-target="password-input.visiblePasswordIcon" class="hidden">
|
||||||
|
<%= svg_icon('eye_off', class: 'w-6 h-6 shrink-0 bg-white') %>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</password-input>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= fields_for @encrypted_config do |ff| %>
|
<%= fields_for @encrypted_config do |ff| %>
|
||||||
|
|||||||
@@ -1,13 +1,35 @@
|
|||||||
<% align = field.dig('preferences', 'align') %>
|
<% align = field.dig('preferences', 'align') %>
|
||||||
<field-value dir="auto" class="flex absolute text-[1.5vw] lg:text-base <%= align == 'right' ? 'justify-end' : (align == 'center' ? 'justify-center' : '') %>" style="width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: #{field['preferences']['font_size']}pt" if field.dig('preferences', 'font_size') %>">
|
<field-value dir="auto" class="flex absolute text-[1.6vw] lg:text-base <%= align == 'right' ? 'justify-end' : (align == 'center' ? 'justify-center' : '') %>" style="width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: #{field['preferences']['font_size']}pt" if field.dig('preferences', 'font_size') %>">
|
||||||
<% if field['type'].in?(['signature', 'image', 'initials', 'stamp']) %>
|
<% if field['type'] == 'signature' %>
|
||||||
|
<div class="flex flex-col justify-between h-full overflow-hidden">
|
||||||
|
<div class="flex-grow flex overflow-hidden" style="min-height: 50%">
|
||||||
|
<img class="object-contain mx-auto" src="<%= attachments_index[value].url %>">
|
||||||
|
</div>
|
||||||
|
<% if local_assigns[:with_signature_id] && attachment = attachments_index[value] %>
|
||||||
|
<div class="w-full mt-1 text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem]">
|
||||||
|
<div class="truncate uppercase">
|
||||||
|
ID: <%= attachment.uuid %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<%= t('reason') %>: <%= t('digitally_signed_by') %> <%= submitter.name %>
|
||||||
|
<% if submitter.email %>
|
||||||
|
<<%= submitter.email %>>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<%= l(attachment.created_at.in_time_zone(local_assigns[:timezone]), format: :long, locale: local_assigns[:locale]) %> <%= TimeUtils.timezone_abbr(local_assigns[:timezone], attachment.created_at) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% elsif field['type'].in?(['image', 'initials', 'stamp']) %>
|
||||||
<img class="object-contain mx-auto" src="<%= attachments_index[value].url %>" loading="lazy">
|
<img class="object-contain mx-auto" src="<%= attachments_index[value].url %>" loading="lazy">
|
||||||
<% elsif field['type'].in?(['file', 'payment']) %>
|
<% elsif field['type'].in?(['file', 'payment']) %>
|
||||||
<autosize-field></autosize-field>
|
<autosize-field></autosize-field>
|
||||||
<div class="px-0.5 flex flex-col justify-center">
|
<div class="px-0.5 flex flex-col justify-center">
|
||||||
<% Array.wrap(value).each do |val| %>
|
<% Array.wrap(value).each do |val| %>
|
||||||
<a target="_blank" href="<%= attachments_index[val].url %>">
|
<a target="_blank" href="<%= attachments_index[val].url %>">
|
||||||
<%= svg_icon('paperclip', class: 'inline w-[1.5vw] h-[1.5vw] lg:w-4 lg:h-4') %>
|
<%= svg_icon('paperclip', class: 'inline w-[1.6vw] h-[1.6vw] lg:w-4 lg:h-4') %>
|
||||||
<%= attachments_index[val].filename %>
|
<%= attachments_index[val].filename %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -24,7 +46,7 @@
|
|||||||
<%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %>
|
<%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif field['type'] == 'cells' && area['cell_w'] %>
|
<% elsif field['type'] == 'cells' && area['cell_w'].to_f > 0.0 %>
|
||||||
<% cell_width = area['cell_w'] / area['w'] * 100 %>
|
<% cell_width = area['cell_w'] / area['w'] * 100 %>
|
||||||
<div class="w-full flex items-center">
|
<div class="w-full flex items-center">
|
||||||
<% (0..(area['w'] / area['cell_w']).ceil).each do |index| %>
|
<% (0..(area['w'] / area['cell_w']).ceil).each do |index| %>
|
||||||
|
|||||||
@@ -1,6 +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) %>
|
||||||
<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">
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% elsif @submission.submitters.to_a.size == 1 %>
|
<% elsif @submission.submitters.to_a.size == 1 && !@submission.expired? %>
|
||||||
<%= 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: 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' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
<div id="document_view" class="w-full overflow-y-auto overflow-x-hidden mt-0.5 pt-0.5">
|
<div id="document_view" class="w-full overflow-y-auto overflow-x-hidden mt-0.5 pt-0.5">
|
||||||
<div class="pr-3.5 pl-0.5">
|
<div class="pr-3.5 pl-0.5">
|
||||||
<% fields_index = Templates.build_field_areas_index(@submission.template_fields || @submission.template.fields) %>
|
<% fields_index = Templates.build_field_areas_index(@submission.template_fields || @submission.template.fields) %>
|
||||||
|
<% submitters_index = @submission.submitters.index_by(&:uuid) %>
|
||||||
<% values = @submission.submitters.reduce({}) { |acc, sub| acc.merge(sub.values) } %>
|
<% values = @submission.submitters.reduce({}) { |acc, sub| acc.merge(sub.values) } %>
|
||||||
<% attachments_index = ActiveStorage::Attachment.where(record: @submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %>
|
<% attachments_index = ActiveStorage::Attachment.where(record: @submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %>
|
||||||
<% page_blob_struct = Struct.new(:url, :metadata, keyword_init: true) %>
|
<% page_blob_struct = Struct.new(:url, :metadata, keyword_init: true) %>
|
||||||
@@ -92,7 +94,7 @@
|
|||||||
<% fields_index.dig(document.uuid, index)&.each do |(area, field)| %>
|
<% fields_index.dig(document.uuid, index)&.each do |(area, field)| %>
|
||||||
<% value = values[field['uuid']] %>
|
<% value = values[field['uuid']] %>
|
||||||
<% next if value.blank? %>
|
<% next if value.blank? %>
|
||||||
<%= render 'submissions/value', area:, field:, attachments_index:, value:, locale: @submission.account.locale, timezone: @submission.account.timezone %>
|
<%= render 'submissions/value', area:, field:, attachments_index:, value:, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter: submitters_index[field['submitter_uuid']], with_signature_id: %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,15 +146,15 @@
|
|||||||
<%= submitter&.completed_at? ? l(submitter.completed_at.in_time_zone(@submission.account.timezone), format: :long, locale: @submission.account.locale) : 'Not completed yet' %>
|
<%= submitter&.completed_at? ? l(submitter.completed_at.in_time_zone(@submission.account.timezone), format: :long, locale: @submission.account.locale) : 'Not completed yet' %>
|
||||||
</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) %>
|
<% if signed_in? && submitter && submitter.email && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && Accounts.can_send_emails?(current_account) && !@submission.expired? %>
|
||||||
<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) %>
|
<% if signed_in? && submitter && submitter.phone && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && !@submission.expired? %>
|
||||||
<%= 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) %>
|
<% if signed_in? && submitter && !submitter.completed_at? && !@submission.archived_at? && can?(:create, submitter) && !@submission.expired? %>
|
||||||
<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
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<% data_attachments = attachments_index.values.select { |e| e.record_id == submitter.id }.to_json(only: %i[uuid], 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-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>
|
<submission-form data-is-demo="<%= Docuseal.demo? %>" 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>
|
||||||
@@ -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_expired_at_html', time: l(@submitter.submission.expire_at, format: :long)) %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= render 'shared/attribution', link_path: '/start', account: @submitter.account %>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<% next if field['redacted'] && 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.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 %>
|
<%= render 'submissions/value', area:, field:, attachments_index: @attachments_index, value:, locale: @submitter.account.locale, timezone: @submitter.account.timezone, submitter: @submitter, with_signature_id: @form_configs[:with_signature_id] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -34,11 +34,19 @@
|
|||||||
<% submitter = submitters.first %>
|
<% submitter = submitters.first %>
|
||||||
<div class="flex items-center space-x-4">
|
<div class="flex items-center space-x-4">
|
||||||
<span class="flex flex-col md:flex-row md:items-center gap-3">
|
<span class="flex flex-col md:flex-row md:items-center gap-3">
|
||||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
<% if submission.expired? %>
|
||||||
<span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold">
|
<div class="tooltip flex" data-tip="<%= l(submission.expire_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
<%= submitter.status %>
|
<span class="badge badge-error md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
||||||
</span>
|
Expired
|
||||||
</div>
|
</span>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
|
<span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold">
|
||||||
|
<%= submitter.status %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<span class="text-lg break-all flex items-center">
|
<span class="text-lg break-all flex items-center">
|
||||||
<%= submitter.name || submitter.email || submitter.phone %>
|
<%= submitter.name || submitter.email || submitter.phone %>
|
||||||
</span>
|
</span>
|
||||||
@@ -61,7 +69,7 @@
|
|||||||
</download-button>
|
</download-button>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<% elsif !submission.archived_at? && !template.archived_at? %>
|
<% elsif !submission.archived_at? && !template.archived_at? && !submission.expired? %>
|
||||||
<% 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">
|
||||||
@@ -82,7 +90,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %>
|
<% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %>
|
||||||
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
||||||
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
|
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, onclick: 'event.stopPropagation()' %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
||||||
@@ -101,12 +109,18 @@
|
|||||||
<%= latest_submitter.status %>
|
<%= latest_submitter.status %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<% elsif submission.expired? %>
|
||||||
|
<div class="tooltip flex" data-tip="<%= l(submission.expire_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
|
<span class="badge badge-error md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
||||||
|
Expired
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="w-full <%= is_submission_completed ? 'space-y-1' : 'space-y-4' %> md:space-y-0">
|
<div class="w-full <%= is_submission_completed ? 'space-y-1' : 'space-y-4' %> md:space-y-0">
|
||||||
<% submitters.each_with_index do |submitter, index| %>
|
<% submitters.each_with_index do |submitter, index| %>
|
||||||
<div class="relative flex justify-between items-start md:items-center space-x-3">
|
<div class="relative flex justify-between items-start md:items-center space-x-3">
|
||||||
<span class="flex flex-col md:flex-row md:items-center gap-2">
|
<span class="flex flex-col md:flex-row md:items-center gap-2">
|
||||||
<% unless is_submission_completed %>
|
<% if !is_submission_completed && !submission.expired? %>
|
||||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||||
<span class="badge md:w-24 <%= status_badges[submitter.status] %> bg-opacity-50 uppercase text-xs font-semibold">
|
<span class="badge md:w-24 <%= status_badges[submitter.status] %> bg-opacity-50 uppercase text-xs font-semibold">
|
||||||
<%= submitter.status %>
|
<%= submitter.status %>
|
||||||
@@ -132,7 +146,7 @@
|
|||||||
</download-button>
|
</download-button>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed %>
|
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed && !submission.expired? %>
|
||||||
<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) %>">
|
||||||
@@ -178,7 +192,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% if !submission.archived_at? && !template.archived_at? %>
|
<% if !submission.archived_at? && !template.archived_at? %>
|
||||||
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
||||||
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
|
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, onclick: 'event.stopPropagation()' %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% if can?(:destroy, template) %>
|
<% if can?(:destroy, template) %>
|
||||||
<span class="tooltip tooltip-left" data-tip="<%= template.archived_at? ? 'Delete' : 'Archive' %>">
|
<span class="tooltip tooltip-left" data-tip="<%= template.archived_at? ? 'Delete' : 'Archive' %>">
|
||||||
<%= button_to template_path(template), data: { turbo_confirm: template.archived_at? ? 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' : 'Are you sure?' }, params: { permanently: template.archived_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %>
|
<%= button_to template_path(template), data: template.archived_at? ? { turbo_confirm: 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' } : {}, params: { permanently: template.archived_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %>
|
||||||
<%= svg_icon(template.archived_at? ? 'trash' : 'archive', class: 'w-4 h-4 enabled') %>
|
<%= svg_icon(template.archived_at? ? 'trash' : 'archive', class: 'w-4 h-4 enabled') %>
|
||||||
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %>
|
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<%= render 'shared/turbo_modal', title: 'Webhook Secret' do %>
|
||||||
|
<%= form_for @encrypted_config, url: webhook_secret_index_path, method: :post, html: { class: 'space-y-4' }, data: { turbo_frame: :_top } do |f| %>
|
||||||
|
<div class="space-y-2">
|
||||||
|
<%= f.fields_for :value, Struct.new(:key, :value).new(*@encrypted_config.value.to_a.first) do |ff| %>
|
||||||
|
<div class="form-control">
|
||||||
|
<%= ff.label :key, class: 'label' %>
|
||||||
|
<%= ff.text_field :key, class: 'base-input', placeholder: 'X-Example-Header' %>
|
||||||
|
</div>
|
||||||
|
<div class="form-control">
|
||||||
|
<%= ff.label :value, class: 'label' %>
|
||||||
|
<%= ff.text_field :value, class: 'base-input' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="form-control pt-2">
|
||||||
|
<%= f.button button_title, class: 'base-button' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
@@ -9,9 +9,12 @@
|
|||||||
<div class="card-body p-6">
|
<div class="card-body p-6">
|
||||||
<%= form_for @encrypted_config, url: settings_webhooks_path, method: :post, html: { autocomplete: 'off' } do |f| %>
|
<%= form_for @encrypted_config, url: settings_webhooks_path, method: :post, html: { autocomplete: 'off' } do |f| %>
|
||||||
<%= f.label :value, 'Webhook URL', class: 'text-sm font-semibold' %>
|
<%= f.label :value, 'Webhook URL', class: 'text-sm font-semibold' %>
|
||||||
<div class="flex flex-row flex-wrap space-y-2 md:space-y-0 md:flex-nowrap md:space-x-4 mt-2">
|
<div class="flex flex-row flex-wrap space-y-2 md:space-y-0 md:flex-nowrap md:space-x-2 mt-2">
|
||||||
<%= f.url_field :value, class: 'input font-mono input-bordered w-full', placeholder: 'https://example.com/hook' %>
|
<%= f.url_field :value, class: 'input font-mono input-bordered w-full', placeholder: 'https://example.com/hook' %>
|
||||||
<%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button w-full md:w-32' %>
|
<%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button w-full md:w-32' %>
|
||||||
|
<a href="<%= webhook_secret_index_path %>" data-turbo-frame="modal" class="white-button w-full md:w-auto">
|
||||||
|
Add Secret
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% preference = current_account.account_configs.find_by(key: AccountConfig::WEBHOOK_PREFERENCES_KEY)&.value || {} %>
|
<% preference = current_account.account_configs.find_by(key: AccountConfig::WEBHOOK_PREFERENCES_KEY)&.value || {} %>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module DocuSeal
|
|||||||
|
|
||||||
config.active_storage.draw_routes = ENV['MULTITENANT'] != 'true'
|
config.active_storage.draw_routes = ENV['MULTITENANT'] != 'true'
|
||||||
|
|
||||||
config.i18n.available_locales = %i[en en-US en-GB es-ES fr-FR pt-PT de-DE es it de fr pl uk cs pt he nl ar ko]
|
config.i18n.available_locales = %i[en en-US en-GB es-ES fr-FR pt-PT de-DE it-IT es it de fr pl uk cs pt he nl ar ko]
|
||||||
config.i18n.fallbacks = [:en]
|
config.i18n.fallbacks = [:en]
|
||||||
|
|
||||||
config.exceptions_app = ->(env) { ErrorsController.action(:show).call(env) }
|
config.exceptions_app = ->(env) { ErrorsController.action(:show).call(env) }
|
||||||
|
|||||||
+30
-1
@@ -19,9 +19,11 @@ en: &en
|
|||||||
language_ar: العربية
|
language_ar: العربية
|
||||||
language_ko: 한국어
|
language_ko: 한국어
|
||||||
email: Email
|
email: Email
|
||||||
|
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}'
|
||||||
digitally_signed_by: Digitally signed by
|
digitally_signed_by: Digitally signed by
|
||||||
role: Role
|
role: Role
|
||||||
|
reason: Reason
|
||||||
provide_your_email_to_start: Provide your email to start
|
provide_your_email_to_start: Provide your email to start
|
||||||
start: Start
|
start: Start
|
||||||
starting: Starting
|
starting: Starting
|
||||||
@@ -64,6 +66,8 @@ en: &en
|
|||||||
|
|
||||||
es: &es
|
es: &es
|
||||||
role: Rol
|
role: Rol
|
||||||
|
reason: Razón
|
||||||
|
form_expired_at_html: 'El formulario expiró el <span class="font-semibold">%{time}</span>'
|
||||||
verification_code_code: 'Código de verificación: %{code}'
|
verification_code_code: 'Código de verificación: %{code}'
|
||||||
email: Correo electrónico
|
email: Correo electrónico
|
||||||
digitally_signed_by: Firmado digitalmente por
|
digitally_signed_by: Firmado digitalmente por
|
||||||
@@ -104,10 +108,12 @@ es: &es
|
|||||||
by_creating_an_account_you_agree_to_our_html: 'Al crear una cuenta, aceptas nuestra <a target="_blank" href="https://www.docuseal.co/privacy">Política de Privacidad</a> y <a target="_blank" href="https://www.docuseal.co/terms">Términos de Servicio</a>.'
|
by_creating_an_account_you_agree_to_our_html: 'Al crear una cuenta, aceptas nuestra <a target="_blank" href="https://www.docuseal.co/privacy">Política de Privacidad</a> y <a target="_blank" href="https://www.docuseal.co/terms">Términos de Servicio</a>.'
|
||||||
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
|
||||||
role: Rôle
|
role: Rôle
|
||||||
|
reason: Ragione
|
||||||
verification_code_code: 'Codice di verifica: %{code}'
|
verification_code_code: 'Codice di verifica: %{code}'
|
||||||
email: Email
|
email: Email
|
||||||
|
form_expired_at_html: 'Il modulo è scaduto il <span class="font-semibold">%{time}</span>'
|
||||||
digitally_signed_by: Firmato digitalmente da
|
digitally_signed_by: Firmato digitalmente da
|
||||||
role: Ruolo
|
role: Ruolo
|
||||||
provide_your_email_to_start: Fornisci la tua email per iniziare
|
provide_your_email_to_start: Fornisci la tua email per iniziare
|
||||||
@@ -149,7 +155,9 @@ fr: &fr
|
|||||||
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
|
||||||
|
reason: Raison
|
||||||
role: Rôle
|
role: Rôle
|
||||||
|
form_expired_at_html: 'Le formulaire a expiré le <span class="font-semibold">%{time}</span>'
|
||||||
provide_your_email_to_start: Entrez votre adresse email pour commencer
|
provide_your_email_to_start: Entrez votre adresse email pour commencer
|
||||||
start: Démarrer
|
start: Démarrer
|
||||||
starting: Démarrage
|
starting: Démarrage
|
||||||
@@ -189,8 +197,10 @@ fr: &fr
|
|||||||
pt: &pt
|
pt: &pt
|
||||||
role: Função
|
role: Função
|
||||||
email: Email
|
email: Email
|
||||||
|
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>'
|
||||||
role: Função
|
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
|
||||||
@@ -230,7 +240,9 @@ pt: &pt
|
|||||||
de: &de
|
de: &de
|
||||||
role: Rolle
|
role: Rolle
|
||||||
verification_code_code: 'Verifizierungscode: %{code}'
|
verification_code_code: 'Verifizierungscode: %{code}'
|
||||||
|
reason: Grund
|
||||||
email: E-Mail
|
email: E-Mail
|
||||||
|
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
|
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
|
||||||
@@ -272,9 +284,11 @@ pl:
|
|||||||
email: Email
|
email: Email
|
||||||
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>'
|
||||||
role: Rola
|
role: Rola
|
||||||
provide_your_email_to_start: Podaj swój adres email, aby rozpocząć
|
provide_your_email_to_start: Podaj swój adres email, aby rozpocząć
|
||||||
start: Rozpocznij
|
start: Rozpocznij
|
||||||
|
reason: Powód
|
||||||
starting: Rozpoczynanie
|
starting: Rozpoczynanie
|
||||||
form_has_been_deleted_by_html: 'Formularz został usunięty przez <span class="font-semibold">%{name}</span>.'
|
form_has_been_deleted_by_html: 'Formularz został usunięty przez <span class="font-semibold">%{name}</span>.'
|
||||||
invited_by_html: 'Zaproszony przez <span class="font-semibold">%{name}</span>'
|
invited_by_html: 'Zaproszony przez <span class="font-semibold">%{name}</span>'
|
||||||
@@ -314,7 +328,9 @@ uk:
|
|||||||
verification_code_code: 'Код підтвердження: %{code}'
|
verification_code_code: 'Код підтвердження: %{code}'
|
||||||
role: Роль
|
role: Роль
|
||||||
provide_your_email_to_start: Введіть свій email, щоб почати
|
provide_your_email_to_start: Введіть свій email, щоб почати
|
||||||
|
form_expired_at_html: 'Строк подачі завершився о <span class="font-semibold">%{time}</span>'
|
||||||
start: Почати
|
start: Почати
|
||||||
|
reason: Причина
|
||||||
starting: Початок
|
starting: Початок
|
||||||
form_has_been_deleted_by_html: 'Форму було видалено користувачем <span class="font-semibold">%{name}</span>.'
|
form_has_been_deleted_by_html: 'Форму було видалено користувачем <span class="font-semibold">%{name}</span>.'
|
||||||
invited_by_html: 'Запрошений користувачем <span class="font-semibold">%{name}</span>'
|
invited_by_html: 'Запрошений користувачем <span class="font-semibold">%{name}</span>'
|
||||||
@@ -354,6 +370,8 @@ cs:
|
|||||||
verification_code_code: 'Ověřovací kód: %{code}'
|
verification_code_code: 'Ověřovací kód: %{code}'
|
||||||
role: Role
|
role: Role
|
||||||
provide_your_email_to_start: Zadejte svůj email pro zahájení
|
provide_your_email_to_start: Zadejte svůj email pro zahájení
|
||||||
|
reason: Důvod
|
||||||
|
form_expired_at_html: 'Formulář vypršel <span class="font-semibold">%{time}</span>'
|
||||||
start: Zahájit
|
start: Zahájit
|
||||||
starting: Zahajování
|
starting: Zahajování
|
||||||
form_has_been_deleted_by_html: 'Formulář byl smazán uživatelem <span class="font-semibold">%{name}</span>.'
|
form_has_been_deleted_by_html: 'Formulář byl smazán uživatelem <span class="font-semibold">%{name}</span>.'
|
||||||
@@ -392,10 +410,12 @@ he:
|
|||||||
email: דוא"ל
|
email: דוא"ל
|
||||||
digitally_signed_by: חתום דיגיטלית על ידי
|
digitally_signed_by: חתום דיגיטלית על ידי
|
||||||
role: תפקיד
|
role: תפקיד
|
||||||
|
reason: סיבה
|
||||||
verification_code_code: 'קוד אימות: %{code}'
|
verification_code_code: 'קוד אימות: %{code}'
|
||||||
provide_your_email_to_start: ספק את כתובת הדוא"ל שלך כדי להתחיל
|
provide_your_email_to_start: ספק את כתובת הדוא"ל שלך כדי להתחיל
|
||||||
start: התחל
|
start: התחל
|
||||||
starting: מתחיל
|
starting: מתחיל
|
||||||
|
form_expired_at_html: 'הטופס פג תוקף ב- <span class="font-semibold">%{time}</span>'
|
||||||
form_has_been_deleted_by_html: 'הטופס נמחק על ידי <span class="font-semibold">%{name}</span>.'
|
form_has_been_deleted_by_html: 'הטופס נמחק על ידי <span class="font-semibold">%{name}</span>.'
|
||||||
invited_by_html: 'הוזמן על ידי <span class="font-semibold">%{name}</span>'
|
invited_by_html: 'הוזמן על ידי <span class="font-semibold">%{name}</span>'
|
||||||
you_have_been_invited_to_submit_a_form: הוזמנת להגיש טופס
|
you_have_been_invited_to_submit_a_form: הוזמנת להגיש טופס
|
||||||
@@ -435,6 +455,8 @@ nl:
|
|||||||
verification_code_code: 'Verificatiecode: %{code}'
|
verification_code_code: 'Verificatiecode: %{code}'
|
||||||
provide_your_email_to_start: Geef uw e-mailadres om te beginnen
|
provide_your_email_to_start: Geef uw e-mailadres om te beginnen
|
||||||
start: Start
|
start: Start
|
||||||
|
reason: Reden
|
||||||
|
form_expired_at_html: 'Formulier is verlopen op <span class="font-semibold">%{time}</span>'
|
||||||
starting: Starten
|
starting: Starten
|
||||||
form_has_been_deleted_by_html: 'Formulier is verwijderd door <span class="font-semibold">%{name}</span>.'
|
form_has_been_deleted_by_html: 'Formulier is verwijderd door <span class="font-semibold">%{name}</span>.'
|
||||||
invited_by_html: 'Uitgenodigd door <span class="font-semibold">%{name}</span>'
|
invited_by_html: 'Uitgenodigd door <span class="font-semibold">%{name}</span>'
|
||||||
@@ -478,7 +500,9 @@ ar:
|
|||||||
starting: بداية
|
starting: بداية
|
||||||
verification_code_code: 'رمز التحقق: %{code}'
|
verification_code_code: 'رمز التحقق: %{code}'
|
||||||
form_has_been_deleted_by_html: 'تم حذف الاستمارة بواسطة <span class="font-semibold">%{name}</span>.'
|
form_has_been_deleted_by_html: 'تم حذف الاستمارة بواسطة <span class="font-semibold">%{name}</span>.'
|
||||||
|
reason: سبب
|
||||||
invited_by_html: 'تمت الدعوة بواسطة <span class="font-semibold">%{name}</span>'
|
invited_by_html: 'تمت الدعوة بواسطة <span class="font-semibold">%{name}</span>'
|
||||||
|
form_expired_at_html: 'استمارة انتهت صلاحيتها في <span class="font-semibold">%{time}</span>'
|
||||||
you_have_been_invited_to_submit_a_form: تمت دعوتك لتقديم استمارة
|
you_have_been_invited_to_submit_a_form: تمت دعوتك لتقديم استمارة
|
||||||
signed_on_time: 'تم التوقيع في %{time}'
|
signed_on_time: 'تم التوقيع في %{time}'
|
||||||
form_has_been_submitted_already: تم تقديم الاستمارة بالفعل
|
form_has_been_submitted_already: تم تقديم الاستمارة بالفعل
|
||||||
@@ -516,7 +540,9 @@ ko:
|
|||||||
role: 역할
|
role: 역할
|
||||||
provide_your_email_to_start: 시작하려면 이메일을 제공하세요
|
provide_your_email_to_start: 시작하려면 이메일을 제공하세요
|
||||||
start: 시작
|
start: 시작
|
||||||
|
reason: 이유
|
||||||
starting: 시작 중
|
starting: 시작 중
|
||||||
|
form_expired_at_html: '양식이 만료되었습니다 <span class="font-semibold">%{time}</span>'
|
||||||
form_has_been_deleted_by_html: '<span class="font-semibold">%{name}</span>에 의해 양식이 삭제되었습니다.'
|
form_has_been_deleted_by_html: '<span class="font-semibold">%{name}</span>에 의해 양식이 삭제되었습니다.'
|
||||||
invited_by_html: '<span class="font-semibold">%{name}</span>에 의해 초대되었습니다.'
|
invited_by_html: '<span class="font-semibold">%{name}</span>에 의해 초대되었습니다.'
|
||||||
you_have_been_invited_to_submit_a_form: 양식을 제출하도록 초대되었습니다.
|
you_have_been_invited_to_submit_a_form: 양식을 제출하도록 초대되었습니다.
|
||||||
@@ -574,3 +600,6 @@ pt-PT:
|
|||||||
|
|
||||||
de-DE:
|
de-DE:
|
||||||
<<: *de
|
<<: *de
|
||||||
|
|
||||||
|
it-IT:
|
||||||
|
<<: *it
|
||||||
@@ -75,6 +75,7 @@ Rails.application.routes.draw do
|
|||||||
resources :submitters_autocomplete, only: %i[index]
|
resources :submitters_autocomplete, only: %i[index]
|
||||||
resources :template_folders_autocomplete, only: %i[index]
|
resources :template_folders_autocomplete, only: %i[index]
|
||||||
resources :webhook_preferences, only: %i[create]
|
resources :webhook_preferences, only: %i[create]
|
||||||
|
resources :webhook_secret, only: %i[index create]
|
||||||
resource :templates_upload, only: %i[create]
|
resource :templates_upload, only: %i[create]
|
||||||
authenticated do
|
authenticated do
|
||||||
resource :templates_upload, only: %i[show], path: 'new'
|
resource :templates_upload, only: %i[show], path: 'new'
|
||||||
@@ -166,5 +167,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get '/js/:filename', to: 'embed_scripts#show', as: :embed_script
|
||||||
|
|
||||||
ActiveSupport.run_load_hooks(:routes, self)
|
ActiveSupport.run_load_hooks(:routes, self)
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddExpireAtToSubmissions < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
add_column :submissions, :expire_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_07_20_063827) do
|
ActiveRecord::Schema[7.1].define(version: 2024_08_01_125558) 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"
|
||||||
|
|
||||||
@@ -218,6 +218,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_20_063827) do
|
|||||||
t.string "slug", null: false
|
t.string "slug", null: false
|
||||||
t.text "preferences", null: false
|
t.text "preferences", null: false
|
||||||
t.bigint "account_id", null: false
|
t.bigint "account_id", null: false
|
||||||
|
t.datetime "expire_at"
|
||||||
t.index ["account_id"], name: "index_submissions_on_account_id"
|
t.index ["account_id"], name: "index_submissions_on_account_id"
|
||||||
t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id"
|
t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id"
|
||||||
t.index ["slug"], name: "index_submissions_on_slug", unique: true
|
t.index ["slug"], name: "index_submissions_on_slug", unique: true
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- .:/data
|
- ./docuseal:/data/docuseal
|
||||||
environment:
|
environment:
|
||||||
- FORCE_SSL=${HOST}
|
- FORCE_SSL=${HOST}
|
||||||
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/docuseal
|
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/docuseal
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ module Submissions
|
|||||||
return email.downcase if email.to_s.include?('.gob')
|
return email.downcase if email.to_s.include?('.gob')
|
||||||
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 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('<'))
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ module Submissions
|
|||||||
submission = template.submissions.new(created_by_user: user, source:,
|
submission = template.submissions.new(created_by_user: user, source:,
|
||||||
account_id: user.account_id,
|
account_id: user.account_id,
|
||||||
preferences: set_submission_preferences,
|
preferences: set_submission_preferences,
|
||||||
|
expire_at: attrs[:expire_at],
|
||||||
template_submitters: [], submitters_order:)
|
template_submitters: [], submitters_order:)
|
||||||
|
|
||||||
maybe_set_template_fields(submission, attrs[:submitters])
|
maybe_set_template_fields(submission, attrs[:submitters])
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ module Submissions
|
|||||||
.rectangle(0, 0, box.width, 20)
|
.rectangle(0, 0, box.width, 20)
|
||||||
.rectangle(0, box.height - 20, box.width, 20)
|
.rectangle(0, box.height - 20, box.width, 20)
|
||||||
.fill
|
.fill
|
||||||
|
|
||||||
|
maybe_add_background(canvas, submission, page_size)
|
||||||
end
|
end
|
||||||
style.frame = style.create_frame(canvas.context, 50)
|
style.frame = style.create_frame(canvas.context, 50)
|
||||||
end
|
end
|
||||||
@@ -336,6 +338,8 @@ module Submissions
|
|||||||
'Signed with DocuSeal.co'
|
'Signed with DocuSeal.co'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def maybe_add_background(_canvas, _submission, _page_size); end
|
||||||
|
|
||||||
def add_logo(column, _submission = nil)
|
def add_logo(column, _submission = nil)
|
||||||
column.image(PdfIcons.logo_io, width: 40, height: 40, position: :float)
|
column.image(PdfIcons.logo_io, width: 40, height: 40, position: :float)
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ module Submissions
|
|||||||
A4_SIZE = [595, 842].freeze
|
A4_SIZE = [595, 842].freeze
|
||||||
SUPPORTED_IMAGE_TYPES = ['image/png', 'image/jpeg'].freeze
|
SUPPORTED_IMAGE_TYPES = ['image/png', 'image/jpeg'].freeze
|
||||||
|
|
||||||
|
TESTING_FOOTER = 'Testing Document - NOT LEGALLY BINDING'
|
||||||
|
|
||||||
MISSING_GLYPH_REPLACE = {
|
MISSING_GLYPH_REPLACE = {
|
||||||
'▪' => '-',
|
'▪' => '-',
|
||||||
'✔️' => 'V',
|
'✔️' => 'V',
|
||||||
@@ -88,6 +90,9 @@ module Submissions
|
|||||||
def generate_pdfs(submitter)
|
def generate_pdfs(submitter)
|
||||||
cell_layouter = HexaPDF::Layout::TextLayouter.new(text_valign: :center, text_align: :center)
|
cell_layouter = HexaPDF::Layout::TextLayouter.new(text_valign: :center, text_align: :center)
|
||||||
|
|
||||||
|
with_signature_id = submitter.account.account_configs
|
||||||
|
.exists?(key: AccountConfig::WITH_SIGNATURE_ID, value: true)
|
||||||
|
|
||||||
is_flatten =
|
is_flatten =
|
||||||
submitter.account.account_configs
|
submitter.account.account_configs
|
||||||
.find_or_initialize_by(key: AccountConfig::FLATTEN_RESULT_PDF_KEY).value != false
|
.find_or_initialize_by(key: AccountConfig::FLATTEN_RESULT_PDF_KEY).value != false
|
||||||
@@ -97,6 +102,35 @@ module Submissions
|
|||||||
|
|
||||||
pdfs_index = build_pdfs_index(submitter, flatten: is_flatten)
|
pdfs_index = build_pdfs_index(submitter, flatten: is_flatten)
|
||||||
|
|
||||||
|
if with_signature_id || submitter.account.testing?
|
||||||
|
pdfs_index.each_value do |pdf|
|
||||||
|
next if pdf.trailer.info[:DocumentID].present?
|
||||||
|
|
||||||
|
document_id = Digest::MD5.hexdigest(submitter.submission.slug).upcase
|
||||||
|
|
||||||
|
pdf.trailer.info[:DocumentID] = document_id
|
||||||
|
pdf.pages.each do |page|
|
||||||
|
font_size = (([page.box.width, page.box.height].min / A4_SIZE[0].to_f) * 9).to_i
|
||||||
|
cnv = page.canvas(type: :overlay)
|
||||||
|
|
||||||
|
cnv.font(FONT_NAME, size: font_size)
|
||||||
|
|
||||||
|
text =
|
||||||
|
if submitter.account.testing?
|
||||||
|
if with_signature_id
|
||||||
|
"#{TESTING_FOOTER} | ID: #{document_id}"
|
||||||
|
else
|
||||||
|
TESTING_FOOTER
|
||||||
|
end
|
||||||
|
else
|
||||||
|
"Document ID: #{document_id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
cnv.text(text, at: [2, 4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
submitter.submission.template_fields.each do |field|
|
submitter.submission.template_fields.each do |field|
|
||||||
next if field['submitter_uuid'] != submitter.uuid
|
next if field['submitter_uuid'] != submitter.uuid
|
||||||
|
|
||||||
@@ -150,6 +184,69 @@ module Submissions
|
|||||||
canvas.font(FONT_NAME, size: font_size)
|
canvas.font(FONT_NAME, size: font_size)
|
||||||
|
|
||||||
case field['type']
|
case field['type']
|
||||||
|
when ->(type) { type == 'signature' && with_signature_id }
|
||||||
|
attachment = submitter.attachments.find { |a| a.uuid == value }
|
||||||
|
|
||||||
|
attachments_data_cache[attachment.uuid] ||= attachment.download
|
||||||
|
|
||||||
|
image = Vips::Image.new_from_buffer(attachments_data_cache[attachment.uuid], '').autorot
|
||||||
|
|
||||||
|
id_string = "ID: #{attachment.uuid}".upcase
|
||||||
|
|
||||||
|
while true
|
||||||
|
text = HexaPDF::Layout::TextFragment.create(id_string,
|
||||||
|
font:,
|
||||||
|
font_size: (font_size / 1.8).to_i)
|
||||||
|
|
||||||
|
result = layouter.fit([text], area['w'] * width, (font_size / 1.8) / 0.65)
|
||||||
|
|
||||||
|
break if result.status == :success
|
||||||
|
|
||||||
|
id_string = "#{id_string.delete_suffix('...')[0..-2]}..."
|
||||||
|
|
||||||
|
break if id_string.length < 8
|
||||||
|
end
|
||||||
|
|
||||||
|
reason_string =
|
||||||
|
"#{I18n.t('reason')}: #{I18n.t('digitally_signed_by')} " \
|
||||||
|
"#{submitter.name}#{submitter.email.present? ? " <#{submitter.email}>" : ''}\n" \
|
||||||
|
"#{I18n.l(attachment.created_at.in_time_zone(submitter.account.timezone),
|
||||||
|
format: :long, locale: submitter.account.locale)} " \
|
||||||
|
"#{TimeUtils.timezone_abbr(submitter.account.timezone, attachment.created_at)}"
|
||||||
|
|
||||||
|
reason_text = HexaPDF::Layout::TextFragment.create(reason_string,
|
||||||
|
font:,
|
||||||
|
font_size: (font_size / 1.8).to_i)
|
||||||
|
|
||||||
|
reason_result = layouter.fit([reason_text], area['w'] * width, height)
|
||||||
|
|
||||||
|
text_height = result.lines.sum(&:height) + reason_result.lines.sum(&:height)
|
||||||
|
|
||||||
|
image_height = (area['h'] * height) - text_height
|
||||||
|
image_height = (area['h'] * height) / 2 if image_height < (area['h'] * height) / 2
|
||||||
|
|
||||||
|
scale = [(area['w'] * width) / image.width, image_height / image.height].min
|
||||||
|
|
||||||
|
io = StringIO.new(image.resize([scale * 4, 1].select(&:positive?).min).write_to_buffer('.png'))
|
||||||
|
|
||||||
|
layouter.fit([text], area['w'] * width, (font_size / 1.8) / 0.65)
|
||||||
|
.draw(canvas, (area['x'] * width) + TEXT_LEFT_MARGIN,
|
||||||
|
height - (area['y'] * height) - TEXT_TOP_MARGIN - image_height)
|
||||||
|
|
||||||
|
layouter.fit([reason_text], area['w'] * width, reason_result.lines.sum(&:height))
|
||||||
|
.draw(canvas, (area['x'] * width) + TEXT_LEFT_MARGIN,
|
||||||
|
height - (area['y'] * height) - TEXT_TOP_MARGIN -
|
||||||
|
result.lines.sum(&:height) - image_height)
|
||||||
|
|
||||||
|
canvas.image(
|
||||||
|
io,
|
||||||
|
at: [
|
||||||
|
(area['x'] * width) + (area['w'] * width / 2) - ((image.width * scale) / 2),
|
||||||
|
height - (area['y'] * height) - (image.height * scale / 2) - (image_height / 2)
|
||||||
|
],
|
||||||
|
width: image.width * scale,
|
||||||
|
height: image.height * scale
|
||||||
|
)
|
||||||
when 'image', 'signature', 'initials', 'stamp'
|
when 'image', 'signature', 'initials', 'stamp'
|
||||||
attachment = submitter.attachments.find { |a| a.uuid == value }
|
attachment = submitter.attachments.find { |a| a.uuid == value }
|
||||||
|
|
||||||
@@ -245,7 +342,7 @@ module Submissions
|
|||||||
width: PdfIcons::WIDTH * scale,
|
width: PdfIcons::WIDTH * scale,
|
||||||
height: PdfIcons::HEIGHT * scale
|
height: PdfIcons::HEIGHT * scale
|
||||||
)
|
)
|
||||||
when ->(type) { type == 'cells' && area['cell_w'] }
|
when ->(type) { type == 'cells' && !area['cell_w'].to_i.zero? }
|
||||||
cell_width = area['cell_w'] * width
|
cell_width = area['cell_w'] * width
|
||||||
|
|
||||||
TextUtils.maybe_rtl_reverse(value).chars.each_with_index do |char, index|
|
TextUtils.maybe_rtl_reverse(value).chars.each_with_index do |char, index|
|
||||||
@@ -451,7 +548,7 @@ module Submissions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def on_missing_glyph(character, font_wrapper)
|
def on_missing_glyph(character, font_wrapper)
|
||||||
Rollbar.error("Missing glyph: #{character}") if character.present? && defined?(Rollbar)
|
Rails.logger.info("Missing glyph: #{character}") if character.present? && defined?(Rollbar)
|
||||||
|
|
||||||
replace_with =
|
replace_with =
|
||||||
if font_wrapper.font_type == :Type1
|
if font_wrapper.font_type == :Type1
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
module Submissions
|
module Submissions
|
||||||
module SerializeForApi
|
module SerializeForApi
|
||||||
SERIALIZE_PARAMS = {
|
SERIALIZE_PARAMS = {
|
||||||
only: %i[id slug source submitters_order 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],
|
||||||
include: {
|
include: {
|
||||||
submitters: { only: %i[id slug uuid name email phone
|
submitters: { only: %i[id slug uuid name email phone
|
||||||
@@ -41,7 +41,7 @@ module Submissions
|
|||||||
json[:completed_at] = last_submitter.completed_at
|
json[:completed_at] = last_submitter.completed_at
|
||||||
else
|
else
|
||||||
json[:documents] = []
|
json[:documents] = []
|
||||||
json[:status] = 'pending'
|
json[:status] = submission.expired? ? 'expired' : 'pending'
|
||||||
json[:completed_at] = nil
|
json[:completed_at] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Submitters
|
module Submitters
|
||||||
TRUE_VALUES = ['1', 'true', true].freeze
|
TRUE_VALUES = ['1', 'true', true].freeze
|
||||||
|
PRELOAD_ALL_PAGES_AMOUNT = 200
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
@@ -29,6 +30,25 @@ module Submitters
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def preload_with_pages(submitter)
|
||||||
|
ActiveRecord::Associations::Preloader.new(
|
||||||
|
records: [submitter],
|
||||||
|
associations: [submission: [:template, { template_schema_documents: :blob }]]
|
||||||
|
).call
|
||||||
|
|
||||||
|
total_pages =
|
||||||
|
submitter.submission.template_schema_documents.sum { |e| e.metadata.dig('pdf', 'number_of_pages').to_i }
|
||||||
|
|
||||||
|
if total_pages < PRELOAD_ALL_PAGES_AMOUNT
|
||||||
|
ActiveRecord::Associations::Preloader.new(
|
||||||
|
records: submitter.submission.template_schema_documents,
|
||||||
|
associations: [:blob, { preview_images_attachments: :blob }]
|
||||||
|
).call
|
||||||
|
end
|
||||||
|
|
||||||
|
submitter
|
||||||
|
end
|
||||||
|
|
||||||
def create_attachment!(submitter, params)
|
def create_attachment!(submitter, params)
|
||||||
blob =
|
blob =
|
||||||
if (file = params[:file])
|
if (file = params[:file])
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ module Submitters
|
|||||||
AccountConfig::FORM_COMPLETED_MESSAGE_KEY,
|
AccountConfig::FORM_COMPLETED_MESSAGE_KEY,
|
||||||
AccountConfig::FORM_WITH_CONFETTI_KEY,
|
AccountConfig::FORM_WITH_CONFETTI_KEY,
|
||||||
AccountConfig::FORM_PREFILL_SIGNATURE_KEY,
|
AccountConfig::FORM_PREFILL_SIGNATURE_KEY,
|
||||||
|
AccountConfig::WITH_SIGNATURE_ID,
|
||||||
AccountConfig::ALLOW_TYPED_SIGNATURE].freeze
|
AccountConfig::ALLOW_TYPED_SIGNATURE].freeze
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
@@ -18,8 +19,14 @@ module Submitters
|
|||||||
with_typed_signature = find_safe_value(configs, AccountConfig::ALLOW_TYPED_SIGNATURE) != false
|
with_typed_signature = find_safe_value(configs, AccountConfig::ALLOW_TYPED_SIGNATURE) != false
|
||||||
with_confetti = find_safe_value(configs, AccountConfig::FORM_WITH_CONFETTI_KEY) != false
|
with_confetti = find_safe_value(configs, AccountConfig::FORM_WITH_CONFETTI_KEY) != false
|
||||||
prefill_signature = find_safe_value(configs, AccountConfig::FORM_PREFILL_SIGNATURE_KEY) != false
|
prefill_signature = find_safe_value(configs, AccountConfig::FORM_PREFILL_SIGNATURE_KEY) != false
|
||||||
|
with_signature_id = find_safe_value(configs, AccountConfig::WITH_SIGNATURE_ID) == true
|
||||||
|
|
||||||
attrs = { completed_button:, with_typed_signature:, with_confetti:, completed_message:, prefill_signature: }
|
attrs = { completed_button:,
|
||||||
|
with_typed_signature:,
|
||||||
|
with_confetti:,
|
||||||
|
completed_message:,
|
||||||
|
prefill_signature:,
|
||||||
|
with_signature_id: }
|
||||||
|
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
attrs[key.to_sym] = configs.find { |e| e.key == key.to_s }&.value
|
attrs[key.to_sym] = configs.find { |e| e.key == key.to_s }&.value
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ module Submitters
|
|||||||
record: submitter
|
record: submitter
|
||||||
)
|
)
|
||||||
|
|
||||||
attachment.uuid
|
|
||||||
elsif field['type'] == 'signature' && (signature = UserConfigs.load_signature(user))
|
|
||||||
attachment = ActiveStorage::Attachment.find_or_create_by!(
|
|
||||||
blob_id: signature.blob_id,
|
|
||||||
name: 'attachments',
|
|
||||||
record: submitter
|
|
||||||
)
|
|
||||||
|
|
||||||
attachment.uuid
|
attachment.uuid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ module Submitters
|
|||||||
else
|
else
|
||||||
Date.parse(value).to_s
|
Date.parse(value).to_s
|
||||||
end
|
end
|
||||||
rescue Date::Error => e
|
rescue Date::Error
|
||||||
Rollbar.warning(e) if defined?(Rollbar)
|
|
||||||
|
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ module Submitters
|
|||||||
def merge_formula_values(submitter)
|
def merge_formula_values(submitter)
|
||||||
computed_values = submitter.submission.template_fields.each_with_object({}) do |field, acc|
|
computed_values = submitter.submission.template_fields.each_with_object({}) do |field, acc|
|
||||||
next if field['submitter_uuid'] != submitter.uuid
|
next if field['submitter_uuid'] != submitter.uuid
|
||||||
|
next if field['type'] == 'payment'
|
||||||
|
|
||||||
formula = field.dig('preferences', 'formula')
|
formula = field.dig('preferences', 'formula')
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ module Templates
|
|||||||
ATTACHMENT_NAME = 'preview_images'
|
ATTACHMENT_NAME = 'preview_images'
|
||||||
|
|
||||||
PDF_CONTENT_TYPE = 'application/pdf'
|
PDF_CONTENT_TYPE = 'application/pdf'
|
||||||
Q = 35
|
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
|
||||||
|
|||||||
@@ -9,9 +9,17 @@ module Templates
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def call(template, schema_documents = template.schema_documents, preview_image_attachments = [])
|
def call(template, schema_documents = template.schema_documents.preload(:blob), preview_image_attachments = nil)
|
||||||
json = template.as_json(SERIALIZE_PARAMS)
|
json = template.as_json(SERIALIZE_PARAMS)
|
||||||
|
|
||||||
|
preview_image_attachments ||=
|
||||||
|
ActiveStorage::Attachment.joins(:blob)
|
||||||
|
.where(blob: { filename: '0.jpg' })
|
||||||
|
.where(record_id: schema_documents.map(&:id),
|
||||||
|
record_type: 'ActiveStorage::Attachment',
|
||||||
|
name: :preview_images)
|
||||||
|
.preload(:blob)
|
||||||
|
|
||||||
json[:documents] = template.schema.map do |item|
|
json[:documents] = template.schema.map do |item|
|
||||||
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }
|
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -32,6 +32,14 @@ module TimeUtils
|
|||||||
tz_info.abbreviation(time)
|
tz_info.abbreviation(time)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parse_time_value(value)
|
||||||
|
if value.is_a?(Integer)
|
||||||
|
Time.zone.at(value.to_s.first(10).to_i)
|
||||||
|
elsif value.present?
|
||||||
|
Time.zone.parse(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def parse_date_string(string, pattern)
|
def parse_date_string(string, pattern)
|
||||||
pattern = pattern.sub(/Y+/, YEAR_FORMATS)
|
pattern = pattern.sub(/Y+/, YEAR_FORMATS)
|
||||||
.sub(/M+/, MONTH_FORMATS)
|
.sub(/M+/, MONTH_FORMATS)
|
||||||
@@ -50,9 +58,7 @@ module TimeUtils
|
|||||||
.sub(/Y+/, YEAR_FORMATS[format[/Y+/]])
|
.sub(/Y+/, YEAR_FORMATS[format[/Y+/]])
|
||||||
|
|
||||||
I18n.l(date, format: i18n_format, locale:)
|
I18n.l(date, format: i18n_format, locale:)
|
||||||
rescue Date::Error => e
|
rescue Date::Error
|
||||||
Rollbar.warning("#{e}: #{string}") if defined?(Rollbar)
|
|
||||||
|
|
||||||
string
|
string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -44,9 +44,7 @@ RSpec.describe 'Template' do
|
|||||||
|
|
||||||
it 'archives a template' do
|
it 'archives a template' do
|
||||||
expect do
|
expect do
|
||||||
accept_confirm('Are you sure?') do
|
click_button 'Archive'
|
||||||
click_button 'Archive'
|
|
||||||
end
|
|
||||||
end.to change { Template.active.count }.by(-1)
|
end.to change { Template.active.count }.by(-1)
|
||||||
|
|
||||||
expect(page).to have_content('Template has been archived')
|
expect(page).to have_content('Template has been archived')
|
||||||
|
|||||||
Reference in new issue
Block a user