This commit is contained in:
salam committed 2026-10-07 05:30:39 +02:00
1 parent 679038a503
commit d0e2f32501
2 files changed
+55 -50

No files matched your search

+22
View File
@@ -84,6 +84,28 @@ class Statistic extends BaseDashboard
return ''; return '';
} }
/**
* Diese Methode liefert das Daten-Array für ALLE Widgets.
* Durch 'once()' läuft die Query pro Request exakt 1x.
*/
// public function getSharedWidgetData(): array
// {
// return once(function () {
// $filters = $this->getFilters();
// // Ihre MongoDB / Eloquent Query basierend auf den aktuellen Filtern
// return Order::query()
// ->when($filters['start_date'] ?? null, fn ($q, $date) => $q->where('created_at', '>=', $date))
// ->when($filters['status'] ?? null, fn ($q, $status) => $q->where('status', $status))
// ->selectRaw('count(*) as total_count, sum(total_price) as total_revenue, avg(total_price) as average_amount')
// ->first()
// ->toArray();
// });
// }
// // Im Widget -> Nutzt exakt dasselbe Array aus dem Speicher
// $sharedData = $this->getPage()->getSharedWidgetData();
public function filtersForm(Schema $schema): Schema public function filtersForm(Schema $schema): Schema
{ {
return $schema return $schema
+33 -50
View File
@@ -201,6 +201,9 @@ class LoadPerformance
$data = [ $data = [
'datasets' => [ 'datasets' => [
[ [
/**
* HOME
*/
'label' => $team_map[$match->home_id], 'label' => $team_map[$match->home_id],
'playing_date' => $date_home, 'playing_date' => $date_home,
'results_per_event' => $results_home, 'results_per_event' => $results_home,
@@ -208,8 +211,8 @@ class LoadPerformance
'data' => $homes['all'] ?? [], 'data' => $homes['all'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fb2c36', 'borderColor' => '#2b7fff',
'backgroundColor' => '#fb2c36', 'backgroundColor' => '#2b7fff',
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
], ],
[ [
@@ -220,8 +223,7 @@ class LoadPerformance
'data' => $home_av['all'], 'data' => $home_av['all'],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fb2c36', 'borderColor' => '#2b7fff',
'backgroundColor' => 'transparent',
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
], ],
@@ -233,8 +235,8 @@ class LoadPerformance
'data' => $homes['def'] ?? [], 'data' => $homes['def'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fe9a00', 'borderColor' => '#8ec5ff',
'backgroundColor' => '#fe9a00', 'backgroundColor' => '#8ec5ff',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => true, 'hidden' => true,
@@ -247,7 +249,7 @@ class LoadPerformance
'data' => $home_av['def'], 'data' => $home_av['def'],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fe9a00', 'borderColor' => '#8ec5ff',
'backgroundColor' => 'transparent', 'backgroundColor' => 'transparent',
'pointStyle' => false, 'pointStyle' => false,
'hidden' => true, 'hidden' => true,
@@ -261,8 +263,8 @@ class LoadPerformance
'data' => $homes['att'] ?? [], 'data' => $homes['att'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fe9a00', 'borderColor' => '#8ec5ff',
'backgroundColor' => '#fe9a00', 'backgroundColor' => '#8ec5ff',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => true, 'hidden' => true,
@@ -275,7 +277,7 @@ class LoadPerformance
'data' => $home_av['att'] ?? [], 'data' => $home_av['att'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fe9a00', 'borderColor' => '#8ec5ff',
'backgroundColor' => 'transparent', 'backgroundColor' => 'transparent',
'fill' => false, 'fill' => false,
'pointStyle' => false, 'pointStyle' => false,
@@ -290,8 +292,8 @@ class LoadPerformance
'data' => $homes['mid'] ?? [], 'data' => $homes['mid'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fe9a00', 'borderColor' => '#8ec5ff',
'backgroundColor' => '#fe9a00', 'backgroundColor' => '#8ec5ff',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => true, 'hidden' => true,
@@ -304,7 +306,7 @@ class LoadPerformance
'data' => $home_av['mid'] ?? [], 'data' => $home_av['mid'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#fe9a00', 'borderColor' => '#8ec5ff',
'backgroundColor' => 'transparent', 'backgroundColor' => 'transparent',
'fill' => false, 'fill' => false,
'pointStyle' => false, 'pointStyle' => false,
@@ -322,8 +324,8 @@ class LoadPerformance
'data' => $aways['all'] ?? [], 'data' => $aways['all'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#00bc7d', 'borderColor' => '#00c950',
'backgroundColor' => '#00bc7d', 'backgroundColor' => '#00c950',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => false, 'hidden' => false,
@@ -336,8 +338,7 @@ class LoadPerformance
'data' => $away_av['all'] ?? [], 'data' => $away_av['all'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#00bc7d', 'borderColor' => '#00c950',
'backgroundColor' => 'transparent',
'fill' => false, 'fill' => false,
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
@@ -351,8 +352,8 @@ class LoadPerformance
'data' => $aways['def'] ?? [], 'data' => $aways['def'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#7ccf00', 'borderColor' => '#7bf1a8',
'backgroundColor' => '#7ccf00', 'backgroundColor' => '#7bf1a8',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => true, 'hidden' => true,
@@ -365,8 +366,7 @@ class LoadPerformance
'data' => $away_av['def'] ?? [], 'data' => $away_av['def'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#7ccf00', 'borderColor' => '#7bf1a8',
'backgroundColor' => 'transparent',
'fill' => false, 'fill' => false,
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
@@ -380,8 +380,8 @@ class LoadPerformance
'data' => $aways['att'] ?? [], 'data' => $aways['att'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#7ccf00', 'borderColor' => '#7bf1a8',
'backgroundColor' => '#7ccf00', 'backgroundColor' => '#7bf1a8',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => true, 'hidden' => true,
@@ -394,8 +394,7 @@ class LoadPerformance
'data' => $away_av['att'] ?? [], 'data' => $away_av['att'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#7ccf00', 'borderColor' => '#7bf1a8',
'backgroundColor' => 'transparent',
'fill' => false, 'fill' => false,
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
@@ -409,27 +408,15 @@ class LoadPerformance
'data' => $aways['mid'] ?? [], 'data' => $aways['mid'] ?? [],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#7ccf00', 'borderColor' => '#7bf1a8',
'backgroundColor' => '#7ccf00', 'backgroundColor' => '#7bf1a8',
'fill' => false, 'fill' => false,
'pointStyle' => $hasdots, 'pointStyle' => $hasdots,
'hidden' => true, 'hidden' => true,
], ],
[ /**
'label' => 'Average Midfield', * AVERAGE
'playing_date' => $date_away, */
'results_per_event' => $results_away,
'events' => $events_away,
'data' => $away_av['mid'] ?? [],
'spanGaps' => true,
'tension' => 0.5,
'borderColor' => '#7ccf00',
'backgroundColor' => 'transparent',
'fill' => false,
'pointStyle' => false,
'borderDash' => [5, 5],
'hidden' => true,
],
[ [
'label' => 'Average League', 'label' => 'Average League',
'playing_date' => $date_home, 'playing_date' => $date_home,
@@ -438,8 +425,7 @@ class LoadPerformance
'data' => $league_av['all'], 'data' => $league_av['all'],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#00a6f4', 'borderColor' => '#ffb900',
'backgroundColor' => '#00a6f4',
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
'hidden' => true, 'hidden' => true,
@@ -452,8 +438,7 @@ class LoadPerformance
'data' => $league_av['def'], 'data' => $league_av['def'],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#155dfc', 'borderColor' => '#ffb900',
'backgroundColor' => 'transparent',
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
'hidden' => true, 'hidden' => true,
@@ -466,8 +451,7 @@ class LoadPerformance
'data' => $league_av['att'], 'data' => $league_av['att'],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#155dfc', 'borderColor' => '#ffb900',
'backgroundColor' => '#155dfc',
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
'hidden' => true, 'hidden' => true,
@@ -480,8 +464,7 @@ class LoadPerformance
'data' => $league_av['mid'], 'data' => $league_av['mid'],
'spanGaps' => true, 'spanGaps' => true,
'tension' => 0.5, 'tension' => 0.5,
'borderColor' => '#155dfc', 'borderColor' => '#ffb900',
'backgroundColor' => 'transparent',
'pointStyle' => false, 'pointStyle' => false,
'borderDash' => [5, 5], 'borderDash' => [5, 5],
'hidden' => true, 'hidden' => true,