mapping provider menu wip

This commit is contained in:
salam committed 2025-12-30 08:54:40 +01:00
1 parent ed54d9f8e4
commit 0c35fa0ebc
9 files changed
+55 -21

No files matched your search

@@ -3,6 +3,7 @@
namespace App\Filament\Resources\Clients\Schemas; namespace App\Filament\Resources\Clients\Schemas;
use App\Models\Bookmaker; use App\Models\Bookmaker;
use App\Models\Provider;
use App\Models\Sport; use App\Models\Sport;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
@@ -23,6 +24,11 @@ class ClientForm
->multiple() ->multiple()
->preload() ->preload()
->searchable(), ->searchable(),
Select::make('provider')
->options(Provider::query()->pluck('name', 'id'))
->multiple()
->preload()
->searchable(),
Select::make('sport') Select::make('sport')
->options(Sport::query()->pluck('name', 'id')) ->options(Sport::query()->pluck('name', 'id'))
->multiple() ->multiple()
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Clients\Tables;
use App\Actions\AlarmGenerator; use App\Actions\AlarmGenerator;
use App\Actions\MultilineGenerator; use App\Actions\MultilineGenerator;
use App\Models\Bookmaker; use App\Models\Bookmaker;
use App\Models\Provider;
use App\Models\Sport; use App\Models\Sport;
use Filament\Actions\Action; use Filament\Actions\Action;
use Filament\Actions\EditAction; use Filament\Actions\EditAction;
@@ -20,20 +21,21 @@ class ClientsTable
->columns([ ->columns([
TextColumn::make('name'), TextColumn::make('name'),
TextColumn::make('bookmaker') TextColumn::make('bookmaker')
->wrap()
->badge() ->badge()
->formatStateUsing(fn (string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()), ->formatStateUsing(fn (string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()),
TextColumn::make('provider')
->badge()
->wrap()
->color('success')
->formatStateUsing(fn (string $state): string => Provider::where('id', $state)->pluck('name')->first()),
TextColumn::make('sport') TextColumn::make('sport')
->badge() ->badge()
->wrap()
->color('warning') ->color('warning')
->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()), ->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()),
TextColumn::make('created_at') TextColumn::make('created_at')->dateTime(),
->dateTime() TextColumn::make('updated_at')->dateTime(),
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
]) ])
->recordActions([ ->recordActions([
Action::make('multiline') Action::make('multiline')
@@ -21,7 +21,10 @@ class UsersTable
->searchable(), ->searchable(),
TextColumn::make('client.name')->badge(), TextColumn::make('client.name')->badge(),
TextColumn::make('roles.name')->badge()->color('success')->wrap(), TextColumn::make('roles.name')->badge()->color('success')->wrap(),
TextColumn::make('bookmaker.name')->badge()->color('warning'), TextColumn::make('bookmaker.name')
->label('Active Bookmaker')
->badge()
->color('warning'),
TextColumn::make('created_at') TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable() ->sortable()
+2
View File
@@ -8,6 +8,7 @@ class Client extends Model
{ {
protected $casts = [ protected $casts = [
'bookmaker' => 'json', 'bookmaker' => 'json',
'provider' => 'json',
'sport' => 'json', 'sport' => 'json',
]; ];
@@ -15,6 +16,7 @@ class Client extends Model
'name', 'name',
'homepage', 'homepage',
'bookmaker', 'bookmaker',
'provider',
'sport', 'sport',
]; ];
} }
@@ -21,6 +21,7 @@ return new class extends Migration
$table->integer('sport_id')->default(1); $table->integer('sport_id')->default(1);
$table->integer('bookmaker_id')->nullable(); $table->integer('bookmaker_id')->nullable();
$table->json('bettype_status')->nullable(); $table->json('bettype_status')->nullable();
$table->string('mapper_source')->default('bookmaker');
$table->text('app_authentication_secret')->nullable(); $table->text('app_authentication_secret')->nullable();
$table->text('app_authentication_recovery_codes')->nullable(); $table->text('app_authentication_recovery_codes')->nullable();
@@ -16,6 +16,7 @@ return new class extends Migration
$table->string('name'); $table->string('name');
$table->string('homepage')->nullable(); $table->string('homepage')->nullable();
$table->string('bookmaker')->nullable(); $table->string('bookmaker')->nullable();
$table->string('provider')->nullable();
$table->string('sport')->nullable(); $table->string('sport')->nullable();
$table->timestamps(); $table->timestamps();
}); });
+4 -3
View File
@@ -12,10 +12,11 @@ class ClientsSeeder extends Seeder
/** /**
* Clients * Clients
*/ */
$sql = "INSERT INTO `clients` (`id`, `name`, `homepage`, `bookmaker`, `sport`, `created_at`, `updated_at`) $sql = "INSERT INTO `clients` (`id`, `name`, `homepage`, `bookmaker`, `provider`, `sport`, `created_at`, `updated_at`)
VALUES VALUES
('1', 'Magloo', NULL, '[\"20\",\"24\"]', '[\"1\",\"3\"]', '2025-08-24 05:56:41', '2025-08-24 05:56:41'), (1, 'Magloo', NULL, '[20,24]', '[3,4]', '[1,3]', '2025-08-24 05:56:41', '2025-12-30 07:42:58'),
('2', 'Logifuture', NULL, '[\"26\",\"27\"]', '[\"1\",\"2\",\"3\",\"5\"]', '2025-08-24 05:57:01', '2025-08-24 05:57:01');"; (2, 'Logifuture', NULL, '[26,27]', '[5,6]', '[1,2,3,5]', '2025-08-24 05:57:01', '2025-12-30 07:43:26');
";
DB::unprepared($sql); DB::unprepared($sql);
} }
@@ -15,8 +15,8 @@ class RolesAndPermissionsSeeder extends Seeder
[ [
['name' => 'super_admin', 'guard_name' => 'web'], ['name' => 'super_admin', 'guard_name' => 'web'],
['name' => 'konto_switch', 'guard_name' => 'web'], ['name' => 'konto_switch', 'guard_name' => 'web'],
['name' => 'provider_menu', 'guard_name' => 'web'],
['name' => 'matchid_column', 'guard_name' => 'web'], ['name' => 'matchid_column', 'guard_name' => 'web'],
['name' => 'mapper_source_betsapi', 'guard_name' => 'web'],
], ],
['name'] ['name']
); );
@@ -27,12 +27,13 @@ class RolesAndPermissionsSeeder extends Seeder
'email_verified_at' => now(), 'email_verified_at' => now(),
'client_id' => 1, 'client_id' => 1,
'sport_id' => 1, 'sport_id' => 1,
'bookmaker_id' => 26, 'bookmaker_id' => 20,
]); ]);
$user->assignRole('super_admin'); $user->assignRole('super_admin');
$user->assignRole('konto_switch'); $user->assignRole('konto_switch');
$user->assignRole('provider_menu'); $user->assignRole('provider_menu');
$user->assignRole('matchid_column'); $user->assignRole('matchid_column');
$user->assignRole('mapper_source_betsapi');
$user = User::factory()->create([ $user = User::factory()->create([
'name' => 'Ubaldo Perrucci', 'name' => 'Ubaldo Perrucci',
@@ -41,10 +42,10 @@ class RolesAndPermissionsSeeder extends Seeder
'email_verified_at' => now(), 'email_verified_at' => now(),
'client_id' => 1, 'client_id' => 1,
'sport_id' => 1, 'sport_id' => 1,
'bookmaker_id' => 26, 'bookmaker_id' => 20,
]); ]);
$user->assignRole('super_admin'); $user->assignRole('super_admin');
$user->assignRole('konto_switch'); $user->assignRole('konto_switch');
$user->assignRole('provider_menu'); $user->assignRole('mapper_source_betsapi');
} }
} }
@@ -17,14 +17,31 @@
</x-slot> </x-slot>
<x-slot name="heading"> <x-slot name="heading">
<div class="flex justify-between items-center w-6xl"> <div class="flex justify-between items-center w-5xl">
<div>Event Mapper</div> <div>Event Mapper</div>
@if (auth()->user()->hasRole('provider_menu')) <x-filament::dropdown>
<x-slot name="trigger">
<x-bkm-bet365 class="w-20 h-6" />
</x-slot>
<x-filament::dropdown.list>
<x-filament::dropdown.list.item>
<x-bkm-magloo-kenia class="w-20 h-6" />
</x-filament::dropdown.list.item>
<x-filament::dropdown.list.item>
<x-bkm-magloo-nig class="w-20 h-6" />
</x-filament::dropdown.list.item>
</x-filament::dropdown.list>
</x-filament::dropdown>
@if (auth()->user()->hasRole('mapper_source_betsapi'))
<x-filament::input.wrapper> <x-filament::input.wrapper>
<x-filament::input.select wire:model="status"> <x-filament::input.select wire:model="status">
<option value="BetsApi">Provider BetsApi</option> <option value="BetsApi">Bet365</option>
<option value="Magloo">Provider Magloo</option> <option value="Magloo">Magloo</option>
<option value="Logifutur">Provider Logifutur</option> <option value="Logifutur">Logifutur</option>
</x-filament::input.select> </x-filament::input.select>
</x-filament::input.wrapper> </x-filament::input.wrapper>
@endif @endif