Handle completion without an editable step

pull/718/head
tomek 3 weeks ago
parent 56a48ae0cd
commit 6554f181bd

@ -141,11 +141,23 @@
<form <form
v-if="!isCompleted && !isInvite" v-if="!isCompleted && !isInvite"
id="complete_form" id="complete_form"
ref="completeForm"
class="hidden" class="hidden"
:action="submitPath" :action="submitPath"
method="post" method="post"
@submit.prevent="submitStep" @submit.prevent="submitStep"
/> >
<input
type="hidden"
name="authenticity_token"
:value="authenticityToken"
>
<input
value="put"
name="_method"
type="hidden"
>
</form>
<button <button
v-if="!isFormVisible && currentField" v-if="!isFormVisible && currentField"
id="expand_form_button" id="expand_form_button"
@ -1615,7 +1627,7 @@ export default {
} }
const currentFieldUuids = this.currentStepFields.map((f) => f.uuid) const currentFieldUuids = this.currentStepFields.map((f) => f.uuid)
const currentFieldType = this.currentField.type const currentFieldType = this.currentField?.type
if (!formData && !this.$refs.form.checkValidity() && currentFieldUuids.every((fieldUuid) => isEmpty(this.submittedValues[fieldUuid]) || !isEmpty(this.values[fieldUuid]))) { if (!formData && !this.$refs.form.checkValidity() && currentFieldUuids.every((fieldUuid) => isEmpty(this.submittedValues[fieldUuid]) || !isEmpty(this.values[fieldUuid]))) {
return return
@ -1683,7 +1695,7 @@ export default {
}) })
}) })
const formData = new FormData(this.$refs.form) const formData = new FormData(this.$refs.form || this.$refs.completeForm)
const isLastStep = (this.onlyRequiredFields ? !this.findNextStep(submitStepIndex) : (submitStepIndex === 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) {

Loading…
Cancel
Save