public function form(Form $form): Form
{
return $form
->schema([
Select::make('product_id')
->searchable()
->autofocus()
->label('Search Product')
->getSearchResultsUsing(fn (string $search): array => Product::where('product_name', 'like', "%{$search}%")
->orWhere('barcode', 'like', "%{$search}%")
->limit(20)->pluck('product_name', 'id')->toArray())
->noSearchResultsMessage('No products found.')
->searchPrompt('Search by name or barcode')
->searchingMessage('Searching products...')
->required()
->native(false),
TextInput::make('quantity')
->label('quantity')
->numeric()
->default(1)
->required(),
])->columns(2)
->statePath('data');
}
public function form(Form $form): Form
{
return $form
->schema([
Select::make('product_id')
->searchable()
->autofocus()
->label('Search Product')
->getSearchResultsUsing(fn (string $search): array => Product::where('product_name', 'like', "%{$search}%")
->orWhere('barcode', 'like', "%{$search}%")
->limit(20)->pluck('product_name', 'id')->toArray())
->noSearchResultsMessage('No products found.')
->searchPrompt('Search by name or barcode')
->searchingMessage('Searching products...')
->required()
->native(false),
TextInput::make('quantity')
->label('quantity')
->numeric()
->default(1)
->required(),
])->columns(2)
->statePath('data');
}