1
0
forked from poc/pds

Updated session plant and line and overriding issue solved

This commit is contained in:
dhanabalan
2025-05-12 20:05:54 +05:30
parent e198b6e613
commit 21ce9c76e8

View File

@@ -3,7 +3,10 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Support\Assets\Js;
use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Contracts\View\View;
class ItemOverview extends ChartWidget class ItemOverview extends ChartWidget
{ {
@@ -16,7 +19,7 @@ class ItemOverview extends ChartWidget
protected $listeners = ['filtersUpdated' => '$refresh']; protected $listeners = ['filtersUpdated' => '$refresh'];
protected function getData(): array public function getData(): array
{ {
$activeFilter = $this->filter; $activeFilter = $this->filter;
@@ -156,6 +159,11 @@ class ItemOverview extends ChartWidget
default => "Today's Hourly Production", default => "Today's Hourly Production",
}, },
'data' => $orderedData, 'data' => $orderedData,
'interaction' => [
'mode' => 'nearest',
'axis' => 'x',
'intersect' => false,
],
'borderColor' => 'rgba(75, 192, 192, 1)', 'borderColor' => 'rgba(75, 192, 192, 1)',
'backgroundColor' => 'rgba(75, 192, 192, 0.2)', 'backgroundColor' => 'rgba(75, 192, 192, 0.2)',
'fill' => false, 'fill' => false,
@@ -171,7 +179,6 @@ class ItemOverview extends ChartWidget
return 'line'; return 'line';
} }
protected function getOptions(): array protected function getOptions(): array
{ {
return [ return [
@@ -187,6 +194,33 @@ class ItemOverview extends ChartWidget
]; ];
} }
// protected function getOptions(): array
// {
// return [
// 'plugins' => [
// 'datalabels' => [
// 'color' => '#3490dc',
// 'font' => [
// 'weight' => 'bold',
// 'size' => 14,
// ],
// 'backgroundColor' => 'rgba(255,255,255,0.8)',
// 'borderRadius' => 4,
// 'formatter' => \Illuminate\Support\Js::from(
// new Js('function(value, context) {
// if (Number(value) === 0) {
// return null;
// }
// return "Count: " + value;
// }')
// ),
// ]
// ]
// ];
// }
protected function getFilters(): ?array protected function getFilters(): ?array
{ {
return [ return [
@@ -199,7 +233,6 @@ class ItemOverview extends ChartWidget
public static function canView(): bool public static function canView(): bool
{ {
// Only show on HourlyProduction page
return request()->routeIs([ return request()->routeIs([
'filament.pages.hourly-production', 'filament.pages.hourly-production',
'filament.admin.resources.production-quantities.create', 'filament.admin.resources.production-quantities.create',