loaded plants against user rights in production quantity page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m14s
Laravel Larastan / larastan (pull_request) Failing after 4m24s

This commit is contained in:
dhanabalan
2026-03-04 15:55:03 +05:30
parent aae1108271
commit 0e1accaaec

View File

@@ -163,11 +163,15 @@ class ProductionQuantityPage extends Page implements HasForms
return $form
->statePath('filters')
->schema([
Select::make('plant_id')
->options(Plant::pluck('name', 'id'))
// ->options(Plant::pluck('name', 'id'))
->label('Plant')
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required()
->columnSpan(1)
->default(function () {
@@ -419,13 +423,13 @@ class ProductionQuantityPage extends Page implements HasForms
$machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $this->mNam)->first();
if (!$machinenotAgaPlant) {
if (! $machinenotAgaPlant) {
Notification::make()
->title('Unknown WorkCenter')
->body("Work Center not found")
->body('Work Center not found')
->danger()
->send();
$this->form->fill([
$this->form->fill([
'plant_id' => $this->pId,
'machine_id' => $this->mNam,
'block_name' => $this->bNam,
@@ -440,9 +444,9 @@ class ProductionQuantityPage extends Page implements HasForms
// 'operator_id'=> $operatorName,
'recent_qr' => $this->recQr,
]);
return;
}
else if (!$machineAgaPlant) {
} elseif (! $machineAgaPlant) {
Notification::make()
->title('Unknown WorkCenter')
->body("Work Center not found against plant code $PlaCo")
@@ -464,20 +468,20 @@ class ProductionQuantityPage extends Page implements HasForms
// 'operator_id'=> $operatorName,
'recent_qr' => $this->recQr,
]);
return;
}
$rec = ProductionQuantity::where('plant_id', $plantId)->where('machine_id', $machineAgaPlant->id)->latest()->first();
if($rec)
{
if ($rec) {
$item = Item::where('id', $rec->item_id)->where('plant_id', $plantId)->first();
$itemCode = $item?->code ?? '';
$serialNo = $rec->serial_number ?? '';
$this->recQr = $itemCode . ' | ' . $serialNo;
$this->recQr = $itemCode.' | '.$serialNo;
}
@@ -1125,7 +1129,6 @@ class ProductionQuantityPage extends Page implements HasForms
$iCode = trim($splits[0]);
$sNumber = isset($splits[1]) ? trim($splits[1]) : null;
if (! ctype_alnum($iCode)) {
$this->form->fill([