From 936e27a31c38222cd112f058740c0beb0ea2df82 Mon Sep 17 00:00:00 2001 From: fsociety Date: Wed, 4 Jun 2025 17:55:15 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20refactor(pleb-table,=20project-supp?= =?UTF-8?q?ort):=20clean=20up=20concatenation,=20improve=20filter=20handli?= =?UTF-8?q?ng,=20and=20optimize=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/EinundzwanzigPlebTable.php | 25 +++++++++---------- .../project-support/index.blade.php | 15 +++++++---- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/Livewire/EinundzwanzigPlebTable.php b/app/Livewire/EinundzwanzigPlebTable.php index 061f29e..4c6f265 100644 --- a/app/Livewire/EinundzwanzigPlebTable.php +++ b/app/Livewire/EinundzwanzigPlebTable.php @@ -66,36 +66,35 @@ final class EinundzwanzigPlebTable extends PowerGridComponent 'avatar', fn($model, ) - => '', + ).'">', ) ->add( 'for', fn($model, ) - => $model->application_for ? '
' . AssociationStatus::from( + => $model->application_for ? '
'.AssociationStatus::from( $model->application_for, - )->label() . '
' : '', + )->label().'
' : '', ) ->add( 'payment', fn(EinundzwanzigPleb $model) - => $model->paymentEvents->count() > 0 && $model->paymentEvents->first( - )->paid ? '' . number_format( + => $model->paymentEvents->count() > 0 && $model->paymentEvents->first()->paid ? ''.number_format( $model->paymentEvents->first()->amount, 0, ',', '.', - ) . '' : 'keine Zahlung vorhanden', + ).'' : 'keine Zahlung vorhanden', ) ->add('npub_export', fn(EinundzwanzigPleb $model) => $model->npub) ->add( 'npub', fn(EinundzwanzigPleb $model) - => 'Nostr Profile', + ).'">Nostr Profile', ) ->add('association_status') ->add('association_status_name', fn(EinundzwanzigPleb $model) => $model->association_status->name) @@ -110,7 +109,7 @@ final class EinundzwanzigPlebTable extends PowerGridComponent AssociationStatus::HONORARY => 'text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1 bg-blue-500/20 text-blue-700', default => 'text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1 text-red-700', }; - return '' . $model->association_status->label() . ''; + return ''.$model->association_status->label().''; }, ) ->add( @@ -140,7 +139,7 @@ final class EinundzwanzigPlebTable extends PowerGridComponent ->visibleInExport(visible: false) ->sortable(), - Column::make('Beitrag ' . date('Y'), 'payment') + Column::make('Beitrag '.date('Y'), 'payment') ->visibleInExport(visible: false), Column::make('Bewirbt sich für', 'for', 'application_for') @@ -181,7 +180,7 @@ final class EinundzwanzigPlebTable extends PowerGridComponent ->findOrFail($rowId); $this->dialog()->confirm([ 'title' => 'Bist du sicher?', - 'description' => 'Möchtest du ' . $pleb->profile->name . ' wirklich akzeptieren?', + 'description' => 'Möchtest du '.$pleb->profile->name.' wirklich akzeptieren?', 'acceptLabel' => 'Ja, akzeptieren', 'method' => 'acceptPleb', 'params' => $rowId, @@ -196,7 +195,7 @@ final class EinundzwanzigPlebTable extends PowerGridComponent ->findOrFail($rowId); $this->dialog()->confirm([ 'title' => 'Bist du sicher?', - 'description' => 'Möchtest du ' . $pleb->profile->name . ' wirklich löschen?', + 'description' => 'Möchtest du '.$pleb->profile->name.' wirklich löschen?', 'acceptLabel' => 'Ja, lösche', 'method' => 'deletePleb', 'params' => $rowId, diff --git a/resources/views/pages/association/project-support/index.blade.php b/resources/views/pages/association/project-support/index.blade.php index 92083b9..a58b730 100644 --- a/resources/views/pages/association/project-support/index.blade.php +++ b/resources/views/pages/association/project-support/index.blade.php @@ -14,9 +14,10 @@ use function Livewire\Volt\{state, mount, on, computed, updated}; name('association.projectSupport'); +state(['activeFilter' => 'all',])->url(); + state([ 'search' => '', - 'activeFilter' => 'all', 'projects' => fn() => \App\Models\ProjectProposal::query() ->with([ @@ -80,6 +81,10 @@ $confirmDelete = function ($id) { ]); }; +$setFilter = function ($filter) { + $this->activeFilter = $filter; +}; + $delete = function ($id) { \App\Models\ProjectProposal::query()->findOrFail($id)->delete(); $this->projects = \App\Models\ProjectProposal::query() @@ -132,25 +137,25 @@ $delete = function ($id) {