wip
This commit is contained in:
1 parent
08a1522868
commit
26052c6cfd
15 files changed
+594
-62
No files matched your search
@@ -26,7 +26,7 @@ class EventMapper extends Page
|
||||
|
||||
protected ?string $heading = '';
|
||||
|
||||
protected static ?int $navigationSort = 3; // Smaller number = higher up
|
||||
protected static ?int $navigationSort = 4; // Smaller number = higher up
|
||||
|
||||
// protected static ?int $navigationSort = 100;
|
||||
|
||||
@@ -36,7 +36,7 @@ class EventMapper extends Page
|
||||
ActionGroup::make([
|
||||
Action::make('bet365')
|
||||
->extraAttributes(['x-on:click' => 'toggle'])
|
||||
->visible(fn(): bool => auth()->user()->provider_id != 2)
|
||||
->visible(fn (): bool => auth()->user()->provider_id != 2)
|
||||
->action(function ($livewire) {
|
||||
User::where('id', auth()->user()->id)->update(['provider_id' => 2]);
|
||||
|
||||
@@ -49,8 +49,8 @@ class EventMapper extends Page
|
||||
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]))
|
||||
->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');
|
||||
@@ -63,8 +63,8 @@ class EventMapper extends Page
|
||||
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]))
|
||||
->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');
|
||||
@@ -77,8 +77,8 @@ class EventMapper extends Page
|
||||
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]))
|
||||
->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]);
|
||||
|
||||
@@ -92,8 +92,8 @@ class EventMapper extends Page
|
||||
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]))
|
||||
->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]);
|
||||
|
||||
@@ -107,7 +107,7 @@ class EventMapper extends Page
|
||||
])
|
||||
->label('Swop Bookmaker')
|
||||
->icon('phosphor-dots-three-vertical')
|
||||
->visible(fn(): bool => auth()->user()->hasRole('mapper_source_betsapi'))
|
||||
->visible(fn (): bool => auth()->user()->hasRole('mapper_source_betsapi'))
|
||||
->color('primary')
|
||||
->button(),
|
||||
];
|
||||
|
||||
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Actions\LoadSofaScoreCategory;
|
||||
use App\Actions\LoadStatisticFixturesLeaguesOptions;
|
||||
use App\Actions\LoadStatisticFixturesMatchOptions;
|
||||
use App\Filament\Widgets\PlayerPropsDrop;
|
||||
use App\Filament\Widgets\PlayerPropsTable;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\StatisticFixtures;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class PlayerProps extends Page implements HasForms
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
protected string $view = 'filament.pages.player-props';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerplayer';
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected static ?string $title = 'Player Props';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public array $boxes;
|
||||
|
||||
public array $activeBoxes;
|
||||
|
||||
public array $sourceRecords;
|
||||
|
||||
public ?array $filterData;
|
||||
|
||||
public array $beschriftung;
|
||||
|
||||
public array $lineup;
|
||||
|
||||
public array $lineUpOptinos;
|
||||
|
||||
public array $lineUpMap;
|
||||
|
||||
public string $lineupActive = '3313';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
// Initialisiert das Formular mit leeren Werten
|
||||
$this->form->fill();
|
||||
|
||||
$this->activeBoxes = $this->boxNames();
|
||||
$this->lineUpMap = $this->linUpMap();
|
||||
$this->lineUpOptinos = $this->lineUpOptinos();
|
||||
$this->lineup = $this->lineUpMap[$this->lineupActive];
|
||||
|
||||
for ($i = 1; $i <= 35; $i++) {
|
||||
$this->boxes[$i] = [];
|
||||
if (isset($this->activeBoxes[$i])) {
|
||||
$this->beschriftung[$i] = $this->activeBoxes[$i];
|
||||
} else {
|
||||
$this->beschriftung[$i] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getWidgetData(): array
|
||||
{
|
||||
return [
|
||||
'beschriftung' => $this->beschriftung,
|
||||
'lineup' => $this->lineup,
|
||||
'boxes' => $this->boxes,
|
||||
];
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(4)
|
||||
->components([
|
||||
Select::make('cid')
|
||||
->live()
|
||||
->preload()
|
||||
->searchable(false)
|
||||
->prefixIconColor(fn (Get $get): string => $get('cid') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-globe-fill')
|
||||
->hiddenLabel()
|
||||
->options(fn () => LoadSofaScoreCategory::load())
|
||||
->placeholder('Country')
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
$set('lid', null);
|
||||
$set('mid', null);
|
||||
$set('tid', null);
|
||||
}),
|
||||
Select::make('lid')
|
||||
->live()
|
||||
->preload()
|
||||
->prefixIconColor(fn (Get $get): string => $get('lid') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-trophy-fill')
|
||||
->hiddenLabel()
|
||||
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid')))
|
||||
->placeholder('League')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('mid', null);
|
||||
$set('tid', null);
|
||||
}),
|
||||
Select::make('mid')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->prefixIconColor(fn (Get $get): string => $get('mid') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-calendar-check-fill')
|
||||
->options(function (Get $get) {
|
||||
return LoadStatisticFixturesMatchOptions::load($get('lid'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('tid', null);
|
||||
})
|
||||
->placeholder('Events'),
|
||||
|
||||
Select::make('tid')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->prefixIconColor(fn (Get $get): string => $get('tid') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-users-three-fill')
|
||||
->options(function (Get $get) {
|
||||
if ($get('mid')) {
|
||||
$res = StatisticFixtures::where('id', $get('mid'))->first();
|
||||
|
||||
$arr = [];
|
||||
if ($res) {
|
||||
$arr[$res->home_id] = SofaScoreRosa::query()->where('ss_team_id', $res->home_id)->value('ss_team_name');
|
||||
$arr[$res->away_id] = SofaScoreRosa::query()->where('ss_team_id', $res->away_id)->value('ss_team_name');
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
})
|
||||
->placeholder('Team')->afterStateUpdated(function ($state) {
|
||||
// Speichert das ausgewählte Team direkt in der Session
|
||||
// session(['player_props_filter_team' => $state]);
|
||||
|
||||
// Widget informieren
|
||||
$this->dispatch('refreshFilters', team_id: $state);
|
||||
}),
|
||||
])->statePath('filterData');
|
||||
}
|
||||
|
||||
protected function getFooterWidgets(): array
|
||||
{
|
||||
return [
|
||||
PlayerPropsTable::class,
|
||||
PlayerPropsDrop::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function getFooterWidgetsColumns(): int|array
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
private function boxNames(): array
|
||||
{
|
||||
return [2 => 'DR', 4 => 'MR', 6 => 'LW', 9 => 'DC', 10 => 'DM', 11 => 'MC', 12 => 'AM', 15 => 'SW', 16 => 'DC', 17 => 'DM', 18 => 'MC', 19 => 'AM', 20 => 'SM', 21 => 'ST', 23 => 'DC', 24 => 'DM', 25 => 'MC', 26 => 'AM', 30 => 'DL', 32 => 'ML', 34 => 'RW'];
|
||||
}
|
||||
|
||||
private function lineUpOptinos(): array
|
||||
{
|
||||
return [
|
||||
'3313' => '3313',
|
||||
'3331' => '3331',
|
||||
'3331-' => '3331-',
|
||||
'3331+' => '3331+',
|
||||
'3412-' => '3412-',
|
||||
'3412+' => '3412+',
|
||||
'3421-' => '3421-',
|
||||
'3421+' => '3421+',
|
||||
'343-' => '343-',
|
||||
'343+' => '343+',
|
||||
'3511' => '3511',
|
||||
'3511-' => '3511-',
|
||||
'3511+' => '3511+',
|
||||
'352' => '352',
|
||||
'352-' => '352-',
|
||||
'352+' => '352+',
|
||||
'4132' => '4132',
|
||||
'4213-' => '4213-',
|
||||
'4213+' => '4213+',
|
||||
'4222' => '4222',
|
||||
'4231' => '4231',
|
||||
'424' => '424',
|
||||
'4312' => '4312',
|
||||
'4312-' => '4312-',
|
||||
'4312+' => '4312+',
|
||||
'4321' => '4321',
|
||||
'4321-' => '4321-',
|
||||
'4321+' => '4321+',
|
||||
'433' => '433',
|
||||
'433-' => '433-',
|
||||
'433+' => '433+',
|
||||
'4411-' => '4411-',
|
||||
'4411+' => '4411+',
|
||||
'442' => '442',
|
||||
'442-' => '442-',
|
||||
'442+' => '442+',
|
||||
'451' => '451',
|
||||
'451-' => '451-',
|
||||
'451+' => '451+',
|
||||
'523-' => '523-',
|
||||
'523+' => '523+',
|
||||
'5311' => '5311',
|
||||
'5311-' => '5311-',
|
||||
'5311+' => '5311+',
|
||||
'532' => '532',
|
||||
'532-' => '532-',
|
||||
'532+' => '532+',
|
||||
'541-' => '541-',
|
||||
'541+' => '541+',
|
||||
];
|
||||
}
|
||||
|
||||
private function linUpMap(): array
|
||||
{
|
||||
return [
|
||||
'3313' => [9, 16, 23, 11, 18, 25, 19, 6, 34, 21],
|
||||
'3331' => [9, 16, 23, 17, 11, 25, 12, 19, 26, 21],
|
||||
'3331-' => [9, 16, 23, 10, 18, 24, 12, 19, 26, 21],
|
||||
'3331+' => [9, 16, 23, 11, 18, 25, 12, 19, 26, 21],
|
||||
'3412-' => [9, 16, 23, 4, 10, 24, 32, 19, 20, 21],
|
||||
'3412+' => [9, 16, 23, 4, 11, 25, 32, 19, 20, 21],
|
||||
'3421-' => [9, 16, 23, 4, 10, 24, 32, 12, 26, 21],
|
||||
'3421+' => [9, 16, 23, 4, 11, 25, 32, 12, 26, 21],
|
||||
'343-' => [9, 16, 23, 4, 10, 24, 32, 6, 34, 21],
|
||||
'343+' => [9, 16, 23, 4, 11, 25, 32, 6, 34, 21],
|
||||
'3511' => [9, 16, 23, 4, 11, 17, 25, 32, 19, 21],
|
||||
'3511-' => [9, 16, 23, 4, 10, 18, 24, 32, 19, 21],
|
||||
'3511+' => [9, 16, 23, 4, 11, 18, 25, 32, 19, 21],
|
||||
'352' => [9, 16, 23, 4, 11, 17, 25, 32, 20, 21],
|
||||
'352-' => [9, 16, 23, 4, 10, 18, 24, 32, 20, 21],
|
||||
'352+' => [9, 16, 23, 4, 11, 18, 25, 32, 20, 21],
|
||||
'4132' => [2, 9, 23, 30, 17, 12, 19, 26, 20, 21],
|
||||
'4213-' => [2, 9, 23, 30, 10, 24, 19, 6, 34, 21],
|
||||
'4213+' => [2, 9, 23, 30, 11, 25, 19, 6, 34, 21],
|
||||
'4222' => [2, 9, 23, 30, 10, 24, 12, 26, 20, 21],
|
||||
'4231' => [2, 9, 23, 30, 10, 24, 12, 19, 26, 21],
|
||||
'424' => [2, 9, 23, 30, 10, 24, 6, 34, 20, 21],
|
||||
'4312' => [2, 9, 23, 30, 17, 11, 25, 19, 20, 21],
|
||||
'4312-' => [2, 9, 23, 30, 10, 18, 24, 19, 20, 21],
|
||||
'4312+' => [2, 9, 23, 30, 11, 18, 25, 19, 20, 21],
|
||||
'4321' => [2, 9, 23, 30, 17, 11, 25, 12, 26, 21],
|
||||
'4321-' => [2, 9, 23, 30, 10, 18, 24, 12, 26, 21],
|
||||
'4321+' => [2, 9, 23, 30, 11, 18, 25, 12, 26, 21],
|
||||
'433' => [2, 9, 23, 30, 17, 11, 25, 6, 34, 21],
|
||||
'433-' => [2, 9, 23, 30, 10, 18, 24, 6, 34, 21],
|
||||
'433+' => [2, 9, 23, 30, 11, 18, 25, 6, 34, 21],
|
||||
'4411-' => [2, 9, 23, 30, 4, 10, 24, 32, 19, 21],
|
||||
'4411+' => [2, 9, 23, 30, 4, 11, 25, 32, 19, 21],
|
||||
'442' => [2, 9, 23, 30, 4, 17, 18, 32, 20, 21],
|
||||
'442-' => [2, 9, 23, 30, 4, 10, 24, 32, 20, 21],
|
||||
'442+' => [2, 9, 23, 30, 4, 11, 25, 32, 20, 21],
|
||||
'451' => [2, 9, 23, 30, 4, 17, 11, 25, 32, 21],
|
||||
'451-' => [2, 9, 23, 30, 4, 10, 18, 24, 32, 21],
|
||||
'451+' => [2, 9, 23, 30, 4, 11, 18, 25, 32, 21],
|
||||
'523-' => [2, 9, 16, 23, 30, 10, 24, 6, 34, 21],
|
||||
'523+' => [2, 9, 16, 23, 30, 11, 25, 6, 34, 21],
|
||||
'5311' => [2, 9, 16, 23, 30, 17, 11, 25, 19, 21],
|
||||
'5311-' => [2, 9, 16, 23, 30, 10, 18, 24, 19, 21],
|
||||
'5311+' => [2, 9, 16, 23, 30, 11, 18, 25, 19, 21],
|
||||
'532' => [2, 9, 16, 23, 30, 17, 11, 25, 20, 21],
|
||||
'532-' => [2, 9, 16, 23, 30, 10, 18, 24, 20, 21],
|
||||
'532+' => [2, 9, 16, 23, 30, 11, 18, 25, 20, 21],
|
||||
'541-' => [2, 9, 16, 23, 30, 4, 10, 24, 32, 21],
|
||||
'541+' => [2, 9, 16, 23, 30, 4, 11, 25, 32, 21],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,8 @@ use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\SlideOverPosition;
|
||||
use Filament\Support\Enums\Width;
|
||||
// use Filament\Support\Enums\SlideOverPosition;
|
||||
// use Filament\Support\Enums\Width;
|
||||
use Filament\Support\RawJs;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Contracts\View\View;
|
||||
@@ -42,6 +42,8 @@ class Statistic extends BaseDashboard
|
||||
|
||||
protected static ?string $title = 'Statistiko';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected int|string|array $columnSpan = [
|
||||
'md' => 2,
|
||||
'xl' => 3,
|
||||
@@ -79,29 +81,29 @@ class Statistic extends BaseDashboard
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('esc')
|
||||
->label('Reset')
|
||||
->icon('phosphor-x-circle')
|
||||
->color('gray')
|
||||
->keyBindings(['esc'])
|
||||
->action('resetFilters'),
|
||||
Action::make('openDispatcherBoard')
|
||||
->modalHeading('')
|
||||
->label('Calculate')
|
||||
->icon('icon-player')
|
||||
->color(fn (): string => $this->filters['team_id'] ? 'primary' : 'gray')
|
||||
->disabled(fn (): string => $this->filters['team_id'] ? false : true)
|
||||
->slideOver()
|
||||
->slideOverPosition(SlideOverPosition::Start)
|
||||
->modalWidth(Width::Screen)
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelAction(false)
|
||||
->modalContent(fn (): View => view('livewire.board-dispatcher-modal-wrapper', ['filters' => $this->filters])),
|
||||
];
|
||||
}
|
||||
// protected function getHeaderActions(): array
|
||||
// {
|
||||
// return [
|
||||
// Action::make('esc')
|
||||
// ->label('Reset')
|
||||
// ->icon('phosphor-x-circle')
|
||||
// ->color('gray')
|
||||
// ->keyBindings(['esc'])
|
||||
// ->action('resetFilters'),
|
||||
// Action::make('openDispatcherBoard')
|
||||
// ->modalHeading('')
|
||||
// ->label('Calculate')
|
||||
// ->icon('icon-player')
|
||||
// ->color(fn (): string => $this->filters['team_id'] ? 'primary' : 'gray')
|
||||
// ->disabled(fn (): string => $this->filters['team_id'] ? false : true)
|
||||
// ->slideOver()
|
||||
// ->slideOverPosition(SlideOverPosition::Start)
|
||||
// ->modalWidth(Width::Screen)
|
||||
// ->modalSubmitAction(false)
|
||||
// ->modalCancelAction(false)
|
||||
// ->modalContent(fn (): View => view('livewire.board-dispatcher-modal-wrapper', ['filters' => $this->filters])),
|
||||
// ];
|
||||
// }
|
||||
|
||||
public function filtersForm(Schema $schema): Schema
|
||||
{
|
||||
@@ -460,6 +462,13 @@ class Statistic extends BaseDashboard
|
||||
->color('gray')
|
||||
->action(fn (Set $set) => $set('end_date', null))
|
||||
),
|
||||
Action::make('esc')
|
||||
->hiddenLabel()
|
||||
->tooltip('Clear all (esc)')
|
||||
->icon('phosphor-x-circle')
|
||||
->color('gray')
|
||||
->keyBindings(['esc'])
|
||||
->action('resetFilters'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user