EventsTable fix multiple filter select
This commit is contained in:
1 parent
3e3330bf80
commit
ba2bf5b19a
2 files changed
+50
-46
No files matched your search
@@ -22,9 +22,7 @@ use App\Models\OddsTable;
|
|||||||
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\ActionGroup;
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\BulkActionGroup;
|
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
|
||||||
use Filament\Forms\Components\Hidden;
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
@@ -43,7 +41,6 @@ use Filament\Tables\Table;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\HtmlString;
|
|
||||||
|
|
||||||
class EventsTable
|
class EventsTable
|
||||||
{
|
{
|
||||||
@@ -216,7 +213,11 @@ class EventsTable
|
|||||||
->searchable()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->whereDate('starttime', '>=', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
$res = Event::where('has_markets', 1)
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('starttime', '>=', Carbon::now())
|
||||||
|
->groupBy('country_id')
|
||||||
|
->pluck('country_id')->toArray();
|
||||||
|
|
||||||
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||||
})
|
})
|
||||||
@@ -235,10 +236,22 @@ class EventsTable
|
|||||||
->searchable()
|
->searchable()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
if ($get('country_id')) {
|
if ($get('country_id')) {
|
||||||
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->whereDate('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
$res = Event::where('has_markets', 1)
|
||||||
|
->with('country')
|
||||||
|
->with('competition_group')
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('starttime', '>', Carbon::now())
|
||||||
|
->whereIn('country_id', $get('country_id'))
|
||||||
|
->groupBy('competition_group_id')->get();
|
||||||
} else {
|
} else {
|
||||||
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->whereDate('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
$res = Event::where('has_markets', 1)
|
||||||
|
->with('country')
|
||||||
|
->with('competition_group')
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('starttime', '>', Carbon::now())
|
||||||
|
->groupBy('competition_group_id')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $val) {
|
foreach ($res as $val) {
|
||||||
$arr[$val->competition_group_id] = $val->country?->name.' '.$val->competition_group->name;
|
$arr[$val->competition_group_id] = $val->country?->name.' '.$val->competition_group->name;
|
||||||
@@ -260,9 +273,22 @@ class EventsTable
|
|||||||
->searchable()
|
->searchable()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
if ($get('country_id')) {
|
if ($get('country_id')) {
|
||||||
$res = Event::where('has_markets', 1)->with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->where('country_id', $get('country_id'))->whereDate('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
$res = Event::where('has_markets', 1)
|
||||||
|
->with('country')
|
||||||
|
->with('group')
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('country_id', $get('country_id'))
|
||||||
|
->where('starttime', '>', Carbon::now())
|
||||||
|
->groupBy('group_id')
|
||||||
|
->get();
|
||||||
} else {
|
} else {
|
||||||
$res = Event::where('has_markets', 1)->with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->whereDate('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
$res = Event::where('has_markets', 1)
|
||||||
|
->with('country')
|
||||||
|
->with('group')
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('starttime', '>', Carbon::now())
|
||||||
|
->groupBy('group_id')
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $val) {
|
foreach ($res as $val) {
|
||||||
@@ -280,7 +306,9 @@ class EventsTable
|
|||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->label('')
|
->label('')
|
||||||
->preload()
|
->preload()
|
||||||
->options(fn () => ClientGroupList::where('sport_id', auth()->user()->sport_id)->where('client_id', auth()->user()->client_id)->pluck('name', 'id'))
|
->options(fn () => ClientGroupList::where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('client_id', auth()->user()->client_id)
|
||||||
|
->pluck('name', 'id'))
|
||||||
->live(),
|
->live(),
|
||||||
|
|
||||||
DateRangePicker::make('starttime_period')
|
DateRangePicker::make('starttime_period')
|
||||||
@@ -312,7 +340,9 @@ class EventsTable
|
|||||||
->query(function (Builder $query, array $data): Builder {
|
->query(function (Builder $query, array $data): Builder {
|
||||||
return $query->when(
|
return $query->when(
|
||||||
$data['country_id'],
|
$data['country_id'],
|
||||||
fn (Builder $query, $country_id) => $query->where('country_id', $country_id)
|
function (Builder $query, $country_id) {
|
||||||
|
$query->whereIn('country_id', $country_id);
|
||||||
|
}
|
||||||
)->when(
|
)->when(
|
||||||
$data['group_id'],
|
$data['group_id'],
|
||||||
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
|
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
|
||||||
@@ -496,28 +526,6 @@ class EventsTable
|
|||||||
$indicators[] = Indicator::make('To Qualify')->color('info')->removable(false);
|
$indicators[] = Indicator::make('To Qualify')->color('info')->removable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (auth()->user()->all_only_none == 1) {
|
|
||||||
// $indicators[] = Indicator::make('With '.auth()->user()->bookmaker->name)->color('info')->removable(false);
|
|
||||||
// }
|
|
||||||
// if (auth()->user()->all_only_none == 2) {
|
|
||||||
// $indicators[] = Indicator::make('Without '.auth()->user()->bookmaker->name)->color('info')->removable(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (auth()->user()->partner_show == 1) {
|
|
||||||
// $indicators[] = Indicator::make('With '.auth()->user()->partnerbookmaker->name)->color('info')->removable(false);
|
|
||||||
// }
|
|
||||||
// if (auth()->user()->partner_compare == 1) {
|
|
||||||
// $indicators[] = Indicator::make('Difference odds '.auth()->user()->bookmaker->name.' vs '.auth()->user()->partnerbookmaker->name)->color('info')->removable(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (auth()->user()->bookmaker_partner_differences == 1) {
|
|
||||||
// // wire:click="toggleComparePartner"
|
|
||||||
// $indicators[] = Indicator::make('missing')
|
|
||||||
// ->label(new HtmlString('<string class="cursor-pointer" wire:click="toggleMissing">'.auth()->user()->bookmaker->name.' vs '.auth()->user()->partnerbookmaker->name.'</string>'))
|
|
||||||
// ->color('info')
|
|
||||||
// ->removable(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($data['filter_notes'] ?? null) {
|
if ($data['filter_notes'] ?? null) {
|
||||||
$indicators[] = Indicator::make('Notes')->removeField('filter_notes')->color('info');
|
$indicators[] = Indicator::make('Notes')->removeField('filter_notes')->color('info');
|
||||||
}
|
}
|
||||||
@@ -699,10 +707,6 @@ class EventsTable
|
|||||||
|
|
||||||
])->iconButton()
|
])->iconButton()
|
||||||
->icon('phosphor-dots-three-vertical'),
|
->icon('phosphor-dots-three-vertical'),
|
||||||
// ])->toolbarActions([
|
|
||||||
// BulkActionGroup::make([
|
|
||||||
// DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
|
|
||||||
// ]),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+10
-10
@@ -3017,16 +3017,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v12.52.0",
|
"version": "v12.53.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "d5511fa74f4608dbb99864198b1954042aa8d5a7"
|
"reference": "f57f035c0d34503d9ff30be76159bb35a003cd1f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/d5511fa74f4608dbb99864198b1954042aa8d5a7",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/f57f035c0d34503d9ff30be76159bb35a003cd1f",
|
||||||
"reference": "d5511fa74f4608dbb99864198b1954042aa8d5a7",
|
"reference": "f57f035c0d34503d9ff30be76159bb35a003cd1f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3235,7 +3235,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2026-02-17T17:07:04+00:00"
|
"time": "2026-02-24T14:35:15+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/prompts",
|
"name": "laravel/prompts",
|
||||||
@@ -3298,16 +3298,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/serializable-closure",
|
"name": "laravel/serializable-closure",
|
||||||
"version": "v2.0.9",
|
"version": "v2.0.10",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/serializable-closure.git",
|
"url": "https://github.com/laravel/serializable-closure.git",
|
||||||
"reference": "8f631589ab07b7b52fead814965f5a800459cb3e"
|
"reference": "870fc81d2f879903dfc5b60bf8a0f94a1609e669"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/8f631589ab07b7b52fead814965f5a800459cb3e",
|
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/870fc81d2f879903dfc5b60bf8a0f94a1609e669",
|
||||||
"reference": "8f631589ab07b7b52fead814965f5a800459cb3e",
|
"reference": "870fc81d2f879903dfc5b60bf8a0f94a1609e669",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3355,7 +3355,7 @@
|
|||||||
"issues": "https://github.com/laravel/serializable-closure/issues",
|
"issues": "https://github.com/laravel/serializable-closure/issues",
|
||||||
"source": "https://github.com/laravel/serializable-closure"
|
"source": "https://github.com/laravel/serializable-closure"
|
||||||
},
|
},
|
||||||
"time": "2026-02-03T06:55:34+00:00"
|
"time": "2026-02-20T19:59:49+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/tinker",
|
"name": "laravel/tinker",
|
||||||
|
|||||||
Reference in new issue
Block a user