Skip to content

Commit 4663d9d

Browse files
committed
fix: disable beneficiary type conversion for unknown identities
1 parent ca8ab9f commit 4663d9d

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

app/Filament/Resources/Beneficiaries/Actions/ConvertOcasionalBeneficiaryAction.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ protected function setUp(): void
2727
{
2828
parent::setUp();
2929

30-
$this->visible(fn (Beneficiary $record) => $record->isOcasional());
30+
$this->visible(fn (Beneficiary $record): bool => $record->isOcasional());
31+
32+
$this->disabled(fn (Beneficiary $record): bool => blank($record->full_name));
33+
34+
$this->tooltip(function (Beneficiary $record): ?string {
35+
if (blank($record->full_name)) {
36+
return __('beneficiary.action_convert.disabled_tooltip');
37+
}
38+
39+
return null;
40+
});
3141

3242
$this->label(__('beneficiary.action_convert.action'));
3343

lang/ro/beneficiary.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
'text_line_2' => 'Doriți să modificați tipul beneficiarului în beneficiar propriu?',
8888
'action' => 'Modifică tipul beneficiarului',
8989
'success' => 'Beneficiarul a fost modificat în beneficiar propriu',
90+
'disabled_tooltip' => 'Beneficiarii ocazionali cu identitate necunoscută nu pot fi transformați în beneficiari proprii.',
9091
],
9192

9293
'action_convert_confirm' => [

0 commit comments

Comments
 (0)