diff --git a/app/Member/Actions/MemberShowAction.php b/app/Member/Actions/MemberShowAction.php new file mode 100644 index 00000000..5cfa950f --- /dev/null +++ b/app/Member/Actions/MemberShowAction.php @@ -0,0 +1,33 @@ + new MemberResource($member->load('memberships')), + 'toolbar' => [['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'undo']], + ]; + } + + public function asController(Member $member): Response + { + session()->put('menu', 'member'); + session()->put('title', 'Mitglied '.$member->fullname); + + return Inertia::render('member/Show', $this->handle($member)); + } +} diff --git a/app/Member/MemberResource.php b/app/Member/MemberResource.php index 5dd71f51..29639afd 100644 --- a/app/Member/MemberResource.php +++ b/app/Member/MemberResource.php @@ -71,6 +71,9 @@ class MemberResource extends JsonResource 'multiply_more_pv' => $this->multiply_more_pv, 'age' => $this->getModel()->getAge(), 'is_leader' => $this->leaderMemberships->count() > 0, + 'links' => [ + 'show' => route('member.show', ['member' => $this->getModel()]), + ], ]; } } diff --git a/resources/img/svg/envelope.svg b/resources/img/svg/envelope.svg new file mode 100755 index 00000000..e51d3c3e --- /dev/null +++ b/resources/img/svg/envelope.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/img/svg/eye.svg b/resources/img/svg/eye.svg new file mode 100755 index 00000000..831137b2 --- /dev/null +++ b/resources/img/svg/eye.svg @@ -0,0 +1 @@ + diff --git a/resources/img/svg/undo.svg b/resources/img/svg/undo.svg new file mode 100644 index 00000000..2bdd064e --- /dev/null +++ b/resources/img/svg/undo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue index c9987c2b..1fbc1fac 100644 --- a/resources/js/layouts/AppLayout.vue +++ b/resources/js/layouts/AppLayout.vue @@ -29,11 +29,11 @@ v-for="(link, index) in filterMenu" :key="index" :href="link.href" - v-text="link.label" class="btn label mr-2" :class="`btn-${link.color}`" > - + + diff --git a/resources/js/views/member/Show.vue b/resources/js/views/member/Show.vue new file mode 100644 index 00000000..ceb5816e --- /dev/null +++ b/resources/js/views/member/Show.vue @@ -0,0 +1,23 @@ + + + diff --git a/resources/js/views/member/VIndex.vue b/resources/js/views/member/VIndex.vue index e0c78850..b19dfdee 100644 --- a/resources/js/views/member/VIndex.vue +++ b/resources/js/views/member/VIndex.vue @@ -88,36 +88,41 @@ - - - - - - - + +
+ + + + + + + +
diff --git a/routes/web.php b/routes/web.php index 7ad9db53..66bd1a28 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,6 +7,7 @@ use App\Efz\ShowEfzDocumentAction; use App\Home\Actions\IndexAction as HomeIndexAction; use App\Initialize\Actions\InitializeAction; use App\Initialize\Actions\InitializeFormAction; +use App\Member\Actions\MemberShowAction; use App\Member\Controllers\MemberResyncController; use App\Member\MemberConfirmController; use App\Member\MemberController; @@ -26,7 +27,8 @@ Route::group(['middleware' => 'auth:web'], function (): void { Route::get('/', HomeIndexAction::class)->name('home'); Route::get('/initialize', InitializeFormAction::class)->name('initialize.form'); Route::post('/initialize', InitializeAction::class)->name('initialize.store'); - Route::resource('member', MemberController::class); + Route::resource('member', MemberController::class)->except('show'); + Route::get('/member/{member}', MemberShowAction::class)->name('member.show'); Route::apiResource('member.payment', PaymentController::class); Route::resource('allpayment', AllpaymentController::class); Route::resource('subscription', SubscriptionController::class); diff --git a/tests/Feature/Member/ShowTest.php b/tests/Feature/Member/ShowTest.php new file mode 100644 index 00000000..cbe3bd07 --- /dev/null +++ b/tests/Feature/Member/ShowTest.php @@ -0,0 +1,30 @@ +withoutExceptionHandling()->login()->loginNami(); + $member = Member::factory() + ->has(Membership::factory()->in('€ LeiterIn', 5, 'Jungpfadfinder', 88)->state(['created_at' => '2022-11-19 05:00:00'])) + ->defaults()->create(['firstname' => 'Max']); + + $response = $this->get("/member/{$member->id}"); + + $this->assertInertiaHas('Max', $response, 'data.firstname'); + $this->assertInertiaHas([ + 'activity_name' => '€ LeiterIn', + 'id' => $member->memberships->first()->id, + 'human_date' => '19.11.2022', + ], $response, 'data.memberships.0'); + } +}