From 853c6aaf8aa8d1b97373ccf5016b337fc18ccce6 Mon Sep 17 00:00:00 2001 From: salam Date: Thu, 29 Jan 2026 08:28:33 +0100 Subject: [PATCH] filter threshold --- .../Resources/Events/Tables/EventsTable.php | 53 ++++++++++++++++--- composer.lock | 18 +++---- .../views/livewire/bettype-toggle.blade.php | 26 ++++++--- 3 files changed, 75 insertions(+), 22 deletions(-) diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index 74803749..49fc6837 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -281,7 +281,8 @@ class EventsTable ->minValue(1.01) ->maxValue(3.00) ->step(0.01) - ->hiddenLabel(), + ->hiddenLabel() + ->live(), Select::make('special_filter_base') ->placeholder('Filters Base') @@ -290,7 +291,6 @@ class EventsTable ->native(false) ->allowHtml() ->options([ - 'sp1' => 'Nig ≠ Ken', 'sp8' => 'Missing', 'sp3' => 'Favorit ≥ ', 'sp4' => 'Favorit ≤ ', @@ -399,10 +399,35 @@ class EventsTable }); }); } - // )->when( - // $data('favorit_threshold'), - // function (Builder $query, $favorit_threshold) {} - // whereRaw("LEAST(price_one, price_two, price_three) BETWEEN ? AND ?", [$min, $max]) + + )->when( + $data['favorit_threshold'], + function (Builder $query, $favorit_threshold) { + + switch (auth()->user()->sport_id) { + case 1: + return $query->whereHas('odds_3ways', function ($query) use ($favorit_threshold) { + $query->where('bookmaker_id', auth()->user()->bookmaker_id)->whereRaw('LEAST(h3w, d3w, a3w) BETWEEN ? AND ?', [1, $favorit_threshold]); + }); + break; + case 2: + return $query->whereHas('odds_3ways', function ($query) use ($favorit_threshold) { + $query->where('bookmaker_id', auth()->user()->bookmaker_id)->whereRaw('LEAST(h3w, d3w, a3w) BETWEEN ? AND ?', [1, $favorit_threshold]); + }); + break; + case 3: + return $query->whereHas('odds_points', function ($query) use ($favorit_threshold) { + $query->where('bookmaker_id', auth()->user()->bookmaker_id)->where('active_spread', 1)->whereRaw('LEAST(home, away) BETWEEN ? AND ?', [1, $favorit_threshold]); + }); + break; + case 5: + return $query->whereHas('odds_2ways', function ($query) use ($favorit_threshold) { + $query->where('bookmaker_id', auth()->user()->bookmaker_id)->whereRaw('LEAST(h2w, a2w) BETWEEN ? AND ?', [1, $favorit_threshold]); + }); + break; + + } + } ); })->indicateUsing(function (array $data): array { $indicators = []; @@ -463,7 +488,21 @@ class EventsTable } if ($data['favorit_threshold'] ?? null) { - $indicators[] = Indicator::make('1X2 Fav <= '.$data['favorit_threshold'])->removeField('favorit_threshold')->color('info'); + switch (auth()->user()->sport_id) { + case 1: + $indicators[] = Indicator::make('1X2 Fav <= '.$data['favorit_threshold'])->removeField('favorit_threshold')->color('info'); + break; + case 2: + $indicators[] = Indicator::make('1X2 Fav <= '.$data['favorit_threshold'])->removeField('favorit_threshold')->color('info'); + break; + case 3: + $indicators[] = Indicator::make('PO Fav <= '.$data['favorit_threshold'])->removeField('favorit_threshold')->color('info'); + break; + case 5: + $indicators[] = Indicator::make('ML Fav <= '.$data['favorit_threshold'])->removeField('favorit_threshold')->color('info'); + break; + + } } if ($data['stars_status'] ?? null) { diff --git a/composer.lock b/composer.lock index 3f34edb6..a62549aa 100644 --- a/composer.lock +++ b/composer.lock @@ -11468,16 +11468,16 @@ }, { "name": "rector/rector", - "version": "2.3.4", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "9227d7a24b0f23ae941057509364f948d5da9ab2" + "reference": "9442f4037de6a5347ae157fe8e6c7cda9d909070" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/9227d7a24b0f23ae941057509364f948d5da9ab2", - "reference": "9227d7a24b0f23ae941057509364f948d5da9ab2", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/9442f4037de6a5347ae157fe8e6c7cda9d909070", + "reference": "9442f4037de6a5347ae157fe8e6c7cda9d909070", "shasum": "" }, "require": { @@ -11516,7 +11516,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.3.4" + "source": "https://github.com/rectorphp/rector/tree/2.3.5" }, "funding": [ { @@ -11524,7 +11524,7 @@ "type": "github" } ], - "time": "2026-01-21T14:49:03+00:00" + "time": "2026-01-28T15:22:48+00:00" }, { "name": "sebastian/cli-parser", @@ -12814,12 +12814,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3" }, - "platform-dev": [], - "plugin-api-version": "2.6.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/resources/views/livewire/bettype-toggle.blade.php b/resources/views/livewire/bettype-toggle.blade.php index 617c6309..94e353b8 100644 --- a/resources/views/livewire/bettype-toggle.blade.php +++ b/resources/views/livewire/bettype-toggle.blade.php @@ -1,21 +1,35 @@ -
+
+ + @role('partner_porgramm') + + + + + + +
+
+
+ @endrole @switch(auth()->user()->all_only_none) @case(0) + tooltip="Toggle to show with or without {{ auth()->user()->bookmaker->name }}"> @break @case(1) - + @break @case(2) - + @break