ranjith-dev #493

Merged
jothi merged 2 commits from ranjith-dev into master 2026-03-25 05:50:51 +00:00
Showing only changes of commit c6fd61a9ba - Show all commits

View File

@@ -9,6 +9,7 @@ use App\Models\Item;
use App\Models\Line; use App\Models\Line;
use App\Models\Plant; use App\Models\Plant;
use App\Models\ProcessOrder; use App\Models\ProcessOrder;
use App\Models\ProductCharacteristicsMaster;
use Closure; use Closure;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Forms; use Filament\Forms;
@@ -130,11 +131,14 @@ class ProcessOrderResource extends Resource
->reactive() ->reactive()
->options(function (callable $get) { ->options(function (callable $get) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
if (empty($plantId)) { $lineId = $get('line_id');
if (empty($plantId) || empty($lineId)) {
return []; return [];
} }
return Item::where('plant_id', $plantId)->pluck('code', 'id'); $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');
}) })
->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) {