wip
This commit is contained in:
1 parent
fcfe1e97fd
commit
bfd513635d
11 files changed
+787
-182
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Filament\Pages\Selections;
|
||||
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\SofaScorePlayerPosition;
|
||||
use App\Filament\Pages\Selections\LoadPositions;
|
||||
use App\Models\SofaScorePlayerPerSeason;
|
||||
use App\Models\StatistikoEvent;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
|
||||
class LoadPlayer
|
||||
@@ -37,7 +37,7 @@ class LoadPlayer
|
||||
|
||||
$matches_count = count($matches);
|
||||
|
||||
$ss_positions_map = SofaScorePlayerPosition::pluck('name', 'ss_code')->toArray();
|
||||
$positions_map = LoadPositions::load();
|
||||
|
||||
// needs to run daily for pre-calculaton
|
||||
$player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->whereIn('season', $season)->get();
|
||||
@@ -63,8 +63,20 @@ class LoadPlayer
|
||||
$colorlevel = round($matches_count / 3);
|
||||
|
||||
$preferred_foot = $val->details->preferred_foot;
|
||||
$player_position = ' (Role ' . $val->details->position . ')';
|
||||
|
||||
$position = $ss_positions_map[$val->details->position] ?? 'No Specific Position';
|
||||
if (in_array($val->details->position, $positions_map['MIDFIELD'])) {
|
||||
$position = 'MIDFIELD';
|
||||
} else if (in_array($val->details->position, $positions_map['DEFENCE'])) {
|
||||
$position = 'DEFENCE';
|
||||
} else if (in_array($val->details->position, $positions_map['ATTACK'])) {
|
||||
$position = 'ATTACK';
|
||||
} else if (in_array($val->details->position, $positions_map['GOALKEEPER'])) {
|
||||
$position = 'GOALKEEPER';
|
||||
} else {
|
||||
$player_position = $val->details->position;
|
||||
$position = 'NO SPECIFIC POSITION';
|
||||
}
|
||||
|
||||
$infostring = $events_played . ' Ev';
|
||||
if ($preferred_foot)
|
||||
@@ -73,11 +85,11 @@ class LoadPlayer
|
||||
$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 cursor-pointer"><b>' . $val->details->player_name . '</b><br>' . $infostring . '</span>';
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-red-600 dark:text-red-500 cursor-pointer"><b>' . $val->details->player_name . '</b>' . $player_position . '<br>' . $infostring . '</span>';
|
||||
} else if ($events_played < $colorlevel * 2) {
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-blue-600 dark:text-blue-500 cursor-pointer"><b>' . $val->details->player_name . '</b><br>' . $infostring . '</span>';
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-blue-600 dark:text-blue-500 cursor-pointer"><b>' . $val->details->player_name . '</b>' . $player_position . '<br>' . $infostring . '</span>';
|
||||
} else {
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-green-600 dark:text-green-500 cursor-pointer"><b>' . $val->details->player_name . '</b><br>' . $infostring . '</span>';
|
||||
$arr[$position][$val->ss_player_id] = '<span class="text-green-600 dark:text-green-500 cursor-pointer"><b>' . $val->details->player_name . '</b>' . $player_position . '<br>' . $infostring . '</span>';
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Selections;
|
||||
|
||||
use App\Models\SofaScorePlayerPosition;
|
||||
|
||||
class LoadPositions
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$res = SofaScorePlayerPosition::all();
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
$arr[$val->generalposition][] = $val->ss_code;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\RawJs;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class Statistic extends BaseDashboard
|
||||
@@ -232,13 +233,13 @@ class Statistic extends BaseDashboard
|
||||
->prefixIcon('icon-player')
|
||||
->preload()
|
||||
->searchable()
|
||||
->extraAttributes(fn() => ['id' => 'player_selector'])
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question-fill')
|
||||
->color('success')
|
||||
->tooltip(fn() => $this->tooltip_player_info())
|
||||
)
|
||||
->extraAttributes(fn() => ['id' => 'player_selector'])
|
||||
->options(function (Get $get) {
|
||||
return LoadPlayer::load($get);
|
||||
}),
|
||||
@@ -251,10 +252,6 @@ class Statistic extends BaseDashboard
|
||||
->hidden(fn(Get $get) => ! $get('ss_player_id'))
|
||||
->prefixIconColor('success')
|
||||
->selectablePlaceholder(false)
|
||||
// ->afterStateUpdated(function (callable $set) {
|
||||
// // $set('team_id', null);
|
||||
// $set('ss_player_id', null);
|
||||
// })
|
||||
->options([
|
||||
'all' => 'All',
|
||||
'lineup' => 'Lineup',
|
||||
@@ -346,13 +343,13 @@ class Statistic extends BaseDashboard
|
||||
|
||||
protected function tooltip_player_info(): HtmlString
|
||||
{
|
||||
$str = '<div class="m-3 grid grid-cols-2 gap-x-5 max-w-md">';
|
||||
$str = '<div class="m-3 grid grid-cols-2 gap-2 max-w-lg">';
|
||||
$str .= '<div class="col-span-2 font-bold">Player Information</div>';
|
||||
$str .= '<div>Events played:</div>';
|
||||
$str .= '<div class="font-bold">Events played:</div>';
|
||||
$str .= '<div>sum</div>';
|
||||
$str .= '<div>Stronger foot:</div>';
|
||||
$str .= '<div class="font-bold">Stronger foot:</div>';
|
||||
$str .= '<div>left | right | both</div>';
|
||||
$str .= '<div>Average on field:</div>';
|
||||
$str .= '<div class="font-bold">Average on field:</div>';
|
||||
$str .= '<div>minutes</div>';
|
||||
$str .= '</div>';
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ class SofaScorePlayerPosition extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'ss_code',
|
||||
'description',
|
||||
'name',
|
||||
'generalposition',
|
||||
];
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Filament\Pages\Statistic;
|
||||
use App\Filament\Resources\Events\Pages\ListEvents;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Support\Assets\Css;
|
||||
@@ -13,6 +14,7 @@ use Filament\Support\Facades\FilamentTimezone;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Filament\Tables\View\TablesRenderHook;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -35,17 +37,17 @@ class AppServiceProvider extends ServiceProvider
|
||||
FilamentTimezone::set('Europe/Vienna');
|
||||
|
||||
FilamentAsset::register([
|
||||
Css::make('font-stylesheet', __DIR__.'/../../resources/css/font.css'),
|
||||
Js::make('number-animator', __DIR__.'/../../resources/js/number-animator.js'),
|
||||
Css::make('font-stylesheet', __DIR__ . '/../../resources/css/font.css'),
|
||||
Js::make('number-animator', __DIR__ . '/../../resources/js/number-animator.js'),
|
||||
]);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::USER_MENU_PROFILE_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'konto-switcher\')'),
|
||||
fn(): string => Blade::render('@livewire(\'konto-switcher\')'),
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_BEFORE,
|
||||
fn (): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
fn(): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
@@ -53,14 +55,19 @@ class AppServiceProvider extends ServiceProvider
|
||||
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
fn(): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
|
||||
fn (): string => Blade::render('@livewire(\'top-menu-items\')')
|
||||
fn(): string => Blade::render('@livewire(\'top-menu-items\')')
|
||||
);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
|
||||
fn(): View => view('filament.modals.position-abbreviation'),
|
||||
);
|
||||
|
||||
Carbon::setLocale(app()->getLocale());
|
||||
|
||||
@@ -2,38 +2,38 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
// use Agencetwogether\HooksHelper\HooksHelperPlugin;
|
||||
use Agencetwogether\HooksHelper\HooksHelperPlugin;
|
||||
use App\Filament\Exports\BetfairExporter;
|
||||
use App\Filament\Pages\Statistic;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
use Awcodes\LightSwitch\LightSwitchPlugin;
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
|
||||
use Filament\Auth\Pages\PasswordReset\RequestPasswordReset;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Actions\Action;
|
||||
use App\Filament\Pages\Statistic;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
use App\Filament\Exports\BetfairExporter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Awcodes\LightSwitch\LightSwitchPlugin;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
use Swis\Filament\Backgrounds\ImageProviders\MyImages;
|
||||
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Filament\Auth\Pages\PasswordReset\RequestPasswordReset;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin;
|
||||
use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage;
|
||||
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;
|
||||
use Swis\Filament\Backgrounds\ImageProviders\MyImages;
|
||||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user