Compare commits
No commits in common. "4b4d073ea2e1bdc7baa76948b0913b681db93c10" and "ef70203c8a3d5232fe7aded143bbbfb20ca1496d" have entirely different histories.
4b4d073ea2
...
ef70203c8a
|
@ -4,24 +4,38 @@ namespace App\Member\Actions;
|
||||||
|
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Member\MemberResource;
|
use App\Member\MemberResource;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
class MemberShowAction
|
class MemberShowAction
|
||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function asController(Member $member): JsonResponse
|
/**
|
||||||
|
* @return array{data: MemberResource}
|
||||||
|
*/
|
||||||
|
public function handle(Member $member): array
|
||||||
{
|
{
|
||||||
return response()->json([
|
return [
|
||||||
'data' => new MemberResource($member
|
'data' => new MemberResource(
|
||||||
|
$member
|
||||||
->load('memberships')
|
->load('memberships')
|
||||||
->load('invoicePositions.invoice')
|
->load('invoicePositions.invoice')
|
||||||
->load('nationality')
|
->load('nationality')
|
||||||
->load('region')
|
->load('region')
|
||||||
->load('subscription')
|
->load('subscription')
|
||||||
->load('courses.course')),
|
->load('courses.course')
|
||||||
|
),
|
||||||
'meta' => MemberResource::meta(),
|
'meta' => MemberResource::meta(),
|
||||||
]);
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Member $member): Response
|
||||||
|
{
|
||||||
|
session()->put('menu', 'member');
|
||||||
|
session()->put('title', 'Mitglied ' . $member->fullname);
|
||||||
|
|
||||||
|
return Inertia::render('member/ShowView', $this->handle($member));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,17 @@ class MemberController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function create(): Response
|
||||||
|
{
|
||||||
|
session()->put('menu', 'member');
|
||||||
|
session()->put('title', 'Mitglied erstellen');
|
||||||
|
|
||||||
|
return Inertia::render('member/VForm', [
|
||||||
|
'mode' => 'create',
|
||||||
|
'meta' => MemberResource::meta(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function store(MemberRequest $request, NamiSettings $settings): RedirectResponse
|
public function store(MemberRequest $request, NamiSettings $settings): RedirectResponse
|
||||||
{
|
{
|
||||||
$request->persistCreate($settings);
|
$request->persistCreate($settings);
|
||||||
|
@ -34,6 +45,19 @@ class MemberController extends Controller
|
||||||
return redirect()->route('member.index');
|
return redirect()->route('member.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function edit(Member $member, Request $request): Response
|
||||||
|
{
|
||||||
|
session()->put('menu', 'member');
|
||||||
|
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
|
||||||
|
|
||||||
|
return Inertia::render('member/VForm', [
|
||||||
|
'data' => new MemberResource($member),
|
||||||
|
'mode' => 'edit',
|
||||||
|
'conflict' => '1' === $request->query('conflict', '0'),
|
||||||
|
'meta' => MemberResource::meta(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function update(Member $member, MemberRequest $request): RedirectResponse
|
public function update(Member $member, MemberRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2,13 +2,11 @@
|
||||||
<v-notification class="fixed z-40 right-0 bottom-0 mb-3 mr-3"></v-notification>
|
<v-notification class="fixed z-40 right-0 bottom-0 mb-3 mr-3"></v-notification>
|
||||||
|
|
||||||
<!-- ******************************** Sidebar ******************************** -->
|
<!-- ******************************** Sidebar ******************************** -->
|
||||||
<div
|
<div class="fixed z-40 bg-gray-800 p-6 w-56 top-0 h-screen border-r border-gray-600 border-solid flex flex-col justify-between transition-all"
|
||||||
class="fixed z-40 bg-gray-800 p-6 w-56 top-0 h-screen border-r border-gray-600 border-solid flex flex-col justify-between transition-all"
|
|
||||||
:class="{
|
:class="{
|
||||||
'-left-[14rem]': !menuStore.isShifted,
|
'-left-[14rem]': !menuStore.isShifted,
|
||||||
'left-0': menuStore.isShifted,
|
'left-0': menuStore.isShifted,
|
||||||
}"
|
}">
|
||||||
>
|
|
||||||
<div class="grid gap-2">
|
<div class="grid gap-2">
|
||||||
<v-link href="/" menu="dashboard" icon="loss">Dashboard</v-link>
|
<v-link href="/" menu="dashboard" icon="loss">Dashboard</v-link>
|
||||||
<v-link href="/member" menu="member" icon="user">Mitglieder</v-link>
|
<v-link href="/member" menu="member" icon="user">Mitglieder</v-link>
|
||||||
|
|
|
@ -90,7 +90,7 @@ Route::group(['middleware' => 'auth:web'], function (): void {
|
||||||
Route::post('/nami/search', NamiSearchAction::class)->name('nami.search');
|
Route::post('/nami/search', NamiSearchAction::class)->name('nami.search');
|
||||||
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)->except('show', 'destroy', 'edit', 'create');
|
Route::resource('member', MemberController::class)->except('show', 'destroy');
|
||||||
Route::delete('/member/{member}', MemberDeleteAction::class);
|
Route::delete('/member/{member}', MemberDeleteAction::class);
|
||||||
Route::get('/member/{member}', MemberShowAction::class)->name('member.show');
|
Route::get('/member/{member}', MemberShowAction::class)->name('member.show');
|
||||||
Route::resource('subscription', SubscriptionController::class);
|
Route::resource('subscription', SubscriptionController::class);
|
||||||
|
|
|
@ -3,22 +3,15 @@
|
||||||
namespace Tests\EndToEnd\Member;
|
namespace Tests\EndToEnd\Member;
|
||||||
|
|
||||||
use App\Activity;
|
use App\Activity;
|
||||||
use App\Country;
|
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Member\Membership;
|
use App\Member\Membership;
|
||||||
use App\Subactivity;
|
use App\Subactivity;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
use Tests\EndToEndTestCase;
|
use Tests\EndToEndTestCase;
|
||||||
|
|
||||||
class IndexTest extends EndToEndTestCase
|
class IndexTest extends EndToEndTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
Country::factory()->create(['name' => 'Deutschland']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItGetsMembers(): void
|
public function testItGetsMembers(): void
|
||||||
{
|
{
|
||||||
$this->withoutExceptionHandling()->login()->loginNami();
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
|
|
@ -36,11 +36,9 @@ class MemberIndexTest extends EndToEndTestCase
|
||||||
->assertInertiaCount('data.data', 1);
|
->assertInertiaCount('data.data', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItGetsDefault(): void
|
public function testItGetsDefaultCountryFromDefaultModel(): void
|
||||||
{
|
{
|
||||||
$this->callFilter('member.index', [])
|
$this->callFilter('member.index', [])->assertInertiaPath('data.meta.default.country_id', Country::firstWhere('name', 'Deutschland')->id);
|
||||||
->assertInertiaPath('data.meta.default.country_id', Country::firstWhere('name', 'Deutschland')->id)
|
|
||||||
->assertInertiaPath('data.meta.default.address', '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItHandlesAddress(): void
|
public function testItHandlesAddress(): void
|
||||||
|
@ -266,24 +264,4 @@ class MemberIndexTest extends EndToEndTestCase
|
||||||
$this->callFilter('member.index', ['hasBirthday' => false, 'exclude' => [$member->id]])
|
$this->callFilter('member.index', ['hasBirthday' => false, 'exclude' => [$member->id]])
|
||||||
->assertInertiaCount('data.data', 0);
|
->assertInertiaCount('data.data', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItDisplaysActivityMeta(): void
|
|
||||||
{
|
|
||||||
$activity = Activity::factory()->inNami(5)->hasAttached(Subactivity::factory()->inNami(23)->name('Biber'))->name('€ Mitglied')->create();
|
|
||||||
$subactivity = $activity->subactivities->first();
|
|
||||||
|
|
||||||
$this->callFilter('member.index', [])
|
|
||||||
->assertInertiaPath("data.meta.formSubactivities.{$activity->id}.{$subactivity->id}", 'Biber')
|
|
||||||
->assertInertiaPath("data.meta.formActivities.{$activity->id}", '€ Mitglied')
|
|
||||||
->assertInertiaPath('data.meta.billKinds.0', ['id' => 'E-Mail', 'name' => 'E-Mail']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItDoesntDisplayActivitiesAndSubactivitiesNotInNami(): void
|
|
||||||
{
|
|
||||||
Activity::factory()->hasAttached(Subactivity::factory()->name('Biber'))->name('€ Mitglied')->create();
|
|
||||||
|
|
||||||
$this->callFilter('member.index', [])
|
|
||||||
->assertInertiaCount('data.meta.formCreateSubactivities', 0)
|
|
||||||
->assertInertiaCount('data.meta.formCreateActivities', 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Member;
|
||||||
|
|
||||||
|
use App\Activity;
|
||||||
|
use App\Country;
|
||||||
|
use App\Subactivity;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class CreateTest extends TestCase
|
||||||
|
{
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->withoutExceptionHandling();
|
||||||
|
$this->login()->loginNami();
|
||||||
|
Country::factory()->create(['name' => 'Deutschland']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItDisplaysCreatePage(): void
|
||||||
|
{
|
||||||
|
$activity = Activity::factory()->inNami(5)->hasAttached(Subactivity::factory()->inNami(23)->name('Biber'))->name('€ Mitglied')->create();
|
||||||
|
$subactivity = $activity->subactivities->first();
|
||||||
|
|
||||||
|
$response = $this->get(route('member.create'));
|
||||||
|
|
||||||
|
$this->assertInertiaHas('Biber', $response, "meta.formSubactivities.{$activity->id}.{$subactivity->id}");
|
||||||
|
$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,
|
||||||
|
'address' => '',
|
||||||
|
], $response, 'data');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItDoesntDisplayActivitiesAndSubactivitiesNotInNami(): void
|
||||||
|
{
|
||||||
|
Activity::factory()->hasAttached(Subactivity::factory()->name('Biber'))->name('€ Mitglied')->create();
|
||||||
|
|
||||||
|
$response = $this->get(route('member.create'));
|
||||||
|
|
||||||
|
$this->assertCount(0, $this->inertia($response, 'meta.formCreateSubactivities'));
|
||||||
|
$this->assertCount(0, $this->inertia($response, 'meta.formCreateActivities'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Member;
|
||||||
|
|
||||||
|
use App\Activity;
|
||||||
|
use App\Member\Member;
|
||||||
|
use App\Subactivity;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class EditTest extends TestCase
|
||||||
|
{
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function testItDisplaysEditPage(): void
|
||||||
|
{
|
||||||
|
$this->withoutExceptionHandling();
|
||||||
|
$this->login()->loginNami();
|
||||||
|
$member = Member::factory()->defaults()->create(['salutation' => 'Doktor', 'firstname' => 'Max', 'comment' => 'Lorem bla']);
|
||||||
|
$activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create();
|
||||||
|
$subactivity = $activity->subactivities->first();
|
||||||
|
|
||||||
|
$response = $this->get(route('member.edit', ['member' => $member]));
|
||||||
|
|
||||||
|
$this->assertInertiaHas('Biber', $response, "meta.formSubactivities.{$activity->id}.{$subactivity->id}");
|
||||||
|
$this->assertInertiaHas('€ Mitglied', $response, "meta.formActivities.{$activity->id}");
|
||||||
|
$this->assertInertiaHas('Max', $response, 'data.firstname');
|
||||||
|
$this->assertInertiaHas('Doktor', $response, 'data.salutation');
|
||||||
|
$this->assertInertiaHas('Lorem bla', $response, 'data.comment');
|
||||||
|
$this->assertInertiaHas('edit', $response, 'mode');
|
||||||
|
$this->assertInertiaHas(false, $response, 'conflict');
|
||||||
|
$this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'meta.billKinds.0');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItDisplaysEducation(): void
|
||||||
|
{
|
||||||
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
$member = Member::factory()
|
||||||
|
->defaults()
|
||||||
|
->create([
|
||||||
|
'efz' => '2022-09-20',
|
||||||
|
'ps_at' => '2022-04-20',
|
||||||
|
'more_ps_at' => '2022-06-02',
|
||||||
|
'without_education_at' => '2022-06-03',
|
||||||
|
'without_efz_at' => '2022-06-04',
|
||||||
|
'recertified_at' => '2022-06-04',
|
||||||
|
'has_vk' => true,
|
||||||
|
'has_svk' => true,
|
||||||
|
'multiply_pv' => true,
|
||||||
|
'multiply_more_pv' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->get(route('member.edit', ['member' => $member]));
|
||||||
|
|
||||||
|
$this->assertInertiaHas([
|
||||||
|
'efz' => '2022-09-20',
|
||||||
|
'ps_at' => '2022-04-20',
|
||||||
|
'more_ps_at' => '2022-06-02',
|
||||||
|
'without_education_at' => '2022-06-03',
|
||||||
|
'without_efz_at' => '2022-06-04',
|
||||||
|
'recertified_at' => '2022-06-04',
|
||||||
|
'has_vk' => true,
|
||||||
|
'has_svk' => true,
|
||||||
|
'multiply_pv' => true,
|
||||||
|
'multiply_more_pv' => true,
|
||||||
|
], $response, 'data');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItDisplaysSystem(): void
|
||||||
|
{
|
||||||
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
$member = Member::factory()
|
||||||
|
->defaults()
|
||||||
|
->emailBillKind()
|
||||||
|
->create();
|
||||||
|
|
||||||
|
$response = $this->get(route('member.edit', ['member' => $member]));
|
||||||
|
|
||||||
|
$this->assertInertiaHas([
|
||||||
|
'bill_kind' => 'E-Mail',
|
||||||
|
], $response, 'data');
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
namespace Tests\Feature\Member;
|
namespace Tests\Feature\Member;
|
||||||
|
|
||||||
use App\Activity;
|
|
||||||
use App\Country;
|
|
||||||
use App\Course\Models\Course;
|
use App\Course\Models\Course;
|
||||||
use App\Course\Models\CourseMember;
|
use App\Course\Models\CourseMember;
|
||||||
|
use App\Fee;
|
||||||
use App\Gender;
|
use App\Gender;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use App\Invoice\Models\Invoice;
|
use App\Invoice\Models\Invoice;
|
||||||
|
@ -13,24 +12,19 @@ use App\Invoice\Models\InvoicePosition;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Member\Membership;
|
use App\Member\Membership;
|
||||||
use App\Nationality;
|
use App\Nationality;
|
||||||
|
use App\Payment\Payment;
|
||||||
use App\Payment\Subscription;
|
use App\Payment\Subscription;
|
||||||
use App\Region;
|
use App\Region;
|
||||||
use App\Subactivity;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Generator;
|
use Generator;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Tests\RequestFactories\Child;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ShowTest extends TestCase
|
class ShowTest extends TestCase
|
||||||
{
|
{
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
public function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
Country::factory()->create(['name' => 'Deutschland']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItShowsSingleMember(): void
|
public function testItShowsSingleMember(): void
|
||||||
{
|
{
|
||||||
Carbon::setTestNow(Carbon::parse('2006-01-01 15:00:00'));
|
Carbon::setTestNow(Carbon::parse('2006-01-01 15:00:00'));
|
||||||
|
@ -77,58 +71,70 @@ class ShowTest extends TestCase
|
||||||
'mitgliedsnr' => 998,
|
'mitgliedsnr' => 998,
|
||||||
'lon' => 19.05,
|
'lon' => 19.05,
|
||||||
'lat' => 14.053,
|
'lat' => 14.053,
|
||||||
'comment' => 'Lorem bla'
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->getJson(route('member.show', ['member' => $member]))
|
$response = $this->get("/member/{$member->id}");
|
||||||
->assertJsonPath('data.firstname', 'Max')
|
|
||||||
->assertJsonPath('data.birthday_human', '20.04.1991')
|
$this->assertInertiaHas([
|
||||||
->assertJsonPath('data.age', 14)
|
'birthday_human' => '20.04.1991',
|
||||||
->assertJsonPath('data.group_name', 'Stamm Beispiel')
|
'age' => 14,
|
||||||
->assertJsonPath('data.full_address', 'Itterstr 3, 42719 Solingen')
|
'group_name' => 'Stamm Beispiel',
|
||||||
->assertJsonPath('data.region.name', 'NRW')
|
'full_address' => 'Itterstr 3, 42719 Solingen',
|
||||||
->assertJsonPath('data.other_country', 'other')
|
'region' => ['name' => 'NRW'],
|
||||||
->assertJsonPath('data.main_phone', '+49 212 1266775')
|
'other_country' => 'other',
|
||||||
->assertJsonPath('data.mobile_phone', '+49 212 1266776')
|
'main_phone' => '+49 212 1266775',
|
||||||
->assertJsonPath('data.work_phone', '+49 212 1266777')
|
'mobile_phone' => '+49 212 1266776',
|
||||||
->assertJsonPath('data.children_phone', '+49 212 1266778')
|
'work_phone' => '+49 212 1266777',
|
||||||
->assertJsonPath('data.email', 'a@b.de')
|
'children_phone' => '+49 212 1266778',
|
||||||
->assertJsonPath('data.email_parents', 'b@c.de')
|
'email' => 'a@b.de',
|
||||||
->assertJsonPath('data.fax', '+49 212 1255674')
|
'email_parents' => 'b@c.de',
|
||||||
->assertJsonPath('data.fullname', 'Herr Max Muster')
|
'fax' => '+49 212 1255674',
|
||||||
->assertJsonPath('data.efz_human', '20.09.2022')
|
'fullname' => 'Herr Max Muster',
|
||||||
->assertJsonPath('data.ps_at_human', '20.04.2022')
|
'efz_human' => '20.09.2022',
|
||||||
->assertJsonPath('data.more_ps_at_human', '02.06.2022')
|
'ps_at_human' => '20.04.2022',
|
||||||
->assertJsonPath('data.without_education_at_human', '03.06.2022')
|
'more_ps_at_human' => '02.06.2022',
|
||||||
->assertJsonPath('data.without_efz_at_human', '04.06.2022')
|
'without_education_at_human' => '03.06.2022',
|
||||||
->assertJsonPath('data.recertified_at_human', '13.06.2022')
|
'without_efz_at_human' => '04.06.2022',
|
||||||
->assertJsonPath('data.has_vk', true)
|
'recertified_at_human' => '13.06.2022',
|
||||||
->assertJsonPath('data.has_svk', true)
|
'has_vk' => true,
|
||||||
->assertJsonPath('data.multiply_pv', true)
|
'has_svk' => true,
|
||||||
->assertJsonPath('data.multiply_more_pv', true)
|
'multiply_pv' => true,
|
||||||
->assertJsonPath('data.has_nami', true)
|
'multiply_more_pv' => true,
|
||||||
->assertJsonPath('data.nami_id', 123)
|
'has_nami' => true,
|
||||||
->assertJsonPath('data.send_newspaper', true)
|
'nami_id' => 123,
|
||||||
->assertJsonPath('data.joined_at_human', '11.06.2022')
|
'send_newspaper' => true,
|
||||||
->assertJsonPath('data.bill_kind_name', 'Post')
|
'joined_at_human' => '11.06.2022',
|
||||||
->assertJsonPath('data.mitgliedsnr', 998)
|
'bill_kind_name' => 'Post',
|
||||||
->assertJsonPath('data.lon', 19.05)
|
'mitgliedsnr' => 998,
|
||||||
->assertJsonPath('data.lat', 14.053)
|
'lon' => 19.05,
|
||||||
->assertJsonPath('data.subscription.name', 'Sub')
|
'lat' => 14.053,
|
||||||
->assertJsonPath('data.comment', 'Lorem bla')
|
'subscription' => [
|
||||||
->assertJsonPath('data.memberships.0.activity_name', '€ LeiterIn')
|
'name' => 'Sub',
|
||||||
->assertJsonPath('data.memberships.0.subactivity_name', 'Jungpfadfinder')
|
],
|
||||||
->assertJsonPath('data.memberships.0.id', $member->memberships->first()->id)
|
], $response, 'data');
|
||||||
->assertJsonPath('data.memberships.0.human_date', '19.11.2022')
|
$this->assertInertiaHas([
|
||||||
->assertJsonPath('data.memberships.0.promised_at', now()->format('Y-m-d'))
|
'activity_name' => '€ LeiterIn',
|
||||||
->assertJsonPath('data.courses.0.organizer', 'DPSG')
|
'subactivity_name' => 'Jungpfadfinder',
|
||||||
->assertJsonPath('data.courses.0.event_name', 'Wochenende')
|
'id' => $member->memberships->first()->id,
|
||||||
->assertJsonPath('data.courses.0.completed_at_human', '03.03.2022')
|
'human_date' => '19.11.2022',
|
||||||
->assertJsonPath('data.courses.0.course.name', ' Baustein 2e - Gewalt gegen Kinder und Jugendliche: Vertiefung, Prävention ')
|
'promised_at' => now()->format('Y-m-d'),
|
||||||
->assertJsonPath('data.courses.0.course.short_name', '2e')
|
], $response, 'data.memberships.0');
|
||||||
->assertJsonPath('data.invoicePositions.0.description', 'uu')
|
$this->assertInertiaHas([
|
||||||
->assertJsonPath('data.invoicePositions.0.price_human', '10,50 €')
|
'organizer' => 'DPSG',
|
||||||
->assertJsonPath('data.invoicePositions.0.invoice.status', 'Neu');
|
'event_name' => 'Wochenende',
|
||||||
|
'completed_at_human' => '03.03.2022',
|
||||||
|
'course' => [
|
||||||
|
'name' => ' Baustein 2e - Gewalt gegen Kinder und Jugendliche: Vertiefung, Prävention ',
|
||||||
|
'short_name' => '2e',
|
||||||
|
],
|
||||||
|
], $response, 'data.courses.0');
|
||||||
|
$this->assertInertiaHas([
|
||||||
|
'description' => 'uu',
|
||||||
|
'price_human' => '10,50 €',
|
||||||
|
'invoice' => [
|
||||||
|
'status' => 'Neu',
|
||||||
|
]
|
||||||
|
], $response, 'data.invoicePositions.0');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItShowsMinimalSingleMember(): void
|
public function testItShowsMinimalSingleMember(): void
|
||||||
|
@ -140,14 +146,24 @@ class ShowTest extends TestCase
|
||||||
->for(Subscription::factory()->forFee())
|
->for(Subscription::factory()->forFee())
|
||||||
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
|
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
|
||||||
|
|
||||||
$this->get(route('member.show', ['member' => $member]))
|
$response = $this->get("/member/{$member->id}");
|
||||||
->assertJsonPath('data.has_vk', false)
|
|
||||||
->assertJsonPath('data.has_svk', false)
|
$this->assertInertiaHas([
|
||||||
->assertJsonPath('data.multiply_pv', false)
|
'region' => ['name' => '-- kein --'],
|
||||||
->assertJsonPath('data.multiply_more_pv', false)
|
'fullname' => 'Max Muster',
|
||||||
->assertJsonPath('data.nationality.name', 'deutsch')
|
'nationality' => [
|
||||||
->assertJsonPath('data.region.name', '-- kein --')
|
'name' => 'deutsch',
|
||||||
->assertJsonPath('data.fullname', 'Max Muster');
|
],
|
||||||
|
'efz_human' => null,
|
||||||
|
'ps_at_human' => null,
|
||||||
|
'more_ps_at_human' => null,
|
||||||
|
'without_education_at_human' => null,
|
||||||
|
'without_efz_at_human' => null,
|
||||||
|
'has_vk' => false,
|
||||||
|
'has_svk' => false,
|
||||||
|
'multiply_pv' => false,
|
||||||
|
'multiply_more_pv' => false,
|
||||||
|
], $response, 'data');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function membershipDataProvider(): Generator
|
public function membershipDataProvider(): Generator
|
||||||
|
@ -168,21 +184,8 @@ class ShowTest extends TestCase
|
||||||
->has(Membership::factory()->in('€ LeiterIn', 455, 'Pfadfinder', 15)->state(['from' => $from, 'to' => $to]))
|
->has(Membership::factory()->in('€ LeiterIn', 455, 'Pfadfinder', 15)->state(['from' => $from, 'to' => $to]))
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
$this->get(route('member.show', ['member' => $member]))
|
$response = $this->get("/member/{$member->id}");
|
||||||
->assertJsonPath('data.memberships.0.is_active', $isActive);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItDisplaysMeta(): void
|
$this->assertInertiaHas($isActive, $response, 'data.memberships.0.is_active');
|
||||||
{
|
|
||||||
$this->withoutExceptionHandling();
|
|
||||||
$this->login()->loginNami();
|
|
||||||
$member = Member::factory()->defaults()->create(['salutation' => 'Doktor', 'firstname' => 'Max', 'comment' => 'Lorem bla']);
|
|
||||||
$activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create();
|
|
||||||
$subactivity = $activity->subactivities->first();
|
|
||||||
|
|
||||||
$this->get(route('member.show', ['member' => $member]))
|
|
||||||
->assertJsonPath("meta.formActivities.{$activity->id}", '€ Mitglied')
|
|
||||||
->assertJsonPath("meta.formSubactivities.{$activity->id}.{$subactivity->id}", 'Biber')
|
|
||||||
->assertJsonPath("meta.billKinds.0", ['id' => 'E-Mail', 'name' => 'E-Mail']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue