From 64863456ee2b5b77351292f9d363aa44075237bd Mon Sep 17 00:00:00 2001 From: Sari Date: Mon, 3 Aug 2026 10:14:00 +0700 Subject: [PATCH] kop Surat Peringatan disamakan dengan format resmi (logo lambang Jatim bersih + 6 baris + garis tebal, nama sekolah satu baris via nowrap) + refactor schoolSettings() --- app/Http/Controllers/SpLetterController.php | 38 +++++++++++++-------- resources/views/sp-letters/print.blade.php | 37 ++++++++++++++++---- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/SpLetterController.php b/app/Http/Controllers/SpLetterController.php index ff4fa93..45b46c6 100644 --- a/app/Http/Controllers/SpLetterController.php +++ b/app/Http/Controllers/SpLetterController.php @@ -25,13 +25,7 @@ class SpLetterController extends Controller abort_unless(auth()->user()->canViewStudent($spLetter->student_id), 403); $spLetter->load(['student', 'spThreshold', 'generator']); - $school = [ - 'name' => Setting::getValue('school_name', 'SMK'), - 'address' => Setting::getValue('school_address', ''), - 'phone' => Setting::getValue('school_phone', ''), - 'kepala_sekolah' => Setting::getValue('kepala_sekolah_name', ''), - 'kepala_sekolah_nip' => Setting::getValue('kepala_sekolah_nip', ''), - ]; + $school = $this->schoolSettings(); return view('sp-letters.show', compact('spLetter', 'school')); } @@ -41,17 +35,33 @@ class SpLetterController extends Controller abort_unless(auth()->user()->canViewStudent($spLetter->student_id), 403); $spLetter->load(['student', 'spThreshold', 'generator']); - $school = [ - 'name' => Setting::getValue('school_name', 'SMK'), - 'address' => Setting::getValue('school_address', ''), - 'phone' => Setting::getValue('school_phone', ''), - 'kepala_sekolah' => Setting::getValue('kepala_sekolah_name', ''), - 'kepala_sekolah_nip' => Setting::getValue('kepala_sekolah_nip', ''), - ]; + $school = $this->schoolSettings(); $spLetter->update(['printed_at' => now(), 'status' => 'printed']); // For now, return an HTML print view return view('sp-letters.print', compact('spLetter', 'school')); } + + /** + * Data sekolah untuk kop surat (format resmi). + */ + protected function schoolSettings(): array + { + return [ + 'name' => Setting::getValue('school_name', 'SMK'), + 'address' => Setting::getValue('school_address', ''), + 'phone' => Setting::getValue('school_phone', ''), + 'logo' => Setting::getValue('school_logo', ''), + 'kop_logo' => Setting::getValue('kop_logo', ''), + 'government' => Setting::getValue('school_government', 'PEMERINTAH PROVINSI JAWA TIMUR'), + 'agency' => Setting::getValue('school_agency', 'DINAS PENDIDIKAN'), + 'full_name' => Setting::getValue('school_full_name', Setting::getValue('school_name', 'SMK')), + 'address_detail' => Setting::getValue('school_address_detail', ''), + 'website_email' => Setting::getValue('school_website_email', ''), + 'postal' => Setting::getValue('school_postal', ''), + 'kepala_sekolah' => Setting::getValue('kepala_sekolah_name', ''), + 'kepala_sekolah_nip' => Setting::getValue('kepala_sekolah_nip', ''), + ]; + } } diff --git a/resources/views/sp-letters/print.blade.php b/resources/views/sp-letters/print.blade.php index 16d096c..d3f3b33 100644 --- a/resources/views/sp-letters/print.blade.php +++ b/resources/views/sp-letters/print.blade.php @@ -6,10 +6,16 @@ + {{-- Nama sekolah: satu baris (nowrap) sesuai format kop resmi --}}
-

{{ $school['name'] }}

-

{{ $school['address'] }}

-

Telp: {{ $school['phone'] }}

+ + + + + +
+

{{ $school['government'] }}

+

{{ $school['agency'] }}

+

{{ $school['full_name'] }}

+

{{ $school['address_detail'] }}

+

{{ $school['website_email'] }}

+

{{ $school['postal'] }}

+