0,'total_amount'=>0,'paid_amount'=>0,'balance'=>0]; $canViewInvoices = !empty($f['can_view_invoices']); $selectedStudentId = (int)($f['selected_student_id'] ?? 0); $scoreDefaultStudentId = $selectedStudentId > 0 ? $selectedStudentId : (int)($f['students'][0]['id'] ?? 0); $displayValue = static function ($value, string $fallback = 'Not provided'): string { if ($value === null || trim((string)$value) === '') { return $fallback; } return (string)$value; }; $formatDate = static function ($value, bool $includeTime = false) use ($displayValue): string { if ($value === null || trim((string)$value) === '') { return 'Not provided'; } try { return $includeTime ? local_datetime((string)$value, 'm-d-Y g:i A') : (new \DateTime((string)$value))->format('m-d-Y'); } catch (\Throwable $e) { return $displayValue($value); } }; $formatScore = static function ($value): string { if ($value === null || $value === '' || !is_numeric($value)) { return '—'; } return rtrim(rtrim(number_format((float)$value, 2, '.', ''), '0'), '.'); }; // Title: prefer provided household_name unless it's generic like "Family of User 53" or empty. $titleRaw = trim((string)($f['household_name'] ?? '')); $title = $titleRaw; if ($title === '' || preg_match('/^\s*Family\s+of\s+User\s*\d+\s*$/i', $title)) { // Derive from primary guardian last name, else first guardian's last name $lastName = ''; $primary = null; foreach (($f['guardians'] ?? []) as $g) { if (!empty($g['is_primary'])) { $primary = $g; break; } } $pick = $primary ?: (($f['guardians'][0] ?? null) ?: null); if ($pick) { $ln = trim((string)($pick['lastname'] ?? '')); if ($ln !== '') $lastName = $ln; } $title = $lastName !== '' ? ('Family of ' . $lastName) : 'Family'; } $returnUrl = trim((string)service('request')->getServer('HTTP_REFERER')); if ($returnUrl === '') { $returnUrl = site_url('family'); } ?>
Guardians: Students: Invoices: Balance: $
Students
No students linked.
0 && $selectedStudentId === $studentId; $allergies = array_values(array_filter(array_map('trim', (array)($s['allergies'] ?? [])))); $conditions = array_values(array_filter(array_map('trim', (array)($s['medical_conditions'] ?? [])))); ?>

Student Details
$displayValue($s['school_id'] ?? null), 'Date of Birth' => $formatDate($s['dob'] ?? null), 'Age' => $displayValue($s['age'] ?? null), 'Gender' => $displayValue($s['gender'] ?? null), 'Assigned Class / Section' => $displayValue($s['grade'] ?? null), 'Enrollment Status' => $displayValue($s['enrollment_status'] ?? null), 'Registration Grade' => $displayValue($s['registration_grade'] ?? null), 'Status' => ((int)($s['is_active'] ?? 0) === 1) ? 'Active' : 'Inactive', 'Photo Consent' => ((int)($s['photo_consent'] ?? 0) === 1) ? 'Yes' : 'No', 'Registration Date' => $formatDate($s['registration_date'] ?? null, true), 'Year of Registration' => $displayValue($s['year_of_registration'] ?? null), 'RFID Tag' => $displayValue($s['rfid_tag'] ?? null), 'Tuition Paid' => ((int)($s['tuition_paid'] ?? 0) === 1) ? 'Yes' : 'No', ]; ?> $value): ?>
Medical Conditions
None on file
Allergies
None on file
No students linked.
No score history found for this student.
School Year Midterm S1 Midterm Comment S1 PTAP S1 PTAP Comment S1 Attendance S1 Attendance Comment S1 Final S2 Final Comment S2 PTAP S2 PTAP Comment S2 Attendance S2 Attendance Comment S2 Year Score
Guardians
Total:
No guardians yet.
Guardian Contact Address
Primary
Relation:
' . esc($gEmail) . '') : '' ?>
'.esc($g['cellphone']).'') : '' ?>
trim((string)$x) !== ''); ?>
Emergency Contacts
Linked to parents/guardians
No emergency contacts on file.
Parent Contact Name Relation Phone Email Updated
'.esc($ph).'') : '' ?> '.esc($em).'') : '' ?>
Invoices
Total
$
Paid
$
Balance
$
Parent Invoices
No invoices on record.
Parent#StatusTotalPaidBalanceIssuedDue
$ $ $
Recent Payments
No payments on record.
ParentInvoiceAmountInvoice BalanceMethodDatePayment StatusInvoice Status
$ $