wip
This commit is contained in:
1 parent
08a1522868
commit
26052c6cfd
15 files changed
+594
-62
No files matched your search
@@ -9,5 +9,5 @@ class GrapperCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-rss';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
protected static ?int $navigationSort = 5;
|
||||
}
|
||||
@@ -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'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ class EventResource extends Resource
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-monitor';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected static ?string $navigationLabel = 'Monitor';
|
||||
|
||||
protected static ?string $modelLabel = 'Monitor';
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use Filament\Widgets\Widget;
|
||||
|
||||
class PlayerPropsDrop extends Widget
|
||||
{
|
||||
protected string $view = 'livewire.player-props-drop';
|
||||
|
||||
public array $beschriftung;
|
||||
|
||||
public array $lineup;
|
||||
|
||||
public array $boxes;
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Livewire\PlayerCalculator;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Support\Enums\SlideOverPosition;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Tables\Columns\ViewColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Widgets\TableWidget;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class PlayerPropsTable extends TableWidget
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
protected int|string|array $columnSpan = 2;
|
||||
|
||||
public string $team_name = '';
|
||||
|
||||
// #[Reactive]
|
||||
public array $sourceRecords = [];
|
||||
|
||||
#[On('refreshFilters')]
|
||||
public function refreshTable(?int $team_id = 0): void
|
||||
{
|
||||
if ($team_id) {
|
||||
$this->team_name = SofaScoreRosa::where('ss_team_id', $team_id)->value('ss_team_name');
|
||||
$this->sourceRecords = PlayerCalculator::load($team_id);
|
||||
$this->resetTable();
|
||||
}
|
||||
}
|
||||
|
||||
public function getHeadingTable(): HtmlString
|
||||
{
|
||||
return new HtmlString('<div class="text-[11px] p-0 flex flex-row gap-4 font-bold font-mono" style="position: relative; left: -2px; bottom: -13px;">
|
||||
<div>Gls</div>
|
||||
<div>Fls</div>
|
||||
<div>Ofs</div>
|
||||
<div>Snt</div>
|
||||
<div>Tsh</div>
|
||||
<div>Crd</div>
|
||||
<div>Foot</div>
|
||||
<div>Evt</div>
|
||||
<div>Min Ø</div>
|
||||
</div>');
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->headerActions([
|
||||
Action::make('esc')
|
||||
->hiddenLabel()
|
||||
->tooltip('Clear all (esc)')
|
||||
->icon('phosphor-x-circle')
|
||||
->color('gray')
|
||||
->keyBindings(['esc'])
|
||||
->action(fn () => $this->resetFilters()),
|
||||
Action::make('lineups')
|
||||
->tooltip('Lineups explanation')
|
||||
->color('success')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-question-mark')
|
||||
->slideOver()
|
||||
->slideOverPosition(SlideOverPosition::Start)
|
||||
->modalWidth(Width::ExtraLarge)
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelAction(false)
|
||||
->modalContent(fn () => view('filament.modals.position-abbreviation')),
|
||||
Action::make('reset')
|
||||
->hiddenLabel()
|
||||
->tooltip('Remove all')
|
||||
->icon('phosphor-arrows-clockwise')
|
||||
->action(fn () => $this->clearResultTable()),
|
||||
Action::make('calculate')
|
||||
->tooltip('Calculate')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-calculator')
|
||||
->action(fn () => $this->calculateAspg()),
|
||||
Action::make('copy_results')
|
||||
->tooltip('Copy results for pasting into a spread sheet')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-copy')
|
||||
->action(fn () => $this->copyResult()),
|
||||
Action::make('copy_development')
|
||||
->tooltip('Copy calculation variables')
|
||||
->hiddenLabel()
|
||||
->hidden(fn () => ! in_array(Auth::user()->id, [1, 2]))
|
||||
->color('warning')
|
||||
->icon('phosphor-copy')
|
||||
->action(fn () => $this->copyDevelopment()),
|
||||
])
|
||||
->heading($this->team_name)
|
||||
->query(User::query()->whereRaw('1 = 0')) // Verhindert DB-Abfragen
|
||||
->striped()
|
||||
->defaultSort('name')
|
||||
->emptyStateHeading('No team selected')
|
||||
->columns([
|
||||
ViewColumn::make('drag_card')
|
||||
->label(fn () => $this->getHeadingTable())
|
||||
->view('filament.tables.columns.drag-card'),
|
||||
])->extraAttributes([
|
||||
'id' => 'playerdragtable',
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('area')
|
||||
->columnSpanFull()
|
||||
->native(false)
|
||||
->options([
|
||||
'attack' => '<span class="text-amber-500">Attack</span>',
|
||||
'midfield' => '<span class="text-blue-500">Midfield</span>',
|
||||
'defence' => '<span class="text-green-500">Defence</span>',
|
||||
'goalkeeper' => '<span class="text-gray-500">Goalkeeper</span>',
|
||||
])->modifyFormFieldUsing(fn (Select $component) => $component->allowHtml())
|
||||
->query(function ($query) {
|
||||
return $query;
|
||||
})->indicateUsing(function (array $data): array {
|
||||
// WICHTIG: Ein leeres Array sorgt dafür, dass kein Indicator-Badge erzeugt wird
|
||||
return [];
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->records(function () {
|
||||
$collection = collect($this->sourceRecords);
|
||||
$selectedPosition = $this->tableFilters['area']['value'] ?? null;
|
||||
if (! empty($selectedPosition)) {
|
||||
$collection = $collection->where('area', $selectedPosition);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,6 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
return $boxes;
|
||||
}
|
||||
|
||||
|
||||
// TEAMPLATE BOX 1
|
||||
protected function template_box1(float $expectations_home, float $expectations_away): HtmlString
|
||||
{
|
||||
@@ -338,7 +337,7 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
}
|
||||
} else {
|
||||
// odd (add 1 because array starts with 0)
|
||||
$m = ceil($size / 2);
|
||||
$m = (int) ceil($size / 2);
|
||||
// dd($m, $arr);
|
||||
// dd('UNGERADE', $m, $arr, $arr[$m]);
|
||||
if (isset($arr[$m])) {
|
||||
|
||||
@@ -4,24 +4,12 @@ namespace App\Livewire;
|
||||
|
||||
use App\Filament\Pages\Selections\LoadPositions;
|
||||
use App\Models\SofaScorePlayerPerSeason;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Component;
|
||||
|
||||
class PlayerCalculator extends Component
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
|
||||
public $players = [];
|
||||
|
||||
public function mount(array $filters)
|
||||
public static function load(int $team_id)
|
||||
{
|
||||
$this->players = self::load($filters);
|
||||
}
|
||||
|
||||
public static function load(array $filters)
|
||||
{
|
||||
$team_id = (int) $filters['team_id'];
|
||||
|
||||
$positions_map = LoadPositions::load();
|
||||
|
||||
$player = SofaScorePlayerPerSeason::with('details')->where('season', '=', 'total')->where('ss_team_id', '=', $team_id)->get();
|
||||
@@ -33,6 +21,7 @@ class PlayerCalculator extends Component
|
||||
$tmp['name'] = $val->details->player_name;
|
||||
$tmp['pos_ori'] = $val->details->position;
|
||||
$tmp['pos'] = '';
|
||||
$tmp['active'] = 0;
|
||||
$tmp['foot'] = $val->details->preferred_foot;
|
||||
$tmp['tot_evt'] = $val->total_events;
|
||||
$tmp['tot_min'] = $val->total_min;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Filament\Exports\BetfairExporter;
|
||||
use App\Filament\Pages\PlayerProps;
|
||||
use App\Filament\Pages\Statistic;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
@@ -50,7 +51,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
->columnMapping(false)
|
||||
->exporter(BetfairExporter::class)
|
||||
->label('Download Betfair')
|
||||
->visible(fn (): bool => auth()->user()->hasRole('download_betfair'))
|
||||
->visible(fn (): bool => Auth::user()->hasRole('download_betfair'))
|
||||
->fileName(fn (Export $export): string => 'betfair-odds-'.date('d.m.Y-H.i')."-{$export->getKey()}")
|
||||
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('odds_3ways_bf')
|
||||
->whereHas('odds_totals_bf')
|
||||
@@ -97,6 +98,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
])
|
||||
->pages([
|
||||
Statistic::class,
|
||||
PlayerProps::class,
|
||||
])
|
||||
->widgets([])
|
||||
->middleware([
|
||||
|
||||
Generated
+9
-9
@@ -4932,16 +4932,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.13.2",
|
||||
"version": "3.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CarbonPHP/carbon.git",
|
||||
"reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb"
|
||||
"reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/a1c54919f5fff9800cd03c32bd01defd5a4061cb",
|
||||
"reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/0023eaa2c9110e47446dd512a263c69c40cd41f2",
|
||||
"reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5033,7 +5033,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-08T11:40:35+00:00"
|
||||
"time": "2026-09-12T20:45:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nette/php-generator",
|
||||
@@ -12180,11 +12180,11 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "2.2.13",
|
||||
"version": "2.2.14",
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9ba9ac76ee9c5cf5b56d58eb5deec6315b7a0260",
|
||||
"reference": "9ba9ac76ee9c5cf5b56d58eb5deec6315b7a0260",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac",
|
||||
"reference": "9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12240,7 +12240,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-09-03T20:38:19+00:00"
|
||||
"time": "2026-09-12T21:39:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
@@ -281,3 +281,20 @@ less padding in table
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
#playerdragtable .fi-ta-content-ctn {
|
||||
max-height: 800px !important;
|
||||
overflow-y: auto !important;
|
||||
overflow-x: visible;
|
||||
scrollbar-width: none;
|
||||
-webkit-scrollbar: hidden;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
|
||||
/* Fixiert den Tabellenkopf sauber im Scroll-Kontext */
|
||||
#playerdragtable .fi-ta-header-ctn {
|
||||
position: sticky !important;
|
||||
top: 0 !important;
|
||||
z-index: 20 !important;
|
||||
background-color: var(--fi-background-color, #ffffff) !important;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<x-filament-panels::page>
|
||||
{{ $this->form }}
|
||||
</x-filament-panels::page>
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class="mx-3 p-3 rounded-2xl col-span-3 grid grid-cols-7 grid-rows-5 gap-2 bg-cover bg-center bg-no-repeat aspect-7/5 shadow"
|
||||
style="background-image: url({{ asset('images/soccerfield-af.jpg') }});">
|
||||
@foreach ($beschriftung as $boxNumber => $benennung)
|
||||
@if ($benennung)
|
||||
@if (in_array($boxNumber, $lineup))
|
||||
<div x-data="{ isOver: false }" @dragover.prevent="isOver = true"
|
||||
@dragenter.prevent="isOver = true" @dragleave.prevent="isOver = false"
|
||||
@drop.prevent="
|
||||
isOver = false;
|
||||
const rawData = $event.dataTransfer.getData('text/plain');
|
||||
if (rawData) {
|
||||
const elementData = JSON.parse(rawData);
|
||||
$wire.dispatch('element-dropped-in-box', { elementData: elementData, boxNumber: {{ $boxNumber }} });
|
||||
}
|
||||
"
|
||||
:class="isOver ? 'border-red-500 bg-white/20 ring-2 ring-red-500/50 scale-[1.02]' :
|
||||
@if (in_array($benennung, ['SW', 'DR', 'DC', 'DL'])) 'border-gray-800 bg-green-500/40'
|
||||
@elseif (in_array($benennung, ['DM', 'MR', 'MC', 'ML', 'AM']))
|
||||
'border-gray-800 bg-blue-500/40'
|
||||
@else
|
||||
'border-gray-800 bg-amber-500/40' @endif"
|
||||
class="border-2 rounded-xl transition-all px-1 pt-0 flex flex-col justify-start transform inset-shadow-sm inset-shadow-white/50 shadow-lg">
|
||||
<!-- Box Header -->
|
||||
<div class="grid grid-cols-6 items-center">
|
||||
<div></div>
|
||||
<div
|
||||
class="w-10 2xl:w-16 text-center mx-auto bg-black text-white p-0.5 2xl:p-1 text-md 2xl:text-xl font-black rounded-b col-span-4">
|
||||
{{ $benennung }}
|
||||
</div>
|
||||
|
||||
@if ($boxes[$boxNumber])
|
||||
<x-filament::icon-button icon="heroicon-m-trash" color="black"
|
||||
class="dark:[&_svg]:text-black" size="sm"
|
||||
wire:click="clearBox({{ $boxNumber }})" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Box Inhalt -->
|
||||
@if ($boxes[$boxNumber])
|
||||
<div draggable="true"
|
||||
x-on:dragstart="e => {
|
||||
e.dataTransfer.effectAllowed = 'copy';
|
||||
e.dataTransfer.setData('text/plain', JSON.stringify({ id: {{ $boxes[$boxNumber]['id'] }} }));
|
||||
}"
|
||||
class="cursor-grab active:cursor-grabbing bg-black border border-black hover:border-blue-500 text-white p-0.5 2xl:p-1 m-0.5 rounded leading-4 2xl:leading-5 text-ms">
|
||||
{{ $boxes[$boxNumber]['name'] }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<div x-data="{ isOver: false }" @dragover.prevent="isOver = true"
|
||||
@dragenter.prevent="isOver = true" @dragleave.prevent="isOver = false"
|
||||
@drop.prevent="
|
||||
isOver = false;
|
||||
const rawData = $event.dataTransfer.getData('text/plain');
|
||||
if (rawData) {
|
||||
const elementData = JSON.parse(rawData);
|
||||
$wire.dispatch('element-dropped-in-box', { elementData: elementData, boxNumber: {{ $boxNumber }} });
|
||||
}
|
||||
"
|
||||
class="border rounded-xl transition-all pt-0 flex flex-col justify-start shadow-2xs invisible">
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div></div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
Reference in new issue
Block a user