wip
This commit is contained in:
1 parent
fbaadcd248
commit
b4379efb82
9 files changed
+110
-13
No files matched your search
@@ -31,7 +31,7 @@ class SupervisorsTable
|
||||
return $table
|
||||
->striped()
|
||||
->recordAction(null)
|
||||
->poll('10s')
|
||||
->poll('15sec')
|
||||
->columns([
|
||||
Split::make([
|
||||
TextColumn::make('id')->badge()->alignCenter(),
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ class StatistikoDetailsTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll('10sec')
|
||||
->poll('15sec')
|
||||
->striped()
|
||||
->defaultPaginationPageOption(8)
|
||||
->paginationPageOptions([8, 16, 24, 36])
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class StatistikoEventsTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll('10sec')
|
||||
->poll('15sec')
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport_id')
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ class StatistikoPlayersTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll()
|
||||
// ->poll()
|
||||
->columns([
|
||||
TextColumn::make('match_id')->searchable(),
|
||||
TextColumn::make('details.name')
|
||||
|
||||
@@ -30,6 +30,8 @@ class Statistic extends BaseDashboard
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-chart-line-up';
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
protected static ?string $title = 'Statistic';
|
||||
|
||||
protected int|string|array $columnSpan = [
|
||||
|
||||
@@ -61,7 +61,7 @@ class EventsTable
|
||||
|
||||
return $table
|
||||
->striped()
|
||||
->poll('20s')
|
||||
->poll('15sec')
|
||||
->deferLoading()
|
||||
->defaultPaginationPageOption(5)
|
||||
->extremePaginationLinks()
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Filament\Widgets;
|
||||
use App\Filament\Widgets\Data\HelperMoveingAverage;
|
||||
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;
|
||||
|
||||
@@ -21,6 +22,26 @@ class ChartMovingAverageEvent extends ChartWidget
|
||||
'legend' => [
|
||||
'display' => false,
|
||||
],
|
||||
'tooltip' => [
|
||||
'callbacks' => [
|
||||
'label' => RawJs::make(<<<'JS'
|
||||
function(context) {
|
||||
let label = context.dataset.label || '';
|
||||
|
||||
if (label) {
|
||||
label += ': ';
|
||||
}
|
||||
if (context.parsed.y !== null) {
|
||||
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.parsed.y);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
JS),
|
||||
],
|
||||
],
|
||||
],
|
||||
'interaction' => [
|
||||
'intersect' => false,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Filament\Widgets;
|
||||
|
||||
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;
|
||||
|
||||
@@ -21,6 +22,9 @@ class ChartPunctualEvent extends ChartWidget
|
||||
'display' => false,
|
||||
],
|
||||
],
|
||||
'interaction' => [
|
||||
'intersect' => false,
|
||||
],
|
||||
];
|
||||
|
||||
public function getDescription(): ?string
|
||||
@@ -41,4 +45,69 @@ class ChartPunctualEvent extends ChartWidget
|
||||
{
|
||||
return 'line';
|
||||
}
|
||||
|
||||
// protected function getOptions(): RawJs|array
|
||||
// {
|
||||
// return RawJs::make(<<<'JS'
|
||||
// {
|
||||
// plugins: {
|
||||
// legend: {
|
||||
// display: false
|
||||
// },
|
||||
// datalabels: {
|
||||
// backgroundColor: function(context) {
|
||||
// return context.active ? context.dataset.backgroundColor : 'white';
|
||||
// },
|
||||
// borderColor: function(context) {
|
||||
// return context.dataset.backgroundColor;
|
||||
// },
|
||||
// borderRadius: function(context) {
|
||||
// return context.active ? 0 : 32;
|
||||
// },
|
||||
// borderWidth: 3,
|
||||
// color: function(context) {
|
||||
// return context.active ? 'white' : context.dataset.backgroundColor;
|
||||
// },
|
||||
// font: {
|
||||
// weight: 'bold'
|
||||
// },
|
||||
// formatter: function(value, context) {
|
||||
// value = Math.round(value * 100) / 100;
|
||||
// return context.active
|
||||
// ? context.dataset.label + '\n' + value + '%'
|
||||
// : Math.round(value);
|
||||
// },
|
||||
// offset: 8,
|
||||
// padding: 5,
|
||||
// textAlign: 'center'
|
||||
// }
|
||||
// },
|
||||
// // Core options
|
||||
// aspectRatio: 5 / 3,
|
||||
// layout: {
|
||||
// padding: {
|
||||
// bottom: 16,
|
||||
// right: 40,
|
||||
// left: 8,
|
||||
// top: 40
|
||||
// }
|
||||
// },
|
||||
// hover: {
|
||||
// mode: 'index',
|
||||
// intersect: false
|
||||
// },
|
||||
// elements: {
|
||||
// line: {
|
||||
// fill: false,
|
||||
// tension: 0.4
|
||||
// }
|
||||
// },
|
||||
// scales: {
|
||||
// y: {
|
||||
// stacked: true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// JS);
|
||||
// }
|
||||
}
|
||||
@@ -31,14 +31,17 @@ class LoadEvents
|
||||
|
||||
$statistic_type = $filter['statistic_type'] ?? 0;
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $team_id) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
if (! $statistic_type) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* STATTISTIC DATA
|
||||
@@ -60,7 +63,7 @@ class LoadEvents
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})
|
||||
->orderBy('starttime')
|
||||
->orderBy('starttime', 'ASC')
|
||||
->get();
|
||||
|
||||
// dd($res);
|
||||
@@ -71,12 +74,10 @@ class LoadEvents
|
||||
|
||||
$datasets = [];
|
||||
$labels = [];
|
||||
|
||||
if (! $statistic_type || $statistic_type == 'none') {
|
||||
$statistic_type = 'gls';
|
||||
}
|
||||
$labels_since = [];
|
||||
|
||||
foreach ($res as $value) {
|
||||
|
||||
$labels[] = $value['starttime']->format('d.M.y');
|
||||
|
||||
if ($team_position == 'home') {
|
||||
@@ -189,11 +190,15 @@ class LoadEvents
|
||||
$data = [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => ucfirst($team_position),
|
||||
'label' => HelperStatisticType::get($filter),
|
||||
'data' => $datasets,
|
||||
'fill' => true,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#36A2EB',
|
||||
'datalabels' => [
|
||||
'align' => 'start',
|
||||
'anchor' => 'start',
|
||||
],
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
|
||||
Reference in new issue
Block a user