Fixed: Add default model for members
This commit is contained in:
parent
c89973032b
commit
3a96b00307
|
@ -36,15 +36,7 @@ class MemberController extends Controller
|
|||
session()->put('title', 'Mitglied erstellen');
|
||||
|
||||
return \Inertia::render('member/VForm', [
|
||||
'data' => [
|
||||
'country_id' => Country::default(),
|
||||
'efz' => null,
|
||||
'ps_at' => null,
|
||||
'without_education_at' => null,
|
||||
'without_efz_at' => null,
|
||||
'more_ps_at' => null,
|
||||
'joined_at' => now()->format('Y-m-d'),
|
||||
],
|
||||
'data' => MemberResource::defaultModel(),
|
||||
'mode' => 'create',
|
||||
'meta' => MemberResource::meta(),
|
||||
]);
|
||||
|
|
|
@ -149,4 +149,51 @@ class MemberResource extends JsonResource
|
|||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function defaultModel(): array
|
||||
{
|
||||
return [
|
||||
'gender_id' => null,
|
||||
'salutation' => '',
|
||||
'nationality_id' => null,
|
||||
'firstname' => '',
|
||||
'lastname' => '',
|
||||
'address' => '',
|
||||
'further_address' => '',
|
||||
'zip' => '',
|
||||
'location' => '',
|
||||
'birthday' => '',
|
||||
'region_id' => null,
|
||||
'country_id' => Country::default(),
|
||||
'other_country' => '',
|
||||
'main_phone' => '',
|
||||
'mobile_phone' => '',
|
||||
'work_phone' => '',
|
||||
'children_phone' => '',
|
||||
'email' => '',
|
||||
'email_parents' => '',
|
||||
'fax' => '',
|
||||
'letter_address' => '',
|
||||
'bill_kind' => null,
|
||||
'subscription_id' => null,
|
||||
'has_nami' => false,
|
||||
'send_newspaper' => false,
|
||||
'joined_at' => now()->format('Y-m-d'),
|
||||
'comment' => '',
|
||||
'first_activity_id' => null,
|
||||
'first_subactivity_id' => null,
|
||||
'efz' => null,
|
||||
'ps_at' => null,
|
||||
'more_ps_at' => null,
|
||||
'without_education_at' => null,
|
||||
'without_efz_at' => null,
|
||||
'has_vk' => false,
|
||||
'has_svk' => false,
|
||||
'multiply_pv' => false,
|
||||
'multiply_more_pv' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,14 @@ class CreateTest extends TestCase
|
|||
$this->assertInertiaHas('€ Mitglied', $response, "meta.formActivities.{$activity->id}");
|
||||
$this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'meta.billKinds.0');
|
||||
|
||||
$this->assertInertiaHas(['efz' => null, 'ps_at' => null, 'more_ps_at' => null, 'without_education_at' => null, 'without_efz_at' => null], $response, 'data');
|
||||
$this->assertInertiaHas([
|
||||
'efz' => null,
|
||||
'ps_at' => null,
|
||||
'more_ps_at' => null,
|
||||
'without_education_at' => null,
|
||||
'without_efz_at' => null,
|
||||
'address' => '',
|
||||
], $response, 'data');
|
||||
}
|
||||
|
||||
public function testItDoesntDisplayActivitiesAndSubactivitiesNotInNami(): void
|
||||
|
|
|
@ -75,9 +75,10 @@ class StoreTest extends TestCase
|
|||
'salutation' => 'Doktor',
|
||||
'comment' => 'Lorem bla',
|
||||
]);
|
||||
NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(fn (Member $memberParam, Activity $activityParam, Subactivity $subactivityParam) => $memberParam->is($member)
|
||||
&& $activityParam->is($activity)
|
||||
&& $subactivityParam->is($subactivity)
|
||||
NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(
|
||||
fn (Member $memberParam, Activity $activityParam, Subactivity $subactivityParam) => $memberParam->is($member)
|
||||
&& $activityParam->is($activity)
|
||||
&& $subactivityParam->is($subactivity)
|
||||
)->once();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue