Skip to content

Commit 1855279

Browse files
[ADVAPP-2295]: Improve the unified inbox wizard by updating the step names and improving the touch controls for the recipient (#2232)
* Rename engagement sending wizard steps * Update code formatting and copyright headers * Upgrade Filament to v4.6.0 * Apply toggle buttons to educatable select and message type select * Update code formatting and copyright headers * Commit to trigger CI * Update code formatting and copyright headers * Address failing test * Address PR feedback * Address request from product * Update code formatting and copyright headers * Ensure consistancy across engagement modals on holistic profile * Hide unavailable options from UI * Update code formatting and copyright headers * Correct message type visibility condition * Update code formatting and copyright headers --------- Co-authored-by: rebecca-canyon <198644076+rebecca-canyon@users.noreply.github.com>
1 parent 6869e19 commit 1855279

7 files changed

Lines changed: 515 additions & 470 deletions

File tree

app-modules/basic-needs/src/Filament/Actions/SendEmailAction.php

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@
4848
use Filament\Forms\Components\DateTimePicker;
4949
use Filament\Forms\Components\Select;
5050
use Filament\Forms\Components\Toggle;
51+
use Filament\Forms\Components\ToggleButtons;
5152
use Filament\Pages\Page;
5253
use Filament\Schemas\Components\Grid;
54+
use Filament\Schemas\Components\Section;
5355
use Filament\Schemas\Components\Utilities\Get;
5456
use Filament\Schemas\Components\Utilities\Set;
5557
use Filament\Schemas\Components\Wizard\Step;
@@ -73,7 +75,7 @@ public static function make(string $view): Action
7375
return Action::make('send_email')
7476
->label('Send Email')
7577
->icon('heroicon-m-chat-bubble-bottom-center-text')
76-
->modalHeading('Send Engagement')
78+
->modalHeading('Send Message')
7779
->model(Engagement::class)
7880
->authorize(fn () => Auth::user()->can('create', Engagement::class))
7981
->steps(fn (): array => self::getSteps($view))
@@ -107,31 +109,36 @@ protected static function getSteps(string $view): array
107109
*/
108110
protected static function getContactInformationStep(string $view): Step
109111
{
110-
return Step::make('Contact Information')
112+
return Step::make('Recipient Details')
111113
->schema([
112-
Select::make('recipient_type')
113-
->label('Recipient Type')
114-
->options([
115-
'student' => 'Student',
116-
'prospect' => 'Prospect',
117-
])
118-
->live()
119-
->afterStateUpdated(fn (Set $set) => $set('recipient_id', null))
120-
->required(),
121-
Select::make('recipient_id')
122-
->label('Recipient')
123-
->searchable()
124-
->hidden(fn (Get $get) => ! filled($get('recipient_type')))
125-
->options(fn (Get $get) => self::getRecipientOptions($get))
126-
->getSearchResultsUsing(fn (string $search, Get $get) => self::getRecipientSearchResults($search, $get))
127-
->getOptionLabelUsing(fn (string $value, Get $get) => self::getRecipientOptionLabel($value, $get))
128-
->afterStateUpdated(function (Get $get, Set $set, Component $livewire) use ($view) {
129-
$record = method_exists($livewire, 'getRecord') ? $livewire->getRecord() : null;
130-
131-
self::updateBodyAndRouteId($get, $set, $record, $view);
132-
})
133-
->live()
134-
->required(),
114+
Section::make()
115+
->label('Recipient Info')
116+
->schema([
117+
ToggleButtons::make('recipient_type')
118+
->label('Recipient Type')
119+
->options([
120+
'student' => 'Student',
121+
'prospect' => 'Prospect',
122+
])
123+
->inline()
124+
->live()
125+
->afterStateUpdated(fn (Set $set) => $set('recipient_id', null))
126+
->required(),
127+
Select::make('recipient_id')
128+
->label('Recipient')
129+
->searchable()
130+
->hidden(fn (Get $get) => ! filled($get('recipient_type')))
131+
->options(fn (Get $get) => self::getRecipientOptions($get))
132+
->getSearchResultsUsing(fn (string $search, Get $get) => self::getRecipientSearchResults($search, $get))
133+
->getOptionLabelUsing(fn (string $value, Get $get) => self::getRecipientOptionLabel($value, $get))
134+
->afterStateUpdated(function (Get $get, Set $set, Component $livewire) use ($view) {
135+
$record = method_exists($livewire, 'getRecord') ? $livewire->getRecord() : null;
136+
137+
self::updateBodyAndRouteId($get, $set, $record, $view);
138+
})
139+
->live()
140+
->required(),
141+
]),
135142

136143
Grid::make(1)
137144
->schema(fn (Get $get) => self::getRecipientRouteIdSchema($get))
@@ -144,7 +151,7 @@ protected static function getContactInformationStep(string $view): Step
144151
*/
145152
protected static function getContentStep(string $view): Step
146153
{
147-
return Step::make('Content')
154+
return Step::make('Message Details')
148155
->schema(function (Get $get) use ($view): array {
149156
$educatable = self::resolveRecipient($get('recipient_type'), $get('recipient_id'));
150157

@@ -197,7 +204,7 @@ protected static function getSignatureStep(): Step
197204

198205
protected static function getSendLaterStep(): Step
199206
{
200-
return Step::make('Send Your Message')
207+
return Step::make('Delivery Details')
201208
->schema([
202209
Toggle::make('send_later')
203210
->reactive()

0 commit comments

Comments
 (0)