Added logic for recently loaded data for lal text input boxes

This commit is contained in:
dhanabalan
2025-06-03 12:56:43 +05:30
parent 22b653fc03
commit ce4f9d7246
2 changed files with 48 additions and 3 deletions

View File

@@ -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