wip
This commit is contained in:
1 parent
77eaea5631
commit
6ecee8635a
2 files changed
+43
-15
No files matched your search
@@ -34,7 +34,7 @@ class PlayerProps extends Page implements HasForms
|
|||||||
->group(static::getNavigationGroup())
|
->group(static::getNavigationGroup())
|
||||||
->icon(static::getNavigationIcon())
|
->icon(static::getNavigationIcon())
|
||||||
->activeIcon(static::getActiveNavigationIcon())
|
->activeIcon(static::getActiveNavigationIcon())
|
||||||
->isActiveWhen(fn() => request()->routeIs(static::getRouteName()))
|
->isActiveWhen(fn () => request()->routeIs(static::getRouteName()))
|
||||||
->sort(static::getNavigationSort())
|
->sort(static::getNavigationSort())
|
||||||
->url(static::getUrl(), shouldOpenInNewTab: true), // 👈 Forces target="_blank"
|
->url(static::getUrl(), shouldOpenInNewTab: true), // 👈 Forces target="_blank"
|
||||||
];
|
];
|
||||||
@@ -58,6 +58,7 @@ class PlayerProps extends Page implements HasForms
|
|||||||
public string $activeLineUp = '3313';
|
public string $activeLineUp = '3313';
|
||||||
|
|
||||||
public array $players = [];
|
public array $players = [];
|
||||||
|
|
||||||
public array $clientLineUps = [];
|
public array $clientLineUps = [];
|
||||||
|
|
||||||
public int $team_id;
|
public int $team_id;
|
||||||
@@ -84,46 +85,48 @@ class PlayerProps extends Page implements HasForms
|
|||||||
->live()
|
->live()
|
||||||
->preload()
|
->preload()
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->prefixIconColor(fn(Get $get): string => $get('cid') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('cid') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-globe-fill')
|
->prefixIcon('phosphor-globe-fill')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->options(fn() => LoadSofaScoreCategory::load())
|
->options(fn () => LoadSofaScoreCategory::load())
|
||||||
->placeholder('Country')
|
->placeholder('Country')
|
||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$set('lid', null);
|
$set('lid', null);
|
||||||
$set('mid', null);
|
$set('mid', null);
|
||||||
$set('tid', null);
|
$set('tid', null);
|
||||||
|
$this->dispatch('clear-all');
|
||||||
}),
|
}),
|
||||||
Select::make('lid')
|
Select::make('lid')
|
||||||
->live()
|
->live()
|
||||||
->preload()
|
->preload()
|
||||||
->prefixIconColor(fn(Get $get): string => $get('lid') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('lid') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-trophy-fill')
|
->prefixIcon('phosphor-trophy-fill')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid')))
|
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('cid')))
|
||||||
->placeholder('League')
|
->placeholder('League')
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('mid', null);
|
$set('mid', null);
|
||||||
$set('tid', null);
|
$set('tid', null);
|
||||||
|
$this->dispatch('clear-all');
|
||||||
}),
|
}),
|
||||||
Select::make('mid')
|
Select::make('mid')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->prefixIconColor(fn(Get $get): string => $get('mid') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('mid') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-calendar-check-fill')
|
->prefixIcon('phosphor-calendar-check-fill')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
return LoadStatisticFixturesMatchOptions::load($get('lid'));
|
return LoadStatisticFixturesMatchOptions::load($get('lid'));
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$this->dispatch('match-update', match_id: $state);
|
|
||||||
$set('tid', null);
|
$set('tid', null);
|
||||||
|
$this->dispatch('match-update', match_id: $state);
|
||||||
})
|
})
|
||||||
->placeholder('Events'),
|
->placeholder('Events'),
|
||||||
|
|
||||||
Select::make('tid')
|
Select::make('tid')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->prefixIconColor(fn(Get $get): string => $get('tid') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('tid') ? 'success' : 'danger')
|
||||||
->prefixIcon('icon-player')
|
->prefixIcon('icon-player')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
if ($get('mid')) {
|
if ($get('mid')) {
|
||||||
@@ -153,11 +156,13 @@ class PlayerProps extends Page implements HasForms
|
|||||||
$res = $this->lineUpOptinos();
|
$res = $this->lineUpOptinos();
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $key => $value) {
|
foreach ($res as $key => $value) {
|
||||||
if ($this->players && in_array($key, $this->clientLineUps))
|
if ($this->players && in_array($key, $this->clientLineUps)) {
|
||||||
$arr[$key] = $value . '<span class="text-blue-600"> has lineup</span>';
|
$arr[$key] = $value.'<span class="text-blue-600"> has lineup</span>';
|
||||||
else
|
} else {
|
||||||
$arr[$key] = $value;
|
$arr[$key] = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
})
|
})
|
||||||
->placeholder('LineUp')
|
->placeholder('LineUp')
|
||||||
@@ -181,6 +186,7 @@ class PlayerProps extends Page implements HasForms
|
|||||||
{
|
{
|
||||||
$this->players = $players;
|
$this->players = $players;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFooterWidgets(): array
|
protected function getFooterWidgets(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -188,10 +194,12 @@ class PlayerProps extends Page implements HasForms
|
|||||||
PlayerPropsDrop::make(['players' => $this->players]),
|
PlayerPropsDrop::make(['players' => $this->players]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFooterWidgetsColumns(): int|array
|
public function getFooterWidgetsColumns(): int|array
|
||||||
{
|
{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function lineUpOptinos(): array
|
private function lineUpOptinos(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -71,11 +71,28 @@ class PlayerPropsDrop extends Widget
|
|||||||
$this->lineup = $this->lineUpMap[$this->activeLineUp];
|
$this->lineup = $this->lineUpMap[$this->activeLineUp];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[On('match-update')]
|
#[On('clear-all')]
|
||||||
public function matchUpdate(int $match_id)
|
public function clearAll()
|
||||||
{
|
{
|
||||||
$this->match_id = $match_id;
|
$this->team_name = '';
|
||||||
$this->loadPlacement();
|
$this->match_id = 0;
|
||||||
|
for ($i = 1; $i <= 35; $i++) {
|
||||||
|
$this->boxes[$i] = [];
|
||||||
|
}
|
||||||
|
$this->players = [];
|
||||||
|
$this->dispatch('update-players', players: $this->players);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[On('match-update')]
|
||||||
|
public function matchUpdate(?int $match_id)
|
||||||
|
{
|
||||||
|
$this->clearResultTable();
|
||||||
|
$this->players = [];
|
||||||
|
if ($match_id) {
|
||||||
|
$this->match_id = $match_id;
|
||||||
|
} else {
|
||||||
|
$this->team_name = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[On('team-update')]
|
#[On('team-update')]
|
||||||
@@ -234,10 +251,13 @@ class PlayerPropsDrop extends Widget
|
|||||||
|
|
||||||
public function clearResultTable(): void
|
public function clearResultTable(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
for ($i = 1; $i <= 35; $i++) {
|
for ($i = 1; $i <= 35; $i++) {
|
||||||
$this->boxes[$i] = [];
|
$this->boxes[$i] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->players as $k => $record) {
|
foreach ($this->players as $k => $record) {
|
||||||
|
// $this->players[$k] = [];
|
||||||
$this->players[$k]['active'] = 0;
|
$this->players[$k]['active'] = 0;
|
||||||
$this->players[$k]['gls'] = '';
|
$this->players[$k]['gls'] = '';
|
||||||
$this->players[$k]['fls'] = '';
|
$this->players[$k]['fls'] = '';
|
||||||
|
|||||||
Reference in new issue
Block a user