add 2 parts for claculation pp wip

This commit is contained in:
salam committed 2026-10-31 19:22:16 +01:00
1 parent 6d2f4c1052
commit ad45880506
19 files changed
+1403 -1049

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Traits\PlayerProps;
trait ClearBoxes
{
public function clearBox(int $boxNumber): void
{
if (isset($this->boxes[$boxNumber])) {
$tmp = $this->boxes[$boxNumber];
$player_id = 0;
foreach ($tmp as $key => $value) {
if ($key == 'id') {
$player_id = $value;
}
}
foreach ($this->players as $k => $record) {
if ($record['id'] == (int) $player_id) {
$this->boxes[$boxNumber] = [];
$this->players[$k]['pos'] = '';
$this->players[$k]['active'] = 0;
$this->player_on_field_counter--;
}
}
foreach ($this->players as $k => $record) {
$this->players[$k]['gls'] = '';
$this->players[$k]['fls'] = '';
$this->players[$k]['ofs'] = '';
$this->players[$k]['crd'] = '';
$this->players[$k]['snt'] = '';
$this->players[$k]['tsh'] = '';
$this->players[$k]['wfl'] = '';
}
$this->storePlacement();
$this->loadPlacement();
}
}
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'] = '';
$this->players[$k]['ofs'] = '';
$this->players[$k]['crd'] = '';
$this->players[$k]['snt'] = '';
$this->players[$k]['tsh'] = '';
$this->players[$k]['wfl'] = '';
}
$this->player_on_field_counter = 0;
$this->dispatch('update-players', players: $this->players);
}
}