Compare commits
5 Commits
547c9edfd5
...
ef70203c8a
Author | SHA1 | Date |
---|---|---|
philipp lang | ef70203c8a | |
philipp lang | b3a29c706c | |
philipp lang | 298140e387 | |
philipp lang | 151477dbdd | |
philipp lang | a01e8adf8a |
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Member;
|
||||
|
||||
use App\Country;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Setting\NamiSettings;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
@ -33,8 +32,7 @@ class MemberController extends Controller
|
|||
session()->put('menu', 'member');
|
||||
session()->put('title', 'Mitglied erstellen');
|
||||
|
||||
return \Inertia::render('member/VForm', [
|
||||
'data' => MemberResource::defaultModel(),
|
||||
return Inertia::render('member/VForm', [
|
||||
'mode' => 'create',
|
||||
'meta' => MemberResource::meta(),
|
||||
]);
|
||||
|
@ -52,7 +50,7 @@ class MemberController extends Controller
|
|||
session()->put('menu', 'member');
|
||||
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
|
||||
|
||||
return \Inertia::render('member/VForm', [
|
||||
return Inertia::render('member/VForm', [
|
||||
'data' => new MemberResource($member),
|
||||
'mode' => 'edit',
|
||||
'conflict' => '1' === $request->query('conflict', '0'),
|
||||
|
|
|
@ -162,54 +162,47 @@ class MemberResource extends JsonResource
|
|||
'activity_ids' => [],
|
||||
'subactivity_ids' => []
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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,
|
||||
'recertified_at' => null,
|
||||
'without_efz_at' => null,
|
||||
'has_vk' => false,
|
||||
'has_svk' => false,
|
||||
'multiply_pv' => false,
|
||||
'multiply_more_pv' => false,
|
||||
'default' => [
|
||||
'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,
|
||||
'recertified_at' => null,
|
||||
'without_efz_at' => null,
|
||||
'has_vk' => false,
|
||||
'has_svk' => false,
|
||||
'multiply_pv' => false,
|
||||
'multiply_more_pv' => false,
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<template>
|
||||
<div class="fixed z-40 top-0 left-0 w-full h-full flex items-center justify-center p-6">
|
||||
<div class="relative rounded-lg p-8 bg-zinc-800 shadow-2xl shadow-black border border-zinc-700 border-solid w-full max-h-full flex flex-col overflow-auto"
|
||||
:class="full ? 'h-full' : innerWidth">
|
||||
<div class="fixed z-40 top-0 left-0 w-full h-full flex items-center justify-center p-6 bg-black/60 backdrop-blur-sm">
|
||||
<div
|
||||
class="relative rounded-lg p-8 bg-zinc-800 shadow-2xl shadow-black border border-zinc-700 border-solid w-full max-h-full flex flex-col overflow-auto"
|
||||
:class="full ? 'h-full' : innerWidth"
|
||||
>
|
||||
<div class="absolute top-0 right-0 mt-6 mr-6 flex space-x-6">
|
||||
<slot name="actions"></slot>
|
||||
<a href="#" @click.prevent="$emit('close')">
|
||||
|
|
|
@ -153,8 +153,8 @@ export default {
|
|||
},
|
||||
data: function () {
|
||||
return {
|
||||
original: {...this.data},
|
||||
inner: {...this.data},
|
||||
original: this.mode === 'create' ? {...this.meta.default} : {...this.data},
|
||||
inner: this.mode === 'create' ? {...this.meta.default} : {...this.data},
|
||||
active: 0,
|
||||
};
|
||||
},
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<page-layout page-class="pb-6">
|
||||
<template #toolbar>
|
||||
<page-toolbar-button :href="meta.links.create" color="primary" icon="plus">Mitglied anlegen</page-toolbar-button>
|
||||
<page-toolbar-button v-if="hasModule('bill')" :href="meta.links.allpayment" color="primary" icon="invoice">Rechnungen erstellen</page-toolbar-button>
|
||||
</template>
|
||||
<ui-popup v-if="deleting !== null" heading="Mitglied löschen?" @close="deleting.reject()">
|
||||
<div>
|
||||
|
@ -40,7 +39,15 @@
|
|||
</ui-popup>
|
||||
<page-filter breakpoint="xl">
|
||||
<template #fields>
|
||||
<f-switch v-show="hasModule('bill')" id="ausstand" :model-value="getFilter('ausstand')" label="Nur Ausstände" size="sm" @update:model-value="setFilter('ausstand', $event)"></f-switch>
|
||||
<f-switch
|
||||
v-show="hasModule('bill')"
|
||||
id="ausstand"
|
||||
name="ausstand"
|
||||
:model-value="getFilter('ausstand')"
|
||||
label="Nur Ausstände"
|
||||
size="sm"
|
||||
@update:model-value="setFilter('ausstand', $event)"
|
||||
></f-switch>
|
||||
<f-multipleselect
|
||||
id="group_ids"
|
||||
:options="meta.groups"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\EndToEnd;
|
||||
|
||||
use App\Activity;
|
||||
use App\Country;
|
||||
use App\Group;
|
||||
use App\Invoice\BillKind;
|
||||
use App\Invoice\Enums\InvoiceStatus;
|
||||
|
@ -16,9 +17,15 @@ use Tests\EndToEndTestCase;
|
|||
class MemberIndexTest extends EndToEndTestCase
|
||||
{
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Country::factory()->create(['name' => 'Deutschland']);
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
}
|
||||
|
||||
public function testItHandlesFullTextSearch(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()->count(2)->create(['firstname' => 'Alexander']);
|
||||
Member::factory()->defaults()->create(['firstname' => 'Heinrich']);
|
||||
|
||||
|
@ -29,9 +36,13 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
->assertInertiaCount('data.data', 1);
|
||||
}
|
||||
|
||||
public function testItGetsDefaultCountryFromDefaultModel(): void
|
||||
{
|
||||
$this->callFilter('member.index', [])->assertInertiaPath('data.meta.default.country_id', Country::firstWhere('name', 'Deutschland')->id);
|
||||
}
|
||||
|
||||
public function testItHandlesAddress(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()->create(['address' => '']);
|
||||
Member::factory()->defaults()->create(['zip' => '']);
|
||||
Member::factory()->defaults()->create(['location' => '']);
|
||||
|
@ -52,7 +63,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItHandlesBirthday(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()->create(['birthday' => null]);
|
||||
Member::factory()->defaults()->count(2)->create();
|
||||
|
||||
|
@ -65,7 +75,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItHandlesBillKind(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()->postBillKind()->create();
|
||||
Member::factory()->defaults()->emailBillKind()->count(2)->create();
|
||||
|
||||
|
@ -80,7 +89,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItHandlesGroupIds(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$group = Group::factory()->create();
|
||||
$otherGroup = Group::factory()->create();
|
||||
$thirdGroup = Group::factory()->create();
|
||||
|
@ -101,7 +109,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItHandlesActivitiesAndSubactivities(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$mitglied = Activity::factory()->name('€ Mitglied')->create();
|
||||
$schnuppermitglied = Activity::factory()->name('Schnuppermitgliedschaft')->create();
|
||||
$woelfling = Subactivity::factory()->name('Wölfling')->create();
|
||||
|
@ -127,7 +134,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItHandlesActivityAndSubactivityForSingleMembership(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$mitglied = Activity::factory()->name('€ Mitglied')->create();
|
||||
$schnuppermitglied = Activity::factory()->name('Schnuppermitgliedschaft')->create();
|
||||
$woelfling = Subactivity::factory()->name('Wölfling')->create();
|
||||
|
@ -144,7 +150,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItIgnoresInactiveMemberships(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$mitglied = Activity::factory()->name('€ Mitglied')->create();
|
||||
$woelfling = Subactivity::factory()->name('Wölfling')->create();
|
||||
Member::factory()->defaults()->has(Membership::factory()->for($mitglied)->for($woelfling)->ended())->create();
|
||||
|
@ -158,7 +163,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItListensForMembershipDeletion(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$mitglied = Activity::factory()->name('€ Mitglied')->create();
|
||||
$member = Member::factory()->defaults()->has(Membership::factory()->for($mitglied))->create();
|
||||
$member->memberships->first()->delete();
|
||||
|
@ -171,7 +175,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItFiltersForMemberships(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$mitglied = Activity::factory()->create();
|
||||
$woelfling = Subactivity::factory()->create();
|
||||
$juffi = Subactivity::factory()->create();
|
||||
|
@ -201,7 +204,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testGroupOfMembershipsFilterCanBeEmpty(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$mitglied = Activity::factory()->create();
|
||||
$woelfling = Subactivity::factory()->create();
|
||||
$group = Group::factory()->create();
|
||||
|
@ -221,7 +223,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItFiltersForSearchButNotForPayments(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()
|
||||
->has(InvoicePosition::factory()->for(Invoice::factory()))
|
||||
->create(['firstname' => 'firstname']);
|
||||
|
@ -234,7 +235,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItIgnoresPaidInvoices(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Member::factory()->defaults()
|
||||
->has(InvoicePosition::factory()->for(Invoice::factory()->status(InvoiceStatus::PAID)))
|
||||
->create();
|
||||
|
@ -247,7 +247,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItIncludesMembers(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$member = Member::factory()->defaults()->create(['birthday' => null, 'location' => '']);
|
||||
|
||||
sleep(1);
|
||||
|
@ -259,7 +258,6 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
|
||||
public function testItExcludesMembers(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$member = Member::factory()->defaults()->create(['birthday' => null]);
|
||||
|
||||
sleep(1);
|
||||
|
|
Loading…
Reference in New Issue