From df178c81868706f4fdab3be259408379214e626f Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Wed, 15 Mar 2023 11:16:52 +0100 Subject: [PATCH] Add search to member filter --- app/Http/Views/MemberView.php | 2 +- app/Member/FilterScope.php | 1 + resources/js/layouts/AppLayout.vue | 27 --------------------------- resources/js/views/member/VIndex.vue | 1 + tests/Feature/Member/IndexTest.php | 9 +++++++++ 5 files changed, 12 insertions(+), 28 deletions(-) diff --git a/app/Http/Views/MemberView.php b/app/Http/Views/MemberView.php index 9cd89420..366f1e71 100644 --- a/app/Http/Views/MemberView.php +++ b/app/Http/Views/MemberView.php @@ -21,7 +21,7 @@ class MemberView $filter = FilterScope::fromRequest($request->input('filter', '')); return [ - 'data' => MemberResource::collection(Member::search($request->search)->query(fn ($q) => $q->select('*') + 'data' => MemberResource::collection(Member::search($filter->search)->query(fn ($q) => $q->select('*') ->withFilter($filter) ->with('payments.subscription')->with('memberships')->with('courses')->with('subscription')->with('leaderMemberships')->with('ageGroupMemberships') ->withPendingPayment() diff --git a/app/Member/FilterScope.php b/app/Member/FilterScope.php index 92d4286b..26bd8172 100644 --- a/app/Member/FilterScope.php +++ b/app/Member/FilterScope.php @@ -21,6 +21,7 @@ class FilterScope extends Filter public ?string $billKind = null, public ?int $activityId = null, public ?int $subactivityId = null, + public string $search = '', ) { } diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue index deab478c..a1a36c2f 100644 --- a/resources/js/layouts/AppLayout.vue +++ b/resources/js/layouts/AppLayout.vue @@ -40,18 +40,6 @@ - - - - -
@@ -69,7 +57,6 @@ import mergesQueryString from '../mixins/mergesQueryString.js'; export default { data: function () { return { - searchVisible: true, menuVisible: true, menuOverflowVisible: false, tooltipsVisible: false, @@ -82,17 +69,6 @@ export default { mixins: [mergesQueryString], computed: { - isearch: { - set: debounce(function (v) { - this.$inertia.visit(this.qs({page: 1, search: v}), { - only: ['page', 'search', 'data'], - preserveState: true, - }); - }, 500), - get() { - return this.$page.props.search; - }, - }, filterMenu() { return this.$page.props.toolbar ? this.$page.props.toolbar.filter((menu) => menu.show !== false) : []; }, @@ -105,13 +81,11 @@ export default { if (x.matches && !this.menuVisible) { console.log('A'); this.menuVisible = true; - this.searchVisible = false; this.menuOverflowVisible = false; return; } if (!x.matches && this.menuVisible) { this.menuVisible = false; - this.searchVisible = false; this.menuOverflowVisible = false; return; } @@ -127,7 +101,6 @@ export default { window.addEventListener('inertiaStart', () => { if (!window.matchMedia('(min-width: 1024px)').matches) { _self.menuVisible = false; - _self.searchVisible = false; _self.menuOverflowVisible = false; } }); diff --git a/resources/js/views/member/VIndex.vue b/resources/js/views/member/VIndex.vue index ed08a434..c234689f 100644 --- a/resources/js/views/member/VIndex.vue +++ b/resources/js/views/member/VIndex.vue @@ -1,6 +1,7 @@