Added production plan table in target
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 3m41s
Laravel Larastan / larastan (pull_request) Failing after 6m42s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 3m41s
Laravel Larastan / larastan (pull_request) Failing after 6m42s
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,17 +65,91 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2>Test</h2>
|
||||
|
||||
<p>Records: {{ count($records) }}</p>
|
||||
|
||||
<p>Dates: {{ count($dates) }}</p>
|
||||
</div>
|
||||
|
||||
|
||||
{{-- //.. --}}
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
PRODUCTION PLAN TABLE:
|
||||
</h2>
|
||||
<div class="overflow-x-auto rounded-lg shadow">
|
||||
<table class="w-full divide-y divide-gray-200 text-sm text-center">
|
||||
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
|
||||
<tr>
|
||||
<th class="border px-4 py-2" rowspan="4">No</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Plant</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Line</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Item Code</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Category</th>
|
||||
|
||||
<th class="border px-4 py-2 whitespace-nowrap" colspan="{{ count($dates) * 3 }}" class="text-center">
|
||||
Production Plan Dates
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach($dates as $date)
|
||||
{{-- <th colspan="3" class="text-center">
|
||||
{{ $date }}
|
||||
</th> --}}
|
||||
<th colspan="2" class="text-center border-r-4 border-gray-400">
|
||||
{{ $date }}
|
||||
</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach($dates as $date)
|
||||
{{-- <th class="border px-4 py-2 whitespace-nowrap">Item Quantity</th> --}}
|
||||
<th class="border px-4 py-2 whitespace-nowrap">Plan Quantity</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap border-r-4 border-gray-400">
|
||||
Actual Quantity
|
||||
</th>
|
||||
|
||||
{{-- <th class="border px-4 py-2 whitespace-nowrap">Produced Quantity</th> --}}
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse ($records as $index => $record)
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['plant_name'] }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['line_name'] }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['item_code'] }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['category'] }}</td>
|
||||
|
||||
{{-- @foreach($dates as $date)
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['target_plan'][$date] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['production_plan'][$date] ?? '-' }}</td>
|
||||
@endforeach --}}
|
||||
|
||||
@foreach($dates as $date)
|
||||
@if(in_array($date, $leaveDates))
|
||||
{{-- <td class="border px-4 py-2 whitespace-nowrap">-</td> --}}
|
||||
<td class="border px-4 py-2 whitespace-nowrap">-</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">-</td>
|
||||
@else
|
||||
{{-- <td class="border px-4 py-2 whitespace-nowrap">{{ $record['daily_target'] ?? '-' }}</td> --}}
|
||||
{{-- <td class="border px-4 py-2 whitespace-nowrap">
|
||||
{{ $record['daily_hourly_quantity'][$date] ?? '-' }}
|
||||
</td> --}}
|
||||
<td class="border px-4 py-2 whitespace-nowrap">
|
||||
{{ $record['daily_target_dynamic'][$date] ?? '-' }}
|
||||
</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">
|
||||
{{ $record['produced_quantity'][$date] ?? '-' }}
|
||||
</td>
|
||||
{{-- <td class="border px-4 py-2 whitespace-nowrap">{{ $record['produced_quantity'] ?? '-' }}</td> --}}
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="10" class="px-4 py-4 text-center text-gray-500">
|
||||
No production plan data found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user