-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add email templates for approved consultation access enquiry (#67)
- Loading branch information
Showing
3 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/ConsultationAccess/ConsultationAccessEnquiryApprovedVariables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace EscolaLms\TemplatesEmail\ConsultationAccess; | ||
|
||
use EscolaLms\Core\Models\User; | ||
use EscolaLms\Templates\Events\EventWrapper; | ||
|
||
class ConsultationAccessEnquiryApprovedVariables extends CommonConsultationAccessEnquiryVariables | ||
{ | ||
const VAR_APPROVED_TERM = '@VarApprovedTerm'; | ||
const VAR_MEETING_LINK = '@VarMeetingLink'; | ||
|
||
public static function mockedVariables(?User $user = null): array | ||
{ | ||
$faker = \Faker\Factory::create(); | ||
return array_merge(parent::mockedVariables(), [ | ||
self::VAR_APPROVED_TERM => $faker->dateTime->format('Y-m-d H:i'), | ||
self::VAR_MEETING_LINK => $faker->url, | ||
]); | ||
} | ||
|
||
public static function requiredVariables(): array | ||
{ | ||
return array_merge(parent::requiredVariables(), [ | ||
self::VAR_APPROVED_TERM, | ||
self::VAR_MEETING_LINK, | ||
]); | ||
} | ||
|
||
public static function requiredVariablesInSection(string $sectionKey): array | ||
{ | ||
if ($sectionKey === 'content') { | ||
return array_merge(parent::requiredVariablesInSection($sectionKey), [ | ||
self::VAR_APPROVED_TERM, | ||
self::VAR_MEETING_LINK, | ||
]); | ||
} | ||
return []; | ||
} | ||
|
||
public static function variablesFromEvent(EventWrapper $event): array | ||
{ | ||
return array_merge(parent::variablesFromEvent($event), [ | ||
self::VAR_APPROVED_TERM => $event->getConsultationAccessEnquiry()->consultationUser->executed_at, | ||
self::VAR_MEETING_LINK => $event->getConsultationAccessEnquiry()->meeting_link, | ||
]); | ||
} | ||
|
||
public static function defaultSectionsContent(): array | ||
{ | ||
return [ | ||
'title' => __('Approved term ":consultation"', [ | ||
'consultation' => self::VAR_CONSULTATION_NAME, | ||
]), | ||
'content' => self::wrapWithMjml(__('<h1>Hello :user_name!</h1><p>Reported term :approved_term for consultation ":consultation" was approved. Meeting link: :link</p>', [ | ||
'user_name' => self::VAR_USER_NAME, | ||
'consultation' => self::VAR_CONSULTATION_NAME, | ||
'approved_term' => self::VAR_APPROVED_TERM, | ||
'link' => self::VAR_MEETING_LINK, | ||
])), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters