Refactored form design, validation and Added items - description, category, uom in resource files
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s

This commit is contained in:
dhanabalan
2026-10-08 09:59:45 +05:30
parent 867c97288f
commit 110b8b2e92
4 changed files with 91 additions and 19 deletions

View File

@@ -1049,6 +1049,27 @@ class RequestCharacteristicResource extends Resource
->alignCenter() ->alignCenter()
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Description')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.category')
->label('Category')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.uom')
->label('Unit of Measure')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('aufnr') Tables\Columns\TextColumn::make('aufnr')
->label('Job Number') ->label('Job Number')
->alignCenter() ->alignCenter()

View File

@@ -1183,6 +1183,27 @@ class TempClassCharacteristicResource extends Resource
->alignCenter() ->alignCenter()
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('DESCRIPTION')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.category')
->label('CATEGORY')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.uom')
->label('UNIT OF MEASURE')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('model_type') Tables\Columns\TextColumn::make('model_type')
->label('MODEL TYPE') ->label('MODEL TYPE')
->alignCenter() ->alignCenter()

View File

@@ -128,7 +128,7 @@ class TempStopCharacteristicResource extends Resource
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required() ->required()
->disabled(fn (Get $get) => ! empty($get('id'))), ->readonly(fn (Get $get) => ! empty($get('id'))),
Forms\Components\TextInput::make('aufnr') Forms\Components\TextInput::make('aufnr')
->label('Job Number') ->label('Job Number')
->reactive() ->reactive()
@@ -152,18 +152,16 @@ class TempStopCharacteristicResource extends Resource
return ($userHas && strlen($userHas) > 0) ? null : optional(TempStopCharacteristic::latest()->first())->aufnr ?? null; return ($userHas && strlen($userHas) > 0) ? null : optional(TempStopCharacteristic::latest()->first())->aufnr ?? null;
}) })
->readOnly(fn ($get) => ($get('item_id') == null)) ->readonly(fn (Get $get) => ! empty($get('id')) || ! $get('item_id')),
->disabled(fn (Get $get) => ! empty($get('id'))),
Forms\Components\TextInput::make('gernr') Forms\Components\TextInput::make('gernr')
->label('Serial Number') ->label('Serial Number')
->reactive() ->reactive()
->minLength(13) ->minLength(13)
->readOnly(fn (callable $get) => ! $get('aufnr'))
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required() ->required()
->disabled(fn (Get $get) => ! empty($get('id'))), ->readonly(fn (Get $get) => ! empty($get('id')) || ! $get('aufnr')),
Forms\Components\TextInput::make('zmm_heading') Forms\Components\TextInput::make('zmm_heading')
->label('Zmm Heading') ->label('Zmm Heading')
->reactive() ->reactive()
@@ -172,7 +170,7 @@ class TempStopCharacteristicResource extends Resource
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required() ->required()
->disabled(fn (Get $get) => ! empty($get('id'))), ->readonly(fn (Get $get) => ! empty($get('id'))),
Forms\Components\Select::make('model_type') Forms\Components\Select::make('model_type')
->label('Model Type') ->label('Model Type')
->reactive() ->reactive()
@@ -200,7 +198,7 @@ class TempStopCharacteristicResource extends Resource
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required() ->required()
->disabled(fn (Get $get) => ! empty($get('id'))), ->readonly(fn (Get $get) => ! empty($get('id'))),
Forms\Components\TextInput::make('samlight_logged_name') Forms\Components\TextInput::make('samlight_logged_name')
->label('SAMLight Logged Name') ->label('SAMLight Logged Name')
->reactive() ->reactive()
@@ -208,7 +206,7 @@ class TempStopCharacteristicResource extends Resource
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->disabled(fn (Get $get) => ! empty($get('id'))), ->readonly(fn (Get $get) => ! empty($get('id'))),
Forms\Components\DateTimePicker::make('stopped_at') Forms\Components\DateTimePicker::make('stopped_at')
->label('Stopped At') ->label('Stopped At')
->default(now()) ->default(now())
@@ -216,7 +214,8 @@ class TempStopCharacteristicResource extends Resource
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required(), ->required()
->disabled(fn (Get $get) => ! empty($get('id'))),
Forms\Components\TextInput::make('stopped_by') Forms\Components\TextInput::make('stopped_by')
->label('Stopped By') ->label('Stopped By')
->reactive() ->reactive()
@@ -224,7 +223,8 @@ class TempStopCharacteristicResource extends Resource
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required(), ->required()
->readonly(fn (Get $get) => ! empty($get('id'))),
Forms\Components\TextInput::make('has_stop_flow_id') Forms\Components\TextInput::make('has_stop_flow_id')
->label('Has Stop Flow ID') ->label('Has Stop Flow ID')
->reactive() ->reactive()
@@ -236,7 +236,8 @@ class TempStopCharacteristicResource extends Resource
} }
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->required(), ->required()
->readonly(fn (Get $get) => ! empty($get('id'))),
Forms\Components\Hidden::make('created_by') Forms\Components\Hidden::make('created_by')
->label('Created By') ->label('Created By')
->default(Filament::auth()->user()?->name), ->default(Filament::auth()->user()?->name),
@@ -284,6 +285,27 @@ class TempStopCharacteristicResource extends Resource
->alignCenter() ->alignCenter()
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Description')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.category')
->label('Category')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.uom')
->label('Unit of Measure')
->default('-')
->searchable()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('aufnr') Tables\Columns\TextColumn::make('aufnr')
->label('Job Number') ->label('Job Number')
->alignCenter() ->alignCenter()

View File

@@ -141,7 +141,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('aufnr') Forms\Components\TextInput::make('aufnr')
->label('AUFNR') ->label('AUFNR')
->placeholder('Scan the AUFNR') ->placeholder('Scan the AUFNR')
@@ -150,7 +151,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('gernr') Forms\Components\TextInput::make('gernr')
->label('GERNR') ->label('GERNR')
->placeholder('Scan the GERNR') ->placeholder('Scan the GERNR')
@@ -159,7 +161,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('model_type') Forms\Components\TextInput::make('model_type')
->label('Model Type') ->label('Model Type')
->placeholder('Scan the Model Type') ->placeholder('Scan the Model Type')
@@ -168,7 +171,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('winded_qr') Forms\Components\TextInput::make('winded_qr')
->label('Winded QR') ->label('Winded QR')
->placeholder('Scan the Winded QR') ->placeholder('Scan the Winded QR')
@@ -176,7 +180,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('winded_code') Forms\Components\TextInput::make('winded_code')
->label('Winded Code') ->label('Winded Code')
->placeholder('Scan the Winded Code') ->placeholder('Scan the Winded Code')
@@ -184,7 +189,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('winded_serial_number') Forms\Components\TextInput::make('winded_serial_number')
->label('Winded Serial Number') ->label('Winded Serial Number')
->placeholder('Scan the Winded Serial Number') ->placeholder('Scan the Winded Serial Number')
@@ -192,7 +198,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('winded_status') Forms\Components\TextInput::make('winded_status')
->label('Winded Status') ->label('Winded Status')
->placeholder('Scan the Winded Status') ->placeholder('Scan the Winded Status')
@@ -201,7 +208,8 @@ class WindedSerialValidationErrorResource extends Resource
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set) { ->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), })
->readOnly(fn (Get $get) => $get('id')),
Forms\Components\TextInput::make('created_by') Forms\Components\TextInput::make('created_by')
->default(fn () => Filament::auth()->user()?->name) ->default(fn () => Filament::auth()->user()?->name)
->readOnly() ->readOnly()