wip
This commit is contained in:
1 parent
77eaea5631
commit
6ecee8635a
2 files changed
+34
-6
No files matched your search
@@ -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;
|
||||||
@@ -93,6 +94,7 @@ class PlayerProps extends Page implements HasForms
|
|||||||
$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()
|
||||||
@@ -105,6 +107,7 @@ class PlayerProps extends Page implements HasForms
|
|||||||
->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()
|
||||||
@@ -115,8 +118,8 @@ class PlayerProps extends Page implements HasForms
|
|||||||
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'),
|
||||||
|
|
||||||
@@ -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->team_name = '';
|
||||||
|
$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;
|
$this->match_id = $match_id;
|
||||||
$this->loadPlacement();
|
} 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