@php
$aiCourseProfile = $aiCourseProfile ?? null;
$curriculumSettings = \App\Models\AppSetting::current();
$cplItems = $rps->learningOutcomes->where('type', 'cpl')->values();
$cpmkItems = $rps->learningOutcomes->where('type', 'cpmk')->values();
$subCpmkItems = $rps->learningOutcomes->where('type', 'sub_cpmk')->values();
$mainReferences = $rps->references->where('category', 'main')->values();
$supportingReferences = $rps->references->where('category', 'supporting')->values();
$printMode = $printMode ?? false;
$weeklyPages = $weeklyPages ?? collect();
$documentCode = filled($rps->document_code) ? $rps->document_code : 'RPS';
$headerLogoPath = $curriculumSettings->logo_path ?: $rps->logo_path;
$resolveEmbeddedImagePath = function (?string $path): ?string {
$relativePath = trim((string) $path);
if ($relativePath === '') {
return null;
}
if (str_starts_with($relativePath, 'storage/')) {
$storageRelativePath = substr($relativePath, strlen('storage/'));
$absoluteStoragePath = storage_path('app/public/'.$storageRelativePath);
if (! is_file($absoluteStoragePath)) {
return null;
}
$mimeType = mime_content_type($absoluteStoragePath) ?: 'image/png';
$contents = file_get_contents($absoluteStoragePath);
return $contents !== false ? 'data:'.$mimeType.';base64,'.base64_encode($contents) : null;
}
$absolutePublicPath = public_path($relativePath);
if (! is_file($absolutePublicPath)) {
return null;
}
$mimeType = mime_content_type($absolutePublicPath) ?: 'image/png';
$contents = file_get_contents($absolutePublicPath);
return $contents !== false ? 'data:'.$mimeType.';base64,'.base64_encode($contents) : null;
};
$headerLogoSrc = $resolveEmbeddedImagePath($headerLogoPath);
$acknowledgedSignatureSrc = $resolveEmbeddedImagePath($rps->acknowledged_by_signature_path);
$lecturerSignatureSrc = $resolveEmbeddedImagePath($rps->lecturer_signature_path);
$paperWidthMm = 330.2;
$paperHeightMm = 215.0;
$compileDateDisplay = optional($rps->compile_date)->translatedFormat('d F Y');
$compileDateCompact = optional($rps->compile_date)->format('d/m/Y') ?: '-';
$signatureDate = optional($rps->compile_date)->format('d m Y') ?: 'DD MM YYYY';
$signaturePlace = 'Parepare';
$sksWordMap = [
'1' => 'Satu',
'2' => 'Dua',
'3' => 'Tiga',
'4' => 'Empat',
'5' => 'Lima',
'6' => 'Enam',
'7' => 'Tujuh',
'8' => 'Delapan',
'9' => 'Sembilan',
];
$sksWord = $sksWordMap[(string) $rps->sks] ?? '-';
$developerApproval = $rps->approvals->first(fn ($item) => str_contains(mb_strtolower((string) $item->role_name), 'pengembang'));
$rmkApproval = $rps->approvals->first(fn ($item) => str_contains(mb_strtolower((string) $item->role_name), 'rmk'));
$headApproval = $rps->approvals->first(fn ($item) => str_contains(mb_strtolower((string) $item->role_name), 'ketua') || str_contains(mb_strtolower((string) $item->role_name), 'prodi'));
$developerName = $developerApproval?->signer_name ?: ($rps->developer_name ?: '-');
$rmkCoordinatorName = $rmkApproval?->signer_name ?: ($rps->rmk_coordinator_name ?: '-');
$headOfStudyProgramName = $headApproval?->signer_name ?: ($rps->head_of_study_program_name ?: '-');
$headOfStudyProgramIdentifier = $headApproval?->signer_identifier ?: null;
$acknowledgedByName = $rps->acknowledged_by_name ?: null;
$acknowledgedByNidn = $rps->acknowledged_by_nidn ?: null;
$lecturerNidn = $rps->lecturer_nidn ?: null;
// Sub-CPMK dibuat menyatu dalam satu blok CP agar preview/export PDF tidak
// terpecah setelah baris pertama dan tidak menyisakan ruang kosong besar.
$firstPageSubCpmkCount = $subCpmkItems->count();
$subCpmkFirstPage = $subCpmkItems->values();
$subCpmkContinuation = collect();
$cpRowspan = 3 + max($cplItems->count(), 1) + max($cpmkItems->count(), 1) + max($subCpmkFirstPage->count(), 1);
$normalizeCurriculumCode = function (?string $value): string {
$text = trim((string) $value);
$text = preg_replace('/\s*\([^)]*\)/', '', $text) ?? $text;
$text = preg_replace('/\s+/', '', $text) ?? $text;
$text = str_replace(['–', '—', '_'], '-', $text);
$text = preg_replace('/-+/', '-', $text) ?? $text;
return strtoupper(trim((string) $text, '-'));
};
$officialCplDescriptionMap = collect($curriculumSettings->learning_outcomes ?? [])
->mapWithKeys(function (array $item) use ($normalizeCurriculumCode) {
$code = $normalizeCurriculumCode($item['code'] ?? '');
$description = trim((string) ($item['description'] ?? ''));
return $code !== '' ? [$code => $description] : [];
});
$resolvedCplItems = $cplItems->map(function ($item) use ($officialCplDescriptionMap, $normalizeCurriculumCode) {
$resolvedCode = trim((string) ($item->code ?? ''));
$normalizedCode = $normalizeCurriculumCode($resolvedCode);
$officialDescription = $officialCplDescriptionMap->get($normalizedCode);
return [
'code' => $resolvedCode !== '' ? $resolvedCode : ($normalizedCode !== '' ? $normalizedCode : 'CPL'),
'description' => $officialDescription !== null && $officialDescription !== ''
? $officialDescription
: trim((string) ($item->description ?? '')),
];
})->values();
$mainReferenceText = $mainReferences->pluck('citation')->filter()->implode('
');
$supportingReferenceText = $supportingReferences->pluck('citation')->filter()->implode('
');
@endphp
@once
@endonce
|
@if ($headerLogoSrc)
|
{{ strtoupper($rps->university_name) }} {{ strtoupper($rps->faculty_name) }} {{ strtoupper($rps->study_program_name) }} |
Kode
Dokumen {{ $documentCode }} |
|||||||
| Rencana Pembelajaran Semester | |||||||||
| MATA KULIAH (MK) | KODE | Rumpun MK | BOBOT (SKS) | SEMESTER | Tgl Penyusunan | ||||
| {{ $rps->course_name ?: '-' }} | {{ $rps->course_code ?: '-' }} | {{ $rps->course_group ?: '-' }} | {{ $rps->sks ?: '-' }} | {{ $sksWord }} | {{ $rps->semester ?: '-' }} | {{ $compileDateCompact }} | |||
| OTORISASI | Pengembang RPS | Koordinator RMK | Ketua PRODI | ||||||
| {{ $developerName }} | {{ $rmkCoordinatorName }} | {{ $headOfStudyProgramName }} | |||||||
| Capaian Pembelajaran (CP) |
CPL-PRODI yang dibebankan pada MK | ||||||||
| {{ $item['code'] ?: 'CPL' }} | {{ $item['description'] ?: 'Belum diisi.' }} | ||||||||
| CPL | Belum diisi. | ||||||||
| Capaian Pembelajaran Mata Kuliah (CPMK) | |||||||||
| {{ $item->code ?: 'CPMK' }} | {{ $item->description ?: 'Belum diisi.' }} | ||||||||
| CPMK | Belum diisi. | ||||||||
| Sub-CPMK | |||||||||
| {{ $item->code ?: 'Sub-CPMK ' . ($index + 1) }} | {{ $item->description ?: 'Belum diisi.' }} | ||||||||
| Sub-CPMK 1 | Belum diisi. | ||||||||
| @endif | {{ $item->code ?: 'Sub-CPMK ' . ($firstPageSubCpmkCount + $index + 1) }} | {{ $item->description ?: 'Belum diisi.' }} | |||||||
| Deskripsi Singkat MK | {{ $rps->course_description ?: '-' }} | ||||||||
| Bahan Kajian / Materi Pembelajaran | {!! nl2br(e($rps->study_materials ?: '-')) !!} | ||||||||
| Pustaka | Utama: | ||||||||
| {!! $mainReferenceText !== '' ? $mainReferenceText : 'Belum diisi.' !!} | |||||||||
| Pendukung: | |||||||||
| {!! $supportingReferenceText !== '' ? $supportingReferenceText : 'Belum diisi.' !!} | |||||||||
| Dosen Pengampuh | {{ $rps->lecturer_name ?: '-' }} | ||||||||
| Matakuliah syarat | {{ $rps->prerequisite_course ?: '-' }} | ||||||||
| Pekan Ke- |
Sub-CPMK (Kemampuan akhir tiap tahapan belajar) |
Penilaian | Bentuk Pembelajaran, Metode Pembelajaran, Penugasan Mahasiswa | Materi Pembelajaran | Bobot Penilaian (%) |
||
|---|---|---|---|---|---|---|---|
| Indikator | Kriteria & Bentuk | Luring (offline) | Daring (online) | ||||
| (1) | (2) | (3) | (4) | (5) | (6) | (7) | (8) |
| {{ $meeting->week_number }}. {{ $meeting->session_type === 'uts' ? 'UJIAN TENGAH SEMESTER' : 'UJIAN AKHIR SEMESTER' }} | |||||||
| {{ $meeting->week_number }} | {{ $meeting->sub_cpmk ?: '-' }} | {{ $meeting->indicator ?: '-' }} |
@php
$criteria = trim((string) $meeting->assessment_criteria);
$form = trim((string) $meeting->assessment_form);
@endphp
@if ($criteria !== '')
{{ $criteria }}
@endif
@if ($form !== '')
{{ $form }}
@endif
@if ($criteria === '' && $form === '')
-
@endif
|
{!! nl2br(e($meeting->offline_activity ?: '-')) !!} | {!! nl2br(e($meeting->online_activity ?: '-')) !!} | {!! nl2br(e($meeting->study_material ?: '-')) !!} | {{ $meeting->assessment_weight !== null ? rtrim(rtrim(number_format((float) $meeting->assessment_weight, 2, '.', ''), '0'), '.') : '-' }} |
|
Mengetahui, Wakil Dekan I {{ $rps->faculty_name ?: '........................................' }} @if ($acknowledgedSignatureSrc){{ $acknowledgedByName ?: '........................................' }} {{ $acknowledgedByNidn ? 'NIDN. '.$acknowledgedByNidn : 'NIDN. ................................' }} |
{{ $signaturePlace }}, {{ $signatureDate }} Dosen Pengampuh @if ($lecturerSignatureSrc){{ $rps->lecturer_name ?: '........................................' }} {{ $lecturerNidn ? 'NIDN. '.$lecturerNidn : 'NIDN. ................................' }} |