wip
This commit is contained in:
1 parent
085dc78e26
commit
958944f21c
6 files changed
+30
-16
No files matched your search
@@ -11,7 +11,7 @@ class ImportDetails
|
||||
{
|
||||
public static function run(string $filePath): void
|
||||
{
|
||||
StatistikoDetail::query()->update(['last_import' => 'out']);
|
||||
StatistikoDetail::query()->update(['last_import' => 'no']);
|
||||
|
||||
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
|
||||
->getRows()
|
||||
@@ -20,12 +20,14 @@ class ImportDetails
|
||||
|
||||
$collection = [];
|
||||
foreach ($chunk as $row) {
|
||||
$row['is_active'] = 1;
|
||||
$row['last_import'] = 'in';
|
||||
$row['birthdate'] = isset($row['birthday']) ? Carbon::parse($row['birthday'])->format('Y-m-d') : '';
|
||||
unset($row['birthday']);
|
||||
$row['last_update'] = Carbon::parse($row['last_update'])->format('Y-m-d H:i:s');
|
||||
$collection[] = $row;
|
||||
if ($row['player_name'] != '') {
|
||||
$row['is_active'] = 1;
|
||||
$row['last_import'] = 'yes';
|
||||
$row['birthdate'] = isset($row['birthday']) ? Carbon::parse($row['birthday'])->format('Y-m-d') : '';
|
||||
unset($row['birthday']);
|
||||
$row['last_update'] = Carbon::parse($row['last_update'])->format('Y-m-d H:i:s');
|
||||
$collection[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
StatistikoDetail::upsert(
|
||||
@@ -48,6 +50,6 @@ class ImportDetails
|
||||
]);
|
||||
});
|
||||
|
||||
StatistikoDetail::where('last_import', 'out')->update(['is_active' => 0, 'ss_team_id' => 0]);
|
||||
StatistikoDetail::where('last_import', 'no')->update(['is_active' => 0, 'ss_team_id' => 0]);
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ class PlayerPropsDrop extends Widget
|
||||
public function matchUpdate(int $match_id)
|
||||
{
|
||||
$this->match_id = $match_id;
|
||||
$this->loadPlacement();
|
||||
}
|
||||
|
||||
#[On('team-update')]
|
||||
@@ -159,7 +160,7 @@ class PlayerPropsDrop extends Widget
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->dispatch('update-players', players: $this->players);
|
||||
$this->calculateAspg();
|
||||
}
|
||||
|
||||
public function storePlacement()
|
||||
@@ -325,6 +326,8 @@ class PlayerPropsDrop extends Widget
|
||||
$this->players[$k]['crd'] = '';
|
||||
}
|
||||
|
||||
$this->dispatch('update-players', players: $this->players);
|
||||
|
||||
if ($manual) {
|
||||
Notification::make()->title('Calculation needs 10 player on field')
|
||||
->info()
|
||||
|
||||
@@ -18,6 +18,7 @@ class PlayerPropsTable extends TableWidget
|
||||
use InteractsWithForms;
|
||||
|
||||
protected int|string|array $columnSpan = 2;
|
||||
|
||||
public int $team_id;
|
||||
|
||||
public array $players;
|
||||
@@ -56,7 +57,7 @@ class PlayerPropsTable extends TableWidget
|
||||
->emptyStateHeading('No team selected')
|
||||
->columns([
|
||||
ViewColumn::make('drag_card')
|
||||
->label(fn() => $this->getHeadingTable())
|
||||
->label(fn () => $this->getHeadingTable())
|
||||
->view('filament.tables.columns.drag-card'),
|
||||
])->extraAttributes([
|
||||
'id' => 'playerdragtable',
|
||||
@@ -86,7 +87,7 @@ class PlayerPropsTable extends TableWidget
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->records(function () {
|
||||
$collection = collect($this->players);
|
||||
$collection = collect($this->players)->sortBy('order');
|
||||
$selectedPosition = $this->tableFilters['positions']['area'] ?? null;
|
||||
if (! empty($selectedPosition)) {
|
||||
$collection = $collection->where('area', $selectedPosition);
|
||||
|
||||
@@ -55,22 +55,28 @@ class PlayerCalculator extends Component
|
||||
if (! isset($val->details)) {
|
||||
$tmp['area'] = 'goalkeeper';
|
||||
$tmp['color_pos'] = 'gray';
|
||||
$tmp['order'] = 5;
|
||||
} else {
|
||||
if (in_array($val->details->position, $positions_map['MIDFIELD'])) {
|
||||
$tmp['area'] = 'midfield';
|
||||
$tmp['color_pos'] = 'info';
|
||||
$tmp['order'] = 2;
|
||||
} elseif (in_array($val->details->position, $positions_map['DEFENCE'])) {
|
||||
$tmp['area'] = 'defence';
|
||||
$tmp['color_pos'] = 'success';
|
||||
$tmp['order'] = 1;
|
||||
} elseif (in_array($val->details->position, $positions_map['ATTACK'])) {
|
||||
$tmp['area'] = 'attack';
|
||||
$tmp['color_pos'] = 'warning';
|
||||
$tmp['order'] = 3;
|
||||
} elseif (in_array($val->details->position, $positions_map['GOALKEEPER'])) {
|
||||
$tmp['area'] = 'goalkeeper';
|
||||
$tmp['color_pos'] = 'gray';
|
||||
$tmp['order'] = 4;
|
||||
} else {
|
||||
$tmp['area'] = 'defence';
|
||||
$tmp['color_pos'] = 'success';
|
||||
$tmp['order'] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
<div>{{ $record['foot'] }}</div>
|
||||
<div>{{ $record['tot_evt'] }}</div>
|
||||
<div>{{ $record['ave_min'] }}</div>
|
||||
<div class="bg-black text-white rounded font-bold">{{ $record['pos'] }}</div>
|
||||
<div class="bg-black text-white rounded font-bold p-0.5">{{ $record['pos'] }}</div>
|
||||
</div>
|
||||
<div class="w-18 font-stretch-ultra-condensed">
|
||||
<x-filament::badge size="sm" color="{{ $record['color_pos'] }}">
|
||||
<div class="text-center">
|
||||
<div class="{{ $record['color_pos'] }}">
|
||||
{{ ucfirst($record['pos_ori']) }}
|
||||
</x-filament::badge>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-left text-sm tracking-tight flex-1 text-red-500">
|
||||
{{ $record['name'] }}
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
</div>
|
||||
</x-slot>
|
||||
</x-filament::modal>
|
||||
<x-filament::button icon="phosphor-arrows-clockwise" tooltip="Clear all" wire:click="clearResultTable()" />
|
||||
<x-filament::button icon="phosphor-x" tooltip="Clear all" wire:click="clearResultTable()" />
|
||||
<x-filament::button icon="phosphor-arrows-clockwise" tooltip="Reload" wire:click="loadPlacement()" />
|
||||
<x-filament::button icon="phosphor-calculator" tooltip="Calculate" wire:click="calculateAspg(1)" />
|
||||
<x-filament::button icon="phosphor-copy" color="success"
|
||||
tooltip="Copy results for pasting into a spread sheet" wire:click="copyResult()" />
|
||||
<x-filament::button icon="phosphor-copy" color="warning" tooltip="Copy calculation variables"
|
||||
wire:click="copyDevelopment()" />
|
||||
{{-- --}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="border border-gray-500 w-full p-3 rounded grid grid-cols-7 grid-rows-5 gap-2 bg-cover bg-center bg-no-repeat aspect-7/5 shadow"
|
||||
|
||||
Reference in new issue
Block a user