|
|
|
@ -16,13 +16,17 @@
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
v-if="!isFormVisible"
|
|
|
|
v-if="!isFormVisible"
|
|
|
|
id="expand_form_button"
|
|
|
|
id="expand_form_button"
|
|
|
|
class="btn btn-neutral flex text-white absolute rounded-none border-x-0 md:border md:rounded-full bottom-0 w-full md:mb-4 text-base"
|
|
|
|
class="btn btn-neutral flex text-white absolute bottom-0 w-full mb-3"
|
|
|
|
|
|
|
|
style="width: 96%; margin-left: 2%"
|
|
|
|
@click.prevent="[isFormVisible = true, scrollIntoField(currentField)]"
|
|
|
|
@click.prevent="[isFormVisible = true, scrollIntoField(currentField)]"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template v-if="['initials', 'signature'].includes(currentField.type)">
|
|
|
|
<template v-if="['initials', 'signature'].includes(currentField.type)">
|
|
|
|
<IconWritingSign stroke-width="1.5" />
|
|
|
|
<IconWritingSign stroke-width="1.5" />
|
|
|
|
{{ t('sign_now') }}
|
|
|
|
{{ t('sign_now') }}
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-else-if="alwaysMinimize">
|
|
|
|
|
|
|
|
{{ t('next') }}
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<template v-else>
|
|
|
|
{{ t('submit_form') }}
|
|
|
|
{{ t('submit_form') }}
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
@ -391,7 +395,7 @@
|
|
|
|
v-if="isSubmitting"
|
|
|
|
v-if="isSubmitting"
|
|
|
|
class="mr-1 animate-spin"
|
|
|
|
class="mr-1 animate-spin"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<span v-if="stepFields.length === currentStep + 1">
|
|
|
|
<span v-if="alwaysMinimize || stepFields.length === currentStep + 1">
|
|
|
|
{{ t('submit') }}
|
|
|
|
{{ t('submit') }}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<span v-else>
|
|
|
|
<span v-else>
|
|
|
|
@ -540,6 +544,11 @@ export default {
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
minimize: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: false
|
|
|
|
|
|
|
|
},
|
|
|
|
withConfetti: {
|
|
|
|
withConfetti: {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
@ -653,12 +662,19 @@ export default {
|
|
|
|
showFillAllRequiredFields: false,
|
|
|
|
showFillAllRequiredFields: false,
|
|
|
|
currentStep: 0,
|
|
|
|
currentStep: 0,
|
|
|
|
phoneVerifiedValues: {},
|
|
|
|
phoneVerifiedValues: {},
|
|
|
|
|
|
|
|
orientation: screen?.orientation?.type,
|
|
|
|
isSubmitting: false,
|
|
|
|
isSubmitting: false,
|
|
|
|
submittedValues: {},
|
|
|
|
submittedValues: {},
|
|
|
|
recalculateButtonDisabledKey: ''
|
|
|
|
recalculateButtonDisabledKey: ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
isMobile () {
|
|
|
|
|
|
|
|
return /android|iphone|ipad/i.test(navigator.userAgent)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
alwaysMinimize () {
|
|
|
|
|
|
|
|
return this.minimize || (this.orientation?.includes('landscape') && this.isMobile && parseInt(window.innerHeight) < 550)
|
|
|
|
|
|
|
|
},
|
|
|
|
currentStepFields () {
|
|
|
|
currentStepFields () {
|
|
|
|
return this.stepFields[this.currentStep]
|
|
|
|
return this.stepFields[this.currentStep]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -738,9 +754,14 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeUnmount () {
|
|
|
|
|
|
|
|
screen?.orientation?.removeEventListener('change', this.onOrientationChange)
|
|
|
|
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
mounted () {
|
|
|
|
this.submittedValues = JSON.parse(JSON.stringify(this.values))
|
|
|
|
this.submittedValues = JSON.parse(JSON.stringify(this.values))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screen?.orientation.addEventListener('change', this.onOrientationChange)
|
|
|
|
|
|
|
|
|
|
|
|
this.fields.forEach((field) => {
|
|
|
|
this.fields.forEach((field) => {
|
|
|
|
if (field.default_value && !field.readonly) {
|
|
|
|
if (field.default_value && !field.readonly) {
|
|
|
|
this.values[field.uuid] ||= field.default_value
|
|
|
|
this.values[field.uuid] ||= field.default_value
|
|
|
|
@ -774,6 +795,10 @@ export default {
|
|
|
|
this.isFormVisible = false
|
|
|
|
this.isFormVisible = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.alwaysMinimize) {
|
|
|
|
|
|
|
|
this.isFormVisible = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
|
|
|
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
const root = this.$root.$el.parentNode.getRootNode()
|
|
|
|
const root = this.$root.$el.parentNode.getRootNode()
|
|
|
|
@ -803,6 +828,9 @@ export default {
|
|
|
|
t (key) {
|
|
|
|
t (key) {
|
|
|
|
return this.i18n[key] || i18n[this.language?.toLowerCase()]?.[key] || i18n[this.browserLanguage]?.[key] || i18n.en[key] || key
|
|
|
|
return this.i18n[key] || i18n[this.language?.toLowerCase()]?.[key] || i18n[this.browserLanguage]?.[key] || i18n.en[key] || key
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
onOrientationChange (event) {
|
|
|
|
|
|
|
|
this.orientation = event.target.type
|
|
|
|
|
|
|
|
},
|
|
|
|
checkFieldConditions (field) {
|
|
|
|
checkFieldConditions (field) {
|
|
|
|
if (field.conditions?.length) {
|
|
|
|
if (field.conditions?.length) {
|
|
|
|
return field.conditions.reduce((acc, c) => {
|
|
|
|
return field.conditions.reduce((acc, c) => {
|
|
|
|
@ -1001,6 +1029,10 @@ export default {
|
|
|
|
const nextStep = (isLastStep && emptyRequiredField) || this.stepFields[this.currentStep + 1]
|
|
|
|
const nextStep = (isLastStep && emptyRequiredField) || this.stepFields[this.currentStep + 1]
|
|
|
|
|
|
|
|
|
|
|
|
if (nextStep) {
|
|
|
|
if (nextStep) {
|
|
|
|
|
|
|
|
if (this.alwaysMinimize) {
|
|
|
|
|
|
|
|
this.isFormVisible = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.goToStep(nextStep, this.autoscrollFields)
|
|
|
|
this.goToStep(nextStep, this.autoscrollFields)
|
|
|
|
|
|
|
|
|
|
|
|
if (emptyRequiredField === nextStep) {
|
|
|
|
if (emptyRequiredField === nextStep) {
|
|
|
|
|