Files
gremiumhub/legalconsenthub/app/composables/useFormElementManagement.ts

31 lines
795 B
TypeScript

import type { FormElementDto } from '~~/.api-client'
export function useFormElementManagement() {
function addInputFormElement(elements: FormElementDto[], position: number): FormElementDto[] {
const inputFormElement = createInputFormElement()
const updatedElements = [...elements]
updatedElements.splice(position + 1, 0, inputFormElement)
return updatedElements
}
function createInputFormElement(): FormElementDto {
return {
title: 'Formular ergänzen',
description: 'Bitte fügen Sie hier Ihre Ergänzungen ein.',
options: [
{
value: '',
label: '',
processingPurpose: 'NONE',
employeeDataCategory: 'NONE'
}
],
type: 'RICH_TEXT'
}
}
return {
addInputFormElement
}
}