Merge pull request 'Changed logic in production target plan' (#1134) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 42s

Reviewed-on: #1134
This commit was merged in pull request #1134.
This commit is contained in:
2026-09-30 08:46:52 +00:00
2 changed files with 6 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ class ProductionTargetPlan extends Component
public $dates = []; public $dates = [];
public $monthlyRecords; public $monthlyRecords = [];
public $leaveDates = []; public $leaveDates = [];
@@ -629,16 +629,11 @@ class ProductionTargetPlan extends Component
} }
public function loadMonthlyPlan($year, $month, $plantId, $lineId){ public function loadMonthlyPlan($year, $month, $plantId, $lineId){
$this->monthlyRecords = ProductionPlan::query() return ProductionPlan::where('plant_id', $plantId)
->selectRaw(' ->where('line_id', $lineId)
plant_id,
line_id,
SUM(plan_quantity) as monthly_plan
')
->whereYear('created_at', $year) ->whereYear('created_at', $year)
->whereMonth('created_at', $month) ->whereMonth('created_at', $month)
->groupBy('plant_id', 'line_id') ->sum('plan_quantity');
->get();
} }
@@ -655,6 +650,7 @@ class ProductionTargetPlan extends Component
// return view('livewire.production-target-plan'); // return view('livewire.production-target-plan');
return view('livewire.production-target-plan', [ return view('livewire.production-target-plan', [
'records' => $this->records, 'records' => $this->records,
'monthlyRecords' => $this->monthlyRecords,
'dates' => $this->dates, 'dates' => $this->dates,
]); ]);
} }

View File

@@ -19,7 +19,7 @@
</thead> </thead>
<tbody class="divide-y divide-gray-100"> <tbody class="divide-y divide-gray-100">
@forelse ($records as $index => $record) @forelse ($monthlyRecords as $index => $record)
<tr class="hover:bg-gray-50"> <tr class="hover:bg-gray-50">
<td class="border px-4 py-2"> <td class="border px-4 py-2">