Skip to content

Commit

Permalink
TM-1326] update remider emails (#666)
Browse files Browse the repository at this point in the history
LimberHope authored Jan 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent a014905 commit 7f2d9f1
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions app/Mail/ReportReminder.php
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
namespace App\Mail;

use App\Models\V2\ReportModel;
use App\Models\V2\Sites\Site;
use Illuminate\Support\Str;

class ReportReminder extends I18nMail
@@ -13,14 +14,36 @@ public function __construct($entity, $feedback, $user)
{
parent::__construct($user);
$this->entity = $entity;
$entityName = '';
$task = $entity->task;
$projectUUID = $task->project()->value('uuid');
$entityClass = Str::kebab(explode_pop('\\', get_class($entity)));
$callbackUrl = '/project/'.$projectUUID.'/reporting-task/'.$task->uuid;
$frontEndUrl = config('app.front_end');

if ($entityClass == 'project-report') {
$entityName = $entity->project->name;
}
if ($entityClass == 'site-report') {
$entityName = Site::find($entity->site_id)?->value('name');
}
if ($entityClass == 'nursery-report') {
$entityName = $entity->nursery->name;
}

if (! Str::endsWith($frontEndUrl, '/')) {
$frontEndUrl .= '/';
}
$feedback = empty($feedback) ? '(No feedback)' : $feedback;

$this->setSubjectKey('report-reminder.subject')
->setTitleKey('report-reminder.title')
->setBodyKey('report-reminder.body')
->setParams([
'{entityTypeName}' => $this->getEntityTypeName($entity),
'{entityModelName}' => $entityName,
'{entityStatus}' => str_replace('-', ' ', $entity->status),
'{callbackUrl}' => $frontEndUrl . $callbackUrl,
'{feedback}' => $feedback,
]);
}
4 changes: 2 additions & 2 deletions database/seeders/LocalizationKeysTableSeeder.php
Original file line number Diff line number Diff line change
@@ -320,8 +320,8 @@ public function run(): void
// report-reminder
$this->createLocalizationKey('report-reminder.subject', 'Reminder: Your {entityTypeName} Still Needs Your Input');
$this->createLocalizationKey('report-reminder.title', 'Reminder: Your {entityTypeName} Still Needs Your Input');
$this->createLocalizationKey('report-reminder.body', 'This is a reminder that your {entityTypeName} still has the status {entityStatus}. Below you will see a note from your project manager about the report.<br><br>
If you have any questions, please reach out to your project manager or to [email protected].<br><br>{feedback}');
$this->createLocalizationKey('report-reminder.body', 'This is a reminder that your {entityTypeName} for {entityModelName} still has the status: {entityStatus}. Below you will see a note from your project manager about the report.<br><br>
Here is a link to the reporting task on TerraMatch so you can easily access your report: <a href="{callbackUrl}" style="color: #6E6E6E;">Here.</a> If you have any questions, please reach out to your project manager or to [email protected].<br><br>{feedback}');

// task-digest
$this->createLocalizationKey('task-digest.subject', '{projectName} - Report Summary for {date}');

0 comments on commit 7f2d9f1

Please sign in to comment.