add submitter completed redirect url
This commit is contained in:
@@ -142,9 +142,9 @@ module Api
|
|||||||
|
|
||||||
params.permit(
|
params.permit(
|
||||||
key => [
|
key => [
|
||||||
[:send_email, :send_sms, :bcc_completed, {
|
[:send_email, :send_sms, :bcc_completed, :completed_redirect_url, {
|
||||||
message: %i[subject body],
|
message: %i[subject body],
|
||||||
submitters: [[:send_email, :send_sms, :uuid, :name, :email, :role,
|
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
|
||||||
:completed, :phone, :application_key,
|
:completed, :phone, :application_key,
|
||||||
{ values: {}, readonly_fields: [], message: %i[subject body],
|
{ values: {}, readonly_fields: [], message: %i[subject body],
|
||||||
fields: [%i[name default_value title description
|
fields: [%i[name default_value title description
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
class SubmitFormController < ApplicationController
|
class SubmitFormController < ApplicationController
|
||||||
layout 'form'
|
layout 'form'
|
||||||
|
|
||||||
around_action :with_browser_locale, only: %i[show completed]
|
around_action :with_browser_locale, only: %i[show completed success]
|
||||||
skip_before_action :authenticate_user!
|
skip_before_action :authenticate_user!
|
||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
@@ -59,4 +59,6 @@ class SubmitFormController < ApplicationController
|
|||||||
def completed
|
def completed
|
||||||
@submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
@submitter = Submitter.find_by!(slug: params[:submit_form_slug])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def success; end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ window.customElements.define('submission-form', class extends HTMLElement {
|
|||||||
withTypedSignature: this.dataset.withTypedSignature !== 'false',
|
withTypedSignature: this.dataset.withTypedSignature !== 'false',
|
||||||
values: reactive(JSON.parse(this.dataset.values)),
|
values: reactive(JSON.parse(this.dataset.values)),
|
||||||
completedButton: JSON.parse(this.dataset.completedButton),
|
completedButton: JSON.parse(this.dataset.completedButton),
|
||||||
|
completedRedirectUrl: this.dataset.completedRedirectUrl,
|
||||||
attachments: reactive(JSON.parse(this.dataset.attachments)),
|
attachments: reactive(JSON.parse(this.dataset.attachments)),
|
||||||
fields: JSON.parse(this.dataset.fields)
|
fields: JSON.parse(this.dataset.fields)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -332,9 +332,9 @@
|
|||||||
v-else
|
v-else
|
||||||
:is-demo="isDemo"
|
:is-demo="isDemo"
|
||||||
:attribution="attribution"
|
:attribution="attribution"
|
||||||
:completed-button="completedButton"
|
:completed-button="completedRedirectUrl ? {} : completedButton"
|
||||||
:with-send-copy-button="withSendCopyButton"
|
:with-send-copy-button="withSendCopyButton && !completedRedirectUrl"
|
||||||
:with-download-button="withDownloadButton"
|
:with-download-button="withDownloadButton && !completedRedirectUrl"
|
||||||
:with-confetti="withConfetti"
|
:with-confetti="withConfetti"
|
||||||
:can-send-email="canSendEmail && !!submitter.email"
|
:can-send-email="canSendEmail && !!submitter.email"
|
||||||
:submitter-slug="submitterSlug"
|
:submitter-slug="submitterSlug"
|
||||||
@@ -496,6 +496,11 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
completedRedirectUrl: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
completedButton: {
|
completedButton: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -784,6 +789,10 @@ export default {
|
|||||||
if (respData) {
|
if (respData) {
|
||||||
this.onComplete(JSON.parse(respData))
|
this.onComplete(JSON.parse(respData))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.completedRedirectUrl) {
|
||||||
|
window.location.href = this.completedRedirectUrl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<% 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], 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 %>
|
||||||
<% configs = Submitters::FormConfigs.call(submitter) %>
|
<% configs = Submitters::FormConfigs.call(submitter) %>
|
||||||
<submission-form data-is-demo="<%= Docuseal.demo? %>" data-completed-button="<%= configs[:completed_button].to_json %>" data-go-to-last="<%= submitter.opened_at? %>" data-is-direct-upload="<%= Docuseal.active_storage_public? %>" data-submitter="<%= submitter.to_json(only: %i[uuid slug name phone email]) %>" data-can-send-email="<%= Accounts.can_send_emails?(Struct.new(:id).new(@submitter.submission.template.account_id)) %>" data-attachments="<%= data_attachments %>" data-fields="<%= data_fields %>" data-values="<%= submitter.values.to_json %>" data-with-typed-signature="<%= configs[:with_typed_signature] %>"></submission-form>
|
<submission-form data-is-demo="<%= Docuseal.demo? %>" data-completed-redirect-url="<%= submitter.preferences['completed_redirect_url'] %>" data-completed-button="<%= configs[:completed_button].to_json %>" data-go-to-last="<%= submitter.opened_at? %>" data-is-direct-upload="<%= Docuseal.active_storage_public? %>" data-submitter="<%= submitter.to_json(only: %i[uuid slug name phone email]) %>" data-can-send-email="<%= Accounts.can_send_emails?(Struct.new(:id).new(@submitter.submission.template.account_id)) %>" data-attachments="<%= data_attachments %>" data-fields="<%= data_fields %>" data-values="<%= submitter.values.to_json %>" data-with-typed-signature="<%= configs[:with_typed_signature] %>"></submission-form>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<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 p-2 mb-4 justify-center">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="mr-3">
|
||||||
|
<%= svg_icon('circle_check', class: 'w-10 h-10 text-green-600') %>
|
||||||
|
</div>
|
||||||
|
<div class="text-2xl">
|
||||||
|
<%= t('completed_successfully') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= render 'shared/attribution', link_path: '/start' %>
|
||||||
@@ -17,6 +17,7 @@ en: &en
|
|||||||
or: or
|
or: or
|
||||||
download_documents: Download documents
|
download_documents: Download documents
|
||||||
downloading: Downloading
|
downloading: Downloading
|
||||||
|
completed_successfully: Completed Successfully
|
||||||
|
|
||||||
es: &es
|
es: &es
|
||||||
digitally_signed_by: Firmado digitalmente por
|
digitally_signed_by: Firmado digitalmente por
|
||||||
@@ -38,6 +39,7 @@ es: &es
|
|||||||
or: o
|
or: o
|
||||||
download_documents: Descargar documentos
|
download_documents: Descargar documentos
|
||||||
downloading: Descargando
|
downloading: Descargando
|
||||||
|
completed_successfully: Completado exitosamente
|
||||||
|
|
||||||
it:
|
it:
|
||||||
digitally_signed_by: Signé numériquement par
|
digitally_signed_by: Signé numériquement par
|
||||||
@@ -59,6 +61,7 @@ it:
|
|||||||
or: o
|
or: o
|
||||||
download_documents: Scarica documenti
|
download_documents: Scarica documenti
|
||||||
downloading: Scaricamento
|
downloading: Scaricamento
|
||||||
|
completed_successfully: Completato con successo
|
||||||
|
|
||||||
fr: &fr
|
fr: &fr
|
||||||
email: Email
|
email: Email
|
||||||
@@ -78,6 +81,7 @@ fr: &fr
|
|||||||
or: ou
|
or: ou
|
||||||
download_documents: Télécharger des documents
|
download_documents: Télécharger des documents
|
||||||
downloading: Téléchargement
|
downloading: Téléchargement
|
||||||
|
completed_successfully: Terminé avec succès
|
||||||
|
|
||||||
pt: &pt
|
pt: &pt
|
||||||
digitally_signed_by: Assinado digitalmente por
|
digitally_signed_by: Assinado digitalmente por
|
||||||
@@ -99,6 +103,7 @@ pt: &pt
|
|||||||
or: ou
|
or: ou
|
||||||
download_documents: Baixar documentos
|
download_documents: Baixar documentos
|
||||||
downloading: Baixando
|
downloading: Baixando
|
||||||
|
completed_successfully: Concluído com sucesso
|
||||||
|
|
||||||
de: &de
|
de: &de
|
||||||
digitally_signed_by: Digital signiert von
|
digitally_signed_by: Digital signiert von
|
||||||
@@ -120,6 +125,7 @@ de: &de
|
|||||||
or: oder
|
or: oder
|
||||||
download_documents: Dokumente herunterladen
|
download_documents: Dokumente herunterladen
|
||||||
downloading: Herunterladen
|
downloading: Herunterladen
|
||||||
|
completed_successfully: Erfolgreich abgeschlossen
|
||||||
|
|
||||||
pl:
|
pl:
|
||||||
email: Email
|
email: Email
|
||||||
@@ -139,6 +145,7 @@ pl:
|
|||||||
or: lub
|
or: lub
|
||||||
download_documents: Pobierz dokumenty
|
download_documents: Pobierz dokumenty
|
||||||
downloading: Pobieranie
|
downloading: Pobieranie
|
||||||
|
completed_successfully: Zakończono pomyślnie
|
||||||
|
|
||||||
uk:
|
uk:
|
||||||
email: Email
|
email: Email
|
||||||
@@ -158,6 +165,7 @@ uk:
|
|||||||
or: або
|
or: або
|
||||||
download_documents: Завантажити документи
|
download_documents: Завантажити документи
|
||||||
downloading: Завантаження
|
downloading: Завантаження
|
||||||
|
completed_successfully: Успішно завершено
|
||||||
|
|
||||||
cs:
|
cs:
|
||||||
email: Email
|
email: Email
|
||||||
@@ -177,6 +185,7 @@ cs:
|
|||||||
or: nebo
|
or: nebo
|
||||||
download_documents: Stáhnout dokumenty
|
download_documents: Stáhnout dokumenty
|
||||||
downloading: Stahování
|
downloading: Stahování
|
||||||
|
completed_successfully: Úspěšně dokončeno
|
||||||
|
|
||||||
he:
|
he:
|
||||||
email: דוא"ל
|
email: דוא"ל
|
||||||
@@ -196,6 +205,7 @@ he:
|
|||||||
or: או
|
or: או
|
||||||
download_documents: הורד מסמכים
|
download_documents: הורד מסמכים
|
||||||
downloading: מוריד
|
downloading: מוריד
|
||||||
|
completed_successfully: הושלם בהצלחה
|
||||||
|
|
||||||
en-US:
|
en-US:
|
||||||
<<: *en
|
<<: *en
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ Rails.application.routes.draw do
|
|||||||
get :completed
|
get :completed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :submit_form, only: %i[], path: '' do
|
||||||
|
get :success, on: :collection
|
||||||
|
end
|
||||||
|
|
||||||
resources :submit_form, only: %i[show update], path: 's', param: 'slug' do
|
resources :submit_form, only: %i[show update], path: 's', param: 'slug' do
|
||||||
get :completed
|
get :completed
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ module Submitters
|
|||||||
preferences['send_email'] = params['send_email'].in?(TRUE_VALUES) if params.key?('send_email')
|
preferences['send_email'] = params['send_email'].in?(TRUE_VALUES) if params.key?('send_email')
|
||||||
preferences['send_sms'] = params['send_sms'].in?(TRUE_VALUES) if params.key?('send_sms')
|
preferences['send_sms'] = params['send_sms'].in?(TRUE_VALUES) if params.key?('send_sms')
|
||||||
preferences['bcc_completed'] = params['bcc_completed'] if params.key?('bcc_completed')
|
preferences['bcc_completed'] = params['bcc_completed'] if params.key?('bcc_completed')
|
||||||
|
preferences['completed_redirect_url'] = params['completed_redirect_url'] if params.key?('completed_redirect_url')
|
||||||
|
|
||||||
preferences
|
preferences
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user