Added description loaded logic in editing in process order screen
This commit is contained in:
@@ -23,7 +23,8 @@ use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use App\Filament\Exports\ProcessOrderExporter;
|
||||
use App\Filament\Imports\ProcessOrderImporter;
|
||||
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
|
||||
class ProcessOrderResource extends Resource
|
||||
{
|
||||
@@ -83,10 +84,26 @@ class ProcessOrderResource extends Resource
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
|
||||
Forms\Components\TextInput::make('item_description')
|
||||
->label('Description')
|
||||
->required()
|
||||
->reactive(),
|
||||
->reactive()
|
||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||
$itemId = $get('item_id');
|
||||
if ($get('id')) {
|
||||
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
||||
if ($item) {
|
||||
$set('item_description', $item);
|
||||
} else {
|
||||
$set('item_description', null);
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
// ->readOnly(true),
|
||||
Forms\Components\TextInput::make('process_order')
|
||||
->label('Process Order')
|
||||
@@ -277,7 +294,6 @@ class ProcessOrderResource extends Resource
|
||||
// ->send();
|
||||
// }),
|
||||
]),
|
||||
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
|
||||
Reference in New Issue
Block a user