ranjith-dev #423

Merged
jothi merged 2 commits from ranjith-dev into master 2026-02-27 10:49:56 +00:00
Showing only changes of commit 8a5641ec35 - Show all commits

View File

@@ -1198,17 +1198,23 @@ class InvoiceValidationResource extends Resource
->inlineLabel(false)
->inline(),
Select::make('Plant')
->label('Select Plant')
->label('Search by Plant Name')
->nullable()
// ->options(function () {
// return Plant::pluck('name', 'id');
// })
->searchable()
->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();
if ($userHas && strlen($userHas) > 0) {
Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('invoiceValidations', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id');
}
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('sticker_master_id', null);
$set('operator_id', null);
@@ -1222,6 +1228,8 @@ class InvoiceValidationResource extends Resource
Select::make('sticker_master_id')
->label('Search by Item Code')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$pId = $get('Plant');
@@ -1234,9 +1242,7 @@ class InvoiceValidationResource extends Resource
}
$query->whereHas('invoiceValidations');
})->pluck('code', 'id');
})
->searchable()
->reactive(),
}),
Select::make('scanned_status')
->label('Scanned Status')
->nullable()
@@ -1356,7 +1362,7 @@ class InvoiceValidationResource extends Resource
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;