Skip to content

Commit

Permalink
Merge pull request #468 from code4romania/279-all-specialists-are-lis…
Browse files Browse the repository at this point in the history
…ted-in-the-add-specialist-module-for-echipa-de-caz

Filter specialist by status in case team
  • Loading branch information
gheorghelupu17 authored Dec 31, 2024
2 parents 15f7edf + 90fe8e9 commit 1d0e976
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function table(Table $table): Table
EditAction::make()
->form($this->getFormSchema())
->fillForm(function (Specialist $record) {
if (!$record->role_id) {
if (! $record->role_id) {
$record->role_id = -1;
}

Expand Down Expand Up @@ -128,7 +128,7 @@ public function getFormSchema(): array
->label(__('beneficiary.section.specialists.labels.name'))
->options(
function (Get $get, $state) {
$roleID = (int)$get('role_id');
$roleID = (int) $get('role_id');
if ($roleID === -1) {
if ($state) {
return [$state => User::find($state)->full_name];
Expand All @@ -155,7 +155,11 @@ function (Get $get, $state) {
fn (Specialist $specialist) => $specialist->role_id === (int) $get('role_id') && $specialist->user_id !== $record?->user_id
)
->map(fn (Specialist $specialist) => $specialist->user_id)
->contains($value)
->contains($value) ||
! User::query()
->find($value)
->userStatus
->isActive()
)
->searchable()
->preload()
Expand Down

0 comments on commit 1d0e976

Please sign in to comment.