Mod member show test
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b330aba572
commit
75130fc794
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Member\Actions;
|
||||||
|
|
||||||
|
use App\Member\Member;
|
||||||
|
use App\Member\MemberResource;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class MemberShowAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{data: MemberResource}
|
||||||
|
*/
|
||||||
|
public function handle(Member $member): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'data' => 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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,6 +71,9 @@ class MemberResource extends JsonResource
|
||||||
'multiply_more_pv' => $this->multiply_more_pv,
|
'multiply_more_pv' => $this->multiply_more_pv,
|
||||||
'age' => $this->getModel()->getAge(),
|
'age' => $this->getModel()->getAge(),
|
||||||
'is_leader' => $this->leaderMemberships->count() > 0,
|
'is_leader' => $this->leaderMemberships->count() > 0,
|
||||||
|
'links' => [
|
||||||
|
'show' => route('member.show', ['member' => $this->getModel()]),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M18 2a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4c0-1.1.9-2 2-2h16zm-4.37 9.1L20 16v-2l-5.12-3.9L20 6V4l-10 8L0 4v2l5.12 4.1L0 14v2l6.37-4.9L10 14l3.63-2.9z"/></svg>
|
After Width: | Height: | Size: 239 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.2 10a11 11 0 0 1 19.6 0A11 11 0 0 1 .2 10zm9.8 4a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-2a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"/></svg>
|
After Width: | Height: | Size: 191 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg height="512" width="512" xmlns="http://www.w3.org/2000/svg"><path d="M483.582 442.704C444.427 364.364 368.123 270.995 227 270.995h-15v75c0 5.537-3.047 10.62-7.925 13.228-4.863 2.622-10.796 2.3-15.396-.747l-181.994-120A15.031 15.031 0 0 1 .02 226.801a15.035 15.035 0 0 1 5.376-12.334l181.994-150c4.497-3.706 10.737-4.512 15.967-2.051A14.99 14.99 0 0 1 212 75.995v75h15c157.148 0 285 127.852 285 285a15.01 15.01 0 0 1-11.558 14.604c-6.953 1.605-13.826-1.809-16.86-7.895z"/></svg>
|
After Width: | Height: | Size: 482 B |
|
@ -29,11 +29,11 @@
|
||||||
v-for="(link, index) in filterMenu"
|
v-for="(link, index) in filterMenu"
|
||||||
:key="index"
|
:key="index"
|
||||||
:href="link.href"
|
:href="link.href"
|
||||||
v-text="link.label"
|
|
||||||
class="btn label mr-2"
|
class="btn label mr-2"
|
||||||
:class="`btn-${link.color}`"
|
:class="`btn-${link.color}`"
|
||||||
>
|
>
|
||||||
<svg-sprite :src="link.icon"></svg-sprite>
|
<svg-sprite v-show="link.icon" class="w-3 h-3 mr-2" :src="link.icon"></svg-sprite>
|
||||||
|
<span v-text="link.label"></span>
|
||||||
</i-link>
|
</i-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
inner: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.inner = this.data;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -88,36 +88,41 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td v-text="`${member.joined_at_human}`"></td>
|
<td v-text="`${member.joined_at_human}`"></td>
|
||||||
<td class="flex">
|
<td>
|
||||||
<i-link :href="`/member/${member.id}/edit`" class="inline-flex btn btn-warning btn-sm"
|
<div class="flex space-x-1">
|
||||||
><svg-sprite src="pencil"></svg-sprite
|
<i-link :href="member.links.show" class="inline-flex btn btn-primary btn-sm"
|
||||||
></i-link>
|
><svg-sprite src="eye"></svg-sprite
|
||||||
<a
|
></i-link>
|
||||||
href="#"
|
<i-link :href="`/member/${member.id}/edit`" class="inline-flex btn btn-warning btn-sm"
|
||||||
v-show="hasModule('bill')"
|
><svg-sprite src="pencil"></svg-sprite
|
||||||
@click.prevent="openSidebar(index, 'payment.index')"
|
></i-link>
|
||||||
class="inline-flex btn btn-info btn-sm"
|
<a
|
||||||
><svg-sprite src="money"></svg-sprite
|
href="#"
|
||||||
></a>
|
v-show="hasModule('bill')"
|
||||||
<a
|
@click.prevent="openSidebar(index, 'payment.index')"
|
||||||
href="#"
|
class="inline-flex btn btn-info btn-sm"
|
||||||
v-show="hasModule('courses')"
|
><svg-sprite src="money"></svg-sprite
|
||||||
@click.prevent="openSidebar(index, 'courses.index')"
|
></a>
|
||||||
class="inline-flex btn btn-info btn-sm"
|
<a
|
||||||
><svg-sprite src="course"></svg-sprite
|
href="#"
|
||||||
></a>
|
v-show="hasModule('courses')"
|
||||||
<a
|
@click.prevent="openSidebar(index, 'courses.index')"
|
||||||
href="#"
|
class="inline-flex btn btn-info btn-sm"
|
||||||
@click.prevent="openSidebar(index, 'membership.index')"
|
><svg-sprite src="course"></svg-sprite
|
||||||
class="inline-flex btn btn-info btn-sm"
|
></a>
|
||||||
><svg-sprite src="user"></svg-sprite
|
<a
|
||||||
></a>
|
href="#"
|
||||||
<a :href="member.efz_link" v-show="member.efz_link" class="inline-flex btn btn-info btn-sm"
|
@click.prevent="openSidebar(index, 'membership.index')"
|
||||||
><svg-sprite src="report"></svg-sprite
|
class="inline-flex btn btn-info btn-sm"
|
||||||
></a>
|
><svg-sprite src="user"></svg-sprite
|
||||||
<i-link href="#" @click.prevent="remove(member)" class="inline-flex btn btn-danger btn-sm"
|
></a>
|
||||||
><svg-sprite src="trash"></svg-sprite
|
<a :href="member.efz_link" v-show="member.efz_link" class="inline-flex btn btn-info btn-sm"
|
||||||
></i-link>
|
><svg-sprite src="report"></svg-sprite
|
||||||
|
></a>
|
||||||
|
<i-link href="#" @click.prevent="remove(member)" class="inline-flex btn btn-danger btn-sm"
|
||||||
|
><svg-sprite src="trash"></svg-sprite
|
||||||
|
></i-link>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -7,6 +7,7 @@ use App\Efz\ShowEfzDocumentAction;
|
||||||
use App\Home\Actions\IndexAction as HomeIndexAction;
|
use App\Home\Actions\IndexAction as HomeIndexAction;
|
||||||
use App\Initialize\Actions\InitializeAction;
|
use App\Initialize\Actions\InitializeAction;
|
||||||
use App\Initialize\Actions\InitializeFormAction;
|
use App\Initialize\Actions\InitializeFormAction;
|
||||||
|
use App\Member\Actions\MemberShowAction;
|
||||||
use App\Member\Controllers\MemberResyncController;
|
use App\Member\Controllers\MemberResyncController;
|
||||||
use App\Member\MemberConfirmController;
|
use App\Member\MemberConfirmController;
|
||||||
use App\Member\MemberController;
|
use App\Member\MemberController;
|
||||||
|
@ -26,7 +27,8 @@ Route::group(['middleware' => 'auth:web'], function (): void {
|
||||||
Route::get('/', HomeIndexAction::class)->name('home');
|
Route::get('/', HomeIndexAction::class)->name('home');
|
||||||
Route::get('/initialize', InitializeFormAction::class)->name('initialize.form');
|
Route::get('/initialize', InitializeFormAction::class)->name('initialize.form');
|
||||||
Route::post('/initialize', InitializeAction::class)->name('initialize.store');
|
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::apiResource('member.payment', PaymentController::class);
|
||||||
Route::resource('allpayment', AllpaymentController::class);
|
Route::resource('allpayment', AllpaymentController::class);
|
||||||
Route::resource('subscription', SubscriptionController::class);
|
Route::resource('subscription', SubscriptionController::class);
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Member;
|
||||||
|
|
||||||
|
use App\Member\Member;
|
||||||
|
use App\Member\Membership;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ShowTest extends TestCase
|
||||||
|
{
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function testItShowsSingleMember(): void
|
||||||
|
{
|
||||||
|
$this->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');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue