|
41 | 41 | use Filament\Schemas\Components\Utilities\Set; |
42 | 42 | use Filament\Schemas\Schema; |
43 | 43 | use Filament\Support\Enums\Width; |
| 44 | +use Filament\Tables\Columns\IconColumn; |
44 | 45 | use Filament\Tables\Columns\ImageColumn; |
45 | 46 | use Filament\Tables\Columns\SelectColumn; |
46 | 47 | use Filament\Tables\Columns\TextColumn; |
@@ -278,6 +279,10 @@ public static function getTableColumns($showGroup = true, $showPlaylist = true): |
278 | 279 | } |
279 | 280 | }) |
280 | 281 | ->sortable(), |
| 282 | + IconColumn::make('epg_map_enabled') |
| 283 | + ->label('Mapping Enabled') |
| 284 | + ->sortable() |
| 285 | + ->boolean(), |
281 | 286 | TextColumn::make('epgChannel.name') |
282 | 287 | ->label('EPG Channel') |
283 | 288 | ->toggleable() |
@@ -783,6 +788,47 @@ public static function getTableBulkActions($addToCustom = true): array |
783 | 788 | ->modalIcon('heroicon-o-arrow-uturn-left') |
784 | 789 | ->modalDescription('Reset Find & Replace results back to playlist defaults for the selected channels. This will remove any custom values set in the selected column.') |
785 | 790 | ->modalSubmitActionLabel('Reset now'), |
| 791 | + BulkAction::make('enable-epg-mapping') |
| 792 | + ->label('Enable EPG mapping') |
| 793 | + ->action(function (Collection $records, array $data): void { |
| 794 | + $records->each(fn ($channel) => $channel->update([ |
| 795 | + 'epg_map_enabled' => true, |
| 796 | + ])); |
| 797 | + })->after(function () { |
| 798 | + Notification::make() |
| 799 | + ->success() |
| 800 | + ->title('EPG map re-enabled for selected channels') |
| 801 | + ->body('The EPG map has been re-enabled for the selected channels.') |
| 802 | + ->send(); |
| 803 | + }) |
| 804 | + ->hidden(fn () => ! $addToCustom) |
| 805 | + ->deselectRecordsAfterCompletion() |
| 806 | + ->requiresConfirmation() |
| 807 | + ->icon('heroicon-o-calendar') |
| 808 | + ->modalIcon('heroicon-o-calendar') |
| 809 | + ->modalDescription('Allow mapping EPG to selected channels when running EPG mapping jobs.') |
| 810 | + ->modalSubmitActionLabel('Enable now'), |
| 811 | + BulkAction::make('disable-epg-mapping') |
| 812 | + ->label('Disabled EPG mapping') |
| 813 | + ->color('warning') |
| 814 | + ->action(function (Collection $records, array $data): void { |
| 815 | + $records->each(fn ($channel) => $channel->update([ |
| 816 | + 'epg_map_enabled' => false, |
| 817 | + ])); |
| 818 | + })->after(function () { |
| 819 | + Notification::make() |
| 820 | + ->success() |
| 821 | + ->title('EPG map disabled for selected channels') |
| 822 | + ->body('The EPG map has been disabled for the selected channels.') |
| 823 | + ->send(); |
| 824 | + }) |
| 825 | + ->hidden(fn () => ! $addToCustom) |
| 826 | + ->deselectRecordsAfterCompletion() |
| 827 | + ->requiresConfirmation() |
| 828 | + ->icon('heroicon-o-calendar') |
| 829 | + ->modalIcon('heroicon-o-calendar') |
| 830 | + ->modalDescription('Don\'t map EPG to selected channels when running EPG mapping jobs.') |
| 831 | + ->modalSubmitActionLabel('Disable now'), |
786 | 832 | BulkAction::make('enable') |
787 | 833 | ->label('Enable selected') |
788 | 834 | ->action(function (Collection $records): void { |
|
0 commit comments