fix swop for mapper

This commit is contained in:
salam committed 2026-04-17 09:34:49 +02:00
1 parent dce543604f
commit 60b524012d
5 files changed
+44 -37

No files matched your search

+11 -9
View File
@@ -30,6 +30,7 @@ use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\Indicator;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\On;
use Livewire\Component;
@@ -51,6 +52,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public function isRemovingAllFilters() {}
public function swop_elements()
{
$this->elements_swopped = ! $this->elements_swopped;
}
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
{
if (($key = array_search($field, $this->search_values)) !== false) {
@@ -99,12 +105,12 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->schema([
Select::make('country_id')
->placeholder('Country')
->visible(fn () => auth()->user()->sport_id != 5)
->visible(fn () => Auth::user()->sport_id != 5)
->hiddenLabel()
->searchable()
->preload()
->options(function (Get $get) {
$query = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->groupBy('country_id');
$query = Event::query()->where('sport_id', Auth::user()->sport_id)->where('betradar_id', 0)->groupBy('country_id');
$timeframe = $get('starttime_period') ?? [];
@@ -140,7 +146,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->searchable()
->options(function (Get $get) {
$query = CompetitionGroup::where('sport_id', auth()->user()->sport_id)
$query = CompetitionGroup::where('sport_id', Auth::user()->sport_id)
->whereHas('event', function ($query) {
$query->where('betradar_id', 0);
});
@@ -169,7 +175,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
}
});
}
if (auth()->user()->sport_id != 5) {
if (Auth::user()->sport_id != 5) {
$res = $query->groupBy('country_id')->get();
} else {
$res = $query->get();
@@ -271,11 +277,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
]);
}
public function toggle()
{
$this->elements_swopped = ! $this->elements_swopped;
}
#[On('search_left')]
public function searchLeft($string)
{
@@ -328,6 +329,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public function render()
{
return view('livewire.mapper-left');
}
}