Add SpecialType to form field

This commit is contained in:
philipp lang 2024-03-15 00:39:17 +01:00
parent 5d576cda6a
commit 6f03063cba
5 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace App\Form\Resources; namespace App\Form\Resources;
use App\Form\Enums\NamiType; use App\Form\Enums\NamiType;
use App\Form\Enums\SpecialType;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use App\Form\Scopes\FormFilterScope; use App\Form\Scopes\FormFilterScope;
use App\Form\Models\Form; use App\Form\Models\Form;
@ -66,6 +67,7 @@ class FormResource extends JsonResource
], ],
'templates' => FormtemplateResource::collection(Formtemplate::get()), 'templates' => FormtemplateResource::collection(Formtemplate::get()),
'namiTypes' => NamiType::forSelect(), 'namiTypes' => NamiType::forSelect(),
'specialTypes' => SpecialType::forSelect(),
'default' => [ 'default' => [
'description' => [], 'description' => [],
'name' => '', 'name' => '',

View File

@ -3,6 +3,7 @@
namespace App\Form\Resources; namespace App\Form\Resources;
use App\Form\Enums\NamiType; use App\Form\Enums\NamiType;
use App\Form\Enums\SpecialType;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use App\Form\Models\Formtemplate; use App\Form\Models\Formtemplate;
use App\Group; use App\Group;
@ -44,6 +45,7 @@ class FormtemplateResource extends JsonResource
'groups' => Group::forSelect(), 'groups' => Group::forSelect(),
'fields' => Field::asMeta(), 'fields' => Field::asMeta(),
'namiTypes' => NamiType::forSelect(), 'namiTypes' => NamiType::forSelect(),
'specialTypes' => SpecialType::forSelect(),
'links' => [ 'links' => [
'store' => route('formtemplate.store'), 'store' => route('formtemplate.store'),
'form_index' => route('form.index'), 'form_index' => route('form.index'),

View File

@ -23,6 +23,7 @@
<column-selector v-model="singleField.model.columns"></column-selector> <column-selector v-model="singleField.model.columns"></column-selector>
<component :is="fields[singleField.model.type]" v-model="singleField.model" :payload="inner.sections" :meta="props.meta"></component> <component :is="fields[singleField.model.type]" v-model="singleField.model" :payload="inner.sections" :meta="props.meta"></component>
<f-select id="nami_type" v-model="singleField.model.nami_type" :options="meta.namiTypes" label="NaMi-Feld" size="sm" name="nami_type"></f-select> <f-select id="nami_type" v-model="singleField.model.nami_type" :options="meta.namiTypes" label="NaMi-Feld" size="sm" name="nami_type"></f-select>
<f-select id="special_type" v-model="singleField.model.special_type" :options="meta.specialTypes" label="Bedeutung" size="sm" name="special_type"></f-select>
<f-switch <f-switch
v-show="singleField.model.nami_type === null" v-show="singleField.model.nami_type === null"
id="for_members" id="for_members"

View File

@ -58,6 +58,7 @@ class FormIndexActionTest extends FormTestCase
->assertInertiaPath('data.meta.default.config', null) ->assertInertiaPath('data.meta.default.config', null)
->assertInertiaPath('data.meta.base_url', url('')) ->assertInertiaPath('data.meta.base_url', url(''))
->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname']) ->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
->assertInertiaPath('data.meta.specialTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
->assertInertiaPath('data.meta.section_default.name', ''); ->assertInertiaPath('data.meta.section_default.name', '');
} }

View File

@ -82,6 +82,8 @@ class FormtemplateIndexActionTest extends TestCase
]) ])
->assertInertiaPath('data.meta.links.store', route('formtemplate.store')) ->assertInertiaPath('data.meta.links.store', route('formtemplate.store'))
->assertInertiaPath('data.meta.links.form_index', route('form.index')) ->assertInertiaPath('data.meta.links.form_index', route('form.index'))
->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
->assertInertiaPath('data.meta.specialTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
->assertInertiaPath('data.meta.section_default', [ ->assertInertiaPath('data.meta.section_default', [
'name' => '', 'name' => '',
'intro' => '', 'intro' => '',