From e89265d4470f1e2b91eb8224c1dd4eb0f2dad930 Mon Sep 17 00:00:00 2001 From: fsociety Date: Mon, 7 Oct 2024 14:16:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20feat(association):=20enhance=20a?= =?UTF-8?q?ssociation=20status=20formatting=20with=20dynamic=20CSS=20class?= =?UTF-8?q?es=20in=20PlebTable=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/EinundzwanzigPlebTable.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Livewire/EinundzwanzigPlebTable.php b/app/Livewire/EinundzwanzigPlebTable.php index 01410ac..705a07f 100644 --- a/app/Livewire/EinundzwanzigPlebTable.php +++ b/app/Livewire/EinundzwanzigPlebTable.php @@ -95,8 +95,16 @@ final class EinundzwanzigPlebTable extends PowerGridComponent ->add('association_status') ->add( 'association_status_formatted', - fn(EinundzwanzigPleb $model) - => $model->association_status->label(), + function (EinundzwanzigPleb $model) { + $class = match ($model->association_status) { + AssociationStatus::DEFAULT => 'text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1 bg-gray-500/20 text-gray-700', + AssociationStatus::PASSIVE => 'text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1 bg-yellow-500/20 text-yellow-700', + AssociationStatus::ACTIVE => 'text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1 bg-green-500/20 text-green-700', + 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().''; + }, ) ->add( 'name_lower',