|
|
|
@ -554,14 +554,18 @@
|
|
|
|
class="flex justify-center mt-3 sm:mt-4 mb-0 sm:mb-1 select-none"
|
|
|
|
class="flex justify-center mt-3 sm:mt-4 mb-0 sm:mb-1 select-none"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div class="flex items-center flex-wrap steps-progress">
|
|
|
|
<div class="flex items-center flex-wrap steps-progress">
|
|
|
|
<a
|
|
|
|
<template
|
|
|
|
v-for="(step, index) in stepFields"
|
|
|
|
v-for="(step, index) in stepFields"
|
|
|
|
:key="step[0].uuid"
|
|
|
|
:key="step[0].uuid"
|
|
|
|
href="#"
|
|
|
|
>
|
|
|
|
class="inline border border-base-300 h-3 w-3 rounded-full mx-1 mt-1"
|
|
|
|
<a
|
|
|
|
:class="{ 'bg-base-300 steps-progress-current': index === currentStep, 'bg-base-content': (index < currentStep && stepFields[index].every((f) => !f.required || ![null, undefined, ''].includes(values[f.uuid]))) || isCompleted, 'bg-white': index > currentStep }"
|
|
|
|
v-if="!onlyRequiredFields || step.some((f) => f.required)"
|
|
|
|
@click.prevent="isCompleted ? '' : [saveStep(), goToStep(index, true)]"
|
|
|
|
href="#"
|
|
|
|
/>
|
|
|
|
class="inline border border-base-300 h-3 w-3 rounded-full mx-1 mt-1"
|
|
|
|
|
|
|
|
:class="{ 'bg-base-300 steps-progress-current': index === currentStep, 'bg-base-content': (index < currentStep && stepFields[index].every((f) => !f.required || ![null, undefined, ''].includes(values[f.uuid]))) || isCompleted, 'bg-white': index > currentStep }"
|
|
|
|
|
|
|
|
@click.prevent="isCompleted ? '' : [saveStep(), goToStep(index, true)]"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
@ -693,6 +697,11 @@ export default {
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
onlyRequiredFields: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: false
|
|
|
|
|
|
|
|
},
|
|
|
|
requireSigningReason: {
|
|
|
|
requireSigningReason: {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
@ -955,7 +964,13 @@ export default {
|
|
|
|
submitButtonText () {
|
|
|
|
submitButtonText () {
|
|
|
|
if (this.alwaysMinimize) {
|
|
|
|
if (this.alwaysMinimize) {
|
|
|
|
return this.t('submit')
|
|
|
|
return this.t('submit')
|
|
|
|
} else if (this.stepFields.length === this.currentStep + 1) {
|
|
|
|
} else if (!this.onlyRequiredFields && this.stepFields.length === this.currentStep + 1) {
|
|
|
|
|
|
|
|
if (this.currentField.type === 'signature') {
|
|
|
|
|
|
|
|
return this.t('sign_and_complete')
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return this.t('complete')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (this.onlyRequiredFields && !this.findNextStep(this.currentStep)) {
|
|
|
|
if (this.currentField.type === 'signature') {
|
|
|
|
if (this.currentField.type === 'signature') {
|
|
|
|
return this.t('sign_and_complete')
|
|
|
|
return this.t('sign_and_complete')
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -1174,11 +1189,11 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
const indexesList = [this.stepFields.length - 1]
|
|
|
|
const indexesList = [this.stepFields.length - 1]
|
|
|
|
|
|
|
|
|
|
|
|
if (requiredEmptyStepIndex !== -1) {
|
|
|
|
if (requiredEmptyStepIndex !== -1 && (!this.onlyRequiredFields || this.stepFields[requiredEmptyStepIndex].some((f) => f.required))) {
|
|
|
|
indexesList.push(requiredEmptyStepIndex)
|
|
|
|
indexesList.push(requiredEmptyStepIndex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lastFilledStepIndex !== -1) {
|
|
|
|
if (lastFilledStepIndex !== -1 && (!this.onlyRequiredFields || this.stepFields[lastFilledStepIndex].some((f) => f.required))) {
|
|
|
|
indexesList.push(lastFilledStepIndex)
|
|
|
|
indexesList.push(lastFilledStepIndex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1329,6 +1344,13 @@ export default {
|
|
|
|
return `${this.t('option')} ${index + 1}`
|
|
|
|
return `${this.t('option')} ${index + 1}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
findNextStep (currentStepIndex) {
|
|
|
|
|
|
|
|
if (this.onlyRequiredFields) {
|
|
|
|
|
|
|
|
return this.stepFields.find((step, index) => index > currentStepIndex && step.some((f) => f.required))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return this.stepFields[currentStepIndex + 1]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
maybeTrackEmailClick () {
|
|
|
|
maybeTrackEmailClick () {
|
|
|
|
const { queryParams } = this
|
|
|
|
const { queryParams } = this
|
|
|
|
|
|
|
|
|
|
|
|
@ -1475,7 +1497,7 @@ export default {
|
|
|
|
this.isSubmittingComplete = true
|
|
|
|
this.isSubmittingComplete = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const submitStep = this.currentStep
|
|
|
|
const submitStepIndex = this.currentStep
|
|
|
|
|
|
|
|
|
|
|
|
const stepPromise = ['signature', 'phone', 'initials', 'payment', 'verification', 'kba'].includes(this.currentField.type)
|
|
|
|
const stepPromise = ['signature', 'phone', 'initials', 'payment', 'verification', 'kba'].includes(this.currentField.type)
|
|
|
|
? this.$refs.currentStep.submit
|
|
|
|
? this.$refs.currentStep.submit
|
|
|
|
@ -1483,7 +1505,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
stepPromise().then(async () => {
|
|
|
|
stepPromise().then(async () => {
|
|
|
|
const emptyRequiredField = this.stepFields.find((fields, index) => {
|
|
|
|
const emptyRequiredField = this.stepFields.find((fields, index) => {
|
|
|
|
if (forceComplete ? index === submitStep : index >= submitStep) {
|
|
|
|
if (forceComplete ? index === submitStepIndex : index >= submitStepIndex) {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1493,7 +1515,7 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const formData = new FormData(this.$refs.form)
|
|
|
|
const formData = new FormData(this.$refs.form)
|
|
|
|
const isLastStep = (submitStep === this.stepFields.length - 1) || forceComplete
|
|
|
|
const isLastStep = (this.onlyRequiredFields ? !this.findNextStep(submitStepIndex) : (submitStepIndex === this.stepFields.length - 1)) || forceComplete
|
|
|
|
|
|
|
|
|
|
|
|
if (isLastStep && !emptyRequiredField && !this.inviteSubmitters.length && !this.optionalInviteSubmitters.length) {
|
|
|
|
if (isLastStep && !emptyRequiredField && !this.inviteSubmitters.length && !this.optionalInviteSubmitters.length) {
|
|
|
|
formData.append('completed', 'true')
|
|
|
|
formData.append('completed', 'true')
|
|
|
|
@ -1537,7 +1559,7 @@ export default {
|
|
|
|
return Promise.reject(new Error(data.error))
|
|
|
|
return Promise.reject(new Error(data.error))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const nextStep = (isLastStep && emptyRequiredField) || (forceComplete ? null : this.stepFields[submitStep + 1])
|
|
|
|
const nextStep = (isLastStep && emptyRequiredField) || (forceComplete ? null : this.findNextStep(submitStepIndex))
|
|
|
|
|
|
|
|
|
|
|
|
if (nextStep) {
|
|
|
|
if (nextStep) {
|
|
|
|
if (this.alwaysMinimize) {
|
|
|
|
if (this.alwaysMinimize) {
|
|
|
|
|