diff --git a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormController.kt b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormController.kt index ad36bad..47b37d5 100644 --- a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormController.kt +++ b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormController.kt @@ -16,9 +16,10 @@ class ApplicationFormController( ) : ApplicationFormApi { override fun createApplicationForm(createApplicationFormDto: CreateApplicationFormDto): ResponseEntity { + val updatedCreateApplicationFormDto = createApplicationFormDto.copy(isTemplate = false) return ResponseEntity.ok( applicationFormMapper.toApplicationFormDto( - applicationFormService.createApplicationForm(createApplicationFormDto) + applicationFormService.createApplicationForm(updatedCreateApplicationFormDto) ) ) } diff --git a/legalconsenthub/pages/application-forms/[id].vue b/legalconsenthub/pages/application-forms/[id].vue new file mode 100644 index 0000000..8c34749 --- /dev/null +++ b/legalconsenthub/pages/application-forms/[id].vue @@ -0,0 +1,67 @@ + + + diff --git a/legalconsenthub/pages/create.vue b/legalconsenthub/pages/create.vue index 0b0d433..95f0c2f 100644 --- a/legalconsenthub/pages/create.vue +++ b/legalconsenthub/pages/create.vue @@ -36,7 +36,8 @@ import { ComplianceStatus, type PagedApplicationFormDto } from '~/.api-client' import { useApplicationFormValidator } from '~/composables/useApplicationFormValidator' import type { FormElementId } from '~/types/FormElement' -const { getAllApplicationFormTemplates, updateApplicationFormTemplate } = useApplicationFormTemplate() +const { getAllApplicationFormTemplates } = useApplicationFormTemplate() +const { createApplicationForm } = useApplicationForm() const { validateFormElements, getHighestComplianceStatus } = useApplicationFormValidator() const { data } = await useAsyncData(async () => { @@ -77,6 +78,11 @@ const ampelStatusEmoji = computed(() => { }) async function onSubmit() { - await updateApplicationFormTemplate(data?.value?.content[0].id, data?.value?.content[0]) + if (data?.value?.content[0]) { + await createApplicationForm(data.value.content[0]) + await navigateTo('/') + } else { + console.error('Application form data is undefined') + } } diff --git a/legalconsenthub/pages/index.vue b/legalconsenthub/pages/index.vue index c414e85..b71e99a 100644 --- a/legalconsenthub/pages/index.vue +++ b/legalconsenthub/pages/index.vue @@ -21,7 +21,7 @@