@php $school = $student->school; $major = $student->major; $dob = $student->birth_date ? $student->birth_date->format('d M Y') : '-'; $photoUrl = $student->photo_path ? asset('storage/' . $student->photo_path) : null; $logo = $school?->logo_path ? asset('storage/' . $school->logo_path) : ($school?->logo_left_path ? asset('storage/' . $school->logo_left_path) : ($school?->logo_right_path ? asset('storage/' . $school->logo_right_path) : null)); $signature = $school?->principal_signature_path ? asset('storage/' . $school->principal_signature_path) : null; $initials = collect(explode(' ', $student->full_name))->filter()->map(fn ($p) => strtoupper(substr($p, 0, 1)))->take(2)->implode(''); $addressParts = array_filter([ $student->address_road, implode(' / ', array_filter([$student->address_rt ? 'RT ' . $student->address_rt : null, $student->address_rw ? 'RW ' . $student->address_rw : null])), $student->address_village, $student->address_district, $student->address_city, $student->address_province, ]); $address = count($addressParts) ? implode(', ', array_filter($addressParts)) : '-'; $validity = $student->grade_level ? 'Masa berlaku sampai kelas ' . $student->grade_level . ' lulus.' : 'Kartu berlaku selama menjadi peserta didik.'; // QR siswa: identitas lengkap (tambah gender) seperti template 4 $qrData = $student->full_name . ' | ' . ($student->birth_place ?: '-') . ', ' . $dob . ' | ' . ($student->gender ?: '-'); // Barcode absensi: NIS fallback NISN $attendanceCode = $student->nis ?: $student->nisn ?: null; $attendanceBarcode = $attendanceCode ? 'https://bwipjs-api.metafloor.com/?bcid=code128&scale=2&includetext&text=' . urlencode($attendanceCode) : null; // QR Gmap sekolah (dipakai di belakang) $schoolGmap = $school?->gmap_link; @endphp