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 array $players = [];
|
||||
|
||||
public array $clientLineUps = [];
|
||||
|
||||
public int $team_id;
|
||||
@@ -93,6 +94,7 @@ class PlayerProps extends Page implements HasForms
|
||||
$set('lid', null);
|
||||
$set('mid', null);
|
||||
$set('tid', null);
|
||||
$this->dispatch('clear-all');
|
||||
}),
|
||||
Select::make('lid')
|
||||
->live()
|
||||
@@ -105,6 +107,7 @@ class PlayerProps extends Page implements HasForms
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('mid', null);
|
||||
$set('tid', null);
|
||||
$this->dispatch('clear-all');
|
||||
}),
|
||||
Select::make('mid')
|
||||
->live()
|
||||
@@ -115,8 +118,8 @@ class PlayerProps extends Page implements HasForms
|
||||
return LoadStatisticFixturesMatchOptions::load($get('lid'));
|
||||
})
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
$this->dispatch('match-update', match_id: $state);
|
||||
$set('tid', null);
|
||||
$this->dispatch('match-update', match_id: $state);
|
||||
})
|
||||
->placeholder('Events'),
|
||||
|
||||
@@ -153,11 +156,13 @@ class PlayerProps extends Page implements HasForms
|
||||
$res = $this->lineUpOptinos();
|
||||
$arr = [];
|
||||
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>';
|
||||
else
|
||||
} else {
|
||||
$arr[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
})
|
||||
->placeholder('LineUp')
|
||||
@@ -181,6 +186,7 @@ class PlayerProps extends Page implements HasForms
|
||||
{
|
||||
$this->players = $players;
|
||||
}
|
||||
|
||||
protected function getFooterWidgets(): array
|
||||
{
|
||||
return [
|
||||
@@ -188,10 +194,12 @@ class PlayerProps extends Page implements HasForms
|
||||
PlayerPropsDrop::make(['players' => $this->players]),
|
||||
];
|
||||
}
|
||||
|
||||
public function getFooterWidgetsColumns(): int|array
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
private function lineUpOptinos(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -71,11 +71,28 @@ class PlayerPropsDrop extends Widget
|
||||
$this->lineup = $this->lineUpMap[$this->activeLineUp];
|
||||
}
|
||||
|
||||
#[On('match-update')]
|
||||
public function matchUpdate(int $match_id)
|
||||
#[On('clear-all')]
|
||||
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->loadPlacement();
|
||||
} else {
|
||||
$this->team_name = '';
|
||||
}
|
||||
}
|
||||
|
||||
#[On('team-update')]
|
||||
@@ -234,10 +251,13 @@ class PlayerPropsDrop extends Widget
|
||||
|
||||
public function clearResultTable(): void
|
||||
{
|
||||
|
||||
for ($i = 1; $i <= 35; $i++) {
|
||||
$this->boxes[$i] = [];
|
||||
}
|
||||
|
||||
foreach ($this->players as $k => $record) {
|
||||
// $this->players[$k] = [];
|
||||
$this->players[$k]['active'] = 0;
|
||||
$this->players[$k]['gls'] = '';
|
||||
$this->players[$k]['fls'] = '';
|
||||
|
||||
Reference in new issue
Block a user