From 01aae85efca0d8cc4663a819895440e4e44887b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veronika=20Feh=C3=A9rv=C3=ADziov=C3=A1?= <128744051+VeronikaFeherviziova@users.noreply.github.com> Date: Tue, 2 Dec 2025 22:51:29 +0100 Subject: [PATCH] refactor: update email template for internship status updates --- backend/app/Mail/InternshipStatusUpdated.php | 18 +++++++--------- .../mail/internship/status_updated.blade.php | 21 ++++++++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/backend/app/Mail/InternshipStatusUpdated.php b/backend/app/Mail/InternshipStatusUpdated.php index fdb43f3..6379bb5 100644 --- a/backend/app/Mail/InternshipStatusUpdated.php +++ b/backend/app/Mail/InternshipStatusUpdated.php @@ -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, ] ); } diff --git a/backend/resources/views/mail/internship/status_updated.blade.php b/backend/resources/views/mail/internship/status_updated.blade.php index 1b9b960..6d23967 100644 --- a/backend/resources/views/mail/internship/status_updated.blade.php +++ b/backend/resources/views/mail/internship/status_updated.blade.php @@ -1,14 +1,21 @@ @include("parts.header") -

Vážená/ý {{ $studentName }},

-

stav vašej praxe vo firme {{ $companyName }} bola aktualizovaná zo stavu "{{ $oldStatus }}" na - "{{ $newStatus }}".

-

Zmenu vykonal {{ $changedByName }}.

-
+@if($recipiantIsStudent) +

Vážená/ý {{ $internship->student->name }},

+@else +

Vážená/ý {{ $internship->company->contactPerson->name }},

+@endif + +

oznamujeme Vás o zmene praxe:

+@if(!$recipiantIsStudent) +

Študent: {{ $internship->student->name }} ({{ $internship->student->email }}, + {{ $internship->student->phone }})

+@endif +

Stav: {{ $oldStatus }} -> {{ $newStatus }}

Poznámka: {{ $note }}.

- +

Zmenu vykonal {{ $changedBy->name }}.


-

s pozdravom

+

S pozdravom.

Systém ISOP UKF

@include("parts.footer") \ No newline at end of file