@extends('layouts.web') @section('content') @php $only = isset($only_certificate) && $only_certificate ? true : false; $activityDateLabel = $activity->date ? \Carbon\Carbon::parse($activity->date)->translatedFormat('d F Y') : 'Tanggal belum ditentukan'; $rawTime = $activity->start_time ?? $activity->time ?? null; $activityTimeLabel = $rawTime ? (\Carbon\Carbon::hasFormat($rawTime, 'H:i:s') || \Carbon\Carbon::hasFormat($rawTime, 'H:i') ? \Carbon\Carbon::parse($rawTime)->format('H:i') : $rawTime) : 'Waktu belum ditentukan'; $activityLocation = $activity->location ?? 'Lokasi belum ditentukan'; $activityPriceLabel = ($activity->price ?? 0) > 0 ? 'Rp ' . number_format($activity->price, 0, ',', '.') : 'Gratis'; @endphp @unless($only)

{{ $activity->name ?? 'Judul Aktivitas' }}

{{ \Illuminate\Support\Str::limit(strip_tags($activity->excerpt ?? $activity->description ?? 'Belum ada deskripsi kegiatan.'), 240) }}

Tanggal

{{ $activityDateLabel }}

Waktu

{{ $activityTimeLabel }}

Lokasi

{{ $activityLocation }}

@endunless @php $widthCm = (float) data_get($certificateSetting, 'card.width_cm', 21); $heightCm = (float) data_get($certificateSetting, 'card.height_cm', 29.7); $bgFilename = data_get($certificateSetting, 'card.background'); if (!function_exists('image_to_base64_data_uri')) { function image_to_base64_data_uri($path) { if (!file_exists($path) || !is_readable($path)) { return null; } $type = mime_content_type($path); if ($type === false) { $type = 'image/' . pathinfo($path, PATHINFO_EXTENSION); } $data = file_get_contents($path); return 'data:' . $type . ';base64,' . base64_encode($data); } } $bgPath = $bgFilename ? public_path('assets/images/certificate/' . $bgFilename) : public_path('assets/images/certificate/default-certificate.png'); $bgBase64 = image_to_base64_data_uri($bgPath); $titleStyle = data_get($certificateSetting, 'title', []); $photoStyle = data_get($certificateSetting, 'photo', []); $qrStyle = data_get($certificateSetting, 'qr', []); $u = $user; $p = $profile; $provinceName = optional($p->province)->name ?? ($p->other_province ?? null); @endphp
@if($bgBase64) Certificate Background @endif
@if(data_get($titleStyle, 'visible', true))
{{ str_replace(["\r\n","\n"], ' ', ($activity->name ?? 'Sertifikat PESERTA')) }}
@endif @if(data_get($certificateSetting, 'name.visible', false))
{{ optional($u)->name ?? '-' }}
@endif @if(data_get($certificateSetting, 'email.visible', false))
{{ optional($u)->email ?? '-' }}
@endif @if(data_get($certificateSetting, 'no_hp.visible', false) && $p && $p->no_hp)
{{ $p->no_hp }}
@endif @if(data_get($certificateSetting, 'jenis_kelamin.visible', false) && $p && $p->jenis_kelamin)
{{ $p->jenis_kelamin }}
@endif @if(data_get($certificateSetting, 'pekerjaan.visible', false) && $p && $p->pekerjaan)
{{ $p->pekerjaan }}
@endif @if(data_get($certificateSetting, 'jabatan.visible', false) && $p && $p->jabatan)
{{ $p->jabatan }}
@endif @if(data_get($certificateSetting, 'alamat.visible', false) && $p && $p->alamat)
{{ $p->alamat }}
@endif @if(data_get($certificateSetting, 'province.visible', false) && $provinceName)
{{ $provinceName }}
@endif @if(data_get($certificateSetting, 'certificate_id.visible', false))
{{ $currentCertificateId ?? '-' }}
@endif @if(data_get($photoStyle, 'visible', true)) @php $photoSize = (int) data_get($photoStyle, 'size', 90); $photoShape = data_get($photoStyle, 'shape', 'square'); $photoFilename = $p && $p->foto ? $p->foto : null; $photoPath = $photoFilename ? public_path('assets/images/profilefoto/' . $photoFilename) : public_path('assets/images/profilefoto/default-profile.png'); $photoBase64 = image_to_base64_data_uri($photoPath); $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 @php $qrTop = (int) data_get($qrStyle, 'top', 320); $qrLeft = (int) data_get($qrStyle, 'left', 90); $qrSizeInput = (int) data_get($qrStyle, 'size', 80); $qrSize = max(40, $qrSizeInput); @endphp
@php $qrLink = route('activity.download-certificate', ['id' => $activity->id]) . '?show_certificate=1'; try { $qrBinary = \SimpleSoftwareIO\QrCode\Facades\QrCode::format('png')->size(max($qrSize,40))->generate((string) $qrLink); $qrSrc = 'data:image/png;base64,'.base64_encode($qrBinary); } catch (\Throwable $e) { $qrSrc = 'https://api.qrserver.com/v1/create-qr-code/?size='.max($qrSize,40).'x'.max($qrSize,40).'&data='.urlencode((string) $qrLink); } @endphp QR Code
@unless($only)
@if(!empty($currentCertificateId)) @endif
@endunless
@unless($only) @endunless @endsection