Added auto focus logic in guard patrol entry #851
@@ -179,6 +179,7 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
Forms\Components\TextInput::make('check_point_name')
|
Forms\Components\TextInput::make('check_point_name')
|
||||||
->label('Check Point Name')
|
->label('Check Point Name')
|
||||||
->required()
|
->required()
|
||||||
|
->autofocus()
|
||||||
->reactive()
|
->reactive()
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
@@ -202,7 +203,7 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$set('check_point_name_id', $checkPoint->id);
|
$set('check_point_name_id', $checkPoint->id);
|
||||||
$set('patrol_time', now()->format('Y-m-d H:i:s'));
|
$set('patrol_time', now());
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
$set('gPeCheckPointNameError', null);
|
$set('gPeCheckPointNameError', null);
|
||||||
})
|
})
|
||||||
@@ -221,11 +222,11 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
}
|
}
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\DateTimePicker::make('patrol_time')
|
Forms\Components\Hidden::make('patrol_time')
|
||||||
->label('Patrol Time')
|
->label('Patrol Time')
|
||||||
->reactive()
|
->reactive()
|
||||||
->default(fn () => now())
|
->default(fn () => now())
|
||||||
->readOnly(fn (Get $get) => ! $get('id'))
|
// ->readOnly(fn (Get $get) => ! $get('id'))
|
||||||
->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);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user