wip
This commit is contained in:
1 parent
d30eb76442
commit
01a3f41ec0
6 files changed
+210
-14
No files matched your search
@@ -3,9 +3,13 @@
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Actions\LoadStatisticFixturesLeaguesOptions;
|
||||
use App\Actions\Statistics\StatisticEvents;
|
||||
use App\Filament\Widgets\MovingAverageChart;
|
||||
use App\Filament\Widgets\PunctualChart;
|
||||
use App\Models\Element;
|
||||
use App\Models\StatisticFixtures;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Slider;
|
||||
@@ -23,7 +27,20 @@ class Statistic extends BaseDashboard
|
||||
|
||||
protected static ?string $title = 'Statistic';
|
||||
|
||||
protected int|string|array $columnSpan = 'full';
|
||||
protected static array $types = [
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls commited',
|
||||
'ofs' => 'Offside',
|
||||
'crd' => 'Cards',
|
||||
'snt' => 'Shot on target',
|
||||
'tsh' => 'Total shots',
|
||||
];
|
||||
|
||||
public function getColumns(): int|array
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function filtersForm(Schema $schema): Schema
|
||||
{
|
||||
@@ -77,15 +94,27 @@ class Statistic extends BaseDashboard
|
||||
->live(),
|
||||
Select::make('team_position')
|
||||
->prefixIcon('phosphor-map-pin')
|
||||
->default('home')
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->color('gray')
|
||||
->icon('phosphor-question')
|
||||
->tooltip('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
|
||||
)
|
||||
->default('all')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'all' => 'All',
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
'all' => 'All',
|
||||
]),
|
||||
Select::make('similar_past_matches')
|
||||
->prefixIcon('phosphor-align-center-horizontal')
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->color('gray')
|
||||
->icon('phosphor-question')
|
||||
->tooltip('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
|
||||
)
|
||||
->default('none')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
@@ -95,10 +124,16 @@ class Statistic extends BaseDashboard
|
||||
]),
|
||||
Select::make('statistic_type')
|
||||
->prefixIcon('phosphor-cell-signal-full')
|
||||
->suffixAction(
|
||||
Action::make('iconInfo')
|
||||
->color('gray')
|
||||
->icon('phosphor-question')
|
||||
->tooltip('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
|
||||
)
|
||||
->default('none')
|
||||
->selectablePlaceholder(false)
|
||||
->options([
|
||||
'gls' => 'Gouls',
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls commited',
|
||||
'ofs' => 'Offside',
|
||||
@@ -117,4 +152,27 @@ class Statistic extends BaseDashboard
|
||||
->pips(),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getFooterWidgets(): array
|
||||
{
|
||||
|
||||
$data = StatisticEvents::load($this->filters);
|
||||
|
||||
$type = self::$types[$this->filters['statistic_type']];
|
||||
|
||||
// $data = [
|
||||
// 'datasets' => [
|
||||
// [
|
||||
// 'label' => 'test',
|
||||
// 'data' => [0, 10, 5, 2, 21, 32, 45, 74, 65, 45, 77, 89],
|
||||
// ],
|
||||
// ],
|
||||
// 'labels' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
// ];
|
||||
|
||||
return [
|
||||
MovingAverageChart::make(['filters' => $data, 'header' => $type.' Punctual']),
|
||||
PunctualChart::make(['filters' => $data, 'header' => $type.' Moving Avverage']),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user