mapper wip

This commit is contained in:
salam committed 2026-02-22 16:17:49 +01:00
1 parent 20e4154423
commit 07a726f192
3 files changed
+41

No files matched your search

+30
View File
@@ -9,11 +9,13 @@ use App\Livewire\Mapper\StoreMapped;
use App\Models\Country;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Sport;
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\Select;
use Filament\Notifications\Notification;
use Filament\Schemas\Components\FusedGroup;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Concerns\InteractsWithSchemas;
@@ -83,6 +85,12 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
}
}),
IconColumn::make('group_cc')->icon(fn (string $state): string => 'flag-country-'.$state)->label(''),
IconColumn::make('sport.icon')
->label('')
->icon(fn ($record) => $record->sport->icon)
->color(fn ($record) => $record->sport->color)
->tooltip(fn ($record) => $record->id)
->visibleFrom('lg'),
])->searchable(['home', 'away'])
->filters([
Filter::make('events')
@@ -274,6 +282,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->toolbarActions([
Action::make('refresh_right')
->hiddenLabel()
->tooltip('Reload')
->icon('phosphor-arrows-counter-clockwise')
->size(Size::Small)
->action(function (Component $livewire) {
@@ -282,6 +291,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
Action::make('reload_right')
->hiddenLabel()
->icon('phosphor-x')
->tooltip('Clear Filter and Reload')
->size(Size::Small)
->action(function (Component $livewire) {
$this->search_values = [];
@@ -290,6 +300,26 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$livewire->resetTableFiltersForm(); // Clears all filters
$this->dispatch('refreshMapperRight');
}),
Action::make('empty_mapper')
->hiddenLabel()
->color('danger')
->icon('phosphor-trash')
->tooltip('Empty Database and Reload from Provider')
->size(Size::Small)
->requiresConfirmation()
->action(function (Component $livewire) {
Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->delete();
$this->search_values = [];
$this->tableSearch = ''; // Clears the main search bar
$livewire->fill(['tableSearch' => '']);
$livewire->resetTableFiltersForm(); // Clears all filters
$this->dispatch('refreshMapperRight');
})->successNotification(
Notification::make()
->success()
->title('Events deleted')
->body('All events for '.Sport::query()->where('id', auth()->user()->sport_id)->value('name').' has been deleted successfully. It will take up to 5 minutes to reload'),
),
]);
}