Add save button
This commit is contained in:
parent
c0a18e8ee1
commit
4dd0fc4c4b
|
@ -113,7 +113,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<navigation v-if="active === index" v-model="active" :last="v.sections.length"></navigation>
|
<navigation v-if="active === index" :as-form="asForm" v-model="active" :last="v.sections.length"></navigation>
|
||||||
</slide>
|
</slide>
|
||||||
</carousel>
|
</carousel>
|
||||||
</div>
|
</div>
|
||||||
|
@ -156,7 +156,7 @@ const {colClassesForField, containerClasses} = useColumns();
|
||||||
const finished = ref(false);
|
const finished = ref(false);
|
||||||
const eventForm = ref(null);
|
const eventForm = ref(null);
|
||||||
|
|
||||||
const emits = defineEmits(['addSection', 'editSection', 'deleteSection', 'editField', 'deleteField', 'active']);
|
const emits = defineEmits(['addSection', 'editSection', 'deleteSection', 'editField', 'deleteField', 'active', 'save']);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
editable: {
|
editable: {
|
||||||
|
@ -179,6 +179,10 @@ const props = defineProps({
|
||||||
default: () => false,
|
default: () => false,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
asForm: {
|
||||||
|
type: Boolean,
|
||||||
|
default: () => false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const active = ref(0);
|
const active = ref(0);
|
||||||
|
@ -227,6 +231,10 @@ const {back, next, backable, nextable} = useNav(active, v.value.sections.length)
|
||||||
const {resolveComponentName} = useFields();
|
const {resolveComponentName} = useFields();
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
|
if (props.asForm) {
|
||||||
|
emit('save', payload.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await axios.post('/api/form/' + props.formId + '/register', payload.value);
|
await axios.post('/api/form/' + props.formId + '/register', payload.value);
|
||||||
finished.value = true;
|
finished.value = true;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Anmeldung absenden
|
<span v-text="asForm ? 'Speichern' : 'Anmeldung absenden'"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -29,6 +29,10 @@ const props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
asForm: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const innerValue = computed({
|
const innerValue = computed({
|
||||||
|
|
Loading…
Reference in New Issue