File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change 77use App \Actions \Article \ApprovedArticleAction ;
88use App \Filament \Resources \ArticleResource \Pages ;
99use App \Models \Article ;
10+ use Awcodes \FilamentBadgeableColumn \Components \BadgeableColumn ;
1011use Filament \Resources \Resource ;
1112use Filament \Support \Enums \MaxWidth ;
1213use Filament \Tables ;
@@ -67,11 +68,30 @@ public static function table(Table $table): Table
6768 ->label ('Soumission ' )
6869 ->placeholder ('N/A ' )
6970 ->date (),
70- Tables \Columns \TextColumn::make ('approved_at ' )
71- ->label ('Approbation ' )
72- ->placeholder ('N/A ' )
73- ->date ()
74- ->toggleable (),
71+ BadgeableColumn::make ('status ' )
72+ ->label ('Status ' )
73+ ->getStateUsing (function ($ record ) {
74+ if ($ record ->approved_at ) {
75+ return [
76+ 'label ' => 'Approuvé ' ,
77+ 'date ' => $ record ->approved_at ->format ('d/m/Y H:i ' ),
78+ ];
79+ }
80+ if ($ record ->declined_at ) {
81+ return [
82+ 'label ' => 'Décliné ' ,
83+ 'date ' => $ record ->declined_at ->format ('d/m/Y H:i ' ),
84+ ];
85+ }
86+ })
87+ ->formatStateUsing (function ($ state ) {
88+ if (is_array ($ state )) {
89+ return "{$ state ['label ' ]} - {$ state ['date ' ]}" ;
90+ }
91+
92+ return $ state ;
93+ })
94+ ->sortable (),
7595 Tables \Columns \TextColumn::make ('declined_at ' )
7696 ->label ('Décliner ' )
7797 ->placeholder ('N/A ' )
You can’t perform that action at this time.
0 commit comments