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 7
7
use App \Actions \Article \ApprovedArticleAction ;
8
8
use App \Filament \Resources \ArticleResource \Pages ;
9
9
use App \Models \Article ;
10
+ use Awcodes \FilamentBadgeableColumn \Components \BadgeableColumn ;
10
11
use Filament \Resources \Resource ;
11
12
use Filament \Support \Enums \MaxWidth ;
12
13
use Filament \Tables ;
@@ -67,11 +68,30 @@ public static function table(Table $table): Table
67
68
->label ('Soumission ' )
68
69
->placeholder ('N/A ' )
69
70
->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 (),
75
95
Tables \Columns \TextColumn::make ('declined_at ' )
76
96
->label ('Décliner ' )
77
97
->placeholder ('N/A ' )
You can’t perform that action at this time.
0 commit comments