From 4dd0fc4c4b8dd88b1a7c47abec0b254e7f81c646 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Fri, 12 Jul 2024 20:03:51 +0200 Subject: [PATCH] Add save button --- src/EventForm.ce.vue | 12 ++++++++++-- src/components/Navigation.vue | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/EventForm.ce.vue b/src/EventForm.ce.vue index 7cb4399..55bf735 100644 --- a/src/EventForm.ce.vue +++ b/src/EventForm.ce.vue @@ -113,7 +113,7 @@ - + @@ -156,7 +156,7 @@ const {colClassesForField, containerClasses} = useColumns(); const finished = ref(false); 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({ editable: { @@ -179,6 +179,10 @@ const props = defineProps({ default: () => false, type: Boolean, }, + asForm: { + type: Boolean, + default: () => false, + }, }); const active = ref(0); @@ -227,6 +231,10 @@ const {back, next, backable, nextable} = useNav(active, v.value.sections.length) const {resolveComponentName} = useFields(); async function submit() { + if (props.asForm) { + emit('save', payload.value); + return; + } try { await axios.post('/api/form/' + props.formId + '/register', payload.value); finished.value = true; diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue index 86517b9..d6bb4d7 100644 --- a/src/components/Navigation.vue +++ b/src/components/Navigation.vue @@ -10,7 +10,7 @@
- Anmeldung absenden + @@ -29,6 +29,10 @@ const props = defineProps({ type: Number, required: true, }, + asForm: { + type: Boolean, + required: true, + }, }); const innerValue = computed({