Added export serial numbers for production order
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Laravel Pint / pint (pull_request) Successful in 2m57s
Laravel Larastan / larastan (pull_request) Failing after 4m3s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Laravel Pint / pint (pull_request) Successful in 2m57s
Laravel Larastan / larastan (pull_request) Failing after 4m3s
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\ProductionOrderResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ProductionOrderResource;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionOrder;
|
||||
use Filament\Actions;
|
||||
@@ -159,6 +160,64 @@ class ViewProductionOrder extends ViewRecord
|
||||
}
|
||||
}
|
||||
|
||||
public function exportSerialNo(){
|
||||
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||
|
||||
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||
|
||||
$itemId = trim($this->form->getState()['item_id'] ?? '') ?? null;
|
||||
|
||||
$fromSerNo = trim($this->form->getState()['from_serial_number'] ?? '') ?? null;
|
||||
|
||||
$toSerNo = trim($this->form->getState()['to_serial_number'] ?? '') ?? null;
|
||||
|
||||
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||
|
||||
// $itemCode = Item::where('id', $itemId)->value('code');
|
||||
|
||||
if (empty($plantId)) {
|
||||
Notification::make()
|
||||
->title('Plant name cannot be empty!')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
} elseif (empty($pOrder)) {
|
||||
Notification::make()
|
||||
->title('Production order cannot be empty!')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
elseif (empty($fromSerNo)) {
|
||||
Notification::make()
|
||||
->title('From serial number cannot be empty!')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
elseif (empty($toSerNo)) {
|
||||
Notification::make()
|
||||
->title('To serial number cannot be empty!')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||
|
||||
if (! $pOrderExists) {
|
||||
Notification::make()
|
||||
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
} else {
|
||||
return redirect()->route('production-orders.exportSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode, 'from_serial_no' => $fromSerNo, 'to_serial_no' => $toSerNo]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user