ranjith-dev #1133
@@ -208,6 +208,8 @@ class ProductionTarget extends Page
|
||||
}
|
||||
|
||||
$this->dispatch('loadData1' ,$plantId, $lineId, $year, $month);
|
||||
|
||||
$this->dispatch('loadDataMonthly' ,$plantId, $lineId, $year, $month);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
|
||||
@@ -20,6 +20,8 @@ class ProductionTargetPlan extends Component
|
||||
|
||||
public $dates = [];
|
||||
|
||||
public $monthlyRecords;
|
||||
|
||||
public $leaveDates = [];
|
||||
|
||||
public $productionPlanDates = '';
|
||||
@@ -27,6 +29,7 @@ class ProductionTargetPlan extends Component
|
||||
protected $listeners = [
|
||||
'loadData' => 'loadProductionData',
|
||||
'loadData1' => 'exportProductionData',
|
||||
'loadDataMonthly' => 'loadMonthlyPlan',
|
||||
];
|
||||
|
||||
public function getMonthDates($month, $year)
|
||||
@@ -625,6 +628,19 @@ class ProductionTargetPlan extends Component
|
||||
$this->records = $records;
|
||||
}
|
||||
|
||||
public function loadMonthlyPlan($year, $month, $plantId, $lineId){
|
||||
$this->monthlyRecords = ProductionPlan::query()
|
||||
->selectRaw('
|
||||
plant_id,
|
||||
line_id,
|
||||
SUM(plan_quantity) as monthly_plan
|
||||
')
|
||||
->whereYear('created_at', $year)
|
||||
->whereMonth('created_at', $month)
|
||||
->groupBy('plant_id', 'line_id')
|
||||
->get();
|
||||
}
|
||||
|
||||
|
||||
public function exportProductionData()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,63 @@
|
||||
<div class="p-4">
|
||||
|
||||
<div class="p-4 mt-6">
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
MONTHLY PRODUCTION PLAN:
|
||||
</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-sm font-semibold uppercase text-gray-700">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">Plant</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">Line</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">
|
||||
Monthly Plan Quantity
|
||||
</th>
|
||||
</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 font-semibold">
|
||||
{{ $this->loadMonthlyPlan(
|
||||
$year,
|
||||
$month,
|
||||
$record['plant_id'],
|
||||
$record['line_id']
|
||||
) }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="px-4 py-4 text-center text-gray-500">
|
||||
No monthly production plan data found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{-- //.. --}}
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
PRODUCTION PLAN TABLE:
|
||||
</h2>
|
||||
|
||||
Reference in New Issue
Block a user