Skip to content

Commit

Permalink
[ADVAPP-969]: Add the ability to merge the value in for the preferred…
Browse files Browse the repository at this point in the history
… name of a student and prospect in engagement scenarios (#1103)

* Add the ability to merge the value in for the preferred name of a student and prospect in engagement scenarios

* chore: fix code style

* Reference the correct model

Signed-off-by: Kevin Ullyott <kevin.ullyott@canyongbs.com>

---------

Signed-off-by: Kevin Ullyott <kevin.ullyott@canyongbs.com>
Co-authored-by: ketan-canyon <ketan-canyon@users.noreply.github.com>
Co-authored-by: Kevin Ullyott <kevin.ullyott@canyongbs.com>
  • Loading branch information
3 people authored Nov 6, 2024
1 parent 0c44f07 commit 77cb9ff
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function generateFields(string $fieldPrefix = ''): array
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('email')
->required()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function generateFields(string $fieldPrefix = ''): array
'student last name',
'student full name',
'student email',
'student preferred name',
]),
]),
DateTimePicker::make('execute_at')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static function make(string $context)
'student last name',
'student full name',
'student email',
'student preferred name',
])
->showMergeTagsInBlocksPanel(false)
->profile('email')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected function setUp(): void
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('email')
->required()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->showMergeTagsInBlocksPanel(! ($form->getLivewire() instanceof RelationManager))
->profile('email')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('email')
->columnSpanFull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('email')
->columnSpanFull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static function make(string $context, ?Form $form = null)
'student last name',
'student full name',
'student email',
'student preferred name',
])
->showMergeTagsInBlocksPanel(is_null($form) ? false : ! ($form->getLivewire() instanceof RelationManager))
->profile('sms')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->showMergeTagsInBlocksPanel(! ($form->getLivewire() instanceof RelationManager))
->profile('email')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('sms')
->columnSpanFull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('sms')
->columnSpanFull()
Expand Down
2 changes: 2 additions & 0 deletions app-modules/engagement/src/Models/Engagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public function getMergeData(): array
'student last name' => $this->recipient->getAttribute($this->recipient->displayLastNameKey()),
'student full name' => $this->recipient->getAttribute($this->recipient->displayNameKey()),
'student email' => $this->recipient->getAttribute($this->recipient->displayEmailKey()),
'student preferred name' => $this->recipient->getAttribute($this->recipient->displayPreferredNameKey()),
];
}

Expand All @@ -238,6 +239,7 @@ public static function getMergeTags(string $type): array
'student last name',
'student full name',
'student email',
'student preferred name',
],
default => [],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function form(FilamentForm $form): FilamentForm
'student last name',
'student full name',
'student email',
'student preferred name',
])
->profile('email')
->required(fn (Get $get) => $get('is_enabled'))
Expand Down
1 change: 1 addition & 0 deletions app-modules/form/src/Models/FormEmailAutoReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function getMergeData(Student|Prospect|null $author): array
'student last name' => $author->getAttribute($author->displayLastNameKey()),
'student full name' => $author->getAttribute($author->displayNameKey()),
'student email' => $author->getAttribute($author->displayEmailKey()),
'student preferred name' => $author->getAttribute($author->displayPreferredNameKey()),
];
}
}
5 changes: 5 additions & 0 deletions app-modules/prospect/src/Models/Prospect.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ public static function displayLastNameKey(): string
return 'last_name';
}

public static function displayPreferredNameKey(): string
{
return 'preferred';
}

public static function filamentResource(): string
{
return ProspectResource::class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function form(Form $form): Form
'student last name',
'student full name',
'student email',
'student preferred name',
])
->showMergeTagsInBlocksPanel(! ($form->getLivewire() instanceof RelationManager))
->profile('email')
Expand Down
5 changes: 5 additions & 0 deletions app-modules/student-data-model/src/Models/Student.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public static function displayEmailKey(): string
return 'email';
}

public static function displayPreferredNameKey(): string
{
return 'preferred';
}

public function serviceRequests(): MorphMany
{
return $this->morphMany(
Expand Down

0 comments on commit 77cb9ff

Please sign in to comment.