Filter starttime differences
This commit is contained in:
1 parent
d58d543583
commit
24c085e663
6 files changed
+50
No files matched your search
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Events;
|
||||
use App\Filament\Resources\Events\Pages\ListEvents;
|
||||
use App\Filament\Resources\Events\Schemas\EventForm;
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadClientStartimeDifference;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadPartnerDifferences;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
@@ -89,6 +90,11 @@ class EventResource extends Resource
|
||||
$query->whereIn('id', $event_ids);
|
||||
}
|
||||
|
||||
if (auth()->user()->starttime_differences) {
|
||||
$event_ids = LoadClientStartimeDifference::load();
|
||||
$query->whereIn('id', $event_ids);
|
||||
}
|
||||
|
||||
if (auth()->user()->bookmaker_partner_differences == 1) {
|
||||
$a = EventBookmaker::where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\Event;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadClientStartimeDifference
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
|
||||
$events = Event::with('event_bookmaker')
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('starttime', '>=', Carbon::now())
|
||||
->whereHas('event_bookmaker', function ($query) {
|
||||
$query->where('bookmaker_id', auth()->user()->bookmaker_id);
|
||||
})
|
||||
->get();
|
||||
|
||||
$event_ids = [];
|
||||
foreach ($events as $event) {
|
||||
if ($event->starttime != $event->event_bookmaker->starttime) {
|
||||
$event_ids[] = $event->id;
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,15 @@ class BettypeToggle extends Component
|
||||
$this->dispatch('refreshTable');
|
||||
}
|
||||
|
||||
public function filterStarttimeDifferences()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['starttime_differences' => DB::raw('!starttime_differences')]);
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
|
||||
$this->dispatch('refreshTable');
|
||||
}
|
||||
|
||||
public function setDifferences()
|
||||
{
|
||||
$a = EventBookmaker::where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
|
||||
@@ -79,6 +79,7 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
|
||||
'partner_show' => 'boolean',
|
||||
'partner_compare' => 'boolean',
|
||||
'bookmaker_partner_differences' => 'boolean',
|
||||
'starttime_differences' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ return new class extends Migration
|
||||
$table->boolean('partner_show')->default(false);
|
||||
$table->boolean('partner_compare')->default(false);
|
||||
$table->boolean('bookmaker_partner_differences')->default(false);
|
||||
$table->boolean('starttime_differences')->default(false);
|
||||
$table->timestamp('app_verified_at')->nullable();
|
||||
|
||||
$table->rememberToken();
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
<div class="flex flex-row gap-2">
|
||||
<x-filament::button size="xs" tooltip="Clear all orange filter" wire:click="clearAllFilter" color="gray"
|
||||
icon="phosphor-x" />
|
||||
<x-filament::button size="xs"
|
||||
tooltip="Filter starttime differences TxOdds vs {{ auth()->user()->bookmaker->name }}"
|
||||
wire:click="filterStarttimeDifferences" :color="auth()->user()->starttime_differences ? 'primary' : 'gray'" icon="phosphor-clock" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row gap-2">
|
||||
|
||||
Reference in new issue
Block a user