Added one more line in hourly count dashboard
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 4m2s
Laravel Larastan / larastan (pull_request) Failing after 5m54s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 4m2s
Laravel Larastan / larastan (pull_request) Failing after 5m54s
This commit is contained in:
@@ -7,6 +7,7 @@ use Filament\Support\Assets\Js;
|
||||
use Filament\Support\RawJs;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class ItemOverview extends ChartWidget
|
||||
{
|
||||
@@ -139,6 +140,11 @@ class ItemOverview extends ChartWidget
|
||||
}, $shiftedKeys);
|
||||
}
|
||||
|
||||
$planData = array_map(
|
||||
fn ($quantity) => round($quantity / 22.5, 2),
|
||||
$orderedData
|
||||
);
|
||||
|
||||
return [
|
||||
'datasets' => [
|
||||
[
|
||||
@@ -159,6 +165,19 @@ class ItemOverview extends ChartWidget
|
||||
'fill' => false,
|
||||
'tension' => 0.3,
|
||||
],
|
||||
[
|
||||
'label' => match ($activeFilter) {
|
||||
'this_week' => $isFgLine ? 'Daily FG Count This Week' : 'Daily Production This Week',
|
||||
'this_month' => $isFgLine ? 'Weekly FG Count This Month' : 'Weekly Production This Month',
|
||||
'yesterday' => $isFgLine ? "Yesterday's FG Count" : "Yesterday's Hourly Production",
|
||||
default => $isFgLine ? "Today's FG Count" : "Today's Hourly Production",
|
||||
},
|
||||
'data' => $planData,
|
||||
'borderColor' => 'rgba(255, 99, 132, 1)',
|
||||
'backgroundColor' => 'rgba(75, 192, 192, 0.2)',
|
||||
'fill' => false,
|
||||
'tension' => 0.3,
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
@@ -169,21 +188,6 @@ class ItemOverview extends ChartWidget
|
||||
return 'line';
|
||||
}
|
||||
|
||||
// protected function getOptions(): array
|
||||
// {
|
||||
// return [
|
||||
|
||||
// 'scales' => [
|
||||
// 'y' => [
|
||||
// 'beginAtZero' => true,
|
||||
// 'ticks' => [
|
||||
// 'stepSize' => 0.5,
|
||||
// ],
|
||||
// ],
|
||||
// ],
|
||||
|
||||
// ];
|
||||
// }
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
@@ -210,6 +214,41 @@ class ItemOverview extends ChartWidget
|
||||
];
|
||||
}
|
||||
|
||||
// public function getHeading(): HtmlString|string|null
|
||||
// {
|
||||
// // Detect selected line & type
|
||||
// $selectedLine = session('selected_line') ?? session('select_line');
|
||||
// $line = \App\Models\Line::find($selectedLine);
|
||||
// $isFgLine = $line?->type == 'FG Line';
|
||||
|
||||
// // Dynamic title and icon
|
||||
// $title = $isFgLine ? 'FG Line Production' : 'Total Production';
|
||||
// $titleColor = $isFgLine ? '#16a34a' : '#1e40af';
|
||||
// //$iconColor = $isFgLine ? 'text-green-500' : 'text-blue-500';
|
||||
// $iconColor = $isFgLine ? 'text-green-500' : 'text-blue-500';
|
||||
// //$textColor = $isFgLine ? '#16a34a' : '#3b82f6';
|
||||
// $textColor = $isFgLine ? '#0f766e' : '#b45309';
|
||||
// $iconSvg = '
|
||||
// <svg xmlns="http://www.w3.org/2000/svg"
|
||||
// class="w-8 h-8 ' . $iconColor . '" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
// <path stroke-linecap="round" stroke-linejoin="round" d="M3 3v18h18M7 13h2v5H7zm4-8h2v13h-2zm4 5h2v8h-2z" />
|
||||
// </svg>
|
||||
// ';
|
||||
|
||||
// $count = number_format($this->totalCount ?? 0);
|
||||
|
||||
// return new HtmlString('
|
||||
// <div class="flex items-center justify-between px-4 py-2 bg-white rounded-lg shadow-sm">
|
||||
// <div class="flex items-center space-x-3">
|
||||
// ' . $iconSvg . '
|
||||
// <div style="margin-left: 12px; color: ' . $textColor . ';">
|
||||
// <p style="color:' . $titleColor . '; font-weight: 600;">' . e($title) . '</p>
|
||||
// <h2 class="text-3xl font-extrabold text-gray-800">' . $count . '</h2>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// ');
|
||||
// }
|
||||
|
||||
|
||||
protected function getFilters(): ?array
|
||||
|
||||
Reference in New Issue
Block a user