|
|
|
@ -1,4 +1,21 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<template
|
|
|
|
|
|
|
|
v-for="field in otherSubmitterFields"
|
|
|
|
|
|
|
|
:key="field.uuid"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Teleport
|
|
|
|
|
|
|
|
v-for="(area, index) in field.areas"
|
|
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
|
|
:to="`#page-${area.attachment_uuid}-${area.page}`"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<FieldArea
|
|
|
|
|
|
|
|
:model-value="values[field.uuid]"
|
|
|
|
|
|
|
|
:field="field"
|
|
|
|
|
|
|
|
:area="area"
|
|
|
|
|
|
|
|
:attachments-index="attachmentsIndex"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Teleport>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<FieldAreas
|
|
|
|
<FieldAreas
|
|
|
|
ref="areas"
|
|
|
|
ref="areas"
|
|
|
|
:steps="stepFields"
|
|
|
|
:steps="stepFields"
|
|
|
|
@ -7,6 +24,7 @@
|
|
|
|
:current-step="currentStepFields"
|
|
|
|
:current-step="currentStepFields"
|
|
|
|
@focus-step="goToStep($event, false, true)"
|
|
|
|
@focus-step="goToStep($event, false, true)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<form
|
|
|
|
<form
|
|
|
|
v-if="!isCompleted"
|
|
|
|
v-if="!isCompleted"
|
|
|
|
ref="form"
|
|
|
|
ref="form"
|
|
|
|
@ -140,6 +158,11 @@
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
v-else-if="currentField.type === 'checkbox'"
|
|
|
|
v-else-if="currentField.type === 'checkbox'"
|
|
|
|
class="flex w-full"
|
|
|
|
class="flex w-full"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
|
|
|
type="hidden"
|
|
|
|
|
|
|
|
name="cast_boolean"
|
|
|
|
|
|
|
|
value="true"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
class="space-y-3.5 mx-auto"
|
|
|
|
class="space-y-3.5 mx-auto"
|
|
|
|
@ -151,12 +174,15 @@
|
|
|
|
<label
|
|
|
|
<label
|
|
|
|
:for="field.uuid"
|
|
|
|
:for="field.uuid"
|
|
|
|
class="flex items-center space-x-3"
|
|
|
|
class="flex items-center space-x-3"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
|
|
|
type="hidden"
|
|
|
|
|
|
|
|
:name="`values[${field.uuid}]`"
|
|
|
|
|
|
|
|
:value="!!values[field.uuid]"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
<input
|
|
|
|
:id="field.uuid"
|
|
|
|
:id="field.uuid"
|
|
|
|
type="checkbox"
|
|
|
|
type="checkbox"
|
|
|
|
:name="`values[${field.uuid}]`"
|
|
|
|
|
|
|
|
:value="false"
|
|
|
|
|
|
|
|
class="base-checkbox !h-7 !w-7"
|
|
|
|
class="base-checkbox !h-7 !w-7"
|
|
|
|
:checked="!!values[field.uuid]"
|
|
|
|
:checked="!!values[field.uuid]"
|
|
|
|
@click="values[field.uuid] = !values[field.uuid]"
|
|
|
|
@click="values[field.uuid] = !values[field.uuid]"
|
|
|
|
@ -198,6 +224,7 @@
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
type="submit"
|
|
|
|
class="base-button w-full"
|
|
|
|
class="base-button w-full"
|
|
|
|
|
|
|
|
:disabled="isSubmitting"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<span v-if="isSubmitting">
|
|
|
|
<span v-if="isSubmitting">
|
|
|
|
Submitting...
|
|
|
|
Submitting...
|
|
|
|
@ -207,6 +234,11 @@
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<FormCompleted
|
|
|
|
|
|
|
|
v-else
|
|
|
|
|
|
|
|
:submitter-slug="submitterSlug"
|
|
|
|
|
|
|
|
/>
|
|
|
|
<div class="flex justify-center">
|
|
|
|
<div class="flex justify-center">
|
|
|
|
<div class="flex items-center mt-5 mb-1">
|
|
|
|
<div class="flex items-center mt-5 mb-1">
|
|
|
|
<a
|
|
|
|
<a
|
|
|
|
@ -214,20 +246,17 @@
|
|
|
|
:key="step[0].uuid"
|
|
|
|
:key="step[0].uuid"
|
|
|
|
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-200': index === currentStep, 'bg-base-content': index < currentStep, 'bg-white': index > currentStep }"
|
|
|
|
:class="{ 'bg-base-200': index === currentStep, 'bg-base-content': index < currentStep || isCompleted, 'bg-white': index > currentStep }"
|
|
|
|
@click.prevent="goToStep(step, true)"
|
|
|
|
@click.prevent="isCompleted ? '' : goToStep(step, true)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<FormCompleted
|
|
|
|
|
|
|
|
v-else
|
|
|
|
|
|
|
|
:submitter-slug="submitterSlug"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import FieldAreas from './areas'
|
|
|
|
import FieldAreas from './areas'
|
|
|
|
|
|
|
|
import FieldArea from './area'
|
|
|
|
import ImageStep from './image_step'
|
|
|
|
import ImageStep from './image_step'
|
|
|
|
import SignatureStep from './signature_step'
|
|
|
|
import SignatureStep from './signature_step'
|
|
|
|
import AttachmentStep from './attachment_step'
|
|
|
|
import AttachmentStep from './attachment_step'
|
|
|
|
@ -238,6 +267,7 @@ export default {
|
|
|
|
name: 'SubmissionForm',
|
|
|
|
name: 'SubmissionForm',
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
|
FieldAreas,
|
|
|
|
FieldAreas,
|
|
|
|
|
|
|
|
FieldArea,
|
|
|
|
ImageStep,
|
|
|
|
ImageStep,
|
|
|
|
SignatureStep,
|
|
|
|
SignatureStep,
|
|
|
|
AttachmentStep,
|
|
|
|
AttachmentStep,
|
|
|
|
@ -287,11 +317,14 @@ export default {
|
|
|
|
currentField () {
|
|
|
|
currentField () {
|
|
|
|
return this.currentStepFields[0]
|
|
|
|
return this.currentStepFields[0]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
submitterFields () {
|
|
|
|
currentSubmitterFields () {
|
|
|
|
return this.fields.filter((f) => f.submitter_uuid === this.submitterUuid)
|
|
|
|
return this.fields.filter((f) => f.submitter_uuid === this.submitterUuid)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
otherSubmitterFields () {
|
|
|
|
|
|
|
|
return this.fields.filter((f) => f.submitter_uuid !== this.submitterUuid)
|
|
|
|
|
|
|
|
},
|
|
|
|
stepFields () {
|
|
|
|
stepFields () {
|
|
|
|
return this.submitterFields.reduce((acc, f) => {
|
|
|
|
return this.currentSubmitterFields.reduce((acc, f) => {
|
|
|
|
const prevStep = acc[acc.length - 1]
|
|
|
|
const prevStep = acc[acc.length - 1]
|
|
|
|
|
|
|
|
|
|
|
|
if (f.type === 'checkbox' && Array.isArray(prevStep) && prevStep[0].type === 'checkbox') {
|
|
|
|
if (f.type === 'checkbox' && Array.isArray(prevStep) && prevStep[0].type === 'checkbox') {
|
|
|
|
|