From cf60bfe2c17cd137deedb6c77dd3f09f6d1955c3 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 30 Sep 2026 17:10:37 +0530 Subject: [PATCH] Added production plan table in target --- app/Livewire/ProductionTargetPlan.php | 26 ++---- .../livewire/production-target-plan.blade.php | 92 +++++++++++++++++-- 2 files changed, 90 insertions(+), 28 deletions(-) diff --git a/app/Livewire/ProductionTargetPlan.php b/app/Livewire/ProductionTargetPlan.php index 21b40057..93f79db7 100644 --- a/app/Livewire/ProductionTargetPlan.php +++ b/app/Livewire/ProductionTargetPlan.php @@ -635,13 +635,13 @@ class ProductionTargetPlan extends Component $this->records = $records; - // $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) - // ->where('line_id', $lineId) - // ->whereYear('created_at', $year) - // ->whereMonth('created_at', $month) - // ->sum('plan_quantity'); + $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) + ->where('line_id', $lineId) + ->whereYear('created_at', $year) + ->whereMonth('created_at', $month) + ->sum('plan_quantity'); - $this->monthlyRecords = $plans->sum('plan_quantity'); + // $this->monthlyRecords = $plans->sum('plan_quantity'); } // public function loadMonthlyPlan($year, $month, $plantId, $lineId){ @@ -662,23 +662,11 @@ class ProductionTargetPlan extends Component public function render() { // return view('livewire.production-target-plan'); - // return view('livewire.production-target-plan', [ - // 'records' => $this->records, - // 'monthlyRecords' => $this->monthlyRecords, - // 'dates' => $this->dates, - // ]); - - $t = microtime(true); - $view = view('livewire.production-target-plan', [ + return view('livewire.production-target-plan', [ 'records' => $this->records, 'monthlyRecords' => $this->monthlyRecords, 'dates' => $this->dates, - 'leaveDates' => $this->leaveDates, ]); - $html = $view->render(); - Log::info('Blade render: ' . ((microtime(true) - $t) * 1000) . ' ms'); - return $html; - } } diff --git a/resources/views/livewire/production-target-plan.blade.php b/resources/views/livewire/production-target-plan.blade.php index fe794927..9241058e 100644 --- a/resources/views/livewire/production-target-plan.blade.php +++ b/resources/views/livewire/production-target-plan.blade.php @@ -65,17 +65,91 @@ -
-

Test

- -

Records: {{ count($records) }}

- -

Dates: {{ count($dates) }}

-
- - {{-- //.. --}} +

+ PRODUCTION PLAN TABLE: +

+
+ + + + + + + + + + + + @foreach($dates as $date) + {{-- --}} + + @endforeach + + + @foreach($dates as $date) + {{-- --}} + + + + {{-- --}} + @endforeach + + + + + @forelse ($records as $index => $record) + + + + + + + + {{-- @foreach($dates as $date) + + + @endforeach --}} + + @foreach($dates as $date) + @if(in_array($date, $leaveDates)) + {{-- --}} + + + @else + {{-- --}} + {{-- --}} + + + {{-- --}} + @endif + @endforeach + + @empty + + + + @endforelse + +
NoPlantLineItem CodeCategory + Production Plan Dates +
+ {{ $date }} + + {{ $date }} +
Item QuantityPlan Quantity + Actual Quantity + Produced Quantity
{{ $index + 1 }}{{ $record['plant_name'] }}{{ $record['line_name'] }}{{ $record['item_code'] }}{{ $record['category'] }}{{ $record['target_plan'][$date] ?? '-' }}{{ $record['production_plan'][$date] ?? '-' }}---{{ $record['daily_target'] ?? '-' }} + {{ $record['daily_hourly_quantity'][$date] ?? '-' }} + + {{ $record['daily_target_dynamic'][$date] ?? '-' }} + + {{ $record['produced_quantity'][$date] ?? '-' }} + {{ $record['produced_quantity'] ?? '-' }}
+ No production plan data found. +
+