Added print second produciton order sticker method in all resource pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 21s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m58s
Laravel Larastan / larastan (pull_request) Failing after 5m56s

This commit is contained in:
dhanabalan
2026-11-26 08:34:44 +05:30
parent 7c1adfc37b
commit de395d9694
3 changed files with 109 additions and 0 deletions

View File

@@ -211,6 +211,42 @@ class CreateProductionOrder extends CreateRecord
}
}
public function printProductionOrderSecond()
{
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
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;
}
$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.print2', ['production_order' => $pOrder]);
}
}
public function printItemSerial()
{
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
@@ -378,6 +414,7 @@ class CreateProductionOrder extends CreateRecord
}
}
protected function getFormActions(): array
{
return [];

View File

@@ -49,6 +49,42 @@ class EditProductionOrder extends EditRecord
}
}
public function printProductionOrderSecond()
{
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
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;
}
$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.print2', ['production_order' => $pOrder]);
}
}
public function printPanel()
{
$plantId = $this->form->getState()['plant_id'] ?? null;

View File

@@ -50,6 +50,42 @@ class ViewProductionOrder extends ViewRecord
}
}
public function printProductionOrderSecond()
{
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
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;
}
$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.print2', ['production_order' => $pOrder]);
}
}
public function printPanel()
{
$plantId = $this->form->getState()['plant_id'] ?? null;