wip
This commit is contained in:
1 parent
4f7de2e489
commit
86115ac9e8
3 files changed
+41
-5
No files matched your search
@@ -62,17 +62,21 @@ class LoadPlayer
|
||||
|
||||
$colorlevel = round($matches_count / 3);
|
||||
|
||||
$time_played = round($minues_played / 60) . 'h:';
|
||||
$time_played .= $minues_played % 60 . 'm';
|
||||
$preferred_foot = $val->details->preferred_foot;
|
||||
|
||||
$position = $ss_positions_map[$val->details->position] ?? 'No Specific Position';
|
||||
|
||||
$infostring = $events_played;
|
||||
if ($preferred_foot)
|
||||
$infostring .= ' - ' . $preferred_foot;
|
||||
$infostring .= ' - ' . round($minues_played / $events_played) . 'min';
|
||||
|
||||
if ($events_played < $colorlevel) {
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-red-600 dark:text-red-500">' . $val->details->player_name . '(' . $events_played . ') (' . $time_played . ')</span>';
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-red-600 dark:text-red-500"><b>' . $val->details->player_name . '</b><br>' . $infostring . '</span>';
|
||||
} else if ($events_played < $colorlevel * 2) {
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-blue-600 dark:text-blue-500">' . $val->details->player_name . ' (' . $events_played . ') (' . $time_played . ')</span>';
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-blue-600 dark:text-blue-500"><b>' . $val->details->player_name . '</b><br>' . $infostring . '</span>';
|
||||
} else {
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-green-600 dark:text-green-500">' . $val->details->player_name . ' (' . $events_played . ') (' . $time_played . ')</span>';
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-green-600 dark:text-green-500"><b>' . $val->details->player_name . '</b><br>' . $infostring . '</span>';
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
|
||||
+11
@@ -3,8 +3,12 @@
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoImports\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoImports\StatistikaImportResource;
|
||||
use App\Models\StatistikoImport;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ListStatistikoImports extends ListRecords
|
||||
{
|
||||
@@ -19,6 +23,13 @@ class ListStatistikoImports extends ListRecords
|
||||
->label('Upload file')
|
||||
->createAnother(false)
|
||||
->icon('phosphor-upload'),
|
||||
Action::make('clear_all')->color('danger')
|
||||
->icon('phosphor-trash')
|
||||
->action(function (): void {
|
||||
$path = storage_path('app/public/statistiko');
|
||||
File::cleanDirectory($path);
|
||||
StatistikoImport::truncate();
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -232,6 +232,12 @@ class Statistic extends BaseDashboard
|
||||
->prefixIcon('icon-player')
|
||||
->preload()
|
||||
->searchable()
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question-fill')
|
||||
->color('success')
|
||||
->tooltip(fn() => $this->tooltip_player_info())
|
||||
)
|
||||
->options(function (Get $get) {
|
||||
return LoadPlayer::load($get);
|
||||
}),
|
||||
@@ -336,4 +342,19 @@ class Statistic extends BaseDashboard
|
||||
|
||||
return new HtmlString($str);
|
||||
}
|
||||
|
||||
protected function tooltip_player_info(): HtmlString
|
||||
{
|
||||
$str = '<div class="m-3 grid grid-cols-2 gap-2 max-w-md">';
|
||||
$str .= '<div class="col-span-2 font-bold">Player Information</div>';
|
||||
$str .= '<div>Events played</div>';
|
||||
$str .= '<div>123</div>';
|
||||
$str .= '<div>Stronger foot</div>';
|
||||
$str .= '<div>Left | Right | Both</div>';
|
||||
$str .= '<div>Average minutes</div>';
|
||||
$str .= '<div>83 min</div>';
|
||||
$str .= '</div>';
|
||||
|
||||
return new HtmlString($str);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user