Added logic for recently loaded data for lal text input boxes
This commit is contained in:
@@ -12,6 +12,17 @@ class CreateQualityValidation extends CreateRecord
|
||||
{
|
||||
protected static string $resource = QualityValidationResource::class;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
parent::mount();
|
||||
session()->forget([
|
||||
'last_selected_plant_id',
|
||||
'last_selected_line',
|
||||
'last_selected_production',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
protected function beforeCreate(): void
|
||||
{
|
||||
$errors = [];
|
||||
@@ -93,6 +104,24 @@ class CreateQualityValidation extends CreateRecord
|
||||
}
|
||||
}
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
// Get the value from the hidden field 'plant'
|
||||
$plant = $this->form->getState()['plant'] ?? null;
|
||||
$line = $this->form->getState()['line'] ?? null;
|
||||
$production = $this->form->getState()['production'] ?? null;
|
||||
if ($plant) {
|
||||
session(['last_selected_plant_id' => $plant]);
|
||||
}
|
||||
if ($line) {
|
||||
session(['last_selected_line' => $line]);
|
||||
}
|
||||
if ($production) {
|
||||
session(['last_selected_production' => $production]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
//return $this->getResource()::getUrl('create'); // Stay on Create Page after saving
|
||||
|
||||
Reference in New Issue
Block a user