kop Surat Peringatan disamakan dengan format resmi (logo lambang Jatim bersih + 6 baris + garis tebal, nama sekolah satu baris via nowrap) + refactor schoolSettings()
This commit is contained in:
@@ -25,13 +25,7 @@ class SpLetterController extends Controller
|
|||||||
abort_unless(auth()->user()->canViewStudent($spLetter->student_id), 403);
|
abort_unless(auth()->user()->canViewStudent($spLetter->student_id), 403);
|
||||||
|
|
||||||
$spLetter->load(['student', 'spThreshold', 'generator']);
|
$spLetter->load(['student', 'spThreshold', 'generator']);
|
||||||
$school = [
|
$school = $this->schoolSettings();
|
||||||
'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', ''),
|
|
||||||
];
|
|
||||||
|
|
||||||
return view('sp-letters.show', compact('spLetter', 'school'));
|
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);
|
abort_unless(auth()->user()->canViewStudent($spLetter->student_id), 403);
|
||||||
|
|
||||||
$spLetter->load(['student', 'spThreshold', 'generator']);
|
$spLetter->load(['student', 'spThreshold', 'generator']);
|
||||||
$school = [
|
$school = $this->schoolSettings();
|
||||||
'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', ''),
|
|
||||||
];
|
|
||||||
|
|
||||||
$spLetter->update(['printed_at' => now(), 'status' => 'printed']);
|
$spLetter->update(['printed_at' => now(), 'status' => 'printed']);
|
||||||
|
|
||||||
// For now, return an HTML print view
|
// For now, return an HTML print view
|
||||||
return view('sp-letters.print', compact('spLetter', 'school'));
|
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', ''),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,16 @@
|
|||||||
<style>
|
<style>
|
||||||
@page { margin: 2cm; size: A4; }
|
@page { margin: 2cm; size: A4; }
|
||||||
body { font-family: 'Times New Roman', Times, serif; font-size: 12pt; line-height: 1.5; color: #000; }
|
body { font-family: 'Times New Roman', Times, serif; font-size: 12pt; line-height: 1.5; color: #000; }
|
||||||
.kop-surat { text-align: center; margin-bottom: 30px; }
|
.kop-surat { margin-bottom: 24px; }
|
||||||
.kop-surat h1 { font-size: 16pt; font-weight: bold; margin: 0; text-transform: uppercase; }
|
.kop-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
|
||||||
.kop-surat p { font-size: 11pt; margin: 2px 0; }
|
.kop-table td { border: none; padding: 0; }
|
||||||
.kop-surat .line { border-top: 2px solid #000; margin-top: 8px; }
|
.kop-logo { width: 112px; text-align: center; vertical-align: middle; }
|
||||||
|
.kop-logo img { height: 86px; width: auto; max-width: 104px; object-fit: contain; }
|
||||||
|
.kop-text { text-align: center; vertical-align: middle; }
|
||||||
|
.kop-1, .kop-2 { font-size: 13.5pt; font-weight: bold; margin: 0; text-transform: uppercase; }
|
||||||
|
.kop-3 { font-size: 11.5pt; font-weight: bold; margin: 1px 0; text-transform: uppercase; white-space: nowrap; }
|
||||||
|
.kop-4, .kop-5, .kop-6 { font-size: 10.5pt; margin: 0; }
|
||||||
|
.kop-surat .line { border-top: 2.5px solid #000; margin-top: 6px; }
|
||||||
.kop-surat .sub-line { border-top: 1px solid #000; margin-top: 2px; }
|
.kop-surat .sub-line { border-top: 1px solid #000; margin-top: 2px; }
|
||||||
.letter-number { text-align: center; margin: 25px 0; font-weight: bold; font-size: 13pt; }
|
.letter-number { text-align: center; margin: 25px 0; font-weight: bold; font-size: 13pt; }
|
||||||
.to-title { margin-bottom: 15px; }
|
.to-title { margin-bottom: 15px; }
|
||||||
@@ -24,10 +30,27 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
{{-- Nama sekolah: satu baris (nowrap) sesuai format kop resmi --}}
|
||||||
<div class="kop-surat">
|
<div class="kop-surat">
|
||||||
<h1>{{ $school['name'] }}</h1>
|
<table class="kop-table">
|
||||||
<p>{{ $school['address'] }}</p>
|
<tr>
|
||||||
<p>Telp: {{ $school['phone'] }}</p>
|
<td class="kop-logo">
|
||||||
|
@if (! empty($school['kop_logo']) && file_exists(public_path('storage/'.$school['kop_logo'])))
|
||||||
|
<img src="{{ public_path('storage/'.$school['kop_logo']) }}" alt="logo">
|
||||||
|
@elseif (! empty($school['logo']) && file_exists(public_path('storage/'.$school['logo'])))
|
||||||
|
<img src="{{ public_path('storage/'.$school['logo']) }}" alt="logo">
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="kop-text">
|
||||||
|
<p class="kop-1">{{ $school['government'] }}</p>
|
||||||
|
<p class="kop-2">{{ $school['agency'] }}</p>
|
||||||
|
<p class="kop-3">{{ $school['full_name'] }}</p>
|
||||||
|
<p class="kop-4">{{ $school['address_detail'] }}</p>
|
||||||
|
<p class="kop-5">{{ $school['website_email'] }}</p>
|
||||||
|
<p class="kop-6">{{ $school['postal'] }}</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
<div class="sub-line"></div>
|
<div class="sub-line"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user