@php $userParticipant = optional($peserta)->user; $profileParticipant = optional($userParticipant)->profile; $provinceParticipant = optional($profileParticipant->province)->name ?? ($profileParticipant->other_province ?? null); $regencyParticipant = optional($profileParticipant->regency)->name ?? ($profileParticipant->other_regency ?? null); $districtParticipant = optional($profileParticipant->district)->name ?? ($profileParticipant->other_district ?? null); $titleStyle = data_get($certificateSetting, 'title', []); $photoStyle = data_get($certificateSetting, 'photo', []); $qrStyle = data_get($certificateSetting, 'qr', []); $titleFont = data_get($titleStyle, 'font'); if (empty($titleFont) || $titleFont === 'undefined') { $titleFont = 'DejaVu Sans'; } @endphp @if(data_get($titleStyle, 'visible', true)) @php $titleTop = (int) round((float) data_get($titleStyle, 'top', 20) * $scaleY); $titleLeft = (int) round((float) data_get($titleStyle, 'marginLeft', data_get($titleStyle, 'left', 0)) * $scaleX); @endphp
{{ str_replace(["\r\n","\n"], ' ', ($activity->name ?? 'Sertifikat PESERTA')) }}
@endif @if(data_get($certificateSetting, 'name.visible', true)) @php $nameFont = data_get($certificateSetting, 'name.font'); if (empty($nameFont) || $nameFont === 'undefined') { $nameFont = 'DejaVu Sans'; } $nameAlignRaw = strtolower((string) data_get($certificateSetting, 'name.align', 'center')); $nameAlignCss = in_array($nameAlignRaw, ['kiri','left']) ? 'left' : (in_array($nameAlignRaw, ['kanan','right']) ? 'right' : 'center'); $nameTop = (int) round((float) data_get($certificateSetting, 'name.top', 190) * $scaleY); $nameLeft = (int) round((float) data_get($certificateSetting, 'name.left', 30) * $scaleX); $nameWidth = (int) round((float) data_get($certificateSetting, 'name.width', 180) * $scaleX); @endphp
{{ $userParticipant->name ?? '-' }}
@endif @if(data_get($certificateSetting, 'email.visible', true)) @php $emailFont = data_get($certificateSetting, 'email.font'); if (empty($emailFont) || $emailFont === 'undefined') { $emailFont = 'DejaVu Sans'; } $emailTop = (int) round((float) data_get($certificateSetting, 'email.top', 220) * $scaleY); $emailLeft = (int) round((float) data_get($certificateSetting, 'email.left', 30) * $scaleX); $emailWidth = (int) round((float) data_get($certificateSetting, 'email.width', 180) * $scaleX); @endphp
{{ $userParticipant->email ?? '-' }}
@endif @if(data_get($certificateSetting, 'no_hp.visible', false))
{{ $profileParticipant->no_hp ?? '-' }}
@endif @if(data_get($certificateSetting, 'jenis_kelamin.visible', false))
{{ $profileParticipant->jenis_kelamin ?? '-' }}
@endif @if(data_get($photoStyle, 'visible', true)) @php $photoSizeSetting = (float) data_get($photoStyle, 'size', 90) * $scaleX; $photoShape = data_get($photoStyle, 'shape', 'square'); $photoFilename = optional($profileParticipant)->foto; $photoPath = $photoFilename ? public_path('assets/images/profilefoto/' . $photoFilename) : public_path('assets/images/profilefoto/default-profile.png'); $photoBase64 = image_to_base64_data_uri($photoPath); $imgAspectRatio = 1.0; if (file_exists($photoPath)) { $imgInfo = @getimagesize($photoPath); if ($imgInfo && $imgInfo[1] > 0) { $imgAspectRatio = $imgInfo[0] / $imgInfo[1]; } } $overlayColor = data_get($photoStyle, 'overlay_color', '#000000'); $overlayOpacity = (int) data_get($photoStyle, 'overlay_opacity', 0); $overlayAlpha = max(0, min(100, $overlayOpacity)) / 100.0; @endphp
@if($photoBase64) Foto
@endif
@endif @if(data_get($qrStyle, 'visible', true)) @php $qrTop = (int) round((float) data_get($qrStyle, 'top', 320) * $scaleY); $qrLeft = (int) round((float) data_get($qrStyle, 'left', 90) * $scaleX); $qrSizeInput = (float) data_get($qrStyle, 'size', 80); $qrSize = max(0, (int) round($qrSizeInput * $scaleX)); $qrVal = route('activity.download-certificate', ['id' => $activity->id]) . '?certificate_id=' . urlencode((string) ($peserta->certificate_id ?? '')); @endphp
@php try { $qrBinary = \SimpleSoftwareIO\QrCode\Facades\QrCode::format('png')->size(max((int)$qrSize,40))->generate((string) $qrVal); $qrSrc = 'data:image/png;base64,'.base64_encode($qrBinary); } catch (\Throwable $e) { $qrSrc = 'https://api.qrserver.com/v1/create-qr-code/?size='.max((int)$qrSize,40).'x'.max((int)$qrSize,40).'&data='.urlencode((string) $qrVal); } @endphp QR Code
@endif