After Production Quantity and Overall Validation
This commit is contained in:
@@ -15,6 +15,7 @@ use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
|
||||
class CompanyResource extends Resource
|
||||
{
|
||||
@@ -24,15 +25,40 @@ class CompanyResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Master Entries';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
//->citext('name')
|
||||
->unique(ignoreRecord: true)
|
||||
->columnSpanFull(),
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
//->citext('name')
|
||||
->placeholder('Scan the valid name')
|
||||
->unique(ignoreRecord: true)
|
||||
->columnSpanFull()
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$companyId = $get('name');
|
||||
// Ensure `linestop_id` is not cleared
|
||||
if (!$companyId) {
|
||||
$set('cNameError', 'Scan the valid name first.');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$set('cNameError', null);
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('cNameError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('cNameError') ? $get('cNameError') : null)
|
||||
->hintColor('danger'),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user