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