ComparingBookmakerMenu ok

This commit is contained in:
salam committed 2026-01-21 09:54:12 +01:00
1 parent be80128226
commit f59ac10c2a
17 files changed
+272 -317

No files matched your search

+7 -12
View File
@@ -9,7 +9,7 @@ use App\Models\CompetitionGroup;
use App\Models\Country;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Sport;
use App\Models\User;
use Carbon\Carbon;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
@@ -42,7 +42,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public $search_left = false;
public $sport_id = 0;
public $user;
protected $listeners = [
'reload_data_left' => '$refresh',
@@ -67,10 +67,10 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public function table(Table $table): Table
{
$this->setSportId();
$this->user = User::getUser();
return $table
->query(LoadEvents::load($this->search_left, $this->sport_id))
->query(LoadEvents::load($this->search_left, $this->user->sport_id))
->columns([
MapperLeftColumn::make('left')->label(''),
])
@@ -87,7 +87,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->searchable()
->preload()
->options(function () {
$res = Event::query()->where('sport_id', $this->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
})
@@ -105,9 +105,9 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->searchable()
->options(function (Get $get) {
if ($get('country_id')) {
$res = Event::query()->where('sport_id', $this->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
} else {
$res = Event::query()->where('sport_id', $this->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
}
$comps = CompetitionGroup::with('country')->whereIn('id', $res)->get();
@@ -172,11 +172,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
$this->elements_swopped = ! $this->elements_swopped;
}
public function setSportId()
{
$this->sport_id = Sport::getSportId();
}
#[On('search_left')]
public function searchLeft($str)
{