mapper provider wip

This commit is contained in:
salam committed 2026-01-01 08:01:28 +01:00
1 parent b3318b1c03
commit a487fe0838
11 files changed
+161 -92

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Actions;
use App\Models\Event;
class MapperEvents
{
public static function load()
{
switch (auth()->user()->provider_id) {
case 2:
// BETSAPI
return Event::query()->where('sport_id', auth()->user()->sport_id)->where('betsapi_id', 0);
break;
case 20:
// Magloo Kenia
return Event::query()->where('sport_id', auth()->user()->sport_id)->where('magnig_id', 0);
break;
case 24:
// Magloo Nigeria
return Event::query()->where('sport_id', auth()->user()->sport_id)->where('magken_id', 0);
break;
case 26:
// Logifuture Nigeria
return Event::query()->where('sport_id', auth()->user()->sport_id)->where('lognig_id', 0);
break;
case 27:
// Magloo Colombia
return Event::query()->where('sport_id', auth()->user()->sport_id)->where('logcol_id', 0);
break;
default:
return Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0);
break;
}
}
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Actions;
use App\Models\Mapper;
class MapperProvider
{
public static function load()
{
return Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id);
}
}
+4 -2
View File
@@ -2,6 +2,7 @@
namespace App\Livewire;
use App\Actions\MapperEvents;
use App\Filament\Tables\Columns\MapperLeftColumn;
use App\Models\CompetitionGroup;
use App\Models\Country;
@@ -37,7 +38,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public function table(Table $table): Table
{
return $table
->query(Event::query()->where('betradar_id', 0))
->query(MapperEvents::load())
->columns([
MapperLeftColumn::make('left')->label(''),
])
@@ -112,7 +113,8 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
Action::make('reload_data_left')
->hiddenLabel()
->color('gray')
->icon('phosphor-x')
->icon('heroicon-o-arrow-path')
// ->icon('phosphor-x')
->action(function (Component $livewire) {
$livewire->resetTableFiltersForm(); // Clears all filters
$livewire->tableSearch = ''; // Clears the main search bar
+4 -2
View File
@@ -2,6 +2,7 @@
namespace App\Livewire;
use App\Actions\MapperProvider;
use App\Filament\Tables\Columns\MapperRightColumn;
use App\Models\Event;
use App\Models\Mapper;
@@ -33,7 +34,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
public function table(Table $table): Table
{
return $table
->query(Mapper::query())
->query(MapperProvider::load())
->columns([
MapperRightColumn::make('right')->label(''),
])->searchable(['home', 'away'])
@@ -86,7 +87,8 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
Action::make('reload_data')
->hiddenLabel()
->color('gray')
->icon('phosphor-x')
->icon('heroicon-o-arrow-path')
// ->icon('phosphor-x')
->action(function (Component $livewire) {
$livewire->resetTableFiltersForm(); // Clears all filters
$livewire->tableSearch = ''; // Clears the main search bar
+7 -3
View File
@@ -54,11 +54,15 @@ class TopMenuItems extends Component
public function swop($client_id)
{
$providers = Client::where('id', $client_id)->pluck('provider')->first();
$provider_id = array_shift($providers);
$bookmakers = Client::where('id', $client_id)->pluck('bookmaker')->first();
$bookmaker_id = array_shift($bookmakers);
User::where('id', auth()->user()->id)->update(['bookmaker_mapper_id' => $bookmaker_id, 'bookmaker_id' => $bookmaker_id, 'client_id' => $client_id]);
User::where('id', auth()->user()->id)->update(['provider_id' => $provider_id, 'bookmaker_id' => $bookmaker_id, 'client_id' => $client_id]);
$this->js('window.location.reload()');
}
@@ -70,9 +74,9 @@ class TopMenuItems extends Component
$this->js('window.location.reload()');
}
public function swopMapper($bookmaker_id)
public function swopProvider($provider_id)
{
User::where('id', auth()->user()->id)->update(['bookmaker_mapper_id' => $bookmaker_id]);
User::where('id', auth()->user()->id)->update(['provider_id' => $provider_id]);
$this->dispatch('reload_data');
}
+1 -1
View File
@@ -35,7 +35,7 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
'client_id',
'sport_id',
'bookmaker_id',
'bookmaker_mapper_id',
'provider_id',
];
protected static function newFactory(): Factory