pips decimal at slider
This commit is contained in:
1 parent
10801ddab2
commit
99363e001c
5 files changed
+2083
-33
No files matched your search
@@ -18,6 +18,7 @@ use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\RawJs;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use PhpOption\None;
|
||||
@@ -203,8 +204,7 @@ class Statistic extends BaseDashboard
|
||||
->hiddenLabel()
|
||||
->placeholder('Similar Past Matches')
|
||||
->prefixIconColor('primary')
|
||||
// ->prefixIcon('phosphor-approximate-equals')
|
||||
->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<span class="text-xl">'.$get('accuracy').'</span>') : '')
|
||||
->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">'.$get('accuracy').'</div>') : '')
|
||||
->columnSpan([
|
||||
'default' => 1,
|
||||
'xl' => 2,
|
||||
@@ -230,18 +230,21 @@ class Statistic extends BaseDashboard
|
||||
// ->label('Accuracy min: 0, max: 0.25, steps: 0.025')
|
||||
->hiddenLabel()
|
||||
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
|
||||
// ->fillTrack()
|
||||
->range(minValue: 0, maxValue: 0.25)
|
||||
->fillTrack()
|
||||
->minValue(0)
|
||||
->maxValue(0.25)
|
||||
->default(0.125)
|
||||
->step(0.025)
|
||||
->default(5)
|
||||
->decimalPlaces(1)
|
||||
->decimalPlaces(3)
|
||||
// ->tooltips()
|
||||
// ->columnSpan([
|
||||
// 'default' => 1,
|
||||
// 'xl' => 2,
|
||||
// ])
|
||||
->columnSpan([
|
||||
'default' => 1,
|
||||
'xl' => 2,
|
||||
])
|
||||
->pips()
|
||||
->pipsFormatter(RawJs::make(<<<'JS'
|
||||
`${$value.toFixed(2)}`
|
||||
JS))
|
||||
->live(),
|
||||
Select::make('tm_player_id')
|
||||
->hiddenLabel()
|
||||
|
||||
@@ -33,7 +33,7 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
'default' => 1,
|
||||
'sm' => 2,
|
||||
'md' => 3,
|
||||
'md' => 6,
|
||||
'lg' => 6,
|
||||
];
|
||||
|
||||
$statistic_type = ucfirst(HelperStatisticType::get($this->filters));
|
||||
@@ -63,7 +63,6 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Number of events',
|
||||
'value' => '0',
|
||||
'hidden' => false,
|
||||
]),
|
||||
Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [
|
||||
'titel' => 'Average '.$statistic_type,
|
||||
@@ -82,17 +81,14 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Win',
|
||||
'value' => 0,
|
||||
'hidden' => false,
|
||||
]),
|
||||
Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Draw',
|
||||
'value' => 0,
|
||||
'hidden' => false,
|
||||
]),
|
||||
Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Lost',
|
||||
'value' => 0,
|
||||
'hidden' => false,
|
||||
]),
|
||||
];
|
||||
}
|
||||
@@ -122,15 +118,20 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
$median_away = $arr_away[$m];
|
||||
}
|
||||
|
||||
$win = $data['results']['w'] ? number_format(Round::odd($total_home / $data['results']['w']), 2) : 0;
|
||||
$draw = $data['results']['d'] ? number_format(Round::odd($total_home / $data['results']['d']), 2) : 0;
|
||||
$lost = $data['results']['l'] ? number_format(Round::odd($total_home / $data['results']['l']), 2) : 0;
|
||||
if ($data['similar_past_matches'] == 'none') {
|
||||
$win = $data['results']['w'] ? number_format(Round::odd($total_home / $data['results']['w']), 2) : 0;
|
||||
$draw = $data['results']['d'] ? number_format(Round::odd($total_home / $data['results']['d']), 2) : 0;
|
||||
$lost = $data['results']['l'] ? number_format(Round::odd($total_home / $data['results']['l']), 2) : 0;
|
||||
} else {
|
||||
$win = 0;
|
||||
$draw = 0;
|
||||
$lost = 0;
|
||||
}
|
||||
|
||||
return [
|
||||
Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Number of events',
|
||||
'value' => $total_home,
|
||||
'hidden' => false,
|
||||
]),
|
||||
Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [
|
||||
'titel' => 'Average '.$statistic_type,
|
||||
@@ -146,21 +147,17 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
'home' => $home_team,
|
||||
'away' => $away_team,
|
||||
]),
|
||||
|
||||
Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Win: '.$data['results']['w'],
|
||||
'titel' => ($data['similar_past_matches'] != 'none') ? 'Win' : 'Win: '.$data['results']['w'],
|
||||
'value' => $win,
|
||||
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
|
||||
]),
|
||||
Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Draw: '.$data['results']['d'],
|
||||
'titel' => ($data['similar_past_matches'] != 'none') ? 'Draw' : 'Draw: '.$data['results']['d'],
|
||||
'value' => $draw,
|
||||
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
|
||||
]),
|
||||
Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [
|
||||
'titel' => 'Lost: '.$data['results']['l'],
|
||||
'titel' => ($data['similar_past_matches'] != 'none') ? 'Lost' : 'Lost: '.$data['results']['l'],
|
||||
'value' => $lost,
|
||||
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user