|
|
|
@ -21,12 +21,6 @@
|
|
|
|
name="authenticity_token"
|
|
|
|
name="authenticity_token"
|
|
|
|
:value="authenticityToken"
|
|
|
|
:value="authenticityToken"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
|
|
|
|
v-if="currentStep === stepFields.length - 1"
|
|
|
|
|
|
|
|
type="hidden"
|
|
|
|
|
|
|
|
name="completed"
|
|
|
|
|
|
|
|
value="true"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<input
|
|
|
|
<input
|
|
|
|
value="put"
|
|
|
|
value="put"
|
|
|
|
name="_method"
|
|
|
|
name="_method"
|
|
|
|
@ -263,7 +257,7 @@
|
|
|
|
href="#"
|
|
|
|
href="#"
|
|
|
|
class="inline border border-base-300 h-3 w-3 rounded-full mx-1"
|
|
|
|
class="inline border border-base-300 h-3 w-3 rounded-full mx-1"
|
|
|
|
:class="{ 'bg-base-300': index === currentStep, 'bg-base-content': index < currentStep || isCompleted, 'bg-white': index > currentStep }"
|
|
|
|
:class="{ 'bg-base-300': index === currentStep, 'bg-base-content': index < currentStep || isCompleted, 'bg-white': index > currentStep }"
|
|
|
|
@click.prevent="isCompleted ? '' : goToStep(step, true)"
|
|
|
|
@click.prevent="isCompleted ? '' : [saveStep(), goToStep(step, true)]"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@ -401,13 +395,13 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
saveStep () {
|
|
|
|
saveStep (formData) {
|
|
|
|
if (this.isCompleted) {
|
|
|
|
if (this.isCompleted) {
|
|
|
|
return Promise.resolve({})
|
|
|
|
return Promise.resolve({})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return fetch(this.submitPath, {
|
|
|
|
return fetch(this.submitPath, {
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
body: new FormData(this.$refs.form)
|
|
|
|
body: formData || new FormData(this.$refs.form)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -420,7 +414,13 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
await stepPromise()
|
|
|
|
await stepPromise()
|
|
|
|
|
|
|
|
|
|
|
|
this.saveStep().then(response => {
|
|
|
|
const formData = new FormData(this.$refs.form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.currentStep === this.stepFields.length - 1) {
|
|
|
|
|
|
|
|
formData.append('completed', 'true')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.saveStep(formData).then(response => {
|
|
|
|
const nextStep = this.stepFields[this.currentStep + 1]
|
|
|
|
const nextStep = this.stepFields[this.currentStep + 1]
|
|
|
|
|
|
|
|
|
|
|
|
if (nextStep) {
|
|
|
|
if (nextStep) {
|
|
|
|
|