Added export button in non planned production page #1222
@@ -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
|
public static function canAccess(): bool
|
||||||
{
|
{
|
||||||
return Auth::check() && Auth::user()->can('view production non planned page');
|
return Auth::check() && Auth::user()->can('view production non planned page');
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
{{ $this->form }}
|
{{ $this->form }}
|
||||||
</div>
|
</div>
|
||||||
|
<x-filament::button
|
||||||
|
wire:click="exportNonPlan"
|
||||||
|
color="primary"
|
||||||
|
class="mt-4"
|
||||||
|
>
|
||||||
|
Export
|
||||||
|
</x-filament::button>
|
||||||
<x-filament::button
|
<x-filament::button
|
||||||
wire:click="generateNonPlan"
|
wire:click="generateNonPlan"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|||||||
Reference in New Issue
Block a user