From acca87c77b3e596a0dc784daa43e1d257c7b91dd Mon Sep 17 00:00:00 2001
From: root Insha Allah this email finds you well";
+ if ($variant === 'answered') {
+ $intro .= ", {$parentName}. Jazakum Allahu khayran for taking the time to speak with us today.
We tried to reach you but could not connect and left a voice message at {$voicemail}.
"; + } else { + $intro .= "."; + } + + $details = match (true) { + str_starts_with($code, 'ABS_1') + => "This is to let you know that {$studentName} was absent on {$incident} without prior notice.
", + str_starts_with($code, 'ABS_2') + => "This is a reminder that {$studentName} has had repeated absences, most recently on {$incident}, without prior notice.
", + str_starts_with($code, 'ABS_3') + => "This is a reminder that {$studentName} has been absent three times, most recently on {$incident}, without prior notice.
", + str_starts_with($code, 'LATE_2') + => "This is a reminder that {$studentName} has been late multiple times, most recently on {$incident}.
", + str_starts_with($code, 'LATE_3'), + str_starts_with($code, 'LATE_4') + => "This is a follow-up that {$studentName} has had repeated lateness concerns, most recently on {$incident}.
", + str_starts_with($code, 'MIX') + => "This is a follow-up that {$studentName} has had a mix of repeated lateness and absence concerns, most recently on {$incident}.
", + default + => "We'd like to inform you about {$studentName}'s recent attendance concern dated {$incident}.
", + }; + + $closing = "If your child will be absent or late due to illness or family commitments, please let us know ahead of time.
" + . "You can email/call/text us at {$phone}.
"; + + return [$subject, $intro . $details . $closing]; + } + public function compose() { @@ -2033,8 +2085,8 @@ class AttendanceTrackingController extends BaseController $rendered = $this->renderTemplate($code, $variant, $ctx); if (!$rendered) { - return redirect()->to(site_url('attendance/violations')) - ->with('error', 'Template not found for ' . $code . ' (' . $variant . ').'); + log_message('warning', 'Attendance email template missing; using fallback compose body. code=' . $code . ' variant=' . $variant); + $rendered = $this->buildFallbackTemplate($code, $variant, $ctx); } [$subject, $body] = $rendered;