From 88f1674f23625327d82efb15e292e86f833341ff Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 25 Mar 2026 14:11:21 +0530 Subject: [PATCH] Commented item_id load functionality on resource page and process order import only if it has characteristics master --- app/Filament/Imports/ProcessOrderImporter.php | 18 +++++++++--------- .../Resources/ProcessOrderResource.php | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/Filament/Imports/ProcessOrderImporter.php b/app/Filament/Imports/ProcessOrderImporter.php index 23f389d..abcd15f 100644 --- a/app/Filament/Imports/ProcessOrderImporter.php +++ b/app/Filament/Imports/ProcessOrderImporter.php @@ -240,17 +240,17 @@ class ProcessOrderImporter extends Importer $warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code!'; } - $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first(); + // $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first(); - if (! $masterExist) { - $warnMsg[] = 'Characteristics master not found for the given plant!'; - } else { - $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first(); + // if (! $masterExist) { + // $warnMsg[] = 'Characteristics master not found for the given plant!'; + // } else { + // $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first(); - if (! $masterExist) { - $warnMsg[] = 'Characteristics master not found for the given line!'; - } - } + // if (! $masterExist) { + // $warnMsg[] = 'Characteristics master not found for the given line!'; + // } + // } } // $user = User::where('name', $this->data['created_by'])->first(); diff --git a/app/Filament/Resources/ProcessOrderResource.php b/app/Filament/Resources/ProcessOrderResource.php index 23836a4..1ba0cd9 100644 --- a/app/Filament/Resources/ProcessOrderResource.php +++ b/app/Filament/Resources/ProcessOrderResource.php @@ -131,14 +131,15 @@ class ProcessOrderResource extends Resource ->reactive() ->options(function (callable $get) { $plantId = $get('plant_id'); - $lineId = $get('line_id'); - if (empty($plantId) || empty($lineId)) { + // $lineId = $get('line_id'); + if (empty($plantId)) {// || empty($lineId) return []; } - $availItems = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('item_id', 'item_id')->toArray(); + // $availItems = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('item_id', 'item_id')->toArray(); - return Item::where('plant_id', $plantId)->whereIn('id', $availItems)->pluck('code', 'id'); // return Item::where('plant_id', $plantId)->pluck('code', 'id'); + // return Item::where('plant_id', $plantId)->whereIn('id', $availItems)->pluck('code', 'id'); + return Item::where('plant_id', $plantId)->pluck('code', 'id'); }) ->disabled(fn (Get $get) => ! empty($get('id'))) ->afterStateUpdated(function (callable $set, callable $get, ?string $state) {