|
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; |
45 | 44 | use Filament\Tables\Columns\ImageColumn; |
46 | 45 | use Filament\Tables\Columns\SelectColumn; |
47 | 46 | use Filament\Tables\Columns\TextColumn; |
@@ -279,10 +278,9 @@ public static function getTableColumns($showGroup = true, $showPlaylist = true): |
279 | 278 | } |
280 | 279 | }) |
281 | 280 | ->sortable(), |
282 | | - IconColumn::make('epg_map_enabled') |
| 281 | + ToggleColumn::make('epg_map_enabled') |
283 | 282 | ->label('Mapping Enabled') |
284 | | - ->sortable() |
285 | | - ->boolean(), |
| 283 | + ->sortable(), |
286 | 284 | TextColumn::make('epgChannel.name') |
287 | 285 | ->label('EPG Channel') |
288 | 286 | ->toggleable() |
@@ -544,31 +542,6 @@ public static function getTableBulkActions($addToCustom = true): array |
544 | 542 | ->modalIcon('heroicon-o-arrows-right-left') |
545 | 543 | ->modalDescription('Move the selected channel(s) to the chosen group.') |
546 | 544 | ->modalSubmitActionLabel('Move now'), |
547 | | - BulkAction::make('map') |
548 | | - ->label('Map EPG to selected') |
549 | | - ->schema(EpgMapResource::getForm(showPlaylist: false, showEpg: true)) |
550 | | - ->action(function (Collection $records, array $data): void { |
551 | | - app('Illuminate\Contracts\Bus\Dispatcher') |
552 | | - ->dispatch(new MapPlaylistChannelsToEpg( |
553 | | - epg: (int) $data['epg_id'], |
554 | | - channels: $records->pluck('id')->toArray(), |
555 | | - force: $data['override'], |
556 | | - settings: $data['settings'] ?? [], |
557 | | - )); |
558 | | - })->after(function () { |
559 | | - Notification::make() |
560 | | - ->success() |
561 | | - ->title('EPG to Channel mapping') |
562 | | - ->body('Mapping started, you will be notified when the process is complete.') |
563 | | - ->send(); |
564 | | - }) |
565 | | - ->deselectRecordsAfterCompletion() |
566 | | - ->requiresConfirmation() |
567 | | - ->icon('heroicon-o-link') |
568 | | - ->modalIcon('heroicon-o-link') |
569 | | - ->modalWidth(Width::FourExtraLarge) |
570 | | - ->modalDescription('Map the selected EPG to the selected channel(s).') |
571 | | - ->modalSubmitActionLabel('Map now'), |
572 | 545 | BulkAction::make('preferred_logo') |
573 | 546 | ->label('Update preferred icon') |
574 | 547 | ->schema([ |
@@ -696,6 +669,49 @@ public static function getTableBulkActions($addToCustom = true): array |
696 | 669 | ->modalIcon('heroicon-o-arrow-path-rounded-square') |
697 | 670 | ->modalDescription('Add the selected channel(s) to the chosen channel as failover sources.') |
698 | 671 | ->modalSubmitActionLabel('Add failovers now'), |
| 672 | + BulkAction::make('map') |
| 673 | + ->label('Map EPG to selected') |
| 674 | + ->schema(EpgMapResource::getForm(showPlaylist: false, showEpg: true)) |
| 675 | + ->action(function (Collection $records, array $data): void { |
| 676 | + app('Illuminate\Contracts\Bus\Dispatcher') |
| 677 | + ->dispatch(new MapPlaylistChannelsToEpg( |
| 678 | + epg: (int) $data['epg_id'], |
| 679 | + channels: $records->pluck('id')->toArray(), |
| 680 | + force: $data['override'], |
| 681 | + settings: $data['settings'] ?? [], |
| 682 | + )); |
| 683 | + })->after(function () { |
| 684 | + Notification::make() |
| 685 | + ->success() |
| 686 | + ->title('EPG to Channel mapping') |
| 687 | + ->body('Mapping started, you will be notified when the process is complete.') |
| 688 | + ->send(); |
| 689 | + }) |
| 690 | + ->deselectRecordsAfterCompletion() |
| 691 | + ->requiresConfirmation() |
| 692 | + ->icon('heroicon-o-link') |
| 693 | + ->modalIcon('heroicon-o-link') |
| 694 | + ->modalWidth(Width::FourExtraLarge) |
| 695 | + ->modalDescription('Map the selected EPG to the selected channel(s).') |
| 696 | + ->modalSubmitActionLabel('Map now'), |
| 697 | + BulkAction::make('unmap') |
| 698 | + ->label('Undo EPG Map') |
| 699 | + ->action(function (Collection $records, array $data): void { |
| 700 | + Channel::whereIn('id', $records->pluck('id')->toArray()) |
| 701 | + ->update(['epg_channel_id' => null]); |
| 702 | + })->after(function () { |
| 703 | + Notification::make() |
| 704 | + ->success() |
| 705 | + ->title('EPG Channel mapping removed') |
| 706 | + ->body('Channel mapping removed for the selected channels.') |
| 707 | + ->send(); |
| 708 | + }) |
| 709 | + ->requiresConfirmation() |
| 710 | + ->icon('heroicon-o-arrow-uturn-left') |
| 711 | + ->color('warning') |
| 712 | + ->modalIcon('heroicon-o-arrow-uturn-left') |
| 713 | + ->modalDescription('Clear EPG mappings for the selected channels.') |
| 714 | + ->modalSubmitActionLabel('Reset now'), |
699 | 715 | BulkAction::make('find-replace') |
700 | 716 | ->label('Find & Replace') |
701 | 717 | ->schema([ |
|
0 commit comments