From 76c319a6a0fc91fa74dec030624d9dc93e4e9513 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Wed, 23 Nov 2022 23:24:32 +0100 Subject: [PATCH] Simplify view --- app/Http/Views/MemberView.php | 2 +- app/Member/Member.php | 7 --- app/Member/MemberConfirmController.php | 17 ------- app/Member/MemberResource.php | 1 - ...20958_drop_members_confirmed_at_column.php | 28 +++++++++++ resources/js/views/member/VForm.vue | 11 ----- resources/js/views/member/VIndex.vue | 48 +++++++------------ routes/web.php | 2 - tests/Feature/Member/IndexTest.php | 30 +++--------- 9 files changed, 54 insertions(+), 92 deletions(-) delete mode 100644 app/Member/MemberConfirmController.php create mode 100644 database/migrations/2022_11_23_220958_drop_members_confirmed_at_column.php diff --git a/app/Http/Views/MemberView.php b/app/Http/Views/MemberView.php index d67b4a45..d31c2b97 100644 --- a/app/Http/Views/MemberView.php +++ b/app/Http/Views/MemberView.php @@ -22,7 +22,7 @@ class MemberView 'data' => MemberResource::collection(Member::select('*') ->filter($filter)->search($request->query('search', null)) ->with('billKind')->with('payments.subscription')->with('memberships')->with('courses')->with('subscription')->with('leaderMemberships')->with('ageGroupMemberships') - ->withIsConfirmed()->withPendingPayment() + ->withPendingPayment() ->orderByRaw('lastname, firstname') ->paginate(15) ), diff --git a/app/Member/Member.php b/app/Member/Member.php index 4219b953..3786e493 100644 --- a/app/Member/Member.php +++ b/app/Member/Member.php @@ -30,7 +30,6 @@ use Zoomyboy\LaravelNami\Data\MembershipEntry; /** * @property string $subscription_name * @property int $pending_payment - * @property bool $is_confirmed */ class Member extends Model { @@ -62,7 +61,6 @@ class Member extends Model 'region_id' => 'integer', 'confession_id' => 'integer', 'nami_id' => 'integer', - 'is_confirmed' => 'boolean', 'has_svk' => 'boolean', 'has_vk' => 'boolean', 'multiply_pv' => 'boolean', @@ -283,11 +281,6 @@ class Member extends Model return $q->orderByRaw('firstname, lastname'); } - public function scopeWithIsConfirmed(Builder $q): Builder - { - return $q->selectSub('DATEDIFF(NOW(), IFNULL(confirmed_at, DATE_SUB(NOW(), INTERVAL 3 YEAR))) < 712', 'is_confirmed'); - } - public function scopeWithPendingPayment(Builder $q): Builder { return $q->addSelect([ diff --git a/app/Member/MemberConfirmController.php b/app/Member/MemberConfirmController.php deleted file mode 100644 index db717ff9..00000000 --- a/app/Member/MemberConfirmController.php +++ /dev/null @@ -1,17 +0,0 @@ -update(['confirmed_at' => now()]); - - return redirect()->route('member.index'); - } -} diff --git a/app/Member/MemberResource.php b/app/Member/MemberResource.php index f81a957d..cef8e14a 100644 --- a/app/Member/MemberResource.php +++ b/app/Member/MemberResource.php @@ -57,7 +57,6 @@ class MemberResource extends JsonResource 'bill_kind_id' => $this->bill_kind_id, 'bill_kind_name' => optional($this->billKind)->name, 'has_nami' => null !== $this->nami_id, - 'is_confirmed' => $this->is_confirmed, 'children_phone' => $this->children_phone, 'payments' => PaymentResource::collection($this->whenLoaded('payments')), 'memberships' => MembershipResource::collection($this->whenLoaded('memberships')), diff --git a/database/migrations/2022_11_23_220958_drop_members_confirmed_at_column.php b/database/migrations/2022_11_23_220958_drop_members_confirmed_at_column.php new file mode 100644 index 00000000..cc7fe394 --- /dev/null +++ b/database/migrations/2022_11_23_220958_drop_members_confirmed_at_column.php @@ -0,0 +1,28 @@ +dropColumn('confirmed_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +}; diff --git a/resources/js/views/member/VForm.vue b/resources/js/views/member/VForm.vue index da7da721..1434c1b1 100644 --- a/resources/js/views/member/VForm.vue +++ b/resources/js/views/member/VForm.vue @@ -19,14 +19,6 @@
-
@@ -262,9 +254,6 @@ export default { }, methods: { - confirm() { - this.$inertia.post(`/member/${this.inner.id}/confirm`); - }, submit() { this.mode === 'create' ? this.$inertia.post(`/member`, this.inner) diff --git a/resources/js/views/member/VIndex.vue b/resources/js/views/member/VIndex.vue index 233508ca..19106d52 100644 --- a/resources/js/views/member/VIndex.vue +++ b/resources/js/views/member/VIndex.vue @@ -12,38 +12,34 @@ Nachname Vorname - Straße - PLZ Ort Tags - Beitrag - Geburtstag + Alter Rechnung Ausstand - Eintritt - - - + +
+ + +
- - - +
N - C
- - +
-
'auth:web'], function (): void { Route::apiResource('member.payment', PaymentController::class); Route::resource('allpayment', AllpaymentController::class); Route::resource('subscription', SubscriptionController::class); - Route::post('/member/{member}/confirm', MemberConfirmController::class); Route::get('/member/{member}/pdf', MemberPdfController::class) ->name('member.singlepdf'); Route::get('/sendpayment', [SendpaymentController::class, 'create'])->name('sendpayment.create'); diff --git a/tests/Feature/Member/IndexTest.php b/tests/Feature/Member/IndexTest.php index 6a2a62de..a6c0ef85 100644 --- a/tests/Feature/Member/IndexTest.php +++ b/tests/Feature/Member/IndexTest.php @@ -3,8 +3,6 @@ namespace Tests\Feature\Member; use App\Activity; -use App\Course\Models\Course; -use App\Course\Models\CourseMember; use App\Member\Member; use App\Member\Membership; use App\Payment\Payment; @@ -12,7 +10,6 @@ use App\Subactivity; use Carbon\Carbon; use Illuminate\Foundation\Testing\DatabaseTransactions; use Tests\TestCase; -use Zoomyboy\LaravelNami\Backend\FakeBackend; class IndexTest extends TestCase { @@ -20,32 +17,19 @@ class IndexTest extends TestCase public function testItGetsMembers(): void { - $backend = app(FakeBackend::class) - ->fakeMember([ - 'vorname' => '::firstname::', - 'nachname' => '::lastname::', - 'beitragsartId' => 300, - 'geburtsDatum' => '2014-07-11 00:00:00', - 'gruppierungId' => 1000, - 'id' => 411, - 'eintrittsdatum' => '2020-11-17 00:00:00', - 'geschlechtId' => 303, - 'landId' => 302, - 'staatsangehoerigkeitId' => 291, - 'zeitschriftenversand' => true, - 'strasse' => '::street', - 'plz' => '12346', - 'ort' => '::location::', - 'gruppierung' => '::group::', - 'version' => 40, - ]); $this->withoutExceptionHandling()->login()->loginNami(); - Member::factory()->defaults()->has(CourseMember::factory()->for(Course::factory()), 'courses')->create(['firstname' => '::firstname::']); + Member::factory()->defaults()->create([ + 'firstname' => '::firstname::', + 'address' => 'Kölner Str 3', + 'zip' => 33333, + 'location' => 'Hilden', + ]); $response = $this->get('/member'); $this->assertComponent('member/VIndex', $response); $this->assertInertiaHas('::firstname::', $response, 'data.data.0.firstname'); + $this->assertInertiaHas('Kölner Str 3, 33333 Hilden', $response, 'data.data.0.full_address'); } public function testItShowsEfzForEfzMembership(): void