106 lines
4.4 KiB
PHP
106 lines
4.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use App\Models\User;
|
|
use BackedEnum;
|
|
use Filament\Actions\Action;
|
|
use Filament\Actions\ActionGroup;
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Pages\Page;
|
|
|
|
class EventMapper extends Page
|
|
{
|
|
protected $listeners = [
|
|
'refresh' => '$refresh',
|
|
];
|
|
|
|
protected string $view = 'filament.pages.event-mapper';
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = 'phosphor-arrows-in-line-horizontal';
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
ActionGroup::make([
|
|
Action::make('bet365')
|
|
->extraAttributes(['x-on:click' => 'toggle'])
|
|
->visible(fn (): bool => auth()->user()->provider_id != 2)
|
|
->action(function ($livewire) {
|
|
User::where('id', auth()->user()->id)->update(['provider_id' => 2]);
|
|
|
|
Notification::make()
|
|
->title('Event Mapper changed to Bet365')
|
|
->success()
|
|
->send();
|
|
$livewire->dispatch('refresh');
|
|
}),
|
|
Action::make('magloo_nigeria')
|
|
->label('MAGLOO NIGERIA')
|
|
->extraAttributes(['x-on:click' => 'toggle'])
|
|
->visible(fn (): bool => in_array(auth()->user()->provider_id, [2, 4]))
|
|
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16]))
|
|
->action(function ($livewire) {
|
|
User::where('id', auth()->user()->id)->update(['provider_id' => 3]);
|
|
$livewire->dispatch('refresh');
|
|
|
|
Notification::make()
|
|
->title('Event Mapper changed to MAGLOO NIGERIA')
|
|
->success()
|
|
->send();
|
|
|
|
}),
|
|
Action::make('magloo_kenia')
|
|
->label('MAGLOO KENIA')
|
|
->extraAttributes(['x-on:click' => 'toggle'])
|
|
->visible(fn (): bool => in_array(auth()->user()->provider_id, [2, 3]))
|
|
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16]))
|
|
->action(function ($livewire) {
|
|
User::where('id', auth()->user()->id)->update(['provider_id' => 4]);
|
|
$livewire->dispatch('refresh');
|
|
|
|
Notification::make()
|
|
->title('Event Mapper changed to MAGLOO KENIA')
|
|
->success()
|
|
->send();
|
|
}),
|
|
Action::make('logifuture_nigeria')
|
|
->label('LOGIFUTURE NIGERA')
|
|
->extraAttributes(['x-on:click' => 'toggle'])
|
|
->visible(fn (): bool => auth()->user()->provider_id == 6)
|
|
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36]))
|
|
->action(function ($livewire) {
|
|
User::where('id', auth()->user()->id)->update(['provider_id' => 5]);
|
|
|
|
$livewire->dispatch('refresh');
|
|
|
|
Notification::make()
|
|
->title('Event Mapper changed to LOGIFUTURE NIGERIA')
|
|
->success()
|
|
->send();
|
|
}),
|
|
Action::make('logifuture_colombia')
|
|
->label('LOGIFUTURE COLOMBIA')
|
|
->extraAttributes(['x-on:click' => 'toggle'])
|
|
->visible(fn (): bool => auth()->user()->provider_id == 5)
|
|
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36]))
|
|
->action(function ($livewire) {
|
|
User::where('id', auth()->user()->id)->update(['provider_id' => 6]);
|
|
|
|
$livewire->dispatch('refresh');
|
|
|
|
Notification::make()
|
|
->title('Event Mapper changed to LOGIFUTURE COLOMBIA')
|
|
->success()
|
|
->send();
|
|
}),
|
|
])
|
|
->label('Swop Bookmaker')
|
|
->icon('phosphor-dots-three-vertical')
|
|
->visible(fn (): bool => auth()->user()->hasRole('mapper_source_betsapi'))
|
|
->color('primary')
|
|
->button(),
|
|
];
|
|
}
|
|
}
|