1
0
forked from poc/pds

Refactor plant selection logic in ItemResource and StickerMasterResource to order by code

This commit is contained in:
dhanabalan
2025-12-01 10:09:22 +05:30
parent c8c38a05f4
commit 173638cd19
2 changed files with 10 additions and 14 deletions

View File

@@ -601,7 +601,7 @@ class StickerMasterResource extends Resource
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->orderBy('code')->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {