diff --git a/app/Form/Fields/Field.php b/app/Form/Fields/Field.php index 36f43f39..078fbc31 100644 --- a/app/Form/Fields/Field.php +++ b/app/Form/Fields/Field.php @@ -29,6 +29,7 @@ abstract class Field extends Data public bool $forMembers; public ?SpecialType $specialType = null; public ?string $hint; + public ?string $intro; /** @var mixed */ public $value; diff --git a/database/migrations/2024_06_07_003232_add_intro_field.php b/database/migrations/2024_06_07_003232_add_intro_field.php new file mode 100644 index 00000000..8b7f5cc8 --- /dev/null +++ b/database/migrations/2024_06_07_003232_add_intro_field.php @@ -0,0 +1,58 @@ +get() as $event) { + $config = json_decode($event->config); + $config->sections = array_map(function ($section) { + /** @var Collection */ + $fields = $section->fields; + $section->fields = collect($fields)->map(function ($field) { + $field->intro = null; + return $field; + })->all(); + + return $section; + }, $config->sections); + DB::table('forms')->where('id', $event->id)->update(['config' => json_encode($config)]); + } + + foreach (DB::table('formtemplates')->get() as $event) { + $config = json_decode($event->config); + $config->sections = array_map(function ($section) { + /** @var Collection */ + $fields = $section->fields; + $section->fields = collect($fields)->map(function ($field) { + $field->intro = null; + return $field; + })->all(); + + return $section; + }, $config->sections); + DB::table('formtemplates')->where('id', $event->id)->update(['config' => json_encode($config)]); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}; diff --git a/resources/js/views/formtemplate/FormBuilder.vue b/resources/js/views/formtemplate/FormBuilder.vue index f5698735..0eaea6d0 100644 --- a/resources/js/views/formtemplate/FormBuilder.vue +++ b/resources/js/views/formtemplate/FormBuilder.vue @@ -2,70 +2,78 @@
- - - + @close="singleSection = null" + @submit="storeSection" + > + + - - -