@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 Kartu Pelajar - {{ $student->full_name }} (Template 1)
Kartu Pelajar
{{ $school->name ?? 'Nama Sekolah' }}
{{ $major->name ?? 'Jurusan' }}
@if($photoUrl) Foto {{ $student->full_name }} @else
{{ $initials ?: 'PF' }}
@endif
@if($signature) Tanda tangan {{ $school?->principal_name }} @endif @php $principal = $school?->principal_name; if ($principal) { $parts = preg_split('/\\s+/', trim($principal)); if (count($parts) > 2) { $parts[2] = strtoupper(substr($parts[2], 0, 1)) . '.'; $principal = implode(' ', $parts); } } @endphp
Kepala Sekolah,
{{ $principal ?? 'Nama Kepala Sekolah' }}
{{ $student->full_name }}
NIS / NISN {{ $student->nis ?: '-' }} / {{ $student->nisn ?: '-' }}
Alamat Lengkap {{ $address }}
{{ $school?->authority_name ?: 'Informasi Sekolah' }}
{{ $school->name ?? '-' }}
{{ $school?->address ?? '-' }}
{{ trim(implode(', ', array_filter([$school?->village, $school?->district, $school?->city])), ', ') }}
{{ $school?->province }}
@if($school?->phone)
Telp: {{ $school->phone }}
@endif @if($schoolGmap)
Lokasi
QR Gmap
@endif
Ketentuan Kartu @php $rules = collect(preg_split('/\r?\n/', (string)($school?->rules)))->filter()->values(); @endphp @forelse($rules as $index => $rule)
{{ $index + 1 }}. {{ $rule }}
@empty
1. Kartu wajib dibawa setiap hari sekolah.
2. Tidak boleh dipinjamkan kepada orang lain.
3. Laporkan ke TU jika kartu hilang/rusak untuk cetak ulang.
4. Scan QR untuk verifikasi keaslian kartu.
@endforelse
Kepala Sekolah
@if($signature) Tanda tangan {{ $school?->principal_name }} @endif @php $principalBack = $school?->principal_name; if ($principalBack) { $parts = preg_split('/\\s+/', trim($principalBack)); if (count($parts) > 2) { $parts[2] = strtoupper(substr($parts[2], 0, 1)) . '.'; $principalBack = implode(' ', $parts); } } @endphp
{{ $principalBack ?? 'Nama Kepala Sekolah' }}
{{ $validity }}