mapper wip
This commit is contained in:
1 parent
20e4154423
commit
07a726f192
3 files changed
+41
No files matched your search
@@ -69,6 +69,12 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->query(LoadEvents::load($this->search_values))
|
->query(LoadEvents::load($this->search_values))
|
||||||
->striped()
|
->striped()
|
||||||
->columns([
|
->columns([
|
||||||
|
IconColumn::make('sport.icon')
|
||||||
|
->label('')
|
||||||
|
->icon(fn ($record) => $record->sport->icon)
|
||||||
|
->color(fn ($record) => $record->sport->color)
|
||||||
|
->tooltip(fn ($record) => $record->id)
|
||||||
|
->visibleFrom('lg'),
|
||||||
IconColumn::make('country.icon')->icon(fn (string $state): string => $state)->label(''),
|
IconColumn::make('country.icon')->icon(fn (string $state): string => $state)->label(''),
|
||||||
TextColumn::make('competition_group.name')->label('Group')
|
TextColumn::make('competition_group.name')->label('Group')
|
||||||
->wrap()
|
->wrap()
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ use App\Livewire\Mapper\StoreMapped;
|
|||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Mapper;
|
use App\Models\Mapper;
|
||||||
|
use App\Models\Sport;
|
||||||
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Schemas\Components\FusedGroup;
|
use Filament\Schemas\Components\FusedGroup;
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
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('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'])
|
])->searchable(['home', 'away'])
|
||||||
->filters([
|
->filters([
|
||||||
Filter::make('events')
|
Filter::make('events')
|
||||||
@@ -274,6 +282,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
Action::make('refresh_right')
|
Action::make('refresh_right')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
->tooltip('Reload')
|
||||||
->icon('phosphor-arrows-counter-clockwise')
|
->icon('phosphor-arrows-counter-clockwise')
|
||||||
->size(Size::Small)
|
->size(Size::Small)
|
||||||
->action(function (Component $livewire) {
|
->action(function (Component $livewire) {
|
||||||
@@ -282,6 +291,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
Action::make('reload_right')
|
Action::make('reload_right')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->icon('phosphor-x')
|
->icon('phosphor-x')
|
||||||
|
->tooltip('Clear Filter and Reload')
|
||||||
->size(Size::Small)
|
->size(Size::Small)
|
||||||
->action(function (Component $livewire) {
|
->action(function (Component $livewire) {
|
||||||
$this->search_values = [];
|
$this->search_values = [];
|
||||||
@@ -290,6 +300,26 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
$livewire->resetTableFiltersForm(); // Clears all filters
|
$livewire->resetTableFiltersForm(); // Clears all filters
|
||||||
$this->dispatch('refreshMapperRight');
|
$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'),
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,9 @@ class Mapper extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Provider::class);
|
return $this->belongsTo(Provider::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sport()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Sport::class)->where('is_active', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user