Skip to content

Commit

Permalink
[ADVAPP-935]: Add the ability to filter the list of Message Center en…
Browse files Browse the repository at this point in the history
…gagement by constituents where you are a member of their care team (#1069)

* Add the ability to filter the list of Message Center engagement by constituents where you are a member of their care team

* reeolve suggestions

* chore: fix code style

---------

Co-authored-by: ankit-canyon <[email protected]>
  • Loading branch information
ankit-canyon and ankit-canyon authored Oct 16, 2024
1 parent a6f5800 commit d72e7b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ class="!focus:ring-trout-700 text-advising-app-black-950 dark:text-advising-app-
</div>
</div>

<label class="flex items-center">
<x-filament::input.checkbox wire:model.live="filterMemberOfCareTeam" />
<span class="ml-2">
Member of Care team
</span>
</label>

<label class="flex items-center">
<x-filament::input.checkbox wire:model.live="filterSubscribed" />

Expand All @@ -100,4 +107,5 @@ class="!focus:ring-trout-700 text-advising-app-black-950 dark:text-advising-app-
Open Service Requests
</span>
</label>

</div>
10 changes: 10 additions & 0 deletions app-modules/engagement/src/Filament/Pages/MessageCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class MessageCenter extends Page
#[Url(as: 'endDate')]
public ?string $filterEndDate = null;

#[Url(as: 'hasMemberOfCareTeam')]
public bool $filterMemberOfCareTeam = false;

public int $inboxPerPage = 10;

public static function canAccess(): bool
Expand Down Expand Up @@ -154,6 +157,7 @@ public function updated($property): void
'filterOpenServiceRequests',
'filterStartDate',
'filterEndDate',
'filterMemberOfCareTeam',
];

if (in_array($property, $filters)) {
Expand Down Expand Up @@ -300,6 +304,12 @@ public function applyFilters(Builder $query, string $dateColumn, string $idColum
->open()
->pluck('respondent_id')
);
})
->when($this->filterMemberOfCareTeam === true, function (Builder $query) use ($idColumn) {
$query->whereIn(
$idColumn,
$this->user->careTeams()->pluck('educatable_id')
);
});
}

Expand Down

0 comments on commit d72e7b8

Please sign in to comment.