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

View File

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