Add checkboxes

This commit is contained in:
philipp lang 2023-12-26 01:05:45 +01:00
parent bde8d48807
commit ac28466c8d
4 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace App\Form\Fields;
class CheckboxField extends Field
{
public static function name(): string
{
return 'Checkbox';
}
public static function meta(): array
{
return [
'description' => '',
];
}
public static function default()
{
return false;
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Form\Fields;
class CheckboxesField extends Field
{
public static function name(): string
{
return 'Checkboxes';
}
public static function meta(): array
{
return [
'options' => [],
];
}
public static function default()
{
return [];
}
}

View File

@ -0,0 +1,20 @@
<template>
<div>
<f-textarea
id="description"
label="Beschreibung"
size="sm"
name="description"
:model-value="modelValue.description"
@update:modelValue="$emit('update:modelValue', {...modelValue, description: $event})"
></f-textarea>
</div>
</template>
<script setup>
const props = defineProps({
modelValue: {},
});
const emit = defineEmits(['update:modelValue']);
</script>

View File

@ -53,6 +53,8 @@ import Asideform from './Asideform.vue';
import TextareaField from './TextareaField.vue';
import DropdownField from './DropdownField.vue';
import RadioField from './RadioField.vue';
import CheckboxField from './CheckboxField.vue';
import CheckboxesField from './DropdownField.vue';
const sectionVisible = ref(-1);
const singleSection = ref(null);
@ -68,6 +70,8 @@ const fields = {
TextareaField: TextareaField,
DropdownField: DropdownField,
RadioField: RadioField,
CheckboxField: CheckboxField,
CheckboxesField: CheckboxesField,
};
function editSection(sectionIndex) {