update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
@@ -52,7 +52,7 @@ class AttendanceConsequenceService
string $type,
array $payload,
string $defaultSubject,
string $viewName,
string $_viewName,
string $logLevel
): array {
$studentName = trim((string) ($payload['student']['firstname'] ?? '') . ' ' . (string) ($payload['student']['lastname'] ?? ''));
@@ -64,7 +64,6 @@ class AttendanceConsequenceService
$schoolYear = (string) ($payload['school_year'] ?? '');
$dateYmd = (string) ($payload['date'] ?? '');
$dateFmt = $dateYmd !== '' ? date('m-d-Y', strtotime($dateYmd)) : '';
$sentAt = $payload['now'] ?? utc_now();
if ($parentEmail === '') {
Log::warning("Attendance {$type}: missing parent email", [
@@ -75,25 +74,16 @@ class AttendanceConsequenceService
$subject = (string) ($payload['subject'] ?? $this->buildSubject($defaultSubject, $studentName, $dateFmt));
$emailData = [
'title' => $subject,
'student_name' => $studentName,
'parent_name' => $parentName,
'teacher_name' => $teacherName,
'class_section_name' => $className,
'semester' => $semester,
'school_year' => $schoolYear,
'date_fmt' => $dateFmt,
'sent_at' => $sentAt,
];
$html = trim((string) ($payload['html'] ?? ''));
if ($html === '') {
try {
$html = view($viewName, $emailData, ['saveData' => true]);
} catch (\Throwable $e) {
$html = '<p>' . e($subject) . '</p>';
}
$period = trim($semester . ' ' . $schoolYear);
$html = '<p>' . e($subject) . '</p>'
. '<p><strong>Student:</strong> ' . e($studentName) . '</p>'
. '<p><strong>Parent:</strong> ' . e($parentName) . '</p>'
. '<p><strong>Teacher:</strong> ' . e($teacherName) . '</p>'
. '<p><strong>Class:</strong> ' . e($className) . '</p>'
. ($period !== '' ? '<p><strong>Term:</strong> ' . e($period) . '</p>' : '')
. '<p><strong>Date:</strong> ' . e($dateFmt) . '</p>';
}
$ok = false;