Merge pull request 'Commented item_id load functionality on resource page and process order import only if it has characteristics master' (#494) from ranjith-dev into master
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run

Reviewed-on: #494
This commit was merged in pull request #494.
This commit is contained in:
2026-03-25 08:42:18 +00:00
2 changed files with 14 additions and 13 deletions

View File

@@ -240,17 +240,17 @@ class ProcessOrderImporter extends Importer
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code!'; $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) { // if (! $masterExist) {
$warnMsg[] = 'Characteristics master not found for the given plant!'; // $warnMsg[] = 'Characteristics master not found for the given plant!';
} else { // } else {
$masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first(); // $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first();
if (! $masterExist) { // if (! $masterExist) {
$warnMsg[] = 'Characteristics master not found for the given line!'; // $warnMsg[] = 'Characteristics master not found for the given line!';
} // }
} // }
} }
// $user = User::where('name', $this->data['created_by'])->first(); // $user = User::where('name', $this->data['created_by'])->first();

View File

@@ -131,14 +131,15 @@ class ProcessOrderResource extends Resource
->reactive() ->reactive()
->options(function (callable $get) { ->options(function (callable $get) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
$lineId = $get('line_id'); // $lineId = $get('line_id');
if (empty($plantId) || empty($lineId)) { if (empty($plantId)) {// || empty($lineId)
return []; 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'))) ->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) { ->afterStateUpdated(function (callable $set, callable $get, ?string $state) {