mirror of
https://github.com/docusealco/docuseal
synced 2026-11-06 06:52:33 -05:00
refactor prefill
This commit is contained in:
1 parent
439f95d87e
commit
2d6f4c521e
13 files changed
+247
-128
No files matched your search
@@ -491,8 +491,8 @@
|
||||
:reason="values[currentField.preferences?.reason_field_uuid]"
|
||||
:field="currentField"
|
||||
:values="values"
|
||||
:previous-value="previousSignatureValueFor(currentField) || previousSignatureValue"
|
||||
:touch-attachment-uuid="previousSignatureValue"
|
||||
:previous-value="previousSignatureValueFor(currentField)"
|
||||
:prefill-data="prefillSignature"
|
||||
:with-typed-signature="withTypedSignature"
|
||||
:remember-signature="rememberSignature"
|
||||
:attachments-index="attachmentsIndex"
|
||||
@@ -507,7 +507,6 @@
|
||||
:show-field-names="showFieldNames"
|
||||
:native-platform="nativePlatform"
|
||||
@update:reason="values[currentField.preferences?.reason_field_uuid] = $event"
|
||||
@touch-attachment="attachmentsIndex[previousSignatureValue] ? attachmentsIndex[previousSignatureValue].created_at = new Date() : null"
|
||||
@attached="attachments.push($event)"
|
||||
@start="scrollIntoField(currentField)"
|
||||
@minimize="minimizeForm"
|
||||
@@ -521,6 +520,7 @@
|
||||
:dry-run="dryRun"
|
||||
:submitter="submitter"
|
||||
:previous-value="previousInitialsValue"
|
||||
:prefill-data="prefillInitials"
|
||||
:attachments-index="attachmentsIndex"
|
||||
:show-field-names="showFieldNames"
|
||||
:submitter-slug="submitterSlug"
|
||||
@@ -981,10 +981,20 @@ export default {
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
previousSignatureValue: {
|
||||
type: String,
|
||||
prefillSignature: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: ''
|
||||
default: null
|
||||
},
|
||||
prefillInitials: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
currentUser: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
allowToSkip: {
|
||||
type: Boolean,
|
||||
@@ -1346,6 +1356,30 @@ export default {
|
||||
|
||||
screen?.orientation?.addEventListener('change', this.onOrientationChange)
|
||||
|
||||
if (this.currentUser) {
|
||||
this.fields.forEach((field) => {
|
||||
if (field.readonly || field.type !== 'text') {
|
||||
return
|
||||
}
|
||||
|
||||
const fieldName = (field.name || '').toLowerCase()
|
||||
|
||||
let value
|
||||
|
||||
if (fieldName === 'full name' || fieldName === 'legal name') {
|
||||
value = this.currentUser.full_name
|
||||
} else if (fieldName === 'first name') {
|
||||
value = this.currentUser.first_name
|
||||
} else if (fieldName === 'last name') {
|
||||
value = this.currentUser.last_name
|
||||
}
|
||||
|
||||
if (value) {
|
||||
this.values[field.uuid] ??= value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.fields.forEach((field) => {
|
||||
if (field.default_value && !field.readonly) {
|
||||
this.values[field.uuid] ||= field.default_value
|
||||
|
||||
Reference in new issue
Block a user