diff --git a/app/Console/Commands/Grapper/TxOdds/Odds.php b/app/Console/Commands/Grapper/TxOdds/Odds.php index 822edb77..5eb4e6f6 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds.php @@ -131,7 +131,7 @@ class Odds // one week per group names (mybee fastes) $groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id'); foreach ($groupids as $groupid) { - $_calls[] = $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&ot='.$markets.'&days=0,7&pgid='.$groupid; + $_calls[] = $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&ot='.$markets.'&days=0,1&pgid='.$groupid; } } elseif (Nuh::$options['b']) { // one day diff --git a/app/Filament/Clusters/Administrator/AdministratorCluster.php b/app/Filament/Clusters/Administrator/AdministratorCluster.php index a4411467..d4888544 100644 --- a/app/Filament/Clusters/Administrator/AdministratorCluster.php +++ b/app/Filament/Clusters/Administrator/AdministratorCluster.php @@ -4,11 +4,10 @@ namespace App\Filament\Clusters\Administrator; use BackedEnum; use Filament\Clusters\Cluster; -use Filament\Support\Icons\Heroicon; class AdministratorCluster extends Cluster { - protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSquares2x2; + protected static string|BackedEnum|null $navigationIcon = 'phosphor-user'; protected static ?int $navigationSort = 3; } diff --git a/app/Filament/Resources/Clients/Tables/ClientsTable.php b/app/Filament/Resources/Clients/Tables/ClientsTable.php index 6aa430a3..58109412 100644 --- a/app/Filament/Resources/Clients/Tables/ClientsTable.php +++ b/app/Filament/Resources/Clients/Tables/ClientsTable.php @@ -34,8 +34,6 @@ class ClientsTable ->wrap() ->color('warning') ->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()), - TextColumn::make('created_at')->dateTime(), - TextColumn::make('updated_at')->dateTime(), ]) ->recordActions([ Action::make('multiline') diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index 61bde294..400f51d3 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -123,6 +123,7 @@ class EventsTable self::load_multiline_bookmaker(); return $table + // ->poll('10s') ->striped() ->deferLoading() ->columns([ @@ -197,8 +198,8 @@ class EventsTable ->width(225) ->label('Totals'), ])->searchable(['id', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'magnig_id', 'magken_id', 'lognig_id', 'logcol_id']) - ->poll('10s') ->defaultSort('starttime', 'ASC') + ->extremePaginationLinks() ->filters([ Filter::make('events') ->schema([ diff --git a/app/Filament/Resources/Users/Tables/UsersTable.php b/app/Filament/Resources/Users/Tables/UsersTable.php index 286638ce..acce7a09 100644 --- a/app/Filament/Resources/Users/Tables/UsersTable.php +++ b/app/Filament/Resources/Users/Tables/UsersTable.php @@ -25,14 +25,6 @@ class UsersTable ->label('Active Bookmaker') ->badge() ->color('warning'), - TextColumn::make('created_at') - ->dateTime() - ->sortable() - ->toggleable(isToggledHiddenByDefault: true), - TextColumn::make('updated_at') - ->dateTime() - ->sortable() - ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ // diff --git a/app/Livewire/MapperLeft.php b/app/Livewire/MapperLeft.php index 1f3b51e6..115c6d51 100644 --- a/app/Livewire/MapperLeft.php +++ b/app/Livewire/MapperLeft.php @@ -18,14 +18,19 @@ use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Concerns\InteractsWithSchemas; use Filament\Schemas\Contracts\HasSchemas; use Filament\Support\Enums\Alignment; +use Filament\Support\Enums\Size; use Filament\Tables\Concerns\InteractsWithTable; use Filament\Tables\Contracts\HasTable; use Filament\Tables\Enums\FiltersLayout; use Filament\Tables\Filters\Filter; +use Filament\Tables\Filters\Indicator; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; +use Livewire\Attributes\Lazy; +use Livewire\Attributes\On; use Livewire\Component; +#[Lazy] class MapperLeft extends Component implements HasActions, HasSchemas, HasTable { use InteractsWithActions; @@ -34,14 +39,33 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable public $elements_swopped = false; + public $search_left = false; + protected $listeners = [ - 'reload_data' => '$refresh', + 'reload_data_left' => '$refresh', ]; + public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void + { + $searchValues = preg_split('/\s+/', $this->search_left, -1, PREG_SPLIT_NO_EMPTY); + + if (($key = array_search($field, $searchValues)) !== false) { + unset($searchValues[$key]); + } + + if ($searchValues) { + $this->search_left = implode(' ', $searchValues); + } else { + $this->search_left = ''; + } + + $this->dispatch('reload_data_left'); + } + public function table(Table $table): Table { return $table - ->query(LoadEvents::load()) + ->query(LoadEvents::load($this->search_left)) ->columns([ MapperLeftColumn::make('left')->label(''), ]) @@ -107,6 +131,16 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable $data['competition_group_id'], fn (Builder $query, $competition_group_id) => $query->whereIn('competition_group_id', $competition_group_id) ); + })->indicateUsing(function (): array { + $indicators = []; + if ($this->search_left) { + $searchValues = preg_split('/\s+/', $this->search_left, -1, PREG_SPLIT_NO_EMPTY); + foreach ($searchValues as $value) { + $indicators[] = Indicator::make($value)->removeField($value); + } + } + + return $indicators; }) ->columns(4)->columnSpan(4), ], layout: FiltersLayout::AboveContent) @@ -116,12 +150,15 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable ->toolbarActions([ Action::make('reload_data_left') ->hiddenLabel() - ->color('gray') - ->icon('heroicon-o-arrow-path') - // ->icon('phosphor-x') + ->icon('phosphor-x') + ->color('danger') + ->size(Size::Small) ->action(function (Component $livewire) { - $livewire->resetTableFiltersForm(); // Clears all filters + $this->search_left = ''; $this->tableSearch = ''; // Clears the main search bar + $livewire->fill(['tableSearch' => '']); + $livewire->resetTableFiltersForm(); // Clears all filters + $this->dispatch('reload_data_left'); }), ]); } @@ -131,6 +168,14 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable $this->elements_swopped = ! $this->elements_swopped; } + #[On('search_left')] + public function searchLeft($str) + { + $this->search_left = $str; + + $this->dispatch('reload_data_left'); + } + public function leftAction(): Action { return Action::make('left') @@ -145,6 +190,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable }) ->action(function ($arguments) { StoreMapped::store($arguments, $this->elements_swopped); + $this->search_right = ''; + $this->search_left = ''; + $this->dispatch('reload_data_left'); + $this->dispatch('reload_data_right'); + }) ->closeModalByEscaping(false) ->modalCloseButton(false) diff --git a/app/Livewire/MapperRight.php b/app/Livewire/MapperRight.php index f4b0ccb9..9c2451ef 100644 --- a/app/Livewire/MapperRight.php +++ b/app/Livewire/MapperRight.php @@ -16,16 +16,21 @@ use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Concerns\InteractsWithSchemas; use Filament\Schemas\Contracts\HasSchemas; use Filament\Support\Enums\Alignment; +use Filament\Support\Enums\Size; use Filament\Tables\Concerns\InteractsWithTable; use Filament\Tables\Contracts\HasTable; use Filament\Tables\Enums\FiltersLayout; use Filament\Tables\Filters\Filter; +use Filament\Tables\Filters\Indicator; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; +use Livewire\Attributes\Lazy; +use Livewire\Attributes\On; use Livewire\Component; +#[Lazy] class MapperRight extends Component implements HasActions, HasSchemas, HasTable { use InteractsWithActions; @@ -34,14 +39,33 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable public $elements_swopped = false; + public $search_right = false; + protected $listeners = [ - 'reload_data' => '$refresh', + 'reload_data_right' => '$refresh', ]; + public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void + { + $searchValues = preg_split('/\s+/', $this->search_right, -1, PREG_SPLIT_NO_EMPTY); + + if (($key = array_search($field, $searchValues)) !== false) { + unset($searchValues[$key]); + } + + if ($searchValues) { + $this->search_right = implode(' ', $searchValues); + } else { + $this->search_right = ''; + } + + $this->dispatch('reload_data_right'); + } + public function table(Table $table): Table { return $table - ->query(LoadProvider::load()) + ->query(LoadProvider::load($this->search_right)) ->columns([ MapperRightColumn::make('right')->label(''), ])->searchable(['home', 'away']) @@ -119,6 +143,16 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable $data['group_id'], fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id) ); + })->indicateUsing(function (): array { + $indicators = []; + if ($this->search_right) { + $searchValues = preg_split('/\s+/', $this->search_right, -1, PREG_SPLIT_NO_EMPTY); + foreach ($searchValues as $value) { + $indicators[] = Indicator::make($value)->removeField($value); + } + } + + return $indicators; }) ->columns(4)->columnSpan(4), ], layout: FiltersLayout::AboveContent) @@ -127,13 +161,17 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable ->filtersFormColumns(3) ->deferFilters(false) ->toolbarActions([ - Action::make('reload_data') + Action::make('reload_data_right') ->hiddenLabel() - ->color('gray') - ->icon('heroicon-o-arrow-path') + ->icon('phosphor-x') + ->color('danger') + ->size(Size::Small) ->action(function (Component $livewire) { - $livewire->resetTableFiltersForm(); // Clears all filters + $this->search_right = ''; $this->tableSearch = ''; // Clears the main search bar + $livewire->fill(['tableSearch' => '']); + $livewire->resetTableFiltersForm(); // Clears all filters + $this->dispatch('reload_data_right'); }), ]); } @@ -143,6 +181,29 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable $this->elements_swopped = ! $this->elements_swopped; } + #[On('search_right')] + public function searchRight($str) + { + $this->search_right = $str; + + $this->dispatch('reload_data_right'); + } + + // In the same Table class + protected function removeTableFilters(): void + { + // Custom logic before or after removing filters + // Example: Log the action + \Log::info('Custom filter removal logic triggered.'); + + // Call the parent method to perform the default removal + parent::removeTableFilters(); + + // Or, if you want full control, you can manually clear: + // $this->tableFilters = []; + // $this->dispatch('refresh-table'); + } + public function rightAction(): Action { return Action::make('right') @@ -156,6 +217,10 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable return view('livewire.confirm-mapping', ['event' => $event, 'mapper' => $mapper]); })->action(function ($arguments) { StoreMapped::store($arguments, $this->elements_swopped); + $this->search_right = ''; + $this->search_left = ''; + $this->dispatch('reload_data_left'); + $this->dispatch('reload_data_right'); }) ->closeModalByEscaping(false) ->modalCloseButton(false) diff --git a/app/Livewire/TopMenuItems.php b/app/Livewire/TopMenuItems.php index c726bc09..57a9620d 100644 --- a/app/Livewire/TopMenuItems.php +++ b/app/Livewire/TopMenuItems.php @@ -25,7 +25,8 @@ class TopMenuItems extends Component public $current = ''; protected $listeners = [ - 'reload_data' => '$refresh', + 'reload_data_left' => '$refresh', + 'reload_data_right' => '$refresh', ]; public function mount() @@ -78,7 +79,7 @@ class TopMenuItems extends Component { User::where('id', auth()->user()->id)->update(['provider_id' => $provider_id]); - $this->dispatch('reload_data'); + $this->dispatch('reload_data_right'); } public function swopSport() diff --git a/app/Mapper/LoadEvents.php b/app/Mapper/LoadEvents.php index 8a09e478..fb7428a3 100644 --- a/app/Mapper/LoadEvents.php +++ b/app/Mapper/LoadEvents.php @@ -2,16 +2,41 @@ namespace App\Mapper; +use App\Models\Element; use App\Models\Event; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; class LoadEvents { - public static function load() + public static function load($search_left) { + if ($search_left) { - $query = Event::query()->where('sport_id', Auth::user()->sport_id)->where('starttime', '>', Carbon::now()); + $searchValues = preg_split('/\s+/', $search_left, -1, PREG_SPLIT_NO_EMPTY); + + $element_ids = Element::where(function ($query) use ($searchValues) { + foreach ($searchValues as $value) { + $query->orWhere('name', 'LIKE', '%'.$value.'%'); + } + })->pluck('id')->toArray(); + + $query = Event::query() + ->with('home') + ->with('away') + ->where('sport_id', Auth::user()->sport_id) + ->where('starttime', '>', Carbon::now()) + ->where(function ($query) use ($element_ids) { + $query->orWhereIn('home_id', $element_ids)->orWhereIn('away_id', $element_ids); + }); + + } else { + $query = Event::query() + ->with('home') + ->with('away') + ->where('sport_id', Auth::user()->sport_id) + ->where('starttime', '>', Carbon::now()); + } switch (Auth::user()->provider_id) { case 2: diff --git a/app/Mapper/LoadProvider.php b/app/Mapper/LoadProvider.php index 1cd84251..a1fabc3f 100644 --- a/app/Mapper/LoadProvider.php +++ b/app/Mapper/LoadProvider.php @@ -8,11 +8,27 @@ use Illuminate\Support\Facades\Auth; class LoadProvider { - public static function load() + public static function load($search_right) { - return Mapper::query() - ->where('sport_id', Auth::user()->sport_id) - ->where('starttime', '>', Carbon::now()) - ->where('provider_id', Auth::user()->provider_id); + if ($search_right) { + + $searchValues = preg_split('/\s+/', $search_right, -1, PREG_SPLIT_NO_EMPTY); + + return Mapper::query() + ->where('sport_id', Auth::user()->sport_id) + ->where('starttime', '>', Carbon::now()) + ->where('provider_id', Auth::user()->provider_id) + ->where(function ($query) use ($searchValues) { + foreach ($searchValues as $value) { + $query->orWhere('home', 'LIKE', '%'.$value.'%') + ->orWhere('away', 'LIKE', '%'.$value.'%'); + } + }); + } else { + return Mapper::query() + ->where('sport_id', Auth::user()->sport_id) + ->where('starttime', '>', Carbon::now()) + ->where('provider_id', Auth::user()->provider_id); + } } } diff --git a/composer.lock b/composer.lock index f8fb3f15..e7be9163 100644 --- a/composer.lock +++ b/composer.lock @@ -9922,16 +9922,16 @@ }, { "name": "laravel/pint", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f" + "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/69dcca060ecb15e4b564af63d1f642c81a241d6f", - "reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f", + "url": "https://api.github.com/repos/laravel/pint/zipball/c67b4195b75491e4dfc6b00b1c78b68d86f54c90", + "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90", "shasum": "" }, "require": { @@ -9942,9 +9942,9 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.90.0", - "illuminate/view": "^12.40.1", - "larastan/larastan": "^3.8.0", + "friendsofphp/php-cs-fixer": "^3.92.4", + "illuminate/view": "^12.44.0", + "larastan/larastan": "^3.8.1", "laravel-zero/framework": "^12.0.4", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3.3", @@ -9985,7 +9985,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-11-25T21:15:52+00:00" + "time": "2026-01-05T16:49:17+00:00" }, { "name": "laravel/sail", diff --git a/resources/views/filament/tables/columns/mapper-left-column.blade.php b/resources/views/filament/tables/columns/mapper-left-column.blade.php index 134c788b..87774ca0 100644 --- a/resources/views/filament/tables/columns/mapper-left-column.blade.php +++ b/resources/views/filament/tables/columns/mapper-left-column.blade.php @@ -21,8 +21,7 @@ @endif - @include('filament.tables.columns.parts.search-button', [ - 'target' => 'input-2', + @include('filament.tables.columns.parts.search-button-left', [ 'find' => $record->home->name, ]) @@ -32,9 +31,9 @@
{{ $record->id }}
-
{{ $record->home->name }}
+
{{ $record->home->name }}
-
-
{{ $record->away->name }}
+
{{ $record->away->name }}
{{ $record->country?->name }}
@@ -43,8 +42,7 @@
- @include('filament.tables.columns.parts.search-button', [ - 'target' => 'input-2', + @include('filament.tables.columns.parts.search-button-left', [ 'find' => $record->away->name, ]) diff --git a/resources/views/filament/tables/columns/mapper-right-column.blade.php b/resources/views/filament/tables/columns/mapper-right-column.blade.php index 4077ff84..7a508cfb 100644 --- a/resources/views/filament/tables/columns/mapper-right-column.blade.php +++ b/resources/views/filament/tables/columns/mapper-right-column.blade.php @@ -16,8 +16,7 @@ @include('filament.tables.columns.parts.move-botton') - @include('filament.tables.columns.parts.search-button', [ - 'target' => 'input-1', + @include('filament.tables.columns.parts.search-button-right', [ 'find' => $record->home, ]) @@ -27,9 +26,9 @@
{{ $record->event_id }}
-
{{ $record->home }}
+
{{ $record->home }}
-
-
{{ $record->away }}
+
{{ $record->away }}
{{ $record->country }}
@@ -38,8 +37,7 @@
- @include('filament.tables.columns.parts.search-button', [ - 'target' => 'input-1', + @include('filament.tables.columns.parts.search-button-right', [ 'find' => $record->away, ]) diff --git a/resources/views/filament/tables/columns/parts/search-button-left.blade.php b/resources/views/filament/tables/columns/parts/search-button-left.blade.php new file mode 100644 index 00000000..1051df91 --- /dev/null +++ b/resources/views/filament/tables/columns/parts/search-button-left.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/views/filament/tables/columns/parts/search-button-right.blade.php b/resources/views/filament/tables/columns/parts/search-button-right.blade.php new file mode 100644 index 00000000..bce04d24 --- /dev/null +++ b/resources/views/filament/tables/columns/parts/search-button-right.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/views/filament/tables/columns/parts/search-button.blade.php b/resources/views/filament/tables/columns/parts/search-button.blade.php deleted file mode 100644 index daab3468..00000000 --- a/resources/views/filament/tables/columns/parts/search-button.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -
- -
diff --git a/resources/views/livewire/confirm-mapping.blade.php b/resources/views/livewire/confirm-mapping.blade.php index f4e4b619..e1b2c111 100644 --- a/resources/views/livewire/confirm-mapping.blade.php +++ b/resources/views/livewire/confirm-mapping.blade.php @@ -2,22 +2,12 @@ use Illuminate\Support\Carbon; $e = Carbon::parse($event->starttime); + $m = Carbon::parse($mapper->starttime); - $seconds = $e->diffInSeconds($m); - - $diff = gmdate('H:i:s', $seconds); - - if ($seconds == 0) { - $color = 1; - } elseif ($seconds < 1800) { - $color = 2; - } elseif ($seconds < 7200) { - $color = 3; - } else { - $color = 4; - } + $seconds = $m->diffInSeconds($e); + $text = $m->diffForHumans($e, ['parts' => 4], true); @endphp
@@ -26,23 +16,15 @@
Startime Difference
{{ $e->format('d-m-y H:i') }}
- @switch($color) - @case(1) -
{{ $diff }}
- @break - - @case(2) -
{{ $diff }}
- @break - - @case(3) -
{{ $diff }}
- @break - - @case(4) -
{{ $diff }}
- @break - @endswitch + @if ($seconds == 0) +
Starttime is matching
+ @elseif ($seconds < 1800 && $seconds > -1800) +
{{ $text }}
+ @elseif ($seconds < 7200 && $seconds > -7200) +
{{ $text }}
+ @else +
{{ $text }}
+ @endif
{{ $m->format('d-m-y H:i') }}
diff --git a/resources/views/livewire/top-menu-items.blade.php b/resources/views/livewire/top-menu-items.blade.php index 32363ed2..eba40e09 100644 --- a/resources/views/livewire/top-menu-items.blade.php +++ b/resources/views/livewire/top-menu-items.blade.php @@ -74,10 +74,10 @@ {{-- Event Mapper --}} - - + Event Mapper @@ -156,7 +156,9 @@
-
+
@livewire('mapper-left')
@@ -253,16 +255,18 @@ @if (auth()->user()->hasRole('konto_switch')) - + {{ $client }} @foreach ($clients as $id => $name) - - {{ $name }} - + @if ($name != $client) + + {{ $name }} + + @endif @endforeach