Skip to content

Commit

Permalink
fix save benefit without types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 committed Dec 24, 2024
1 parent 91a0c27 commit 90c6d45
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,15 @@ protected function getHeaderActions(): array
->url(BenefitResource::getUrl()),
];
}

public function mutateFormDataBeforeCreate(array $data): array
{
foreach ($this->data['benefitTypes'] as $key => $value) {
if (! $value['name']) {
unset($this->data['benefitTypes'][$key]);
}
}

return $data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ protected function getHeaderActions(): array
->tooltip(fn (Actions\DeleteAction $action) => $action->isDisabled() ? __('nomenclature.helper_texts.delete_benefit') : ''),
];
}

public function beforeSave(): void
{
foreach ($this->data['benefitTypes'] as $key => $value) {
if (! $value['name']) {
unset($this->data['benefitTypes'][$key]);
}
}
}
}

0 comments on commit 90c6d45

Please sign in to comment.