Added export button in non planned production page #1222

Merged
jothi merged 1 commits from ranjith-dev into master 2026-10-12 08:41:45 +00:00
2 changed files with 54 additions and 0 deletions

View File

@@ -174,6 +174,53 @@ class ProductionNonPlannedReport extends Page implements HasForms
}
}
public function exportNonPlan(){
$plantId = $this->filters['plant_id'] ?? null;
$lineId = $this->filters['line_id'] ?? null;
$date = $this->filters['date'] ?? null;
$selectedDate = Carbon::parse($date);
$date = $selectedDate->toDateString();
$month = $selectedDate->month;
$year = $selectedDate->year;
if (! $plantId) {
Notification::make()
->title('Plant')
->body("please select plant to export data..!")
->danger()
->send();
return;
}
else if (! $lineId) {
Notification::make()
->title('Line')
->body("please select line to export data..!")
->danger()
->send();
return;
}
else if (! $year) {
Notification::make()
->title('Year')
->body("please select year to export data..!")
->danger()
->send();
return;
}
else if (! $month) {
Notification::make()
->title('Month')
->body("please select month to export data..!")
->danger()
->send();
return;
}
$this->dispatch('loadDataExport' ,$plantId, $lineId, $year, $month);
}
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view production non planned page');

View File

@@ -5,6 +5,13 @@
<div class="space-y-4">
{{ $this->form }}
</div>
<x-filament::button
wire:click="exportNonPlan"
color="primary"
class="mt-4"
>
Export
</x-filament::button>
<x-filament::button
wire:click="generateNonPlan"
color="primary"