diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index 8f42acc6..6d358589 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -50,24 +50,6 @@ class Statistic extends BaseDashboard return ''; } - public function updatedFilter($value) // Or whatever your property name is - { - $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 @@ -94,7 +76,6 @@ class Statistic extends BaseDashboard $set('match_id', null); $set('team_id', null); $set('tm_player_id', null); - $this->dispatch('filterChanged', filterValue: $state); }), Select::make('match_id') ->hiddenLabel() @@ -198,7 +179,7 @@ class Statistic extends BaseDashboard 'ofs' => 'Offside', 'crd' => 'Cards', 'snt' => 'Shots On Target', - 'tsh' => 'Total shots', + 'tsh' => 'Total Shots', ]), Select::make('similar_past_matches') ->hiddenLabel() diff --git a/app/Filament/Widgets/Data/HelperStatisticType.php b/app/Filament/Widgets/Data/HelperStatisticType.php index 056fd02d..6dbcec2b 100644 --- a/app/Filament/Widgets/Data/HelperStatisticType.php +++ b/app/Filament/Widgets/Data/HelperStatisticType.php @@ -7,11 +7,11 @@ class HelperStatisticType protected static array $types = [ 'gls' => 'Goals', 'crn' => 'Corner', - 'fls' => 'Fouls Commited', + 'fls' => 'Fouls', 'ofs' => 'Offside', 'crd' => 'Cards', - 'snt' => 'Shots On Target', - 'tsh' => 'Total shots', + 'snt' => 'S on T', + 'tsh' => 'Shots', ]; public static function get($filter): string diff --git a/app/Filament/Widgets/Data/LoadPerformance.php b/app/Filament/Widgets/Data/LoadPerformance.php index 51cd3581..ed4e62d7 100644 --- a/app/Filament/Widgets/Data/LoadPerformance.php +++ b/app/Filament/Widgets/Data/LoadPerformance.php @@ -228,6 +228,10 @@ class LoadPerformance public static function shortenEnding(array &$labels, array &$homes, array &$aways) { + if (! isset($homes['all'])) { + return; + } + $count_home = 0; $count_away = 0; for ($i = \count($homes['all']) - 1; $i > 0; $i--) { diff --git a/app/Filament/Widgets/StatsMedianAverage.php b/app/Filament/Widgets/StatsMedianAverage.php index 116b4d60..1281dfb5 100644 --- a/app/Filament/Widgets/StatsMedianAverage.php +++ b/app/Filament/Widgets/StatsMedianAverage.php @@ -7,6 +7,7 @@ use App\Filament\Widgets\Data\LoadEvents; use App\Utilities\Round; use Filament\Widgets\StatsOverviewWidget; use Filament\Widgets\StatsOverviewWidget\Stat; +use Illuminate\Support\HtmlString; use Livewire\Attributes\Reactive; class StatsMedianAverage extends StatsOverviewWidget @@ -18,6 +19,8 @@ class StatsMedianAverage extends StatsOverviewWidget #[Reactive] public ?array $filters = []; + public ?int $count; + public function mount(array $filters) { $this->filters = $filters; @@ -36,7 +39,7 @@ class StatsMedianAverage extends StatsOverviewWidget 'lg' => 6, ]; - $statistic_type = ucfirst(HelperStatisticType::get($this->filters)); + $statistic_type = HelperStatisticType::get($this->filters); if (! isset($data['datasets'][0])) { $data['datasets'][0]['data'] = []; @@ -60,36 +63,12 @@ class StatsMedianAverage extends StatsOverviewWidget if (! $total_home) { return [ - Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => 'Number of events', - 'value' => '0', - ]), - Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [ - 'titel' => 'Average '.$statistic_type, - 'value1' => 0, - 'value2' => 0, - 'home' => $home_team, - 'away' => $away_team, - ]), - Stat::make('stat3', 'stat3')->view('filament.resources.events.widgets.statistic-average', [ - 'titel' => 'Median '.$statistic_type, - 'value1' => 0, - 'value2' => 0, - 'home' => $home_team, - 'away' => $away_team, - ]), - Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => 'Win', - 'value' => 0, - ]), - Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => 'Draw', - 'value' => 0, - ]), - Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => 'Lost', - 'value' => 0, - ]), + Stat::make('Number of events', 0), + Stat::make('Average '.$statistic_type, self::template(0, 0, $home_team, $away_team)), + Stat::make('Median '.$statistic_type, self::template(0, 0, $home_team, $away_team)), + Stat::make('Win', 0), + Stat::make('Draw', 0), + Stat::make('Lost', 0), ]; } @@ -119,37 +98,26 @@ class StatsMedianAverage extends StatsOverviewWidget $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; + $value_home = number_format($summe_home / $total_home, 1); + $value_away = number_format($summe_away / $total_away, 1); + return [ - Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => 'Number of events', - 'value' => $total_home, - ]), - Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [ - 'titel' => 'Average '.$statistic_type, - 'value1' => number_format($summe_home / $total_home, 1), - 'value2' => number_format($summe_away / $total_away, 1), - 'home' => $home_team, - 'away' => $away_team, - ]), - Stat::make('stat3', 'stat3')->view('filament.resources.events.widgets.statistic-average', [ - 'titel' => 'Median '.$statistic_type, - 'value1' => $median_home, - 'value2' => $median_away, - 'home' => $home_team, - 'away' => $away_team, - ]), - Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => ($data['similar_past_matches'] != 'none') ? 'Win' : 'Win: '.$data['results']['w'], - 'value' => $win, - ]), - Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => ($data['similar_past_matches'] != 'none') ? 'Draw' : 'Draw: '.$data['results']['d'], - 'value' => $draw, - ]), - Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [ - 'titel' => ($data['similar_past_matches'] != 'none') ? 'Lost' : 'Lost: '.$data['results']['l'], - 'value' => $lost, - ]), + Stat::make('Number of events', new HtmlString('
'.$total_home.'
'))->extraAttributes(['x-init' => "animate('number-of-events', $total_home)"]), + Stat::make('Average '.$statistic_type, self::template('avhome', 'avaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('avhome', $value_home); animate('avaway', $value_away)"]), + Stat::make('Median '.$statistic_type, self::template('mehome', 'meaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('mehome', $median_home); animate('meaway', $median_away)"]), + Stat::make($data['similar_past_matches'] != 'none' ? 'Win' : 'Win: '.$data['results']['w'], new HtmlString('
'.$win.'
'))->extraAttributes(['x-init' => "animate('number-of-win', $win)"]), + Stat::make($data['similar_past_matches'] != 'none' ? 'Draw' : 'Draw: '.$data['results']['d'], new HtmlString('
'.$draw.'
'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw)"]), + Stat::make($data['similar_past_matches'] != 'none' ? 'Lost' : 'Lost: '.$data['results']['l'], new HtmlString('
'.$lost.'
'))->extraAttributes(['x-init' => "animate('number-of-lost', $lost)"]), ]; } + + protected function template(string $home_id, string $away_id, string $home_name, string $away_name): HtmlString + { + return new HtmlString('
+ + + '.$home_name.' + '.$away_name.' +
'); + } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 3b89f815..521a7feb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -5,6 +5,7 @@ namespace App\Providers; use App\Filament\Resources\Events\Pages\ListEvents; use Carbon\Carbon; use Filament\Support\Assets\Css; +use Filament\Support\Assets\Js; use Filament\Support\Colors\Color; use Filament\Support\Facades\FilamentAsset; use Filament\Support\Facades\FilamentColor; @@ -35,6 +36,7 @@ class AppServiceProvider extends ServiceProvider FilamentAsset::register([ Css::make('font-stylesheet', __DIR__.'/../../resources/css/font.css'), + Js::make('number-animator', __DIR__.'/../../resources/js/number-animator.js'), ]); FilamentView::registerRenderHook( diff --git a/package-lock.json b/package-lock.json index 0e0410c5..90b8aaf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -507,9 +507,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.4.tgz", - "integrity": "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -521,9 +521,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.4.tgz", - "integrity": "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -535,9 +535,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.4.tgz", - "integrity": "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -549,9 +549,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.4.tgz", - "integrity": "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -563,9 +563,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.4.tgz", - "integrity": "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -577,9 +577,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.4.tgz", - "integrity": "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -591,9 +591,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.4.tgz", - "integrity": "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], @@ -608,9 +608,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.4.tgz", - "integrity": "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], @@ -625,9 +625,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.4.tgz", - "integrity": "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], @@ -642,9 +642,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.4.tgz", - "integrity": "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], @@ -659,9 +659,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.4.tgz", - "integrity": "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], @@ -676,9 +676,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.4.tgz", - "integrity": "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], @@ -693,9 +693,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.4.tgz", - "integrity": "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], @@ -710,9 +710,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.4.tgz", - "integrity": "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], @@ -727,9 +727,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.4.tgz", - "integrity": "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], @@ -744,9 +744,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.4.tgz", - "integrity": "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], @@ -761,9 +761,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.4.tgz", - "integrity": "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], @@ -778,9 +778,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.4.tgz", - "integrity": "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], @@ -795,9 +795,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.4.tgz", - "integrity": "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], @@ -812,9 +812,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.4.tgz", - "integrity": "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -826,9 +826,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.4.tgz", - "integrity": "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -840,9 +840,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.4.tgz", - "integrity": "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -854,9 +854,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.4.tgz", - "integrity": "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -868,9 +868,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.4.tgz", - "integrity": "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -882,9 +882,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.4.tgz", - "integrity": "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1180,9 +1180,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT" }, @@ -1233,9 +1233,9 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.1.tgz", - "integrity": "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.17.0.tgz", + "integrity": "sha512-J8SwNxprqqpbfenehxWYXE7CW+wM1BB4w3+N+g+/Wx40xM4rsLrfPmHHxSWIxJLYDgSY/HqlFPIYb2/S3rxafw==", "dev": true, "license": "MIT", "dependencies": { @@ -1423,9 +1423,9 @@ "license": "MIT" }, "node_modules/enhanced-resolve": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.22.0.tgz", - "integrity": "sha512-xYcDWrpELkFzz9SpZ3PlI6Eu6eD93Yf0WLDRxikGhWJ3MAir2SNZTIVCVZqZ/NUyx8AdMc2gT9C0gPiw18kG+A==", + "version": "5.22.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.22.2.tgz", + "integrity": "sha512-0rxICaFZ7NQho/sHely2bvOPRP0Eu2B0NZ9zM54YvRvWMn7jfz3DmnOZDR9LlXDdDcqntAVc6Hfy4gr/tdH/Ag==", "dev": true, "license": "MIT", "dependencies": { @@ -1727,9 +1727,9 @@ } }, "node_modules/hasown": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", - "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "dev": true, "license": "MIT", "dependencies": { @@ -2205,13 +2205,13 @@ } }, "node_modules/rollup": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz", - "integrity": "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -2221,31 +2221,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.4", - "@rollup/rollup-android-arm64": "4.60.4", - "@rollup/rollup-darwin-arm64": "4.60.4", - "@rollup/rollup-darwin-x64": "4.60.4", - "@rollup/rollup-freebsd-arm64": "4.60.4", - "@rollup/rollup-freebsd-x64": "4.60.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.4", - "@rollup/rollup-linux-arm-musleabihf": "4.60.4", - "@rollup/rollup-linux-arm64-gnu": "4.60.4", - "@rollup/rollup-linux-arm64-musl": "4.60.4", - "@rollup/rollup-linux-loong64-gnu": "4.60.4", - "@rollup/rollup-linux-loong64-musl": "4.60.4", - "@rollup/rollup-linux-ppc64-gnu": "4.60.4", - "@rollup/rollup-linux-ppc64-musl": "4.60.4", - "@rollup/rollup-linux-riscv64-gnu": "4.60.4", - "@rollup/rollup-linux-riscv64-musl": "4.60.4", - "@rollup/rollup-linux-s390x-gnu": "4.60.4", - "@rollup/rollup-linux-x64-gnu": "4.60.4", - "@rollup/rollup-linux-x64-musl": "4.60.4", - "@rollup/rollup-openbsd-x64": "4.60.4", - "@rollup/rollup-openharmony-arm64": "4.60.4", - "@rollup/rollup-win32-arm64-msvc": "4.60.4", - "@rollup/rollup-win32-ia32-msvc": "4.60.4", - "@rollup/rollup-win32-x64-gnu": "4.60.4", - "@rollup/rollup-win32-x64-msvc": "4.60.4", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, @@ -2348,9 +2348,9 @@ } }, "node_modules/tinyglobby": { - "version": "0.2.16", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", - "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, "license": "MIT", "dependencies": { @@ -2382,9 +2382,9 @@ "license": "0BSD" }, "node_modules/vite": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.3.tgz", - "integrity": "sha512-/4XH147Ui7OGTjg3HbdWe5arnZQSbfuRzdr9Ec7TQi5I7R+ir0Rlc9GIvD4v0XZurELqA035KVXJXpR61xhiTA==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 65bb90c5..e4372bc4 100644 --- a/package.json +++ b/package.json @@ -14,5 +14,10 @@ "laravel-vite-plugin": "^2.0.0", "tailwindcss": "^4.1.11", "vite": "^7.0.4" + }, + "allowScripts": { + "esbuild@0.25.12": true, + "esbuild@0.27.7": true, + "fsevents@2.3.3": true } } diff --git a/public/js/app/countup.js b/public/js/app/countup.js new file mode 100644 index 00000000..4e9f14bb --- /dev/null +++ b/public/js/app/countup.js @@ -0,0 +1 @@ +var t=function(){return t=Object.assign||function(t){for(var i,e=1,s=arguments.length;en.endVal;n.frameVal=e?n.endVal:n.frameVal,n.frameVal=Number(n.frameVal.toFixed(n.options.decimalPlaces)),n.printValue(n.frameVal),i1?n.options.decimal+r[1]:"",n.options.useGrouping){a="";for(var l=3,u=0,h=0,p=e.length;ht;var i=t-this.startVal;if(Math.abs(i)>this.options.smartEasingThreshold&&this.options.useEasing){this.finalEndVal=t;var e=this.countDown?1:-1;this.endVal=t+e*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;null!==this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},i.prototype.start=function(t){this.error||(this.options.onStartCallback&&this.options.onStartCallback(),t&&(this.options.onCompleteCallback=t),this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},i.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},i.prototype.reset=function(){clearTimeout(this.autoAnimateTimeout),cancelAnimationFrame(this.rAF),this.paused=!0,this.once=!1,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},i.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,null==this.finalEndVal&&this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},i.prototype.printValue=function(t){var i;if(this.el){var e=this.formattingFn(t);if(null===(i=this.options.plugin)||void 0===i?void 0:i.render)this.options.plugin.render(this.el,e);else if("INPUT"===this.el.tagName)this.el.value=e;else"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=e:this.el.innerHTML=e}},i.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},i.prototype.validateValue=function(t){var i=Number(t);return this.ensureNumber(i)?i:(this.error="[CountUp] invalid start or end value: ".concat(t),null)},i.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},i.prototype.parse=function(t){var i=function(t){return t.replace(/([.,'  ])/g,"\\$1")},e=i(this.options.separator),s=i(this.options.decimal),n=t.replace(new RegExp(e,"g"),"").replace(new RegExp(s,"g"),".");return parseFloat(n)},i.observedElements=new WeakMap,i}();export{i as CountUp}; diff --git a/public/js/app/number-animator.js b/public/js/app/number-animator.js new file mode 100644 index 00000000..048a79db --- /dev/null +++ b/public/js/app/number-animator.js @@ -0,0 +1,32 @@ +function animate(element, end, duration = 500) { + console.log(element, end); + + var element = document.getElementById(element); + const startTime = performance.now(); + + // Cubic easing function: slows down at the start and end + const easeInOutCubic = (t) => + t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; + + const updateCount = (currentTime) => { + const elapsedTime = currentTime - startTime; + let progress = elapsedTime / duration; + + // Clamp progress to ensure it doesn't overshoot + if (progress > 1) progress = 1; + + // Apply easing curve to progress + const easedProgress = easeInOutCubic(progress); + + // Calculate current value and round to integer + const currentCount = Math.round(end * easedProgress * 100) / 100; + + element.innerHTML = currentCount; + + if (progress < 1) { + requestAnimationFrame(updateCount); + } + }; + + requestAnimationFrame(updateCount); +} diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index ccb75170..000c2d64 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -87,6 +87,10 @@ button[wire\:click="resetTableFiltersForm"] { @apply p-2 border border-gray-200 shadow rounded-md cursor-pointer has-checked:bg-blue-50 has-checked:text-blue-900 dark:has-checked:bg-blue-950 dark:has-checked:text-blue-200 } +.fi-sc-component .fi-wi-stats-overview-stat { + @apply bg-green-50 dark:bg-green-900 border border-green-300 dark:border-green-700 +} + /* #mapper_right .fi-dropdown-list-item, #mapper_left .fi-dropdown-list-item { padding: 2px; diff --git a/resources/js/filament-chart-js-plugins.js b/resources/js/filament-chart-js-plugins.js deleted file mode 100644 index 20d4dc75..00000000 --- a/resources/js/filament-chart-js-plugins.js +++ /dev/null @@ -1,4 +0,0 @@ -import IntersectionFiller from './widget-chart-line-intersection-filler' - -window.filamentChartJsPlugins ??= [] -window.filamentChartJsPlugins.push(IntersectionFiller) \ No newline at end of file diff --git a/resources/js/number-animator.js b/resources/js/number-animator.js new file mode 100644 index 00000000..048a79db --- /dev/null +++ b/resources/js/number-animator.js @@ -0,0 +1,32 @@ +function animate(element, end, duration = 500) { + console.log(element, end); + + var element = document.getElementById(element); + const startTime = performance.now(); + + // Cubic easing function: slows down at the start and end + const easeInOutCubic = (t) => + t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; + + const updateCount = (currentTime) => { + const elapsedTime = currentTime - startTime; + let progress = elapsedTime / duration; + + // Clamp progress to ensure it doesn't overshoot + if (progress > 1) progress = 1; + + // Apply easing curve to progress + const easedProgress = easeInOutCubic(progress); + + // Calculate current value and round to integer + const currentCount = Math.round(end * easedProgress * 100) / 100; + + element.innerHTML = currentCount; + + if (progress < 1) { + requestAnimationFrame(updateCount); + } + }; + + requestAnimationFrame(updateCount); +} diff --git a/resources/js/widget-chart-line-intersection-filler.js b/resources/js/widget-chart-line-intersection-filler.js deleted file mode 100644 index bed8e00f..00000000 --- a/resources/js/widget-chart-line-intersection-filler.js +++ /dev/null @@ -1,42 +0,0 @@ -const fillPlugin = { - id: 'fillHigherValue', - beforeDatasetsDraw(chart) { - const { ctx } = chart; - const metaA = chart.getDatasetMeta(0); // Dataset A - const metaB = chart.getDatasetMeta(1); // Dataset B - - ctx.save(); - - // Loop through your data points - for (let i = 0; i < metaA.data.length; i++) { - const pA = metaA.data[i]; - const pB = metaB.data[i]; - - if (!pA || !pB) continue; - - // Define your colors - const colorA = 'rgba(255, 99, 132, 0.4)'; // Color when Line A is higher - const colorB = 'rgba(54, 162, 235, 0.4)'; // Color when Line B is higher - - // Determine which line is higher (remember canvas Y=0 is at the top) - if (pA.y < pB.y) { - ctx.fillStyle = colorA; - } else { - ctx.fillStyle = colorB; - } - - // Draw the fill polygon segment between the two points - ctx.beginPath(); - ctx.moveTo(pA.x, pA.y); - ctx.lineTo(pB.x, pB.y); - // If doing multiple segments, connect back to create a contiguous fill - if (metaA.data[i + 1] && metaB.data[i + 1]) { - ctx.lineTo(metaB.data[i + 1].x, metaB.data[i + 1].y); - ctx.lineTo(metaA.data[i + 1].x, metaA.data[i + 1].y); - } - ctx.closePath(); - ctx.fill(); - } - ctx.restore(); - } -}; \ No newline at end of file diff --git a/resources/views/filament/resources/events/widgets/statistic-regular.blade.php b/resources/views/filament/resources/events/widgets/statistic-regular.blade.php index c1651d16..1ea5b8f1 100644 --- a/resources/views/filament/resources/events/widgets/statistic-regular.blade.php +++ b/resources/views/filament/resources/events/widgets/statistic-regular.blade.php @@ -1,6 +1,10 @@ -
- {{ $titel }} - {{ $value }} - {{-- --}} -
+
+
+
+ + {{ $titel }} + +
+
123
+
+
\ No newline at end of file diff --git a/resources/views/filament/widgets/custom-chart-widget.blade.php b/resources/views/filament/widgets/custom-chart-widget.blade.php deleted file mode 100644 index e8d0fa52..00000000 --- a/resources/views/filament/widgets/custom-chart-widget.blade.php +++ /dev/null @@ -1,76 +0,0 @@ -@php - use Filament\Widgets\View\Components\ChartWidgetComponent; - use Illuminate\View\ComponentAttributeBag; - - $color = $this->getColor(); - $heading = $this->getHeading(); - $description = $this->getDescription(); - $filters = $this->getFilters(); - $isCollapsible = $this->isCollapsible(); - $type = $this->getType(); - $maxHeight = $this->getMaxHeight(); - $hasMaxHeight = filled($maxHeight) && $maxHeight !== '100%'; -@endphp - -{{-- --}} -{{-- :collapsible="$this->isCollapsible()" x-bind:collapsed="isCollapsed" --}} - - - @if ($filters || method_exists($this, 'getFiltersSchema')) - - @if ($filters) - - - @foreach ($filters as $value => $label) - - @endforeach - - - @endif - - @if (method_exists($this, 'getFiltersSchema')) - - - {{ $this->getFiltersTriggerAction() }} - - -
- {{ $this->getFiltersSchema() }} - - @if (method_exists($this, 'hasDeferredFilters') && $this->hasDeferredFilters()) -
- {{ $this->getFiltersApplyAction() }} - - {{ $this->getFiltersResetAction() }} -
- @endif -
-
- @endif -
- @endif - -
getPollingInterval()) wire:poll.{{ $pollingInterval }}="updateChartData" @endif> -
color(ChartWidgetComponent::class, $color)->class(['fi-wi-chart-canvas-ctn', 'fi-wi-chart-canvas-ctn-no-aspect-ratio' => $hasMaxHeight]) }}> - !$hasMaxHeight, "max-height: {$maxHeight}" => $hasMaxHeight])> - - - - - - - - -
-
-
-
diff --git a/vite.config.js b/vite.config.js index c1f195e9..4de10272 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,14 +1,14 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; -import tailwindcss from '@tailwindcss/vite'; +import { defineConfig } from "vite"; +import laravel from "laravel-vite-plugin"; +import tailwindcss from "@tailwindcss/vite"; export default defineConfig({ plugins: [ laravel({ input: [ - 'resources/css/app.css', - 'resources/js/app.js', - 'resources/css/filament/admin/theme.css', + "resources/css/app.css", + "resources/js/app.js", + "resources/css/filament/admin/theme.css", ], refresh: true, }),