Compare commits
No commits in common. "43821ec416b09d9cf8f54c9dd812a0976fd9a37a" and "0e69e7c7f18b9afaed7b9756127f55df00dbf1ab" have entirely different histories.
43821ec416
...
0e69e7c7f1
|
@ -14,9 +14,6 @@ enum NamiType: string
|
|||
case REGION = 'Bezirk';
|
||||
case STAMM = 'Stamm';
|
||||
case EMAIL = 'E-Mail-Adresse';
|
||||
case ADDRESS = 'Adresse';
|
||||
case ZIP = 'PLZ';
|
||||
case LOCATION = 'Ort';
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, id: string}>
|
||||
|
@ -37,9 +34,6 @@ enum NamiType: string
|
|||
static::REGION => $this->matchRegion($member),
|
||||
static::STAMM => $this->matchGroup($member),
|
||||
static::EMAIL => $member->email,
|
||||
static::ADDRESS => $member->address,
|
||||
static::ZIP => $member->zip,
|
||||
static::LOCATION => $member->location,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -53,8 +47,9 @@ enum NamiType: string
|
|||
static::FIRSTNAME => $query->where('firstname', $value),
|
||||
static::LASTNAME => $query->where('lastname', $value),
|
||||
static::BIRTHDAY => $query->where('birthday', $value),
|
||||
static::REGION => $query,
|
||||
static::STAMM => $query,
|
||||
static::EMAIL => $query->where('email', $value),
|
||||
default => $query,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ abstract class Field extends Data
|
|||
public ColumnData $columns;
|
||||
public bool $forMembers;
|
||||
public ?SpecialType $specialType = null;
|
||||
public string $hint;
|
||||
|
||||
/** @var mixed */
|
||||
public $value;
|
||||
|
@ -151,7 +150,6 @@ abstract class Field extends Data
|
|||
'nami_type' => null,
|
||||
'for_members' => true,
|
||||
'special_type' => null,
|
||||
'hint' => '',
|
||||
...collect(static::meta())->mapWithKeys(fn ($meta) => [$meta['key'] => $meta['default']])->toArray(),
|
||||
],
|
||||
];
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Form\Models\Form;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
foreach (DB::table('forms')->get() as $event) {
|
||||
$config = json_decode($event->config);
|
||||
$config->sections = array_map(function ($section) {
|
||||
$section->fields = array_map(function ($field) {
|
||||
$field->hint = '';
|
||||
return $field;
|
||||
}, $section->fields);
|
||||
|
||||
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) {
|
||||
$section->fields = array_map(function ($field) {
|
||||
$field->hint = '';
|
||||
return $field;
|
||||
}, $section->fields);
|
||||
|
||||
return $section;
|
||||
}, $config->sections);
|
||||
DB::table('formtemplates')->where('id', $event->id)->update(['config' => json_encode($config)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
|
@ -1 +1 @@
|
|||
Subproject commit b59bc28f649879321da870d8861810a8570454b2
|
||||
Subproject commit 2e232a95fd84f6dcca80abe4d2ed37e1fac7e352
|
|
@ -24,7 +24,6 @@
|
|||
<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="special_type" v-model="singleField.model.special_type" :options="meta.specialTypes" label="Bedeutung" size="sm" name="special_type"></f-select>
|
||||
<f-textarea id="hint" v-model="singleField.model.hint" label="Hinweis" size="sm" name="hint"></f-textarea>
|
||||
<f-switch
|
||||
v-show="singleField.model.nami_type === null"
|
||||
id="for_members"
|
||||
|
|
|
@ -386,24 +386,6 @@ class FormRegisterActionTest extends FormTestCase
|
|||
'Muster'
|
||||
];
|
||||
|
||||
yield [
|
||||
['address' => 'Maxstr 5'],
|
||||
NamiType::ADDRESS,
|
||||
'Maxstr 5'
|
||||
];
|
||||
|
||||
yield [
|
||||
['zip' => 44444],
|
||||
NamiType::ZIP,
|
||||
'44444'
|
||||
];
|
||||
|
||||
yield [
|
||||
['location' => 'Hilden'],
|
||||
NamiType::LOCATION,
|
||||
'Hilden'
|
||||
];
|
||||
|
||||
yield [
|
||||
['birthday' => '2023-06-06'],
|
||||
NamiType::BIRTHDAY,
|
||||
|
|
|
@ -29,7 +29,7 @@ class FormStoreActionTest extends FormTestCase
|
|||
->mailTop('Guten Tag')
|
||||
->mailBottom('Viele Grüße')
|
||||
->headerImage('htzz.jpg')
|
||||
->sections([FormtemplateSectionRequest::new()->name('sname')->fields([$this->textField()->namiType(NamiType::BIRTHDAY)->forMembers(false)->hint('hhh')])])
|
||||
->sections([FormtemplateSectionRequest::new()->name('sname')->fields([$this->textField()->namiType(NamiType::BIRTHDAY)->forMembers(false)])])
|
||||
->fake();
|
||||
|
||||
$this->postJson(route('form.store'))->assertOk();
|
||||
|
@ -46,7 +46,6 @@ class FormStoreActionTest extends FormTestCase
|
|||
$this->assertEquals('2023-07-07', $form->from->format('Y-m-d'));
|
||||
$this->assertEquals('2023-07-08', $form->to->format('Y-m-d'));
|
||||
$this->assertEquals('Geburtstag', $form->config->sections->get(0)->fields->get(0)->namiType->value);
|
||||
$this->assertEquals('hhh', $form->config->sections->get(0)->fields->get(0)->hint);
|
||||
$this->assertFalse($form->config->sections->get(0)->fields->get(0)->forMembers);
|
||||
$this->assertCount(1, $form->getMedia('headerImage'));
|
||||
$this->assertEquals('formname.jpg', $form->getMedia('headerImage')->first()->file_name);
|
||||
|
|
|
@ -21,7 +21,6 @@ use App\Form\Enums\SpecialType;
|
|||
* @method self namiType(?NamiType $type)
|
||||
* @method self forMembers(bool $forMembers)
|
||||
* @method self specialType(SpecialType $specialType)
|
||||
* @method self hint(string $hint)
|
||||
*/
|
||||
class FormtemplateFieldRequest extends RequestFactory
|
||||
{
|
||||
|
@ -36,7 +35,6 @@ class FormtemplateFieldRequest extends RequestFactory
|
|||
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
||||
'nami_type' => null,
|
||||
'for_members' => true,
|
||||
'hint' => '',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ class FormtemplateIndexActionTest extends TestCase
|
|||
'nami_type' => null,
|
||||
'for_members' => true,
|
||||
'special_type' => null,
|
||||
'hint' => '',
|
||||
'options' => [],
|
||||
]
|
||||
])
|
||||
|
@ -58,7 +57,6 @@ class FormtemplateIndexActionTest extends TestCase
|
|||
'nami_type' => null,
|
||||
'for_members' => true,
|
||||
'special_type' => null,
|
||||
'hint' => '',
|
||||
]
|
||||
])
|
||||
->assertInertiaPath('data.meta.fields.8', [
|
||||
|
@ -73,7 +71,6 @@ class FormtemplateIndexActionTest extends TestCase
|
|||
'nami_type' => null,
|
||||
'for_members' => true,
|
||||
'special_type' => null,
|
||||
'hint' => '',
|
||||
'rows' => 5,
|
||||
]
|
||||
])
|
||||
|
|
|
@ -22,7 +22,7 @@ class FormtemplateStoreActionTest extends FormTestCase
|
|||
$this->login()->loginNami()->withoutExceptionHandling();
|
||||
FormtemplateRequest::new()->name('testname')->sections([
|
||||
FormtemplateSectionRequest::new()->name('Persönliches')->fields([
|
||||
$this->textField('a')->name('lala1')->columns(['mobile' => 2, 'tablet' => 2, 'desktop' => 1])->required(false)->hint('hhh'),
|
||||
$this->textField('a')->name('lala1')->columns(['mobile' => 2, 'tablet' => 2, 'desktop' => 1])->required(false),
|
||||
$this->textareaField('b')->name('lala2')->required(false)->specialType(SpecialType::FIRSTNAME)->rows(10),
|
||||
]),
|
||||
])->fake();
|
||||
|
@ -33,7 +33,6 @@ class FormtemplateStoreActionTest extends FormTestCase
|
|||
$this->assertEquals('Persönliches', $formtemplate->config->sections->get(0)->name);
|
||||
$this->assertEquals('lala1', $formtemplate->config->sections->get(0)->fields->get(0)->name);
|
||||
$this->assertNull($formtemplate->config->sections->get(0)->fields->get(0)->specialType);
|
||||
$this->assertEquals('hhh', $formtemplate->config->sections->get(0)->fields->get(0)->hint);
|
||||
$this->assertInstanceOf(TextField::class, $formtemplate->config->sections->get(0)->fields->get(0));
|
||||
$this->assertInstanceOf(TextareaField::class, $formtemplate->config->sections->get(0)->fields->get(1));
|
||||
$this->assertEquals(false, $formtemplate->config->sections->get(0)->fields->get(1)->required);
|
||||
|
|
Loading…
Reference in New Issue