refactor: update email template for internship status updates

This commit is contained in:
Veronika Fehérvíziová
2025-12-02 22:51:29 +01:00
parent b95cdb070d
commit 01aae85efc
2 changed files with 22 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Mail;
use App\Enums\InternshipStatus;
use App\Models\Internship;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
@@ -15,25 +16,23 @@ class InternshipStatusUpdated extends Mailable
use Queueable, SerializesModels;
private Internship $internship;
private string $changedByName;
private string $studentName;
private string $companyName;
private InternshipStatus $oldStatus;
private InternshipStatus $newStatus;
private string $note;
private User $changedBy;
private bool $recipiantIsStudent;
/**
* Create a new message instance.
*/
public function __construct(Internship $internship, string $changedByName, string $studentName, string $companyName, InternshipStatus $oldStatus, InternshipStatus $newStatus, string $note)
public function __construct(Internship $internship, InternshipStatus $oldStatus, InternshipStatus $newStatus, string $note, User $changedBy, bool $recipiantIsStudent)
{
$this->internship = $internship;
$this->changedByName = $changedByName;
$this->studentName = $studentName;
$this->companyName = $companyName;
$this->oldStatus = $oldStatus;
$this->newStatus = $newStatus;
$this->note = $note;
$this->changedBy = $changedBy;
$this->recipiantIsStudent = $recipiantIsStudent;
}
/**
@@ -55,12 +54,11 @@ class InternshipStatusUpdated extends Mailable
view: 'mail.internship.status_updated',
with: [
"internship" => $this->internship,
"changedByName" => $this->changedByName,
"studentName" => $this->studentName,
"companyName" => $this->companyName,
"oldStatus" => $this->prettyStatus($this->oldStatus->value),
"newStatus" => $this->prettyStatus($this->newStatus->value),
"note" => $this->note,
"recipiantIsStudent" => $this->recipiantIsStudent,
"changedBy" => $this->changedBy,
]
);
}

View File

@@ -1,14 +1,21 @@
@include("parts.header")
<p>Vážená/ý {{ $studentName }},</p>
<p>stav vašej praxe vo firme {{ $companyName }} bola aktualizovaná zo stavu "{{ $oldStatus }}" na
"{{ $newStatus }}".</p>
<p>Zmenu vykonal <em>{{ $changedByName }}</em>.</p>
<br />
@if($recipiantIsStudent)
<p>Vážená/ý {{ $internship->student->name }},</p>
@else
<p>Vážená/ý {{ $internship->company->contactPerson->name }},</p>
@endif
<p>oznamujeme Vás o zmene praxe:</p>
@if(!$recipiantIsStudent)
<p>Študent: <em>{{ $internship->student->name }} ({{ $internship->student->email }},
{{ $internship->student->phone }})</em></p>
@endif
<p>Stav: <em>{{ $oldStatus }}</em> <strong>-></strong> <em>{{ $newStatus }}</em></p>
<p>Poznámka: <em>{{ $note }}</em>.</p>
<p>Zmenu vykonal <em>{{ $changedBy->name }}</em>.</p>
<br />
<p>s pozdravom</p>
<p>S pozdravom.</p>
<p>Systém ISOP UKF</p>
@include("parts.footer")