This commit is contained in:
salam committed 2026-02-13 13:38:10 +01:00
1 parent 35a6e605b9
commit 2de7cb1504
1 file changed
+42 -42
+42 -42
View File
@@ -98,51 +98,51 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->columns(4)
->schema([
FusedGroup::make([
Select::make('country_id')
->placeholder('Country')
->hiddenLabel()
->searchable()
->preload()
->options(function () {
$res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
// Select::make('country_id')
// ->placeholder('Country')
// ->hiddenLabel()
// ->searchable()
// ->preload()
// ->options(function () {
// $res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
})
->afterStateUpdated(function (callable $set) {
$set('competition_group_id', null);
})
->live(),
Select::make('competition_group_id')
->placeholder('League')
->hiddenLabel()
->label('')
->searchable()
->options(function (Get $get) {
$map = Country::all()->pluck('name', 'id');
$query = CompetitionGroup::where('sport_id', auth()->user()->sport_id)
->whereHas('event', function ($query) {
$query->where('starttime', '>', now())
->where('betradar_id', 0);
});
// return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
// })
// ->afterStateUpdated(function (callable $set) {
// $set('competition_group_id', null);
// })
// ->live(),
// Select::make('competition_group_id')
// ->placeholder('League')
// ->hiddenLabel()
// ->label('')
// ->searchable()
// ->options(function (Get $get) {
// $map = Country::all()->pluck('name', 'id');
// $query = CompetitionGroup::where('sport_id', auth()->user()->sport_id)
// ->whereHas('event', function ($query) {
// $query->where('starttime', '>', now())
// ->where('betradar_id', 0);
// });
if ($get('country_id') ?? null) {
$res = $query->where('country_id', $get('country_id'))->get();
} else {
$res = $query->get();
}
$arr = [];
foreach ($res as $value) {
if (isset($map[$value->country_id])) {
$arr[$value->id] = $map[$value->country_id].' '.$value->name;
} else {
$arr[$value->id] = $value->name;
}
}
asort($arr);
// if ($get('country_id') ?? null) {
// $res = $query->where('country_id', $get('country_id'))->get();
// } else {
// $res = $query->get();
// }
// $arr = [];
// foreach ($res as $value) {
// if (isset($map[$value->country_id])) {
// $arr[$value->id] = $map[$value->country_id].' '.$value->name;
// } else {
// $arr[$value->id] = $value->name;
// }
// }
// asort($arr);
return $arr;
})
->live(),
// return $arr;
// })
// ->live(),
])->columnSpan(2),
DateRangePicker::make('starttime_period')
->displayFormat('d M Y')