mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 06:42:32 -05:00
add fields configs param to submissions api
This commit is contained in:
1 parent
69a3782903
commit
2f0c79444b
3 files changed
+47
-12
No files matched your search
@@ -107,7 +107,8 @@ module Api
|
||||
def submissions_params
|
||||
params.permit(submission: [{
|
||||
submitters: [[:uuid, :name, :email, :role, :completed, :phone,
|
||||
{ values: {}, readonly_fields: [] }]]
|
||||
{ values: {}, readonly_fields: [],
|
||||
fields: [%i[name default_value readonly validation_pattern invalid_message]] }]]
|
||||
}])
|
||||
end
|
||||
|
||||
@@ -116,11 +117,15 @@ module Api
|
||||
|
||||
Array.wrap(submissions_params).each do |submission|
|
||||
submission[:submitters].each_with_index do |submitter, index|
|
||||
next if submitter[:values].blank?
|
||||
default_values = submitter[:values] || {}
|
||||
|
||||
submitter[:fields]&.each { |f| default_values[f[:name]] = f[:default_value] if f[:default_value].present? }
|
||||
|
||||
next if default_values.blank?
|
||||
|
||||
values, new_attachments =
|
||||
Submitters::NormalizeValues.call(template,
|
||||
submitter[:values],
|
||||
default_values,
|
||||
submitter[:role] || template.submitters[index]['name'])
|
||||
|
||||
attachments.push(*new_attachments)
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
v-model="values[currentField.uuid]"
|
||||
class="base-input !text-2xl w-full"
|
||||
:required="currentField.required"
|
||||
:pattern="currentField.validation?.pattern"
|
||||
:oninvalid="currentField.validation?.message ? `this.setCustomValidity(${JSON.stringify(currentField.validation.message)})` : ''"
|
||||
:oninput="currentField.validation?.message ? `this.setCustomValidity('')` : ''"
|
||||
:placeholder="`${t('type_here')}...${currentField.required ? '' : ` (${t('optional')})`}`"
|
||||
type="text"
|
||||
:name="`values[${currentField.uuid}]`"
|
||||
|
||||
Reference in new issue
Block a user