Add salutation field
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2023-02-27 22:40:47 +01:00
parent 9f4f2683a3
commit a66145e105
9 changed files with 53 additions and 11 deletions

View File

@ -1,5 +1,5 @@
{ {
"printWidth": 120, "printWidth": 200,
"singleQuote": true, "singleQuote": true,
"tabWidth": 4, "tabWidth": 4,
"quoteProps": "consistent", "quoteProps": "consistent",

View File

@ -49,7 +49,7 @@ class Member extends Model
/** /**
* @var array<int, string> * @var array<int, string>
*/ */
public static array $namiFields = ['firstname', 'lastname', 'joined_at', 'birthday', 'send_newspaper', 'address', 'zip', 'location', 'nickname', 'other_country', 'further_address', 'main_phone', 'mobile_phone', 'work_phone', 'fax', 'email', 'email_parents', 'gender_id', 'confession_id', 'region_id', 'country_id', 'fee_id', 'nationality_id', 'slug', 'search']; public static array $namiFields = ['firstname', 'lastname', 'joined_at', 'birthday', 'send_newspaper', 'address', 'zip', 'location', 'nickname', 'other_country', 'further_address', 'main_phone', 'mobile_phone', 'work_phone', 'fax', 'email', 'email_parents', 'gender_id', 'confession_id', 'region_id', 'country_id', 'fee_id', 'nationality_id', 'slug'];
/** /**
* @var array<int, string> * @var array<int, string>

View File

@ -78,6 +78,7 @@ class MemberRequest extends FormRequest
'children_phone' => '', 'children_phone' => '',
'fax' => '', 'fax' => '',
'other_country' => '', 'other_country' => '',
'salutation' => '',
]; ];
} }

View File

@ -89,6 +89,7 @@ class MemberResource extends JsonResource
'age' => $this->getModel()->getAge(), 'age' => $this->getModel()->getAge(),
'is_leader' => $this->leaderMemberships->count() > 0, 'is_leader' => $this->leaderMemberships->count() > 0,
'group_id' => $this->group_id, 'group_id' => $this->group_id,
'salutation' => $this->salutation,
'links' => [ 'links' => [
'show' => route('member.show', ['member' => $this->getModel()]), 'show' => route('member.show', ['member' => $this->getModel()]),
], ],

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('members', function (Blueprint $table) {
$table->string('salutation')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('members', function (Blueprint $table) {
$table->dropColumn('salutation');
});
}
};

View File

@ -21,14 +21,17 @@
<div class="grow grid md:grid-cols-2 gap-3 p-3"> <div class="grow grid md:grid-cols-2 gap-3 p-3">
<box heading="Stammdaten"> <box heading="Stammdaten">
<div class="grid sm:grid-cols-2 gap-3"> <div class="grid sm:grid-cols-2 gap-3">
<f-select <div class="grid grid-cols-2 gap-3">
id="gender_id" <f-select
name="gender_id" id="gender_id"
:options="genders" name="gender_id"
v-model="inner.gender_id" :options="genders"
label="Geschlecht" v-model="inner.gender_id"
size="sm" label="Geschlecht"
></f-select> size="sm"
></f-select>
<f-text id="salutation" v-model="inner.salutation" size="sm" label="Anrede"></f-text>
</div>
<f-select <f-select
:options="nationalities" :options="nationalities"
id="nationality_id" id="nationality_id"

View File

@ -16,7 +16,7 @@ class EditTest extends TestCase
{ {
$this->withoutExceptionHandling(); $this->withoutExceptionHandling();
$this->login()->loginNami(); $this->login()->loginNami();
$member = Member::factory()->defaults()->create(['firstname' => 'Max']); $member = Member::factory()->defaults()->create(['salutation' => 'Doktor', 'firstname' => 'Max']);
$activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create(); $activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create();
$subactivity = $activity->subactivities->first(); $subactivity = $activity->subactivities->first();
@ -25,6 +25,7 @@ class EditTest extends TestCase
$this->assertInertiaHas('Biber', $response, "subactivities.{$activity->id}.{$subactivity->id}"); $this->assertInertiaHas('Biber', $response, "subactivities.{$activity->id}.{$subactivity->id}");
$this->assertInertiaHas('€ Mitglied', $response, "activities.{$activity->id}"); $this->assertInertiaHas('€ Mitglied', $response, "activities.{$activity->id}");
$this->assertInertiaHas('Max', $response, 'data.firstname'); $this->assertInertiaHas('Max', $response, 'data.firstname');
$this->assertInertiaHas('Doktor', $response, 'data.salutation');
$this->assertInertiaHas('edit', $response, 'mode'); $this->assertInertiaHas('edit', $response, 'mode');
$this->assertInertiaHas(false, $response, 'conflict'); $this->assertInertiaHas(false, $response, 'conflict');
$this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'billKinds.0'); $this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'billKinds.0');

View File

@ -45,6 +45,7 @@ class StoreTest extends TestCase
'first_subactivity_id' => $subactivity->id, 'first_subactivity_id' => $subactivity->id,
'subscription_id' => $subscription->id, 'subscription_id' => $subscription->id,
'bill_kind' => 'Post', 'bill_kind' => 'Post',
'salutation' => 'Doktor',
])); ]));
$response->assertRedirect('/member')->assertSessionHasNoErrors(); $response->assertRedirect('/member')->assertSessionHasNoErrors();
@ -70,6 +71,7 @@ class StoreTest extends TestCase
'subscription_id' => $subscription->id, 'subscription_id' => $subscription->id,
'zip' => '42719', 'zip' => '42719',
'fax' => '+49 666', 'fax' => '+49 666',
'salutation' => 'Doktor',
]); ]);
NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(fn (Member $memberParam, Activity $activityParam, Subactivity $subactivityParam) => $memberParam->is($member) NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(fn (Member $memberParam, Activity $activityParam, Subactivity $subactivityParam) => $memberParam->is($member)
&& $activityParam->is($activity) && $activityParam->is($activity)

View File

@ -87,6 +87,7 @@ class UpdateTest extends TestCase
'has_nami' => false, 'has_nami' => false,
'multiply_pv' => true, 'multiply_pv' => true,
'multiply_more_pv' => true, 'multiply_more_pv' => true,
'salutation' => 'Doktor',
])); ]));
$this->assertEquals('2021-02-01', $member->fresh()->ps_at->format('Y-m-d')); $this->assertEquals('2021-02-01', $member->fresh()->ps_at->format('Y-m-d'));
@ -98,6 +99,7 @@ class UpdateTest extends TestCase
$this->assertEquals('2021-02-03', $member->fresh()->efz->format('Y-m-d')); $this->assertEquals('2021-02-03', $member->fresh()->efz->format('Y-m-d'));
$this->assertEquals('2021-02-04', $member->fresh()->without_education_at->format('Y-m-d')); $this->assertEquals('2021-02-04', $member->fresh()->without_education_at->format('Y-m-d'));
$this->assertEquals('2021-02-05', $member->fresh()->without_efz_at->format('Y-m-d')); $this->assertEquals('2021-02-05', $member->fresh()->without_efz_at->format('Y-m-d'));
$this->assertEquals('Doktor', $member->fresh()->salutation);
} }
/** /**