wip chart in tab
This commit is contained in:
1 parent
527280a670
commit
095a4ffd41
12 files changed
+109
-86
No files matched your search
@@ -4,15 +4,6 @@ namespace App\Filament\Pages;
|
||||
|
||||
use App\Actions\LoadStatisticFixturesLeaguesOptions;
|
||||
use App\Actions\LoadStatisticFixturesMatchOptions;
|
||||
use App\Filament\Widgets\ChartEvent;
|
||||
use App\Filament\Widgets\ChartEventMoAv;
|
||||
use App\Filament\Widgets\ChartEventPerf;
|
||||
use App\Filament\Widgets\ChartEventPerfMoAv;
|
||||
use App\Filament\Widgets\ChartPlayer;
|
||||
use App\Filament\Widgets\ChartPlayerMoAv;
|
||||
use App\Filament\Widgets\ChartPlayerPerf;
|
||||
use App\Filament\Widgets\ChartPlayerPerfMoAv;
|
||||
use App\Filament\Widgets\StatsMedianAverage;
|
||||
use App\Models\Element;
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoDetail;
|
||||
@@ -36,6 +27,10 @@ class Statistic extends BaseDashboard
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-chart-line-up';
|
||||
|
||||
protected string $view = 'filament.pages.statistic';
|
||||
|
||||
protected string $activeTab = 'tab1';
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
protected static ?string $title = 'Statistic';
|
||||
@@ -45,24 +40,34 @@ class Statistic extends BaseDashboard
|
||||
'xl' => 3,
|
||||
];
|
||||
|
||||
public function getActiveTab()
|
||||
{
|
||||
return $this->activeTab;
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable|null
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
public function updatedFilter($value) // Or whatever your property name is
|
||||
{
|
||||
return [
|
||||
Action::make('collapseAll')
|
||||
->label('Collapse All Charts')
|
||||
->icon('heroicon-m-chevron-up')
|
||||
->color('gray')
|
||||
->action(function ($record, $livewire) {
|
||||
$livewire->dispatch('collapse-all-charts');
|
||||
}),
|
||||
];
|
||||
$this->dispatch('filterChanged', filterValue: $value);
|
||||
}
|
||||
|
||||
// protected function getHeaderActions(): array
|
||||
// {
|
||||
// return [
|
||||
// Action::make('collapseAll')
|
||||
// ->label('Collapse All Charts')
|
||||
// ->icon('heroicon-m-chevron-up')
|
||||
// ->color('gray')
|
||||
// ->action(function ($record, $livewire) {
|
||||
// $livewire->dispatch('collapse-all-charts');
|
||||
// }),
|
||||
// ];
|
||||
// }
|
||||
|
||||
public function filtersForm(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
@@ -84,8 +89,9 @@ class Statistic extends BaseDashboard
|
||||
->options(fn () => LoadStatisticFixturesLeaguesOptions::load(1))
|
||||
->live()
|
||||
->label('League')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
$set('match_id', null);
|
||||
$this->dispatch('filterChanged', filterValue: $state);
|
||||
}),
|
||||
Select::make('match_id')
|
||||
->prefixIconColor('primary')
|
||||
@@ -247,25 +253,6 @@ class Statistic extends BaseDashboard
|
||||
return [
|
||||
'default' => 1,
|
||||
'md' => 2,
|
||||
'lg' => 4,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getFooterWidgets(): array
|
||||
{
|
||||
return [
|
||||
StatsMedianAverage::make(),
|
||||
|
||||
// Events
|
||||
ChartEvent::make(),
|
||||
ChartEventMoAv::make(),
|
||||
ChartEventPerf::make(),
|
||||
ChartEventPerfMoAv::make(),
|
||||
// Players
|
||||
ChartPlayer::make(),
|
||||
ChartPlayerMoAv::make(),
|
||||
ChartPlayerPerf::make(),
|
||||
ChartPlayerPerfMoAv::make(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,18 @@ use App\Filament\Widgets\Data\HelperStatisticType;
|
||||
use App\Filament\Widgets\Data\LoadEvents;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartEvent extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
|
||||
// protected string $view = 'filament.widgets.custom-chart-widget';
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $heading = 'Events';
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
protected bool $isCollapsible = true;
|
||||
protected bool $isCollapsible = false;
|
||||
|
||||
protected $f;
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ use App\Filament\Widgets\Data\HelperStatisticType;
|
||||
use App\Filament\Widgets\Data\LoadEvents;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartEventMoAv extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $heading = 'Events';
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ namespace App\Filament\Widgets;
|
||||
use App\Filament\Widgets\Data\LoadPerformance;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartEventPerf extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $heading = 'Events';
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ use App\Filament\Widgets\Data\HelperMoveingAveragePerformens;
|
||||
use App\Filament\Widgets\Data\LoadPerformance;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartEventPerfMoAv extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $heading = 'Events';
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ namespace App\Filament\Widgets;
|
||||
use App\Filament\Widgets\Data\LoadPlayer;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartPlayer extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ use App\Filament\Widgets\Data\HelperMoveingAverage;
|
||||
use App\Filament\Widgets\Data\LoadPlayer;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartPlayerMoAv extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartPlayerPerf extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $heading = 'Player';
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class ChartPlayerPerfMoAv extends ChartWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
protected ?string $heading = 'Player';
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoDetail;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -146,30 +145,6 @@ class LoadPerformance
|
||||
|
||||
return $data;
|
||||
|
||||
/**
|
||||
* IF WITH PLAYER
|
||||
*/
|
||||
// $matches_played = 0;
|
||||
// $description = '';
|
||||
// if ($tm_player_id) {
|
||||
// $matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
|
||||
// ->when($player_on_field, function ($query) use ($player_on_field) {
|
||||
// switch ($player_on_field) {
|
||||
// case 'lineup':
|
||||
// return $query->where('lineup', 'T');
|
||||
// case 'substituted':
|
||||
// return $query->where('lineup', 'P');
|
||||
// }
|
||||
// })
|
||||
// ->pluck('match_id')->toArray();
|
||||
|
||||
// if (! $matches_played) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
// $description = ' (with '.StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name').')';
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public static function filterMatches($res, $matches)
|
||||
|
||||
@@ -5,16 +5,22 @@ namespace App\Filament\Widgets;
|
||||
use App\Filament\Widgets\Data\HelperStatisticType;
|
||||
use App\Filament\Widgets\Data\LoadEvents;
|
||||
use App\Utilities\Round;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Filament\Widgets\StatsOverviewWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
use Livewire\Attributes\Reactive;
|
||||
|
||||
class StatsMedianAverage extends StatsOverviewWidget
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
#[Reactive]
|
||||
public ?array $filters = [];
|
||||
|
||||
public function mount(array $filters)
|
||||
{
|
||||
$this->filters = $filters;
|
||||
}
|
||||
|
||||
public function getColumns(): int|array
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user