From 9bf084cfb5bf8b89d9b7e6974aa72e63fa4d715c Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Fri, 27 Dec 2024 21:32:30 +0200 Subject: [PATCH] disable role options in create beneficiary final step --- .../BeneficiaryResource/Pages/CreateBeneficiary.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php index c4d4f420..d7ef66dc 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php @@ -369,7 +369,11 @@ protected function getSteps(): array $roles[-1] = __('beneficiary.section.specialists.labels.without_role'); return $roles; - }), + }) + ->disableOptionWhen(fn (Get $get, string $value) => $value === '-1' ? + array_diff($get('roles'), ['-1']): + in_array('-1', $get('roles'))) + ->live(), ]), ]), ];