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);
|
||||
|
||||
Reference in new issue
Block a user